Open ekmett opened 4 years ago
I also note that the old c64 SYS57812"FILENAME",8,1 trick doesn't work, because I'm presuming things moved around in the new ROM and it isn't in the documented API, which means invoking the kernel load more directly from BASIC is rather more involved.
It looks like
LOAD"FOO",8,1,$a000
works without restarting BASIC, but is currently undocumented?
Has the resetting of variables when loading a program from inside Basic been fixed? It seems like between that and an an ability to load to direct memory without resetting basic, then a basic program to check if binaries are in place and execute them, otherwise load them and call itself again, should work.
I tried: 10 IF A=1 THEN GOTO 100 20 A=1 30 PRINT"FIRST" 40 LOAD"2STATE" 100 PRINT"SECOND" SAVE"2STATE"
RUN
gives
FIRST SECOND
So by experiment, it doesn't seem like LOAD from a program is resetting variables.
We have 3 behaviors that are out of sync between the actual emulator/rom, the programmer's reference manual, and the way the Commodore worked with LOAD from within a running BASIC program.
Whenever I run
LOAD
from within a BASIC program, the running basic program restarts.But the example from the Programmer's Reference Manual fires off several
LOAD
s in series:actually loops back to the start here rather than progress to
When I saw this example, I'd first hoped to use this to prep a loading screen from file, blit data into banks, and then launch the real body of the program without any setup cruft taking space in the main PRG. It strikes me that it is more powerful to be able to do this sort of binary data loading thing directly rather than having to OPEN and blit data into the right place yourself.
Even if you still need to figure out the right behavior for chainloading.
But even though we restart, so the Progammer's Reference Manual example breaks, we aren't able to do the same things we did do back on the Commodore. The restart acts different in other ways.
When it does restart itself, even when it doesn't clobber the running program, the
READ
cursor and variables happen to reset. But that means you don't really have any good way to track your progress through your chainloader. (Literally the only trick I could come up with was to peek/poke $803 and change the first line number into a stage counter!)would be the sort of program I'd expect to have work if we didn't reset READ
Or
if we instead matched the behavior in the programmer's reference manual and could do multiple loads without the program restarting.