lda oldvec
ora oldvec+1 ; Did we save the vector already?
- bne L1 ; Jump if we installed the handler already
+ bne L1 ; Jump if we installed the handler already
lda VBREAK
sta oldvec
.proc _reset_brk
lda oldvec
- bne @L1
- ldx oldvec
+ ldx oldvec+1
beq @L9 ; Jump if vector not installed
-@L1: sta VBREAK
+ sta VBREAK
stx VBREAK+1
-@L9: rts
+ lda #$00
+ sta oldvec ; Clear the old vector
+ stx oldvec+1
+@L9: rts
.endproc