From 910f9277ac931dc36d6ad26007c3ad8de7052dff Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 2 Mar 2004 16:59:52 +0000 Subject: [PATCH] Place the return code into ST git-svn-id: svn://svn.cc65.org/cc65/trunk@2883 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/c128/crt0.s | 8 +++++--- libsrc/c64/crt0.s | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index ea70a8dc8..46cfd93d2 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -112,10 +112,12 @@ L1: lda sp,x NoIRQ1: jsr callmain -; Back from main (this is also the _exit entry). Reset the IRQ vector if -; we chained it. +; 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. -_exit: lda #<__IRQFUNC_COUNT__ +_exit: sta ST + lda #<__IRQFUNC_COUNT__ beq NoIRQ2 lda IRQInd+1 ldx IRQInd+2 diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index 63d4c864c..7144d61ae 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -82,7 +82,8 @@ L1: lda sp,x ; Call module destructors. This is also the _exit entry. -_exit: jsr donelib ; Run module destructors +_exit: sta ST ; Place return code into ST + jsr donelib ; Run module destructors ; Restore system stuff -- 2.39.5