1
0
mirror of https://github.com/cc65/cc65.git synced 2026-01-23 08:16:38 +00:00

calculate the disk blocks in the linker config

This commit is contained in:
mrdudz
2025-07-20 19:18:24 +02:00
parent e554d0ccfb
commit 2c906474eb
2 changed files with 47 additions and 26 deletions

View File

@@ -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;

View File

@@ -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,