xc-basic3 icon indicating copy to clipboard operation
xc-basic3 copied to clipboard

[3.1] Possible byte wastage regarding error handling, sprites and sound

Open JJFlash-IT opened this issue 2 years ago • 1 comments

XC=BASIC compiler version v3.1.1 (Oct 27 2022)

When it comes to the C64/C128 target, XCB3.1 allocates a total of 25 bytes for the following features:

  • 1 byte for the error number (used for the error handling) - this was already in place in XCB3.0;
  • 5 bytes for sound handling;
  • 19 bytes for sprite handling.

But no matter if the program does or does not use some or any of those features, those bytes are always allocated in the compiled program and in RAM, and can't be used for variables, arrays or included binaries. They're potentially wasted bytes.

I'll also verify if a similar byte wastage occurs for the other supported platforms.

One temporary workaround to this is commenting out unused features in the lib/xcb3lib.asm file. One has to remember, though, to uncomment them once those features are needed in some other project.

As for the ERRNO byte, I propose moving this part in the lib/io/_error.asm file

; Return value of the ERR() function
ERRNO HEX 00

just under

IFCONST I_RUNTIME_ERROR_IMPORTED

but I haven't tested it yet.

JJFlash-IT avatar Nov 13 '22 09:11 JJFlash-IT

Hey @JJFlash-IT It looks like you've dug into the code and you understand it pretty well. How about joining the team? PM'd you on FB.

neilsf avatar Nov 19 '22 07:11 neilsf