]> git.sur5r.net Git - cc65/blob - libsrc/common/doatexit.s
Replaced missing routine, fixed a bug
[cc65] / libsrc / common / doatexit.s
1 ;
2 ; Ullrich von Bassewitz, 26.10.2000
3 ;
4 ; Handle exit functions
5 ;
6
7         .export         doatexit, exitfunc_index, exitfunc_table
8         .exportzp       exitfunc_max
9         .import         jmpvec
10
11 .bss
12 exitfunc_index: .res    1       ; Index into table, inc'ed by 2
13 exitfunc_table: .res    10      ; 5 exit functions
14 exitfunc_max    = <(* - exitfunc_table)
15
16
17 .code
18
19 .proc   doatexit
20
21         ldy     exitfunc_index          ; Get index
22         beq     @L9                     ; Jump if done
23         dey
24         lda     exitfunc_table,y
25         sta     jmpvec+2
26         dey
27         lda     exitfunc_table,y
28         sta     jmpvec+1
29         sty     exitfunc_index
30         jsr     jmpvec                  ; Call the function
31         jmp     doatexit                ; Next one
32
33 @L9:    rts
34
35 .endproc
36
37
38