mirror of
https://github.com/cc65/cc65.git
synced 2026-04-22 01:16:54 +00:00
First condes feature test
git-svn-id: svn://svn.cc65.org/cc65/trunk@463 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -33,7 +33,6 @@ S_OBJS = _fdesc.o \
|
||||
atexit.o \
|
||||
atoi.o \
|
||||
copydata.o \
|
||||
doatexit.o \
|
||||
errno.o \
|
||||
fmisc.o \
|
||||
free.o \
|
||||
|
||||
+34
-2
@@ -5,12 +5,13 @@
|
||||
;
|
||||
|
||||
.export _atexit
|
||||
.import exitfunc_table, exitfunc_index
|
||||
.importzp exitfunc_max
|
||||
.destructor doatexit, 16
|
||||
.import __errno
|
||||
.import jmpvec
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.proc _atexit
|
||||
|
||||
@@ -47,4 +48,35 @@
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
|
||||
.proc doatexit
|
||||
|
||||
ldy exitfunc_index ; Get index
|
||||
beq @L9 ; Jump if done
|
||||
dey
|
||||
lda exitfunc_table,y
|
||||
sta jmpvec+2
|
||||
dey
|
||||
lda exitfunc_table,y
|
||||
sta jmpvec+1
|
||||
sty exitfunc_index
|
||||
jsr jmpvec ; Call the function
|
||||
jmp doatexit ; Next one
|
||||
|
||||
@L9: rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.bss
|
||||
exitfunc_index: .res 1 ; Index into table, inc'ed by 2
|
||||
exitfunc_table: .res 10 ; 5 exit functions
|
||||
exitfunc_max = <(* - exitfunc_table)
|
||||
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; Handle exit functions
|
||||
;
|
||||
|
||||
.export doatexit, exitfunc_index, exitfunc_table
|
||||
.exportzp exitfunc_max
|
||||
.import jmpvec
|
||||
|
||||
.bss
|
||||
exitfunc_index: .res 1 ; Index into table, inc'ed by 2
|
||||
exitfunc_table: .res 10 ; 5 exit functions
|
||||
exitfunc_max = <(* - exitfunc_table)
|
||||
|
||||
|
||||
.code
|
||||
|
||||
.proc doatexit
|
||||
|
||||
ldy exitfunc_index ; Get index
|
||||
beq @L9 ; Jump if done
|
||||
dey
|
||||
lda exitfunc_table,y
|
||||
sta jmpvec+2
|
||||
dey
|
||||
lda exitfunc_table,y
|
||||
sta jmpvec+1
|
||||
sty exitfunc_index
|
||||
jsr jmpvec ; Call the function
|
||||
jmp doatexit ; Next one
|
||||
|
||||
@L9: rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user