]> git.sur5r.net Git - cc65/commitdiff
Restored the old C-stack initiation code.
authorGreg King <gregdk@users.sf.net>
Thu, 8 Oct 2015 09:05:48 +0000 (05:05 -0400)
committerGreg King <gregdk@users.sf.net>
Thu, 8 Oct 2015 10:04:49 +0000 (06:04 -0400)
I had forgotten that the stack must be put below the CBM overlays.

cfg/c64-overlay.cfg
cfg/c64.cfg
libsrc/c64/crt0.s

index 5d0f611cb4bf27949621d7bf99410d4134de920b..a95c1f6efcd31467620e7fab7e097a319e1d4b97 100644 (file)
@@ -14,7 +14,7 @@ MEMORY {
     ZP:       file = "", define = yes, start = $0002,                        size = $001A;
     LOADADDR: file = %O,               start = %S - 2,                       size = $0002;
     HEADER:   file = %O, define = yes, start = %S,                           size = $000D;
-    RAM:      file = %O,               start = __HEADER_LAST__,              size = __HIMEM__ - __OVERLAYSIZE__ - __STACKSIZE__ - __HEADER_LAST__;
+    RAM:      file = %O, define = yes, start = __HEADER_LAST__,              size = __HIMEM__ - __OVERLAYSIZE__ - __STACKSIZE__ - __HEADER_LAST__;
     MOVE:     file = %O,               start = __ZPSAVE_LOAD__,              size = __HIMEM__ - __INIT_RUN__;
     OVL1ADDR: file = "%O.1",           start = __HIMEM2__ - __OVERLAYSIZE__, size = $0002;
     OVL1:     file = "%O.1",           start = __HIMEM__  - __OVERLAYSIZE__, size = __OVERLAYSIZE__;
index e4e275f2ed1a38b81388d40aebae95c779264a79..8fe1c0c6f6a57b3a46ac7e162c6b08c0ea7557f8 100644 (file)
@@ -11,7 +11,7 @@ MEMORY {
     ZP:       file = "", define = yes, start = $0002,           size = $001A;
     LOADADDR: file = %O,               start = %S - 2,          size = $0002;
     HEADER:   file = %O, define = yes, start = %S,              size = $000D;
-    RAM:      file = %O,               start = __HEADER_LAST__, size = __HIMEM__ - __STACKSIZE__ - __HEADER_LAST__;
+    RAM:      file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __STACKSIZE__ - __HEADER_LAST__;
     MOVE:     file = %O,               start = __ZPSAVE_LOAD__, size = __HIMEM__ - __INIT_RUN__;
 }
 SEGMENTS {
index 4953d4ade3533725d00f7a5085bcd60d3f4558eb..a846897febf18359e4427465b5dd701ab72e70dc 100644 (file)
@@ -8,7 +8,8 @@
         .import         initlib, donelib
         .import         moveinit, zerobss, callmain
         .import         BSOUT
-        .import         __HIMEM__                       ; from configure file
+        .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
+        .import         __STACKSIZE__                   ; from configure file
         .importzp       ST
 
         .include        "zeropage.inc"
@@ -105,8 +106,8 @@ L1:     lda     sp,x
 
 ; Set up the stack.
 
-        lda     #<__HIMEM__
-        ldx     #>__HIMEM__
+        lda     #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        ldx     #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
         sta     sp
         stx     sp+1            ; Set argument stack ptr