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:
@@ -112,7 +112,7 @@ L1: lda sp,x
|
|||||||
|
|
||||||
NoIRQ1: jsr callmain
|
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.
|
; chained it.
|
||||||
|
|
||||||
_exit: pha ; Save the return code on stack
|
_exit: pha ; Save the return code on stack
|
||||||
@@ -129,11 +129,6 @@ _exit: pha ; Save the return code on stack
|
|||||||
|
|
||||||
NoIRQ2: jsr donelib
|
NoIRQ2: jsr donelib
|
||||||
|
|
||||||
; Reset the stack
|
|
||||||
|
|
||||||
ldx spsave
|
|
||||||
txs
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -142,16 +137,18 @@ L2: lda zpsave,x
|
|||||||
dex
|
dex
|
||||||
bpl L2
|
bpl L2
|
||||||
|
|
||||||
; Reset the memory configuration
|
|
||||||
|
|
||||||
lda mmusave
|
|
||||||
sta MMU_CR
|
|
||||||
|
|
||||||
; Place the program return code into ST
|
; Place the program return code into ST
|
||||||
|
|
||||||
pla
|
pla
|
||||||
sta ST
|
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
|
; Done, restore kernal vectors in an attempt to cleanup
|
||||||
|
|
||||||
jmp RESTOR
|
jmp RESTOR
|
||||||
|
|||||||
@@ -79,11 +79,6 @@ MemOk: stx sp
|
|||||||
_exit: pha ; Save the return code on stack
|
_exit: pha ; Save the return code on stack
|
||||||
jsr donelib ; Run module destructors
|
jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Restore system stuff
|
|
||||||
|
|
||||||
ldx spsave
|
|
||||||
txs
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -97,6 +92,11 @@ L2: lda zpsave,x
|
|||||||
pla
|
pla
|
||||||
sta ST
|
sta ST
|
||||||
|
|
||||||
|
; Restore the stack pointer
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs
|
||||||
|
|
||||||
; Reset changed vectors
|
; Reset changed vectors
|
||||||
|
|
||||||
jmp RESTOR
|
jmp RESTOR
|
||||||
|
|||||||
@@ -85,13 +85,6 @@ L1: lda sp,x
|
|||||||
_exit: pha ; Save the return code
|
_exit: pha ; Save the return code
|
||||||
jsr donelib ; Run module destructors
|
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
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -105,6 +98,13 @@ L2: lda zpsave,x
|
|||||||
pla
|
pla
|
||||||
sta ST
|
sta ST
|
||||||
|
|
||||||
|
; Restore system stuff
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs ; Restore stack pointer
|
||||||
|
ldx mmusave
|
||||||
|
stx $01 ; Restore memory configuration
|
||||||
|
|
||||||
; Reset changed vectors, back to basic
|
; Reset changed vectors, back to basic
|
||||||
|
|
||||||
jmp RESTOR
|
jmp RESTOR
|
||||||
|
|||||||
@@ -74,11 +74,6 @@ L1: lda sp,x
|
|||||||
_exit: pha ; Save the return code on stack
|
_exit: pha ; Save the return code on stack
|
||||||
jsr donelib ; Run module destructors
|
jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Restore system stuff
|
|
||||||
|
|
||||||
ldx spsave
|
|
||||||
txs ; Restore stack pointer
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -92,6 +87,11 @@ L2: lda zpsave,x
|
|||||||
pla
|
pla
|
||||||
sta ST
|
sta ST
|
||||||
|
|
||||||
|
; Restore the stack pointer
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs ; Restore stack pointer
|
||||||
|
|
||||||
; Back to basic
|
; Back to basic
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|||||||
@@ -101,11 +101,6 @@ _exit: pha ; Save the return code
|
|||||||
sta irqcount ; Disable custom IRQ handlers
|
sta irqcount ; Disable custom IRQ handlers
|
||||||
jsr donelib ; Run module destructors
|
jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Restore system stuff
|
|
||||||
|
|
||||||
ldx spsave
|
|
||||||
txs
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -119,6 +114,11 @@ L2: lda zpsave,x
|
|||||||
pla
|
pla
|
||||||
sta ST
|
sta ST
|
||||||
|
|
||||||
|
; Restore the stack pointer
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs
|
||||||
|
|
||||||
; Enable the ROM, reset changed vectors and return to BASIC
|
; Enable the ROM, reset changed vectors and return to BASIC
|
||||||
|
|
||||||
sta ENABLE_ROM
|
sta ENABLE_ROM
|
||||||
|
|||||||
@@ -79,11 +79,6 @@ L1: lda sp,x
|
|||||||
_exit: pha ; Save the return code on stack
|
_exit: pha ; Save the return code on stack
|
||||||
jsr donelib ; Run module destructors
|
jsr donelib ; Run module destructors
|
||||||
|
|
||||||
; Restore system stuff
|
|
||||||
|
|
||||||
ldx spsave
|
|
||||||
txs ; Restore stack pointer
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@@ -97,6 +92,11 @@ L2: lda zpsave,x
|
|||||||
pla
|
pla
|
||||||
sta ST
|
sta ST
|
||||||
|
|
||||||
|
; Restore the stack pointer
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs
|
||||||
|
|
||||||
; Reset changed vectors, back to basic
|
; Reset changed vectors, back to basic
|
||||||
|
|
||||||
jmp RESTOR
|
jmp RESTOR
|
||||||
|
|||||||
Reference in New Issue
Block a user