neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
44 stars 5 forks source link

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

Closed JJFlash-IT closed 1 year ago

JJFlash-IT commented 1 year ago

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:

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.

neilsf commented 1 year ago

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.