The player speaks indices, which is the shape a file has to be

Order lists hold one-byte sequence indices and 0x80 holds a one-byte
patch index. Two tables, PatchTable and SequenceTable, are the only
places an address lives.

THAT IS WHAT MAKES A TUNE LOADABLE WITHOUT WALKING IT. Nothing inside a
sequence or an order list is an address, so putting one in memory means
adding the load address to two arrays and nothing else. The alternative
is a loader that parses every sequence looking for addresses to correct,
which is a loader a malformed file can walk off a cliff.

Doing it now, while the tune is still assembled in, means the file form
and the assembled form are the same shape - so reading a tune from a file
will change no engine code at all. The whole point of the rung.

The patch each voice starts on moved from four calls in a row into
VoiceStart, four declared bytes, and loadStartPatches reads them. A
starting instrument is state and belongs where state goes: the user's
ruling is that a voice with undefined state is an error, prompted by
noticing that a program run a second time starts with the memory the
first run left, because loading is what initialises and running is not.

Order lists also halved in size, which was not the reason but is welcome.

Hand-writing the two tables is exactly the tedium the compiler exists to
remove - every sequence counted into its place, and moving one means
renumbering. Better to feel that here than after a tool has baked the
shape in.

Verified by rendering: bar for bar the same piece. break.sh confirms the
scaling, since an index is doubled to reach a two-byte entry and halving
that step lands on the wrong sequence and fails four checks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-05 20:45:40 -04:00
co-authored by Claude Opus 5
parent 8029063bdc
commit 5d9b39514b
14 changed files with 132 additions and 64 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -22,7 +22,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -39,7 +39,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -29,7 +29,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -29,7 +29,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -115,7 +115,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -34,7 +34,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -22,7 +22,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -20,7 +20,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121
+1 -1
View File
@@ -29,7 +29,7 @@ vars.script 50
blocks.script 343
loops.script 272
tune.sbx 318
Play.sbx 892
Play.sbx 939
notes.txt 21
Apps <dir>
hi.script 121