Skip to content

Texts with numbers in them, in a map of our own - #38

Merged
jeany55 merged 2 commits into
trigscript-4from
digits
Oct 20, 2026
Merged

jeany55 merged 2 commits into
trigscript-4from
digits

Conversation

@jeany55

@jeany55 jeany55 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Texts with numbers in them, in a map of our own (no eudplib, no Python): step 2 of the way off eudplib in the plan.

Not a table of digits after all. The plan proposed a table of 1,000 three-digit cells. Working it out, the table only
saves the last step — a number still has to be cut into groups of three, a division by 1,000 — and the harder part is
where the digits go: a number's width changes from print to print, so everything after it moves a byte, and the game
writes whole dwords. What was built instead (compiler/backend/emit.ts, layout.ts, graph.ts, scripts/build-own.mts):

  • A template for each print, laid out when the map is built: its text, and for each number a field of 12 bytes on
    a dword's start, the room before the number 0x0D — a carriage return, drawn as nothing. eudplib pads its strings with
    it, and its own prints carry it around every number, so it is proven in Remastered already. Nothing in a text ever
    moves. A byte from a value (a colour from JSX) is one byte of the template.
  • One routine, shared by every print, writes a number into a field: how many digits by comparisons with powers of
    ten (four at most), then four triggers a digit — 8, 4, 2 and 1 times its power of ten, taken from the number and
    added to the digit's byte. eudplib's build divides by ten for each digit, a bit at a time.
  • A print copies the field's three dwords into its template (routed) and shows it with Display Text. The template
    is a string of the map's — a placeholder it is written into, its offset moved to the first dword's start — among the
    map's own strings, since 1.16.1's table names only their first 64 KB.

probes/own-print.ts, lifted game, Remastered's weights:

Own eudplib
One text, one number 0.001 ms 0.013 ms
A hundred texts of two numbers in a frame 0.133 ms 2.411 ms

Checked: the random programs print now (words, Korean, numbers signed and u32, bytes from values): about 9,600
texts compared byte for byte with what JavaScript makes of them, as graphs and from the laid-out bytes, in the programs
with functions that call themselves too; both builds of the probe print the same twenty lines at the same frames once
the 0x0D are taken out of both; game-check: none of 178 accesses ends the game; the calls, recursion and own-loader
probes still all ok. Played in Remastered: every line word for word as the lifted game's, the Korean drawn, nothing
where the padding is — in Remastered's graphics and, after F5, Classic's.

The suite: 1194 pass; tests/sound.test.ts could not load in this worktree — its shared node_modules lacks
wasm-media-encoders, which the music work added — nothing of this change.

Not yet: a fixed number printed (3.25), a player's name or colour, a text of the program's, position: "center".

🤖 Generated with Claude Code

https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg

jeany55 and others added 2 commits October 19, 2026 19:59
…one routine for the digits

Each print with values is a template laid out when the map is built — its text, and for each
number a field of 12 bytes on a dword's start, the room before the number 0x0D (a carriage
return, drawn as nothing; eudplib pads with it too) — so nothing in a text moves however wide a
number is. One routine, shared by every print, writes a number into a field: how many digits by
comparisons with powers of ten, then four triggers a digit (8, 4, 2 and 1 times its power of ten,
taken from the number and added to the digit's byte). A print copies the field's three dwords into
its template and shows it with Display Text. The template is a string of the map's (a placeholder
the template is written into, its offset moved to the first dword's start), since 1.16.1's table
names only the first 64 KB of strings.

probes/own-print.ts: a hundred texts of two numbers in a frame, 0.133 ms against eudplib's 2.411.
Both builds print the same twenty lines at the same frames, less the 0x0D.

Checked: the random programs print (words, Korean, numbers signed and u32, bytes from values),
about 9,600 texts compared byte for byte with what JavaScript makes of them, as graphs and from
the laid-out bytes; game-check: none of 178 accesses ends the game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
… lifted game's, the padding invisible in both graphics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
@jeany55
jeany55 merged commit e617cd7 into trigscript-4 Oct 20, 2026
1 check failed
@jeany55
jeany55 deleted the digits branch October 20, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant