After implementing the flash loader for Basic programs I noticed that some programs wouldn't load correctly. Specifically I had problems with programs consisting of a single line which somehow auto runs and pass control over to machine code embedded in the Basic code. An example is the demo "SONG IN LINES Part 4" (1990, Busysoft & Fuxoft) which looks like this when opened in Tapir:
1600 LIST : RANDOMIZE USR 0[at 0,0][inverse 0][over 0][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][back][comma][comma] S touto ROMkou niesom ochotny spolupracovat !!![comma][comma][comma]
I don't know how this code works, but it wouldn't run correctly after being flash loaded. I suspect that I somehow didn't update the system variables correctly, so I implemented another method for flash loading, where instead of handling the system variables in the emulator I let the ROM routine handle this as it normally would. I intercept the LD_PROG_1 routine at 0x08B3, where the header has been interpreted and everything is prepared for loading the Basic program data block. I flash load the data block and return to ROM at 0x0805, which is right after the LD_BYTES routine (this method keeps the stack intact). I also update the IX register pair to point to the end address of the loaded data block. In addition I set DE to zero (being a counter for the LD_BYTES routine). I actually added the IX and DE updates to the old routine which made it work much better but still not as good as this routine. Here is the resulting code from the Controller and TapeFlashLoader classes:
There are still some tape files that don't load correctly, and this is something I will investigate. However, I don't think the problem in those cases is the Basic loader.
0 Comments
Leave a Reply. |
Archives
November 2020
Categories
All
|