neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

JJFlash-IT opened this issue · 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.

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.