From 71179368280acf386c454e65d80a33b0a02d9bfc Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 12 Jul 2025 20:58:18 +0200 Subject: [PATCH 1/7] calculate number of disk blocks from size of VLIR record(s) --- src/grc65/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index 5ef9e9645..2b594a497 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -559,6 +559,9 @@ static void DoHeader (void) /* OK, all information is gathered, do flushout */ + fprintf (outputSFile, + "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__, __STARTUP_RUN__\n\n"); + fprintf (outputSFile, "\t\t.segment \"DIRENTRY\"\n\n"); @@ -607,7 +610,7 @@ static void DoHeader (void) "\t.byte %i\n" "\t.byte %i\n" "\t.byte %i, %i, %i, %i, %i\n\n" - "\t.word 0\n" + "\t.word ((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254\n" /* length in blocks */ "\t.byte \"PRG formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min); @@ -615,7 +618,6 @@ static void DoHeader (void) fprintf (outputSFile, "\t\t.segment \"FILEINFO\"\n\n" - "\t.import __VLIR0_START__, __STARTUP_RUN__\n\n" "\t.byte 3, 21, 63 | $80\n"); if (myHead.icon != NULL) { From b99bdf1e8980fe50bb27dd44ed267754ac7ec157 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 12 Jul 2025 21:15:12 +0200 Subject: [PATCH 2/7] if "geos-template.d64" exists, copy the samples to that instead of a blank image --- samples/geos/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/samples/geos/Makefile b/samples/geos/Makefile index 0ede7e78c..1443d9709 100644 --- a/samples/geos/Makefile +++ b/samples/geos/Makefile @@ -39,10 +39,12 @@ ifdef CMD_EXE NULLDEV = nul: DEL = -del /f RMDIR = rmdir /s /q + CP = copy else NULLDEV = /dev/null DEL = $(RM) RMDIR = $(RM) -r + CP = cp endif ifdef CC65_HOME @@ -107,7 +109,11 @@ $(C1541) -attach $(0).d64 -geoswrite $(1); endef samples-geos: $(EXELIST_$(SYS)) +ifeq (,$(wildcard ./geos-template.d64)) $(C1541) -format "$@,01" d64 $@.d64 +else + $(CP) geos-template.d64 $@.d64 +endif $(foreach tool,$(EXELIST_$(SYS)),$(call samples-geos,$(tool))) else samples: @@ -172,4 +178,5 @@ clean: @$(DEL) bitmap.c 2>$(NULLDEV) @$(DEL) *.cvt 2>$(NULLDEV) @$(DEL) *.map 2>$(NULLDEV) + @$(DEL) samples-geos.d64 2>$(NULLDEV) $(foreach dir,$(DIRLIST),$(SUBDIR_recipe)) From 3ff1a9e463e15028fc954d32330638dbe1574d5f Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 19 Jul 2025 23:00:28 +0200 Subject: [PATCH 3/7] another try. still not quite right apparently --- src/grc65/main.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index 2b594a497..d4864f545 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -560,7 +560,28 @@ static void DoHeader (void) /* OK, all information is gathered, do flushout */ fprintf (outputSFile, - "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__, __STARTUP_RUN__\n\n"); + "\t.import __BSS_SIZE__, __STARTUP_RUN__\n" + "\t.import __VLIR0_START__, __VLIR0_LAST__\n" + "\t.import __VLIR1_START__, __VLIR1_LAST__\n" + "\t.import __VLIR2_START__, __VLIR2_LAST__\n" + "\t.import __VLIR3_START__, __VLIR3_LAST__\n" + "\t.import __VLIR4_START__, __VLIR4_LAST__\n" + "\t.import __VLIR5_START__, __VLIR5_LAST__\n" + "\t.import __VLIR6_START__, __VLIR6_LAST__\n" + "\t.import __VLIR7_START__, __VLIR7_LAST__\n" + "\t.import __VLIR8_START__, __VLIR8_LAST__\n" + "\t.import __VLIR9_START__, __VLIR9_LAST__\n" + "\t.import __VLIR10_START__, __VLIR10_LAST__\n" + "\t.import __VLIR11_START__, __VLIR11_LAST__\n" + "\t.import __VLIR12_START__, __VLIR12_LAST__\n" + "\t.import __VLIR13_START__, __VLIR13_LAST__\n" + "\t.import __VLIR14_START__, __VLIR14_LAST__\n" + "\t.import __VLIR15_START__, __VLIR15_LAST__\n" + "\t.import __VLIR16_START__, __VLIR16_LAST__\n" + "\t.import __VLIR17_START__, __VLIR17_LAST__\n" + "\t.import __VLIR18_START__, __VLIR18_LAST__\n" + "\t.import __VLIR19_START__, __VLIR19_LAST__\n\n" + ); fprintf (outputSFile, "\t\t.segment \"DIRENTRY\"\n\n"); @@ -610,7 +631,10 @@ static void DoHeader (void) "\t.byte %i\n" "\t.byte %i\n" "\t.byte %i, %i, %i, %i, %i\n\n" - "\t.word ((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254\n" /* length in blocks */ + /* add size of each VLIR segment, plus 1 block for the info block (icon), + * plus another block for the VLIR RECORDS table + */ + "\t.word 2 + (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254) + (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254) + (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254) + (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254) + (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254) + (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254) + (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254) + (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254) + (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254) + (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254) + (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254) + (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254) + (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254) + (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254) + (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254) + (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254) + (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254) + (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254) + (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254) + (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254)\n" /* length in blocks */ "\t.byte \"PRG formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min); From e554d0ccfbbb0c3e45702bb71266a55b254b4738 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 20 Jul 2025 02:01:37 +0200 Subject: [PATCH 4/7] mark sequential GEOS files without RECORD table as such. --- src/grc65/main.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index d4864f545..1c033cdbf 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -64,6 +64,9 @@ struct appheader { char *icon; }; +#define APPHEADER_STRUCTURE_SEQ 0 +#define APPHEADER_STRUCTURE_VLIR 1 + const char *mainToken[] = {"MENU", "HEADER", "ICON", "DIALOG", "MEMORY", ""}; const char *toggle[] = {"off", "no", "0", "on", "yes", "1", ""}; @@ -464,8 +467,10 @@ static void DoHeader (void) myHead.author = "cc65"; myHead.info = "Program compiled with cc65 and GEOSLib."; myHead.dostype = 128; - if (apple == 0) myHead.dostype += 3; - myHead.structure = 0; + if (apple == 0) { + myHead.dostype += 3; + } + myHead.structure = APPHEADER_STRUCTURE_SEQ; myHead.mode = 0; myHead.icon = NULL; @@ -542,11 +547,11 @@ static void DoHeader (void) AbEnd ("unknown structure type in header '%s'", myHead.dosname); case 0: case 1: - myHead.structure = 0; + myHead.structure = APPHEADER_STRUCTURE_SEQ; break; case 2: case 3: - myHead.structure = 1; + myHead.structure = APPHEADER_STRUCTURE_VLIR; break; } break; @@ -588,7 +593,7 @@ static void DoHeader (void) if (apple == 1) { - if (myHead.structure == 0) { + if (myHead.structure == APPHEADER_STRUCTURE_SEQ) { fprintf (outputSFile, "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); } @@ -612,7 +617,7 @@ static void DoHeader (void) "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" "\t.word 0\n\n", myHead.geostype, - myHead.structure == 0 ? + myHead.structure == APPHEADER_STRUCTURE_SEQ ? "__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__" : "0", myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min); @@ -631,13 +636,18 @@ static void DoHeader (void) "\t.byte %i\n" "\t.byte %i\n" "\t.byte %i, %i, %i, %i, %i\n\n" - /* add size of each VLIR segment, plus 1 block for the info block (icon), - * plus another block for the VLIR RECORDS table + /* length in blocks: + * add size of each VLIR segment, plus 1 block for the info block (icon), + * plus another block for the VLIR RECORDS table (VLIR structure only) */ - "\t.word 2 + (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254) + (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254) + (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254) + (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254) + (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254) + (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254) + (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254) + (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254) + (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254) + (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254) + (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254) + (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254) + (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254) + (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254) + (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254) + (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254) + (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254) + (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254) + (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254) + (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254)\n" /* length in blocks */ - "\t.byte \"PRG formatted GEOS file V1.0\"\n\n", + "\t.word %d + (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254) + (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254) + (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254) + (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254) + (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254) + (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254) + (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254) + (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254) + (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254) + (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254) + (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254) + (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254) + (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254) + (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254) + (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254) + (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254) + (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254) + (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254) + (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254) + (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254)\n" + /* PRG formatted or SEQ formatted */ + "\t.byte \"%s formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, - myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min); + myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min, + (myHead.structure == APPHEADER_STRUCTURE_SEQ) ? 1 : 2, + (myHead.structure == APPHEADER_STRUCTURE_SEQ) ? "SEQ" : "PRG" + ); } fprintf (outputSFile, From 2c906474ebcb29268bd184f6ffeff679fb53be03 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 20 Jul 2025 19:18:24 +0200 Subject: [PATCH 5/7] calculate the disk blocks in the linker config --- cfg/geos-cbm.cfg | 32 ++++++++++++++++++++++++++------ src/grc65/main.c | 41 +++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/cfg/geos-cbm.cfg b/cfg/geos-cbm.cfg index 4bf33fdf5..db7912475 100644 --- a/cfg/geos-cbm.cfg +++ b/cfg/geos-cbm.cfg @@ -2,12 +2,32 @@ FEATURES { STARTADDRESS: default = $0400; } SYMBOLS { - __BACKBUFSIZE__: type = weak, value = $2000; - __HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__; - __OVERLAYSIZE__: type = weak, value = $0000; - __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__; - __STACKSIZE__: type = weak, value = $0400; # 1k stack - __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; + __BACKBUFSIZE__: type = weak, value = $2000; + __HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__; + __OVERLAYSIZE__: type = weak, value = $0000; + __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__; + __STACKSIZE__: type = weak, value = $0400; # 1k stack + __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; + __VLIR0_BLOCKS__: type = export, value = (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254); + __VLIR1_BLOCKS__: type = export, value = (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254); + __VLIR2_BLOCKS__: type = export, value = (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254); + __VLIR3_BLOCKS__: type = export, value = (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254); + __VLIR4_BLOCKS__: type = export, value = (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254); + __VLIR5_BLOCKS__: type = export, value = (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254); + __VLIR6_BLOCKS__: type = export, value = (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254); + __VLIR7_BLOCKS__: type = export, value = (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254); + __VLIR8_BLOCKS__: type = export, value = (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254); + __VLIR9_BLOCKS__: type = export, value = (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254); + __VLIR10_BLOCKS__: type = export, value = (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254); + __VLIR11_BLOCKS__: type = export, value = (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254); + __VLIR12_BLOCKS__: type = export, value = (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254); + __VLIR13_BLOCKS__: type = export, value = (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254); + __VLIR14_BLOCKS__: type = export, value = (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254); + __VLIR15_BLOCKS__: type = export, value = (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254); + __VLIR16_BLOCKS__: type = export, value = (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254); + __VLIR17_BLOCKS__: type = export, value = (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254); + __VLIR18_BLOCKS__: type = export, value = (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254); + __VLIR19_BLOCKS__: type = export, value = (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254); } MEMORY { CVT: file = %O, start = $0, size = $40000; diff --git a/src/grc65/main.c b/src/grc65/main.c index 1c033cdbf..7b61ddc85 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -567,25 +567,26 @@ static void DoHeader (void) fprintf (outputSFile, "\t.import __BSS_SIZE__, __STARTUP_RUN__\n" "\t.import __VLIR0_START__, __VLIR0_LAST__\n" - "\t.import __VLIR1_START__, __VLIR1_LAST__\n" - "\t.import __VLIR2_START__, __VLIR2_LAST__\n" - "\t.import __VLIR3_START__, __VLIR3_LAST__\n" - "\t.import __VLIR4_START__, __VLIR4_LAST__\n" - "\t.import __VLIR5_START__, __VLIR5_LAST__\n" - "\t.import __VLIR6_START__, __VLIR6_LAST__\n" - "\t.import __VLIR7_START__, __VLIR7_LAST__\n" - "\t.import __VLIR8_START__, __VLIR8_LAST__\n" - "\t.import __VLIR9_START__, __VLIR9_LAST__\n" - "\t.import __VLIR10_START__, __VLIR10_LAST__\n" - "\t.import __VLIR11_START__, __VLIR11_LAST__\n" - "\t.import __VLIR12_START__, __VLIR12_LAST__\n" - "\t.import __VLIR13_START__, __VLIR13_LAST__\n" - "\t.import __VLIR14_START__, __VLIR14_LAST__\n" - "\t.import __VLIR15_START__, __VLIR15_LAST__\n" - "\t.import __VLIR16_START__, __VLIR16_LAST__\n" - "\t.import __VLIR17_START__, __VLIR17_LAST__\n" - "\t.import __VLIR18_START__, __VLIR18_LAST__\n" - "\t.import __VLIR19_START__, __VLIR19_LAST__\n\n" + "\t.import __VLIR0_BLOCKS__\n" + "\t.import __VLIR1_BLOCKS__\n" + "\t.import __VLIR2_BLOCKS__\n" + "\t.import __VLIR3_BLOCKS__\n" + "\t.import __VLIR4_BLOCKS__\n" + "\t.import __VLIR5_BLOCKS__\n" + "\t.import __VLIR6_BLOCKS__\n" + "\t.import __VLIR7_BLOCKS__\n" + "\t.import __VLIR8_BLOCKS__\n" + "\t.import __VLIR9_BLOCKS__\n" + "\t.import __VLIR10_BLOCKS__\n" + "\t.import __VLIR11_BLOCKS__\n" + "\t.import __VLIR12_BLOCKS__\n" + "\t.import __VLIR13_BLOCKS__\n" + "\t.import __VLIR14_BLOCKS__\n" + "\t.import __VLIR15_BLOCKS__\n" + "\t.import __VLIR16_BLOCKS__\n" + "\t.import __VLIR17_BLOCKS__\n" + "\t.import __VLIR18_BLOCKS__\n" + "\t.import __VLIR19_BLOCKS__\n\n" ); fprintf (outputSFile, @@ -640,7 +641,7 @@ static void DoHeader (void) * add size of each VLIR segment, plus 1 block for the info block (icon), * plus another block for the VLIR RECORDS table (VLIR structure only) */ - "\t.word %d + (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254) + (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254) + (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254) + (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254) + (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254) + (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254) + (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254) + (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254) + (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254) + (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254) + (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254) + (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254) + (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254) + (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254) + (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254) + (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254) + (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254) + (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254) + (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254) + (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254)\n" + "\t.word %d + __VLIR0_BLOCKS__ + __VLIR1_BLOCKS__ + __VLIR2_BLOCKS__ + __VLIR3_BLOCKS__ + __VLIR4_BLOCKS__ + __VLIR5_BLOCKS__ + __VLIR6_BLOCKS__ + __VLIR7_BLOCKS__ + __VLIR8_BLOCKS__ + __VLIR9_BLOCKS__ + __VLIR10_BLOCKS__ + __VLIR11_BLOCKS__ + __VLIR12_BLOCKS__ + __VLIR13_BLOCKS__ + __VLIR14_BLOCKS__ + __VLIR15_BLOCKS__ + __VLIR16_BLOCKS__ + __VLIR17_BLOCKS__ + __VLIR18_BLOCKS__ + __VLIR19_BLOCKS__\n" /* PRG formatted or SEQ formatted */ "\t.byte \"%s formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, From 3d052ea4a3ad63505cdfe0820410592d27c837d7 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 26 Jul 2025 00:21:00 +0200 Subject: [PATCH 6/7] remove some braces --- cfg/geos-cbm.cfg | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/cfg/geos-cbm.cfg b/cfg/geos-cbm.cfg index db7912475..945735683 100644 --- a/cfg/geos-cbm.cfg +++ b/cfg/geos-cbm.cfg @@ -8,26 +8,26 @@ SYMBOLS { __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__; __STACKSIZE__: type = weak, value = $0400; # 1k stack __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; - __VLIR0_BLOCKS__: type = export, value = (((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254); - __VLIR1_BLOCKS__: type = export, value = (((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254); - __VLIR2_BLOCKS__: type = export, value = (((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254); - __VLIR3_BLOCKS__: type = export, value = (((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254); - __VLIR4_BLOCKS__: type = export, value = (((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254); - __VLIR5_BLOCKS__: type = export, value = (((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254); - __VLIR6_BLOCKS__: type = export, value = (((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254); - __VLIR7_BLOCKS__: type = export, value = (((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254); - __VLIR8_BLOCKS__: type = export, value = (((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254); - __VLIR9_BLOCKS__: type = export, value = (((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254); - __VLIR10_BLOCKS__: type = export, value = (((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254); - __VLIR11_BLOCKS__: type = export, value = (((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254); - __VLIR12_BLOCKS__: type = export, value = (((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254); - __VLIR13_BLOCKS__: type = export, value = (((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254); - __VLIR14_BLOCKS__: type = export, value = (((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254); - __VLIR15_BLOCKS__: type = export, value = (((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254); - __VLIR16_BLOCKS__: type = export, value = (((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254); - __VLIR17_BLOCKS__: type = export, value = (((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254); - __VLIR18_BLOCKS__: type = export, value = (((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254); - __VLIR19_BLOCKS__: type = export, value = (((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254); + __VLIR0_BLOCKS__: type = export, value = ((__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__) + 253) / 254; + __VLIR1_BLOCKS__: type = export, value = ((__VLIR1_LAST__ - __VLIR1_START__) + 253) / 254; + __VLIR2_BLOCKS__: type = export, value = ((__VLIR2_LAST__ - __VLIR2_START__) + 253) / 254; + __VLIR3_BLOCKS__: type = export, value = ((__VLIR3_LAST__ - __VLIR3_START__) + 253) / 254; + __VLIR4_BLOCKS__: type = export, value = ((__VLIR4_LAST__ - __VLIR4_START__) + 253) / 254; + __VLIR5_BLOCKS__: type = export, value = ((__VLIR5_LAST__ - __VLIR5_START__) + 253) / 254; + __VLIR6_BLOCKS__: type = export, value = ((__VLIR6_LAST__ - __VLIR6_START__) + 253) / 254; + __VLIR7_BLOCKS__: type = export, value = ((__VLIR7_LAST__ - __VLIR7_START__) + 253) / 254; + __VLIR8_BLOCKS__: type = export, value = ((__VLIR8_LAST__ - __VLIR8_START__) + 253) / 254; + __VLIR9_BLOCKS__: type = export, value = ((__VLIR9_LAST__ - __VLIR9_START__) + 253) / 254; + __VLIR10_BLOCKS__: type = export, value = ((__VLIR10_LAST__ - __VLIR10_START__) + 253) / 254; + __VLIR11_BLOCKS__: type = export, value = ((__VLIR11_LAST__ - __VLIR11_START__) + 253) / 254; + __VLIR12_BLOCKS__: type = export, value = ((__VLIR12_LAST__ - __VLIR12_START__) + 253) / 254; + __VLIR13_BLOCKS__: type = export, value = ((__VLIR13_LAST__ - __VLIR13_START__) + 253) / 254; + __VLIR14_BLOCKS__: type = export, value = ((__VLIR14_LAST__ - __VLIR14_START__) + 253) / 254; + __VLIR15_BLOCKS__: type = export, value = ((__VLIR15_LAST__ - __VLIR15_START__) + 253) / 254; + __VLIR16_BLOCKS__: type = export, value = ((__VLIR16_LAST__ - __VLIR16_START__) + 253) / 254; + __VLIR17_BLOCKS__: type = export, value = ((__VLIR17_LAST__ - __VLIR17_START__) + 253) / 254; + __VLIR18_BLOCKS__: type = export, value = ((__VLIR18_LAST__ - __VLIR18_START__) + 253) / 254; + __VLIR19_BLOCKS__: type = export, value = ((__VLIR19_LAST__ - __VLIR19_START__) + 253) / 254; } MEMORY { CVT: file = %O, start = $0, size = $40000; From cb39da2fba3aaaef4c238be76fa54526c55266f7 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 26 Jul 2025 23:52:14 +0200 Subject: [PATCH 7/7] Use spaces instead of tabs in the output files --- src/grc65/main.c | 188 +++++++++++++++++++++++------------------------ 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/src/grc65/main.c b/src/grc65/main.c index 7b61ddc85..51211ddff 100644 --- a/src/grc65/main.c +++ b/src/grc65/main.c @@ -117,16 +117,16 @@ static void Usage (void) printf ( "Usage: %s [options] file\n" "Short options:\n" - " -V\t\t\tPrint the version number\n" - " -h\t\t\tHelp (this text)\n" - " -o name\t\tName the C output file\n" - " -s name\t\tName the asm output file\n" - " -t sys\t\tSet the target system\n" + " -V Print the version number\n" + " -h Help (this text)\n" + " -o name Name the C output file\n" + " -s name Name the asm output file\n" + " -t sys Set the target system\n" "\n" "Long options:\n" - " --help\t\tHelp (this text)\n" - " --target sys\t\tSet the target system\n" - " --version\t\tPrint the version number\n", + " --help Help (this text)\n" + " --target sys Set the target system\n" + " --version Print the version number\n", ProgName); } @@ -179,11 +179,11 @@ static void printCHeader (void) { fprintf (outputCFile, "//\n" - "//\tThis file was generated by the GEOS Resource Compiler\n" + "// This file was generated by the GEOS Resource Compiler\n" "//\n" - "//\tDO NOT EDIT! Any changes will be lost!\n" + "// DO NOT EDIT! Any changes will be lost!\n" "//\n" - "//\tEdit proper resource file instead.\n" + "// Edit proper resource file instead.\n" "//\n\n"); } @@ -192,11 +192,11 @@ static void printSHeader (void) { fprintf (outputSFile, ";\n" - ";\tThis file was generated by the GEOS Resource Compiler\n" + "; This file was generated by the GEOS Resource Compiler\n" ";\n" - ";\tDO NOT EDIT! Any changes will be lost!\n" + "; DO NOT EDIT! Any changes will be lost!\n" ";\n" - ";\tEdit proper resource file instead.\n" + "; Edit proper resource file instead.\n" ";\n\n"); } @@ -271,11 +271,11 @@ static void fillOut (char *name, int len, char *filler) int a; setLen (name, len); - fprintf (outputSFile, "\t.byte \"%s\"\n", name); + fprintf (outputSFile, " .byte \"%s\"\n", name); a = strlen (name); if (a < len) { - fprintf (outputSFile, "\t.res (%i - %i), %s\n", len, a, filler); + fprintf (outputSFile, " .res (%i - %i), %s\n", len, a, filler); } } @@ -391,15 +391,15 @@ static void DoMenu (void) fprintf (outputCFile, "\n" "const void %s = {\n" - "\t(char)%i, (char)%i,\n" - "\t(int)%i, (int)%i,\n" - "\t(char)(%i | %s),\n", + " (char)%i, (char)%i,\n" + " (int)%i, (int)%i,\n" + " (char)(%i | %s),\n", myMenu.name, myMenu.top, myMenu.bot, myMenu.left, myMenu.right, item, myMenu.type); curItem = myMenu.item; for (a = 0; a != item; a++) { fprintf (outputCFile, - "\t%s, (char)%s, (int)", + " %s, (char)%s, (int)", curItem->name, curItem->type); if ((strstr (curItem->type, "SUB_MENU") != NULL) && (strstr (curItem->type, "DYN_SUB_MENU") == NULL)) { fprintf (outputCFile, @@ -565,58 +565,58 @@ static void DoHeader (void) /* OK, all information is gathered, do flushout */ fprintf (outputSFile, - "\t.import __BSS_SIZE__, __STARTUP_RUN__\n" - "\t.import __VLIR0_START__, __VLIR0_LAST__\n" - "\t.import __VLIR0_BLOCKS__\n" - "\t.import __VLIR1_BLOCKS__\n" - "\t.import __VLIR2_BLOCKS__\n" - "\t.import __VLIR3_BLOCKS__\n" - "\t.import __VLIR4_BLOCKS__\n" - "\t.import __VLIR5_BLOCKS__\n" - "\t.import __VLIR6_BLOCKS__\n" - "\t.import __VLIR7_BLOCKS__\n" - "\t.import __VLIR8_BLOCKS__\n" - "\t.import __VLIR9_BLOCKS__\n" - "\t.import __VLIR10_BLOCKS__\n" - "\t.import __VLIR11_BLOCKS__\n" - "\t.import __VLIR12_BLOCKS__\n" - "\t.import __VLIR13_BLOCKS__\n" - "\t.import __VLIR14_BLOCKS__\n" - "\t.import __VLIR15_BLOCKS__\n" - "\t.import __VLIR16_BLOCKS__\n" - "\t.import __VLIR17_BLOCKS__\n" - "\t.import __VLIR18_BLOCKS__\n" - "\t.import __VLIR19_BLOCKS__\n\n" + " .import __BSS_SIZE__, __STARTUP_RUN__\n" + " .import __VLIR0_START__, __VLIR0_LAST__\n" + " .import __VLIR0_BLOCKS__\n" + " .import __VLIR1_BLOCKS__\n" + " .import __VLIR2_BLOCKS__\n" + " .import __VLIR3_BLOCKS__\n" + " .import __VLIR4_BLOCKS__\n" + " .import __VLIR5_BLOCKS__\n" + " .import __VLIR6_BLOCKS__\n" + " .import __VLIR7_BLOCKS__\n" + " .import __VLIR8_BLOCKS__\n" + " .import __VLIR9_BLOCKS__\n" + " .import __VLIR10_BLOCKS__\n" + " .import __VLIR11_BLOCKS__\n" + " .import __VLIR12_BLOCKS__\n" + " .import __VLIR13_BLOCKS__\n" + " .import __VLIR14_BLOCKS__\n" + " .import __VLIR15_BLOCKS__\n" + " .import __VLIR16_BLOCKS__\n" + " .import __VLIR17_BLOCKS__\n" + " .import __VLIR18_BLOCKS__\n" + " .import __VLIR19_BLOCKS__\n\n" ); fprintf (outputSFile, - "\t\t.segment \"DIRENTRY\"\n\n"); + " .segment \"DIRENTRY\"\n\n"); if (apple == 1) { if (myHead.structure == APPHEADER_STRUCTURE_SEQ) { fprintf (outputSFile, - "\t.import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); + " .import __VLIR0_START__, __VLIR0_LAST__, __BSS_SIZE__\n\n"); } fprintf (outputSFile, - "\t.byte %i << 4 | %u\n", + " .byte %i << 4 | %u\n", myHead.structure + 2, (unsigned)strlen (myHead.dosname)); fillOut (myHead.dosname, 15, "0"); fprintf (outputSFile, - "\t.byte $%02x\n" - "\t.word 0\n" - "\t.word 0\n" - "\t.word %s\n" - "\t.byte 0\n" - "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" - "\t.byte 0\n" - "\t.byte 0\n" - "\t.byte 0\n" - "\t.word 0\n" - "\t.word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" - "\t.word 0\n\n", + " .byte $%02x\n" + " .word 0\n" + " .word 0\n" + " .word %s\n" + " .byte 0\n" + " .word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" + " .byte 0\n" + " .byte 0\n" + " .byte 0\n" + " .word 0\n" + " .word %i << 9 | %i << 5 | %i, %i << 8 | %i\n" + " .word 0\n\n", myHead.geostype, myHead.structure == APPHEADER_STRUCTURE_SEQ ? "__VLIR0_LAST__ - __VLIR0_START__ - __BSS_SIZE__" : "0", @@ -626,24 +626,24 @@ static void DoHeader (void) } else { fprintf (outputSFile, - "\t.byte %i\n" - "\t.word 0\n", + " .byte %i\n" + " .word 0\n", myHead.dostype); fillOut (myHead.dosname, 16, "$a0"); fprintf (outputSFile, - "\t.word 0\n" - "\t.byte %i\n" - "\t.byte %i\n" - "\t.byte %i, %i, %i, %i, %i\n\n" + " .word 0\n" + " .byte %i\n" + " .byte %i\n" + " .byte %i, %i, %i, %i, %i\n\n" /* length in blocks: * add size of each VLIR segment, plus 1 block for the info block (icon), * plus another block for the VLIR RECORDS table (VLIR structure only) */ - "\t.word %d + __VLIR0_BLOCKS__ + __VLIR1_BLOCKS__ + __VLIR2_BLOCKS__ + __VLIR3_BLOCKS__ + __VLIR4_BLOCKS__ + __VLIR5_BLOCKS__ + __VLIR6_BLOCKS__ + __VLIR7_BLOCKS__ + __VLIR8_BLOCKS__ + __VLIR9_BLOCKS__ + __VLIR10_BLOCKS__ + __VLIR11_BLOCKS__ + __VLIR12_BLOCKS__ + __VLIR13_BLOCKS__ + __VLIR14_BLOCKS__ + __VLIR15_BLOCKS__ + __VLIR16_BLOCKS__ + __VLIR17_BLOCKS__ + __VLIR18_BLOCKS__ + __VLIR19_BLOCKS__\n" + " .word %d + __VLIR0_BLOCKS__ + __VLIR1_BLOCKS__ + __VLIR2_BLOCKS__ + __VLIR3_BLOCKS__ + __VLIR4_BLOCKS__ + __VLIR5_BLOCKS__ + __VLIR6_BLOCKS__ + __VLIR7_BLOCKS__ + __VLIR8_BLOCKS__ + __VLIR9_BLOCKS__ + __VLIR10_BLOCKS__ + __VLIR11_BLOCKS__ + __VLIR12_BLOCKS__ + __VLIR13_BLOCKS__ + __VLIR14_BLOCKS__ + __VLIR15_BLOCKS__ + __VLIR16_BLOCKS__ + __VLIR17_BLOCKS__ + __VLIR18_BLOCKS__ + __VLIR19_BLOCKS__\n" /* PRG formatted or SEQ formatted */ - "\t.byte \"%s formatted GEOS file V1.0\"\n\n", + " .byte \"%s formatted GEOS file V1.0\"\n\n", myHead.structure, myHead.geostype, myHead.year, myHead.month, myHead.day, myHead.hour, myHead.min, (myHead.structure == APPHEADER_STRUCTURE_SEQ) ? 1 : 2, @@ -652,24 +652,24 @@ static void DoHeader (void) } fprintf (outputSFile, - "\t\t.segment \"FILEINFO\"\n\n" - "\t.byte 3, 21, 63 | $80\n"); + " .segment \"FILEINFO\"\n\n" + " .byte 3, 21, 63 | $80\n"); if (myHead.icon != NULL) { fprintf (outputSFile, - "\t.incbin \"%s\", 0, 63\n", + " .incbin \"%s\", 0, 63\n", myHead.icon); } else { for (i = 0; i != 63; i = i + 3) { fprintf (outputSFile, - "\t.byte %%%s, %%%s, %%%s\n", + " .byte %%%s, %%%s, %%%s\n", bintos (icon1[i], i1), bintos (icon1[i+1], i2), bintos (icon1[i+2], i3)); } } fprintf (outputSFile, - "\t.byte %i, %i, %i\n" - "\t.word __VLIR0_START__, __VLIR0_START__ - 1, __STARTUP_RUN__\n\n", + " .byte %i, %i, %i\n" + " .word __VLIR0_START__, __VLIR0_START__ - 1, __STARTUP_RUN__\n\n", myHead.dostype, myHead.geostype, myHead.structure); fillOut (myHead.classname, 12, "$20"); @@ -677,21 +677,21 @@ static void DoHeader (void) fillOut (myHead.version, 4, "0"); fprintf (outputSFile, - "\t.byte 0, 0, 0\n" - "\t.byte %i\n\n", + " .byte 0, 0, 0\n" + " .byte %i\n\n", myHead.mode); setLen (myHead.author, 62); fprintf (outputSFile, - "\t.byte \"%s\"\n" - "\t.byte 0\n" - "\t.res (63 - %i)\n\n", + " .byte \"%s\"\n" + " .byte 0\n" + " .res (63 - %i)\n\n", myHead.author, (int)(strlen (myHead.author) + 1)); setLen (myHead.info, 95); fprintf (outputSFile, - "\t.byte \"%s\"\n" - "\t.byte 0\n\n", + " .byte \"%s\"\n" + " .byte 0\n\n", myHead.info); if (fclose (outputSFile) != 0) { @@ -788,13 +788,13 @@ static void DoMemory (void) if (lastnumber != -1) { fprintf (outputSFile, - "\t\t.segment \"RECORDS\"\n\n"); + " .segment \"RECORDS\"\n\n"); if (apple == 1) { for (number = 0; number <= lastnumber; number++) { fprintf (outputSFile, - "\t.byte %s\n", + " .byte %s\n", overlaytable[number] == 1 ? "$00" : "$FF"); } fprintf (outputSFile, @@ -803,12 +803,12 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t\t.segment \"VLIRIDX%i\"\n\n" - "\t.import __VLIR%i_START__, __VLIR%i_LAST__%s\n\n" - "\t.res 255\n" - "\t.byte .lobyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n" - "\t.res 255\n" - "\t.byte .hibyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n\n", + " .segment \"VLIRIDX%i\"\n\n" + " .import __VLIR%i_START__, __VLIR%i_LAST__%s\n\n" + " .res 255\n" + " .byte .lobyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n" + " .res 255\n" + " .byte .hibyte (__VLIR%i_LAST__ - __VLIR%i_START__%s)\n\n", number, number, number, number == 0 ? ", __BSS_SIZE__" : "", number, number, @@ -823,7 +823,7 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t.import __VLIR%i_START__, __VLIR%i_LAST__%s\n", + " .import __VLIR%i_START__, __VLIR%i_LAST__%s\n", number, number, number == 0 ? ", __BSS_SIZE__" : ""); } } @@ -833,14 +833,14 @@ static void DoMemory (void) for (number = 0; number <= lastnumber; number++) { if (overlaytable[number] == 1) { fprintf (outputSFile, - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) / 254) + 1\n" - "\t.byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) .MOD 254) + 2\n", + " .byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) / 254) + 1\n" + " .byte .lobyte ((__VLIR%i_LAST__ - __VLIR%i_START__%s - 1) .MOD 254) + 2\n", number, number, number == 0 ? " - __BSS_SIZE__" : "", number, number, number == 0 ? " - __BSS_SIZE__" : ""); } else { fprintf (outputSFile, - "\t.byte $00\n" - "\t.byte $FF\n"); + " .byte $00\n" + " .byte $FF\n"); } } fprintf (outputSFile, @@ -862,19 +862,19 @@ static void DoMemory (void) if (stacksize != -1) { fprintf (outputSFile, - "\t.export __STACKSIZE__ : absolute = $%04x\n\n", + " .export __STACKSIZE__ : absolute = $%04x\n\n", stacksize); } if (overlaysize != -1) { fprintf (outputSFile, - "\t.export __OVERLAYSIZE__ : absolute = $%04x\n\n", + " .export __OVERLAYSIZE__ : absolute = $%04x\n\n", overlaysize); } if (backbuffer != -1) { fprintf (outputSFile, - "\t.export __BACKBUFSIZE__ : absolute = $%04x\n\n", + " .export __BACKBUFSIZE__ : absolute = $%04x\n\n", backbuffer ? 0x2000 : 0x0000); }