Something about the funky way M65Connect sends PRG files confuses BS Monitor's X command. The X command is supposed to exit to BASIC, but if the program was sent via M65Connect, X actually goes somewhere else then re-breaks back into the monitor with PC 002005 (which is a weird PC because that's in BASIC memory).
Here's the beginning of monexit, which is where X goes:
cd9b monexit
cd9b 20 80 03 jsr restore_system ;Restore system configuration
cd9e ad 05 11 lda save_status ;Restore BASIC's init status
cda1 8d 04 11 sta init_status
cda4 ea nop
cda5 6c 00 11 jmp (system_vector) ;Return to system
It seems like sending a PRG interferes with this process and jumps where it shouldn't.
Steps to repro:
Send a PRG via M65Connect over JTAG/serial.
Type MONITOR, press Return. The monitor opens.
Type X, press Return. Instead of exiting to BASIC, it re-breaks to the monitor, PC 002005.
For comparison, try MONITOR and X from a clean boot, or after loading the same PRG from the SD card. X exits the monitor cleanly in these cases.
Something about the funky way M65Connect sends PRG files confuses BS Monitor's
X
command. TheX
command is supposed to exit to BASIC, but if the program was sent via M65Connect,X
actually goes somewhere else then re-breaks back into the monitor with PC002005
(which is a weird PC because that's in BASIC memory).Here's the beginning of
monexit
, which is whereX
goes:It seems like sending a PRG interferes with this process and jumps where it shouldn't.
Steps to repro:
MONITOR
, press Return. The monitor opens.X
, press Return. Instead of exiting to BASIC, it re-breaks to the monitor, PC 002005.For comparison, try
MONITOR
andX
from a clean boot, or after loading the same PRG from the SD card.X
exits the monitor cleanly in these cases.