tft: script tokens, global variables, timers, control flow

build-tft now reproduces 35 Editor-made samples byte for byte: assignments,
arithmetic, 27 commands, system variables and colours, attribute references,
Program.s globals, all page/hotspot/timer events, if/else/while/for.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Fable 5.2 committed 2026-11-16 18:23:14 +01:00
1 parent f66c902443
commit 99a5240af0
7 files changed
+511 -50

No files matched your search

+16 -3
View File
@@ -152,6 +152,19 @@ Useful facts not obvious from the format description:
- Record references in scripts (`01` + u32) are global record numbers, so adding a component
renumbers every reference after it.
Not done: script tokens beyond `baud=115200` / `page N`; timers, sliders and every drawing
component; global variables declared in Program.s (blob header tables 0 and 1); other models,
portrait, other series; and nothing has been loaded onto a display.
Script (same day): tokens, global variables, timers and control flow are in (FORMAT.md 7.6,
`nxhmi.tft_code`); 35 Editor-made samples are reproduced byte for byte. Things to know:
- A token table entry exists only for names that were compiled once. To add names: put them in
a project, compile, read the token from the chunk (the analysis was a 30-line script printing
source line next to chunk).
- `>=` was never the plain operator in a sample (only as the inverse of `<` in an `||`); its
code 5 is the gap in 1..6. Verify before relying on it.
- Unverified and therefore refused: negative global initial values, `x-1000` (binary minus
before a long number), mixed `&&`/`||`, parentheses in conditions, braces-less `if`.
- The Editor appends one `page 0` chunk to the program even when Program.s already ends with it.
Not done: sliders, touch cap and every drawing component (text, number, button, progress bar,
gauge, waveform, picture, crop, checkbox, radio, QR code ...); string variables and string
functions; page backgrounds other than a solid colour; global (vscope) components; other
models, portrait, other series; and nothing has been loaded onto a display.