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

@@ -112,7 +112,7 @@ L1: lda sp,x
NoIRQ1: jsr callmain
; Back from main (this is also the _exit entry). Reset the IRQ vector if we
; Back from main (this is also the _exit entry). Reset the IRQ vector if we
; chained it.
_exit: pha ; Save the return code on stack
@@ -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