From 0cd1141f6094a1086e562d961b0f793e1565cb83 Mon Sep 17 00:00:00 2001
From: cuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Date: Sun, 24 Nov 2002 19:13:19 +0000
Subject: [PATCH] Fixed last fix:-)

git-svn-id: svn://svn.cc65.org/cc65/trunk@1620 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
 libsrc/c64/crt0.s | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s
index 70df21d7c..4c441d513 100644
--- a/libsrc/c64/crt0.s
+++ b/libsrc/c64/crt0.s
@@ -52,14 +52,22 @@ L1:	lda	sp,x
 	lda	#14
 	jsr	BSOUT
 
-; Save system stuff and setup the stack
+; Switch off the BASIC ROM
 
 	lda	$01
-       	tax                     ; Remember in X
+       	pha                     ; Remember the value
 	and	#$F8
        	ora	#$06		; Enable kernal+I/O, disable basic
 	sta	$01
-        stx	mmusave      	; Save the memory configuration
+
+; Clear the BSS data
+
+	jsr	zerobss
+
+; Save system settings and setup the stack
+
+        pla
+        sta	mmusave      	; Save the memory configuration
 
        	tsx
        	stx    	spsave 		; Save the system stack ptr
@@ -69,10 +77,6 @@ L1:	lda	sp,x
 	lda	#>(__RAM_START__ + __RAM_SIZE__)
        	sta	sp+1   		; Set argument stack ptr
 
-; Clear the BSS data
-
-	jsr	zerobss
-
 ; Call module constructors
 
 	jsr	initlib