2 ; Ullrich von Bassewitz, 06.06.1998
4 ; int atexit (void (*f) (void));
9 .export _atexit, doatexit
10 .import __errno, jmpvec
15 ecount: .byte 0 ; Really an index, inc'ed by 2
16 efunc: .word 0,0,0,0,0 ; 5 exit functions
24 cpy #maxcount ; slot available?
27 ; Enter the function into the table
42 ; Error, no space left
44 E0: lda #ENOSPC ; No space left
52 ; Function called from exit
55 ldy ecount ; get index
64 ldy #0 ; number of function parms
66 jmp doatexit ; next one