Rework the megademo for the 80-column line limit #35
Reference in New Issue
Block a user
Delete Branch "fix/megademo-80col"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Unbreaks
examples/megademounder this branch'sAKBASIC_MAX_LINE_LENGTHcut from 256 to 80, per the caveat in #33's description and the corpus impact tracked in #32. Seventeen lines were over the limit: the sixteenIM$()picture strings (up to 252 characters) and the two four-barPLAYstrings inTUNEA/TUNEB. Nothing else in the file was over — but see the finding below about what "80" actually means.The picture: regenerate at a record-aware 64-character chunk
No decoder changes.
DRAWSTREAMalready carries itsX#/Y#cursor from oneIM$entry to the next, and theVA#/VB#frame tables already describe multi-entry frames, so the fix is entirely invaporwave.py:PAYLOAD240 → 64, so every emittedIM$(NN) = "..."line fits the ceiling with margin.chop()now walks the stream a record at a time — two characters for a run, three for anRrow record — and never cuts inside one. The decoder reads a record's tail withMIDon the string it is walking; a record straddling two entries decodes as garbage. The old blind slice at 240 was only safe by luck: nothing checked it, becauseverify()simulated the unchopped blobs.verify()now simulates the chopped strings, threading the cursor across boundaries exactly the wayDRAWSTREAMexecutes them, so a bad cut is an assertion failure instead of a corrupted screen.emit_block()also asserts every emitted line fits.The regenerated block is 56 strings where it was 16 (same 3,370 encoded bytes), and re-running
--spliceis idempotent.The music: one
PLAYper barTUNEAandTUNEBeach become fourPLAYstatements, one bar apiece.play.ckeeps voice, envelope, level and duration state on the runtime across statements, and everyPLAYappends to the same queue — four bars queue exactly as the one long string did. Each bar restates theV1T3U9Sprefix so a bar dropped byQFULLcannot leave the next batch playing on the drum kit's envelope.Findings along the way
char code[80]and the newstdio_readline()guard refuses a read that consumes 79 characters without a newline, so content +\nmust fit in 79. Worth stating in the constant's comment if 80 was meant to be the content width — as it stands, an authentic 80-column Commodore line does not load. (The guard's error message, "exceeds the %zu character limit" withlen - 1= 79, is also one off from the real content ceiling.)DEF FN; batch size andPLAYqueue interplay unchanged.vaporwave.py --preview's reference. The test suite fails the identical seventeen cases with and without this commit (the fifteen from #32 plusdocs_examplesand one golden case that appear environmental here).examples/breakoutstill needs the same treatment; its longest line cleared the old 256 ceiling "by more than half" per the sink_stdio comment, and it shares the stroke-fontDATAidiom but not the string-picture machinery.🤖 Generated with Claude Code
https://claude.ai/code/session_01ACffnV6F7sxQuG3Y8a1L3s