The loader, and the reason it is small: everything in a tune is an offset from wherever it was put, so taking one means adding the base to two tables and pointing four voices at their order lists. No sequence is walked. Nothing inside one is an address to be found and corrected, which is the difference between a malformed tune that plays wrongly and one that takes the loader with it. "SBTU", version, the tick in cycles, how many patches and sequences, offsets to the two tables, an order list each, and the patch each voice starts on. The magic is checked before anything else, because from there on the loader follows what the offsets name. break.sh shows what that guard is worth: without it, handing Play a PROGRAM runs the machine away until the cycle limit, rather than saying it is not a tune. PatchTable, SequenceTable and VoiceStart became pointers, so the engine does not care whether a tune came out of a file or was assembled in. Play's built-in tune now hands over the same three addresses a loaded one would, in eight lines - which is what keeps the two paths from drifting, and what made this rung change no scheduler code at all. Tests/maketune.py lays the fixture out byte by byte. IT IS NOT THE COMPILER: the sequences and the patches are literal bytes and the only thing computed is where each piece lands. That is the point - the loader is checked by something that does not share its idea of the format, which is the same reason SplitDisk and sbfs.asm share nothing but a specification. Both notes in the fixture are number 60, so the octave between them is a 0x80 command loading the second patch out of the file: the header, the tick, the relocation, an order list and a patch from a file, measured in one go. Play and the tune live on quiet.img rather than cosmos.img, so a fixture does not move ten recordings every time it changes size. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
48 lines
1.0 KiB
Plaintext
48 lines
1.0 KiB
Plaintext
CosmOS
|
|
> Say before Grid
|
|
it says: before Grid
|
|
finished
|
|
> Grid
|
|
[2J[Hfinished
|
|
>
|
|
> Say after Grid
|
|
it says: after Grid
|
|
finished
|
|
> dir
|
|
greet.sbx 211
|
|
hello.sbx 53
|
|
Life.sbx 1396
|
|
Snake.sbx 2164
|
|
Keys.sbx 664
|
|
Say.sbx 156
|
|
Break.sbx 149
|
|
Grid.sbx 571
|
|
Press.sbx 872
|
|
Mode.sbx 48
|
|
Flip.sbx 173
|
|
Sprite.sbx 442
|
|
Depth.sbx 672
|
|
Lander.sbx 9201
|
|
Pad.sbx 264
|
|
Crash.sbx 632
|
|
vars.script 50
|
|
blocks.script 343
|
|
loops.script 272
|
|
tune.sbx 318
|
|
Play.sbx 2525
|
|
notes.txt 21
|
|
Apps <dir>
|
|
hi.script 121
|
|
bad.script 45
|
|
plain.script 24
|
|
cross.script 280
|
|
nonl.script 38
|
|
outer.script 376
|
|
inner.script 44
|
|
loop.script 35
|
|
30 files, 1 directory
|
|
> exit
|
|
halted
|
|
Execution halted.
|
|
[exit 0]
|