telestrat target : manage main return code

This commit is contained in:
jedeoric
2025-07-18 00:23:44 +02:00
committed by GitHub
parent 3f3dc3d145
commit 329ec64a4b

View File

@@ -1,7 +1,7 @@
; ;
; Startup code for cc65 (Oric version) ; Startup code for cc65 (Oric version)
; ;
; By Debrune J<EFBFBD>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org> ; By Debrune Jérôme <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
; ;
.export _exit .export _exit
@@ -36,12 +36,12 @@
; Call the module destructors. This is also the exit() entry. ; Call the module destructors. This is also the exit() entry.
_exit: jsr donelib _exit:
; Restore the system stuff. ; Save return code on stack
ldx spsave pha
txs jsr donelib
; Copy back the zero-page stuff. ; Copy back the zero-page stuff.
@@ -51,6 +51,16 @@ L2: lda zpsave,x
dex dex
bpl L2 bpl L2
; Restore the return code.
; The return code is on the stack, so we can just pop it.
; This is the return code from main().
pla
; Restore the system stuff.
ldx spsave
txs
; Back to BASIC. ; Back to BASIC.
rts rts