1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-31 03:33:04 +00:00

Use a destructor instead of atexit

git-svn-id: svn://svn.cc65.org/cc65/trunk@515 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-12-01 17:58:40 +00:00
parent b46dab6d44
commit e02b3e91c8
7 changed files with 77 additions and 91 deletions

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.include "apple2.inc" .include "apple2.inc"
@ -43,10 +43,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda BRKVec+1 lda BRKVec+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta BRKVec sta BRKVec
lda #>brk_handler lda #>brk_handler
@ -60,10 +56,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.include "atari.inc" .include "atari.inc"
@ -43,10 +43,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda VBREAK+1 lda VBREAK+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta VBREAK sta VBREAK
lda #>brk_handler lda #>brk_handler
@ -60,10 +56,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta VBREAK bne @L1
lda oldvec+1 ldx oldvec
sta VBREAK+1 beq @L9 ; Jump if vector not installed
rts @L1: sta VBREAK
stx VBREAK+1
@L9: rts
.endproc .endproc

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.importzp ptr1 .importzp ptr1
.include "c128.inc" .include "c128.inc"
@ -54,10 +54,6 @@ L1: lda brk_stub,y
dey dey
bpl L1 bpl L1
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L2: lda #<stub_addr ; Set the break vector to our stub L2: lda #<stub_addr ; Set the break vector to our stub
sta BRKVec sta BRKVec
lda #>stub_addr lda #>stub_addr
@ -71,10 +67,12 @@ L2: lda #<stub_addr ; Set the break vector to our stub
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.include "c64.inc" .include "c64.inc"
@ -43,10 +43,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda BRKVec+1 lda BRKVec+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta BRKVec sta BRKVec
lda #>brk_handler lda #>brk_handler
@ -60,10 +56,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc

View File

@ -45,10 +45,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda BRKVec+1 lda BRKVec+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta BRKVec sta BRKVec
lda #>brk_handler lda #>brk_handler
@ -62,10 +58,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.include "pet.inc" .include "pet.inc"
@ -43,10 +43,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda BRKVec+1 lda BRKVec+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta BRKVec sta BRKVec
lda #>brk_handler lda #>brk_handler
@ -60,10 +56,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc

View File

@ -6,8 +6,8 @@
; ;
.export _set_brk, _reset_brk .export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.import _atexit
.include "plus4.inc" .include "plus4.inc"
@ -43,10 +43,6 @@ uservec: jmp $FFFF ; Patched at runtime
lda BRKVec+1 lda BRKVec+1
sta oldvec+1 ; Save the old vector sta oldvec+1 ; Save the old vector
lda #<_reset_brk
ldx #>_reset_brk
jsr _atexit ; Install an exit handler
L1: lda #<brk_handler ; Set the break vector to our routine L1: lda #<brk_handler ; Set the break vector to our routine
sta BRKVec sta BRKVec
lda #>brk_handler lda #>brk_handler
@ -60,10 +56,12 @@ L1: lda #<brk_handler ; Set the break vector to our routine
.proc _reset_brk .proc _reset_brk
lda oldvec lda oldvec
sta BRKVec bne @L1
lda oldvec+1 ldx oldvec
sta BRKVec+1 beq @L9 ; Jump if vector not installed
rts @L1: sta BRKVec
stx BRKVec+1
@L9: rts
.endproc .endproc