diff --git a/libsrc/cbm510/crt0.s b/libsrc/cbm510/crt0.s
index 936d67c61..829aed4c7 100644
--- a/libsrc/cbm510/crt0.s
+++ b/libsrc/cbm510/crt0.s
@@ -485,7 +485,7 @@ _exit:  pha			; Save the return code on stack
 ; Place the program return code into ST
 
 	pla
-	ldy	#ST
+	ldy	#$9C		; ST
 	sta	(sysp0),y
 
 ; Setup the welcome code at the stack bottom in the system bank.
diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s
index 12e083d87..c6b073bb0 100644
--- a/libsrc/cbm610/crt0.s
+++ b/libsrc/cbm610/crt0.s
@@ -392,7 +392,7 @@ _exit:  pha			; Save the return code
 ; Place the program return code into ST
 
 	pla
-	ldy	#ST
+	ldy	#$9C		; ST
 	sta	(sysp0),y
 
 ; Setup the welcome code at the stack bottom in the system bank.