Watchpoints get a wrong PC during interrupts
Versatile Commodore Emulator
Brought to you by:
blackystardust,
gpz
Activate the monitor and enter:
a 1000 sei
lda #$00
sta $d012
lda #$01
sta $d01a
lda #$00
sta $0314
lda #$30
sta $0315
cli
inc $2000
jmp $1016
a 3000 inc $d019
jmp $ea31
r pc = 1000
watch 2000 if (pc >= $3000)
x
The watchpoint is triggered even though the program counter is below $3000:
#1 (Stop on load 2000) 256/$100, 14/$0e
.C:1016 EE 00 20 INC $2000 - A:30 X:00 Y:0A SP:f0 ..-..I.. 5873630
(C:$ff48) x
#1 (Stop on store 2000) 256/$100, 14/$0e
.C:1016 EE 00 20 INC $2000 - A:30 X:00 Y:0A SP:f0 ..-..I.. 5873630
(C:$ff48) watch
WATCH: 1 C:$2000 (Stop on load store)
Condition: ( PC >= $3000 )
This is annoying when you want to watch memory accesses from a specific range of code.
I just noticed it also affects subroutine jumps:
The monitor thinks that loading the address high byte from $6002 happens when PC == $1003: