From ffc06fcea371b0eff8d20e6c329519d2d729c7f8 Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Fri, 8 Jun 2012 21:46:51 +0000
Subject: [PATCH] Apple GEOS reserves beside the main app area at $4000-$C000 a
secondary app area at $0C00-$2000. While it was an elegant idea to use that
secondary area for overlays at the end of the day those 5 kB are just too
small. So now overlays go at the end of the main area (as with GEOS 64/128).
However the stack (usually 1 kB) can be securely placed in the secondary area
without effort from the side of the developer. The rest of the secondary area
(usually 4 kB) is made available to the developer as (uninitialized)
'EXTBSS'.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5696 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
libsrc/geos-common/system/crt0.s | 8 ++++----
src/grc65/main.c | 2 +-
src/ld65/cfg/geos-apple.cfg | 12 +++++++-----
src/ld65/cfg/geos-cbm.cfg | 6 +++---
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/libsrc/geos-common/system/crt0.s b/libsrc/geos-common/system/crt0.s
index 8dba46f6d..aed4b72a5 100644
--- a/libsrc/geos-common/system/crt0.s
+++ b/libsrc/geos-common/system/crt0.s
@@ -6,8 +6,8 @@
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
- .import __VLIR0_START__, __VLIR0_SIZE__ ; Linker generated
- .import __STACKSIZE__, __BACKBUFSIZE__ ; Linker generated
+ .import __STACKADDR__, __STACKSIZE__ ; Linker generated
+ .import __BACKBUFSIZE__ ; Linker generated
.import initlib, donelib
.import callmain
.import zerobss
@@ -46,8 +46,8 @@
; Setup stack.
- lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
- ldx #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
+ lda #<(__STACKADDR__ + __STACKSIZE__)
+ ldx #>(__STACKADDR__ + __STACKSIZE__)
sta sp
stx sp+1
diff --git a/src/grc65/main.c b/src/grc65/main.c
index 83dda479a..c22e85b4d 100644
--- a/src/grc65/main.c
+++ b/src/grc65/main.c
@@ -828,7 +828,7 @@ static void DoMemory (void)
stacksize);
}
- if (overlaysize != -1 && apple == 0) {
+ if (overlaysize != -1) {
fprintf (outputSFile,
"\t.export __OVERLAYSIZE__ : absolute = $%04x\n\n",
overlaysize);
diff --git a/src/ld65/cfg/geos-apple.cfg b/src/ld65/cfg/geos-apple.cfg
index c7006d2f3..caf97a92f 100644
--- a/src/ld65/cfg/geos-apple.cfg
+++ b/src/ld65/cfg/geos-apple.cfg
@@ -1,14 +1,15 @@
SYMBOLS {
- __STACKSIZE__: type = weak, value = $0400;
__BACKBUFSIZE__: type = weak, value = $2000;
- __OVERLAYSIZE__: type = weak, value = $2000 - $0C00;
- __OVERLAYADDR__: type = weak, value = $0C00;
- __VLIR0END__: type = weak, value = $C000 - __BACKBUFSIZE__ - __STACKSIZE__;
+ __OVERLAYSIZE__: type = weak, value = $0000;
+ __OVERLAYADDR__: type = weak, value = $C000 - __BACKBUFSIZE__ - __OVERLAYSIZE__;
+ __STACKSIZE__: type = weak, value = $0400;
+ __STACKADDR__: type = weak, value = $2000 - __STACKSIZE__;
}
MEMORY {
CVT: file = %O, start = $0, size = $20000;
ZP: define = yes, start = $80, size = $1A + $06;
- VLIR0: define = yes, start = $4000, size = __VLIR0END__ - $4000;
+ EXT: define = yes, start = $0C00, size = __STACKADDR__ - $0C00;
+ VLIR0: define = yes, start = $4000, size = __OVERLAYADDR__ - $4000;
VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
@@ -32,6 +33,7 @@ MEMORY {
SEGMENTS {
ZEROPAGE: type = zp, load = ZP;
EXTZP: type = zp, load = ZP;
+ EXTBSS: type = bss, load = EXT optional = yes;
FILEINFO: type = ro, load = CVT, offset = $002;
RECORDS: type = ro, load = CVT, offset = $100, optional = yes;
DIRENTRY: type = ro, load = CVT, offset = $180;
diff --git a/src/ld65/cfg/geos-cbm.cfg b/src/ld65/cfg/geos-cbm.cfg
index a58b57c6c..ef0f2a08e 100644
--- a/src/ld65/cfg/geos-cbm.cfg
+++ b/src/ld65/cfg/geos-cbm.cfg
@@ -1,14 +1,14 @@
SYMBOLS {
- __STACKSIZE__: type = weak, value = $0400;
__BACKBUFSIZE__: type = weak, value = $2000;
__OVERLAYSIZE__: type = weak, value = $0000;
__OVERLAYADDR__: type = weak, value = $8000 - __BACKBUFSIZE__ - __OVERLAYSIZE__;
- __VLIR0END__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__;
+ __STACKSIZE__: type = weak, value = $0400;
+ __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__;
}
MEMORY {
CVT: file = %O, start = $0, size = $40000;
ZP: define = yes, start = $58, size = $1A + $06;
- VLIR0: define = yes, start = $0400, size = __VLIR0END__ - $0400;
+ VLIR0: define = yes, start = $0400, size = __STACKADDR__ - $0400;
VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
--
2.39.5