MEGA65 / m65connect

Cross-Platform Remote Interaction Tool for the MEGA65
GNU General Public License v3.0
8 stars 1 forks source link

M65Connect's PRG send causes BS Monitor's X command to fail #11

Closed dansanderson closed 2 years ago

dansanderson commented 2 years ago

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:

  1. Send a PRG via M65Connect over JTAG/serial.
  2. Type MONITOR, press Return. The monitor opens.
  3. 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.

dansanderson commented 2 years ago

As expected, this is also true when sending files with m65. Does this issue belong in mega65-tools?

dansanderson commented 2 years ago

Relocated to mega65-tools repo. https://github.com/MEGA65/mega65-tools/issues/129