1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-03 16:33:19 +00:00

Fixed issues with the last change: The return code must be pulled from stack

before the stack pointer is reset.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2906 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-03-08 20:38:58 +00:00
parent 742d8c3294
commit 7a5d4f3138
6 changed files with 35 additions and 38 deletions

View File

@ -129,11 +129,6 @@ _exit: pha ; Save the return code on stack
NoIRQ2: jsr donelib
; Reset the stack
ldx spsave
txs
; Copy back the zero page stuff
ldx #zpspace-1
@ -142,16 +137,18 @@ L2: lda zpsave,x
dex
bpl L2
; Reset the memory configuration
lda mmusave
sta MMU_CR
; Place the program return code into ST
pla
sta ST
; Reset the stack and the memory configuration
ldx spsave
txs
ldx mmusave
stx MMU_CR
; Done, restore kernal vectors in an attempt to cleanup
jmp RESTOR

View File

@ -79,11 +79,6 @@ MemOk: stx sp
_exit: pha ; Save the return code on stack
jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs
; Copy back the zero page stuff
ldx #zpspace-1
@ -97,6 +92,11 @@ L2: lda zpsave,x
pla
sta ST
; Restore the stack pointer
ldx spsave
txs
; Reset changed vectors
jmp RESTOR

View File

@ -85,13 +85,6 @@ L1: lda sp,x
_exit: pha ; Save the return code
jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs ; Restore stack pointer
lda mmusave
sta $01 ; Restore memory configuration
; Copy back the zero page stuff
ldx #zpspace-1
@ -105,6 +98,13 @@ L2: lda zpsave,x
pla
sta ST
; Restore system stuff
ldx spsave
txs ; Restore stack pointer
ldx mmusave
stx $01 ; Restore memory configuration
; Reset changed vectors, back to basic
jmp RESTOR

View File

@ -74,11 +74,6 @@ L1: lda sp,x
_exit: pha ; Save the return code on stack
jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs ; Restore stack pointer
; Copy back the zero page stuff
ldx #zpspace-1
@ -92,6 +87,11 @@ L2: lda zpsave,x
pla
sta ST
; Restore the stack pointer
ldx spsave
txs ; Restore stack pointer
; Back to basic
rts

View File

@ -101,11 +101,6 @@ _exit: pha ; Save the return code
sta irqcount ; Disable custom IRQ handlers
jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs
; Copy back the zero page stuff
ldx #zpspace-1
@ -119,6 +114,11 @@ L2: lda zpsave,x
pla
sta ST
; Restore the stack pointer
ldx spsave
txs
; Enable the ROM, reset changed vectors and return to BASIC
sta ENABLE_ROM

View File

@ -79,11 +79,6 @@ L1: lda sp,x
_exit: pha ; Save the return code on stack
jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs ; Restore stack pointer
; Copy back the zero page stuff
ldx #zpspace-1
@ -97,6 +92,11 @@ L2: lda zpsave,x
pla
sta ST
; Restore the stack pointer
ldx spsave
txs
; Reset changed vectors, back to basic
jmp RESTOR