2 ; Ullrich von Bassewitz, 06.06.1998
4 ; int atexit (void (*f) (void));
9 .export _atexit, doatexit
10 .import __errno, jmpvec
13 ecount: .byte 0 ; Really an index, inc'ed by 2
14 efunc: .word 0,0,0,0,0 ; 5 exit functions
22 cpy #maxcount ; slot available?
25 ; Enter the function into the table
40 ; Error, no space left
43 sta __errno ; Use -1 until codes are defined ###
48 ; Function called from exit
51 ldy ecount ; get index
60 ldy #0 ; number of function parms
62 jmp doatexit ; next one