stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 56 forks source link

NMOS and CMOS 6502 emulations fail self-modifying JSR test #205

Closed SteveFosdick closed 1 year ago

SteveFosdick commented 1 year ago

Test program:

   10 DIM code 99:P%=code
   20 [ SEI:TSX:STX&70:LDX#&21:TXS:JMP&011F:]
   30 P%=&011F: REM here's the vital code to test
   40 [ JSR &4340: NOP: ]
   50 P%=&0123:REM incorrect emulator may land here
   60 [ LDX&70: TXS: LDA #ASC("X"):CLI:RTS: ]
   70 P%=&140: REM real 6502 will land here
   80 [ LDX&70: TXS: LDA #ASC("P"):CLI:RTS: ]
   90 P%=&4340:REM incorrect emulator may land here
  100 [ LDX&70: TXS: LDA #ASC("F"):CLI:RTS: ]
  110 PRINT CHR$ USR code

See http://forum.6502.org/viewtopic.php?f=1&t=7640 and https://stardot.org.uk/forums/viewtopic.php?f=2&t=27208

SteveFosdick commented 1 year ago

Fixed by https://github.com/stardot/b-em/commit/44b4252ca9c20744deab17f7768939401d157c51