2 ; Christian Groessler, 27-Feb-2000
4 ; void set_brk (unsigned Addr);
5 ; void reset_brk (void);
8 .export _set_brk, _reset_brk
10 .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
22 oldvec: .res 2 ; Old vector
26 uservec: jmp $FFFF ; Patched at runtime
31 ; Set the break vector
35 stx uservec+2 ; Set the user vector
38 ora oldvec+1 ; Did we save the vector already?
39 bne L1 ; Jump if we installed the handler already
44 sta oldvec+1 ; Save the old vector
46 L1: lda #<brk_handler ; Set the break vector to our routine
55 ; Reset the break vector
60 beq @L9 ; Jump if vector not installed
64 sta oldvec ; Clear the old vector
72 ; Break handler, called if a break occurs
81 and #$EF ; Clear break bit
85 sbc #2 ; Point to start of brk
91 jsr uservec ; Call the user's routine