| Re: Does the Plus/4 support some form of VARPTR() command?|
> Still, it's easier to just POKE it to any free unused location, right? It's one less line.
But it has to POKE it into RAM every time the code is loaded after startup, and that requires the data statements.
Once you've loaded it into the REM, you don't need the data statements or the loop that pokes the code into memory. Yeah, the SYS call is made every time you execute the code but that's so fast it really doesn't matter.
You could attach the resulting line 0 and SYS call to any program small enough to meet the memory limits that need a little speed boost. The REM line plus SYS call only takes around 52 bytes.
You do have to perform a hard reset to restore the original CHRGOT code, but that could also be done with a SYS call when you exit a program.
If there is empty space in the ROM, the patch could be placed there and the default USR function address could point to it. Then programs could just add USR(0) to the first line. Or they could just use SYS with the address of the patch routine in ROM.
FWIW, the CHRGOT code is designed to exit with the most likely type of byte to be found without taking any jumps. This saves a clock cycle for every byte it finds meeting the requirements and that doesn't even count the other tests that are skipped in the process.
At least that's the theory behind it. I haven't performed any tests to confirm that assumption.