Settled in milestone M1.1 (assumption A3). The linker config cfg/stonehold-64.cfg defines
these areas. tools/build.ps1 passes it to cl65 (resolved.targets[0].build.config in
project.json).
| Range | Size | ld65 memory area / segment | Contents |
|---|---|---|---|
| $0002-$001B | 26 B | ZP / ZEROPAGE | cc65 runtime zero page |
| $0400-$07E7 | 1000 B | (not linked) | VIC-II screen RAM |
| $0801-$37FF | 12 KB | MAIN / STARTUP, CODE, RODATA, DATA, INIT, ONCE, BSS | Program. BSS may use up to $2FFF |
| $3000-$37FF | 2 KB | (top of MAIN) | C stack (__STACKSIZE__ = $0800), grows down from $3800 |
| $3800-$3FFF | 2 KB | CHARMEM / CHARSET | Custom character set (charset[]), VIC bank 0 |
| $4000-$7FFF | 16 KB | MAPMEM / MAP | 128x128 tile map (map[]), one byte per tile |
| $8000-$CFFF | 20 KB | HIMEM / HIBSS | Large uninitialised buffers (planned: BFS scratch, about 4.2 KB) |
| $D000-$DFFF | 4 KB | (I/O) | VIC-II, SID, colour RAM, CIAs |
Segment 'X' overflows memory area 'Y',
then cl65 exits 1 and tools/build.ps1 exits 1. This was tested in M1.1 with one extra byte in
MAP and with 10 KB of extra BSS. Both links failed.#pragma bss-name (push, "HIBSS") and
#pragma bss-name (pop). src/map.c and src/charset.c show how.main() checks that charset is at CHARSET_ADDR (charset.h), that map is at
MAP_ADDR (map.h) and that BSS ends below the charset. If any check fails it shows
MEMORY CLASH instead of CHARSET OK. This catches a linker config that has drifted from the
headers.malloc.Move large tables and buffers to HIBSS first. If code still does not fit, a later task can add a
file-backed area at $4000 and move the map to $8000-$BFFF. The charset area would then need
fill = yes, so the PRG would grow by 2 KB. That change touches this file, the linker config and
MAP_ADDR.
Powered by TurnKey Linux.