Call atexit functions with correct data bank in large memory model

Previously, the functions registered with atexit() would be called with data bank corresponding to the blank segment, which is correct in the small memory model but not necessarily in the large memory model. This could cause memory corruption or misbehavior for certain operations accessing global variables.
This commit is contained in:
Stephen Heumann 2023-03-28 18:52:14 -05:00
parent 48371dc669
commit a4ba2403fe
1 changed files with 2 additions and 10 deletions

12
cc.asm
View File

@ -522,10 +522,7 @@ ptr equ 3 pointer to exit routines
;
; Set up our stack frame
;
phb
phk
plb
ph4 ~ExitList set up our stack frame
ph4 >~ExitList set up our stack frame
phd
tsc
tcd
@ -574,7 +571,6 @@ lb3 lda >stderr+6 while there is a next file
lb4 pld return
pla
pla
plb
rts
end
@ -592,10 +588,7 @@ ptr equ 3 pointer to exit routines
;
; Set up our stack frame
;
phb
phk
plb
ph4 ~QuickExitList set up our stack frame
ph4 >~QuickExitList set up our stack frame
phd
tsc
tcd
@ -632,7 +625,6 @@ lb2 ldy #2 dereference the pointer
lb3 pld return
pla
pla
plb
rts
end