Files
Sprinter-SDCC/release_docs/en/sprinter_cc.md
T
snark13 f4b4852d51 QuickSave F6/F9 в roomtest; bank_load_file/bank_save_file/gfx_w0_page_prepare; sprinter-cc: авто n_banks
roomtest:
- QuickSave/QuickLoad (F6/F9): снапшот 'POPQ' v3 в POP.SAV/POP.BAK на HDD,
  транзакционная запись (POP.NEW -> rename, откат при ошибке), XOR-контрольная
  сумма payload'а; сериализация всех игровых переменных через W0-примитивы
  pop_qs_*; pop_qsave_process() на границе кадра вне Char-окон
- pop_qsave_restore_room(): полная перезагрузка комнаты после загрузки
  (карта/края/швы, сброс bake-кэша, перерисовка обеих страниц, инвалидация
  кэшей спрайтов и HP)
- сериализаторы в pop_map/pop_loose_mob/pop_trob/pop_guard_ai
  (+ восстановление инвариантов: mobs_live, trob_drawn, redraw)
- immortal-чит 2 уровня: уровень 2 поглощает только малый урон Kid'а

libc/libbgi:
- bank_load_file()/bank_save_file() — резидентное файловое I/O в банк,
  без правила W3 (путь читается до переключения страницы)
- gfx_w0_page_prepare(page) — подготовка W0-окна (IRQ/NMI-стабы) одной
  функцией; atlas_load.c и roomtest переведены на новые примитивы;
  ручные ISR-стабы удалены

sprinter-cc / сборка:
- --bank N=FILE.c: автогенерация n_banks (_n_banks_auto.c), ручные
  const n_banks удалены из тестов
- roomtest/app.mk: ресурсы через stamp-файлы (.resource-stamps/) — один
  запуск упаковщика на группу вместо N под -B; HDD_PACK_ARGS
2026-08-22 11:53:10 +03:00

83 lines
2.6 KiB
Markdown

# `sprinter-cc` — compiler driver
One-line entrypoint to the entire toolchain. Takes `.c` files plus options
and emits a SprintEXE.
## Synopsis
```
sprinter-cc -o OUT.exe SRC.c [more.c ...] [options]
```
## Options
### Memory layout
| Flag | Description |
|---|---|
| `--memory MODE` | `tiny` (default), `small`, `big`, `huge`, `manual`. See `memory_modes.md`. |
| `--memory-manual SPEC` | For `--memory manual`: comma-separated `KEY=VAL` list, e.g. `CODE=W2,DATA=W2,BANKED=W3`. |
| `--stack-size N` | Bytes reserved for the stack. Default ≈ 1278. Larger value reduces the heap. |
### Code organisation
| Flag | Description |
|---|---|
| `--bank N=FILE.c` | Compile FILE.c into bank N (1..15). Numbers must be consecutive; crt0's bank count is generated automatically. Repeatable; functions need `__banked`. |
| `--crt0=TYPE` | Override startup file: `default` / `minimal` / `banked` / `small`. Normally chosen automatically by the memory mode. |
### Diagnostics
| Flag | Description |
|---|---|
| `--debug` | Prepends `DEBUG_RT = 1` to crt0 and passes `-DDEBUG_RT` to SDCC. Exposes runtime introspection symbols like `_w2_self_allocated`. |
| `-v` | Verbose — echo every sub-command. |
| `-h` / `--help` | Built-in help. |
### Passthrough
| Flag | Description |
|---|---|
| `-I PATH` | Extra include path. |
| `-Wl FLAG` | Pass FLAG to the linker. |
| `--mkexe FLAG` | Pass FLAG to mkexe (e.g. `--mkexe -p --mkexe 0` for zero-padded banks). |
| `-L 0xADDR` | Override load address. |
| `-E 0xADDR` | Override entry address. |
| `-S 0xADDR` | Override initial stack address. Default `0xBFFE`. |
## Examples
Smallest possible build:
```sh
sprinter-cc -o hello.exe hello.c
```
Larger program (doesn't fit in 14 KB):
```sh
sprinter-cc --memory small -o big.exe big.c
```
Multi-bank game:
```sh
sprinter-cc --memory huge -o game.exe \
main.c --bank 1=engine.c --bank 2=ai.c --bank 3=audio.c
```
Custom stack size:
```sh
sprinter-cc --stack-size 4096 -o app.exe app.c
```
## Under the hood
1. Picks crt0 based on `--memory` (and `--bank` presence).
2. Assembles crt0 (with optional `DEBUG_RT` / `BANK_W1` prepended).
3. Assembles `heap_top.s` (custom value if `--stack-size`).
4. Compiles every source `.c` to `.rel` via SDCC.
5. Compiles bank sources with `--codeseg/--constseg/--dataseg BANK_n`.
6. Compiles `runtime/bank.s` trampoline (if banks are used).
7. Links everything to `.ihx`, runs `check_banks.py` to enforce 16 KB bank limits.
8. Calls `toolchain/mkexe/mkexe` to wrap the `.ihx` as SprintEXE.
Per-build artefacts go in `.sprinter-cc-<basename>/` next to the output.