mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Place the return code into ST
git-svn-id: svn://svn.cc65.org/cc65/trunk@2884 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
910f9277ac
commit
220e5a3898
@ -112,11 +112,10 @@ L1: lda sp,x
|
||||
|
||||
NoIRQ1: jsr callmain
|
||||
|
||||
; Back from main (this is also the _exit entry). Store the return code into
|
||||
; ST, where it is accessible from BASIC. Reset the IRQ vector if we chained
|
||||
; it.
|
||||
; Back from main (this is also the _exit entry). Reset the IRQ vector if we
|
||||
; chained it.
|
||||
|
||||
_exit: sta ST
|
||||
_exit: pha ; Save the return code on stack
|
||||
lda #<__IRQFUNC_COUNT__
|
||||
beq NoIRQ2
|
||||
lda IRQInd+1
|
||||
@ -148,6 +147,11 @@ L2: lda zpsave,x
|
||||
lda mmusave
|
||||
sta MMU_CR
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Done, restore kernal vectors in an attempt to cleanup
|
||||
|
||||
jmp RESTOR
|
||||
|
@ -76,7 +76,8 @@ MemOk: stx sp
|
||||
|
||||
; Call module destructors. This is also the _exit entry.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
_exit: pha ; Save the return code on stack
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Restore system stuff
|
||||
|
||||
@ -91,6 +92,11 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Store the return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Reset changed vectors
|
||||
|
||||
jmp RESTOR
|
||||
|
@ -82,7 +82,7 @@ L1: lda sp,x
|
||||
|
||||
; Call module destructors. This is also the _exit entry.
|
||||
|
||||
_exit: sta ST ; Place return code into ST
|
||||
_exit: pha ; Save the return code
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Restore system stuff
|
||||
@ -100,6 +100,11 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Reset changed vectors, back to basic
|
||||
|
||||
jmp RESTOR
|
||||
|
@ -442,7 +442,8 @@ ccopy2: lda __VIDRAM_START__,y
|
||||
; Call module destructors. This is also the _exit entry and the default entry
|
||||
; point for the break vector.
|
||||
|
||||
_exit: lda #$00
|
||||
_exit: pha ; Save the return code on stack
|
||||
lda #$00
|
||||
sta irqcount ; Disable custom irq handlers
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
@ -481,6 +482,12 @@ _exit: lda #$00
|
||||
bne @L0
|
||||
.endif
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
ldy #ST
|
||||
sta (sysp0),y
|
||||
|
||||
; Setup the welcome code at the stack bottom in the system bank.
|
||||
|
||||
ldy #$FF
|
||||
|
@ -363,7 +363,8 @@ Init: jsr initlib
|
||||
; Call module destructors. This is also the _exit entry and the default entry
|
||||
; point for the break vector.
|
||||
|
||||
_exit: lda #$00
|
||||
_exit: pha ; Save the return code
|
||||
lda #$00
|
||||
sta irqcount ; Disable custom irq handlers
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
@ -388,6 +389,12 @@ _exit: lda #$00
|
||||
bne @L0
|
||||
.endif
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
ldy #ST
|
||||
sta (sysp0),y
|
||||
|
||||
; Setup the welcome code at the stack bottom in the system bank.
|
||||
|
||||
ldy #$FF
|
||||
|
@ -71,7 +71,8 @@ L1: lda sp,x
|
||||
|
||||
; Call module destructors. This is also the _exit entry.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
_exit: pha ; Save the return code on stack
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Restore system stuff
|
||||
|
||||
@ -86,6 +87,11 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Store the program return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Back to basic
|
||||
|
||||
rts
|
||||
|
@ -96,7 +96,8 @@ L1: lda sp,x
|
||||
|
||||
; Back from main (this is also the _exit entry). Run module destructors.
|
||||
|
||||
_exit: lda #0
|
||||
_exit: pha ; Save the return code
|
||||
lda #0
|
||||
sta irqcount ; Disable custom IRQ handlers
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
@ -113,6 +114,11 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Enable the ROM, reset changed vectors and return to BASIC
|
||||
|
||||
sta ENABLE_ROM
|
||||
|
@ -76,7 +76,8 @@ L1: lda sp,x
|
||||
|
||||
; Call module destructors. This is also the _exit entry.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
_exit: pha ; Save the return code on stack
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Restore system stuff
|
||||
|
||||
@ -91,6 +92,11 @@ L2: lda zpsave,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
; Place the program return code into ST
|
||||
|
||||
pla
|
||||
sta ST
|
||||
|
||||
; Reset changed vectors, back to basic
|
||||
|
||||
jmp RESTOR
|
||||
|
Loading…
x
Reference in New Issue
Block a user