From 084453ba57307131dc4465196d177f83a79e0068 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt 
Date: Thu, 10 Mar 2016 10:07:09 +0100
Subject: [PATCH] Don't presume the stack size to be a multiple of pages.
---
 libsrc/supervision/crt0.s | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libsrc/supervision/crt0.s b/libsrc/supervision/crt0.s
index d78bfeab5..6c1287868 100644
--- a/libsrc/supervision/crt0.s
+++ b/libsrc/supervision/crt0.s
@@ -31,9 +31,10 @@ reset:
         ; Initialize data.
         jsr     copydata
 
-        lda     #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
-        sta     sp+1            ; Set argument stack ptr
-        stz     sp              ; #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        lda     #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        ldx     #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        sta     sp
+        stx     sp+1            ; Set argument stack ptr
         jsr     initlib
         jsr     _main
 _exit:  jsr     donelib
-- 
2.39.5