|
1 | 1 | ## Changelog |
2 | 2 |
|
| 3 | +### Transpiler: trek-portable.bas runs on the full 8-bit spread (2026-06-16) |
| 4 | + |
| 5 | +`examples/trek-portable.bas` (a 1530-line structured-BASIC Super Star Trek) now |
| 6 | +transpiles to C and compiles **warning-clean on cc65 (every 6502: C64, C128, |
| 7 | +PET, Apple II, Atari 8-bit, VIC-20, Plus/4), cmoc (6809: CoCo, Dragon) and SDCC |
| 8 | +(Z80: MSX, Spectrum, CPC, Coleco)**, plus native. It plays identically to the |
| 9 | +rgc-basic interpreter (galaxy layout differs by RND, as designed): the |
| 10 | +short-range-scan quadrant grid, status panel and command loop all render. |
| 11 | + |
| 12 | +The remaining language surface that trek needed: |
| 13 | + |
| 14 | +- **DICT subset** (`DICTNEW`/`DICTSET`/`DICTHAS`/`DICTGETN`) as a fixed-pool |
| 15 | + string→int dict, no malloc (cc65-safe). |
| 16 | +- **SELECT CASE** `IS <relop> expr` and `lo TO hi` ranges; `STOP`; structured |
| 17 | + labels; nested single-line `IF` in a `THEN`; empty `PRINT` items (`;;`). |
| 18 | +- **COLOR n** mapped from C64's 16-colour palette to the contract's 8 colours, |
| 19 | + routed through a current-colour global; `BACKGROUND`/`PAPER` are no-ops (the |
| 20 | + contract has no per-cell background). **PRINT TAB(n)** cursor move. |
| 21 | +- **Scrolling text console**: trek is written for a scrolling teletype (305 |
| 22 | + PRINTs, never a CLS) but the platform contract is a fixed no-scroll screen. A |
| 23 | + runtime-side shadow buffer scrolls on newline and repaints via `plat_puts`, |
| 24 | + preserving per-cell colour — works on every adapter without touching the 16 |
| 25 | + platform files. |
| 26 | + |
| 27 | +Correctness fixes flagged by the float caveat (navigation/targeting use reals): |
| 28 | + |
| 29 | +- **Single-line `IF cond THEN a : b : c`** now puts a, b and c all under the IF. |
| 30 | + The `:`-split was lowering b/c as unconditional siblings, turning |
| 31 | + `... then DEVICE_DAMAGE(I)=-.1 : continue for` into an unconditional |
| 32 | + `continue` (corrupting the damage-repair loop and ~15 other lines). |
| 33 | +- **Call-arg → param type propagation** now scans the whole statement (a bare |
| 34 | + call keeps its name in `first_word`) and no longer skips calls on the RHS of a |
| 35 | + string assignment. So a real coordinate passed to an int-declared param marks |
| 36 | + that param real — `SectorIndex` rounds `SX+.5`, and a pre-truncated int would |
| 37 | + round to the wrong sector. |
| 38 | +- `STR$` of a real keeps its decimals; string index/count args (`MID$`/`LEFT$`/ |
| 39 | + `RIGHT$`/`STRING$`) floor reals explicitly; embedded `\n`/`\r` in PRINT move |
| 40 | + the cursor. |
| 41 | + |
3 | 42 | ### Transpiler: real numbers via rgc_real (float / fixed-point) (2026-06-16) |
4 | 43 |
|
5 | 44 | BASIC numeric values are floating point, but cc65 (every 6502 target incl. the |
|
0 commit comments