From dab3db05a2dece9d5c0a2d4d06ed015cb6f397a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Djupdal?= Date: Fri, 9 Oct 2026 08:46:57 +0200 Subject: [PATCH] CBM GEOS desk accessory support This provides support for creating desk accessories for C64/C128 GEOS. A working sample is provided, demonstrating that this works. A new target is created: geos-c-da This implements issue #823. --- cfg/geos-c-da.cfg | 49 +++++++++ doc/grc65.sgml | 14 ++- include/geos/gsys.h | 1 + libsrc/Makefile | 11 +- libsrc/geos-c-da/crt0.s | 76 +++++++++++++ samples/geos/Makefile | 6 ++ samples/geos/deskacc.c | 210 ++++++++++++++++++++++++++++++++++++ samples/geos/deskaccres.grc | 24 +++++ src/ca65/main.c | 1 + src/cc65/main.c | 1 + src/common/target.c | 2 + src/common/target.h | 1 + src/grc65/main.c | 98 ++++++++++++----- 13 files changed, 461 insertions(+), 33 deletions(-) create mode 100644 cfg/geos-c-da.cfg create mode 100644 libsrc/geos-c-da/crt0.s create mode 100644 samples/geos/deskacc.c create mode 100644 samples/geos/deskaccres.grc diff --git a/cfg/geos-c-da.cfg b/cfg/geos-c-da.cfg new file mode 100644 index 000000000..a11b637a7 --- /dev/null +++ b/cfg/geos-c-da.cfg @@ -0,0 +1,49 @@ +FEATURES { + STARTADDRESS: default = $1000; +} +SYMBOLS { + __BACKBUFSIZE__: type = weak, value = $2000; + __STACKSIZE__: type = weak, value = $0400; # 1k stack + __STACKADDR__: type = weak, value = __VLIR0_LAST__; + __SAVEDZPADDR__: type = weak, value = __STACKADDR__ + __STACKSIZE__; + __HIMEM__: type = weak, value = __SAVEDZPADDR__ + __ZP_SIZE__; + __VLIR0_BLOCKS__: type = export, value = ((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254; +} +MEMORY { + CVT: file = %O, start = $0, size = $40000; + ZP: define = yes, start = $58, size = $1A + $06; + + VLIR0: define = yes, start = %S, size = ($6000 - %S) - __STACKSIZE__ - __ZP_SIZE__; + SAVEDZP: define = yes, start = __SAVEDZPADDR__, size = __ZP_SIZE__; +} +SEGMENTS { + ZEROPAGE: type = zp, load = ZP; + EXTZP: type = zp, load = ZP, optional = yes; + DIRENTRY: type = ro, load = CVT, align = $FE; + FILEINFO: type = ro, load = CVT, align = $FE; + RECORDS: type = ro, load = CVT, align = $FE, optional = yes; + STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes; + LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes; + ONCE: type = ro, run = VLIR0, load = CVT, optional = yes; + CODE: type = ro, run = VLIR0, load = CVT; + RODATA: type = ro, run = VLIR0, load = CVT; + DATA: type = rw, run = VLIR0, load = CVT; + INIT: type = bss, load = VLIR0, optional = yes; + BSS: type = bss, load = VLIR0, define = yes; + SAVEDZP: type = bss, load = SAVEDZP; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/doc/grc65.sgml b/doc/grc65.sgml index d256c31e6..2ab88f7f5 100644 --- a/doc/grc65.sgml +++ b/doc/grc65.sgml @@ -24,8 +24,9 @@ Optional resources might be menu definitions, other headers (e.g., for data files of an app.), dialog definitions, etc. Without an application's header, GEOS is unable to load and start it. -Currently, "dosname" "classname" "version" { } The header definition describes the GEOS header sector which is unique to each file. The definition starts with the keyword Building desk accessories