Decompress a full-screen picture and six frames of video from strings
Some checks failed
akbasic CI Build / cmake_build (push) Failing after 3m23s
akbasic CI Build / sanitizers (push) Failing after 4m33s
akbasic CI Build / coverage (push) Failing after 3m45s
akbasic CI Build / akgl_build (push) Failing after 24s
akbasic CI Build / mutation_test (push) Failing after 3m30s

The megademo gains a scene: an 800x600 vaporwave sunset carried inside
the listing, then six looping delta frames of full motion video -- the
floor grid rolling forward and the sun's slices crawling, about 220
bytes a frame. DATA cannot carry an image (512 items, ~350 owned by the
stroke font), so the picture rides in RLE-encoded string literals
decoded with INSTR: 2 KB of base frame, 1.3 KB of video. Row records
jump the decoder between changed rows, an unreachable colour is the
skip, black draws so a delta can erase, and the rays are struck live
over every frame rather than encoded. The 63-byte bird gliding over it
is the one image DATA does have room for, via SPRSAV's type-in form.

examples/megademo/vaporwave.py composes the image in palette space,
dithers by row so the gradients band instead of shattering the RLE,
proves base-plus-deltas reproduces every frame against a simulation of
the decoder, and owns the generated block between the PICTURE markers.
TODO.md section 4 records the DATA ceiling and the wanted verb.

Co-Authored-By: Claude Code (Fable 5) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwxGB6TdoVvZ11KQQME9cL
This commit is contained in:
2026-08-02 16:26:56 -04:00
parent 6536658c92
commit 0d79a3f52c
4 changed files with 578 additions and 12 deletions

View File

@@ -8,14 +8,15 @@ megagreetz to starfort.
./build-akgl/basic examples/megademo/megademo.bas
```
Q or ESC quits. Six scenes: a title card, a Lissajous braid, a spinning wireframe
Q or ESC quits. Seven scenes: a title card, a Lissajous braid, a spinning wireframe
cube and octahedron — which drift together, ignite a pulsing origin point strobing
the next scene's colours, swallow the camera as the perspective scale outgrows the
window, and split that origin into the first two raster bars — then the raster
bars proper, the sprite bank going supernova — the letters fall into the middle, a
fireball throws them at the walls, and a black hole drags everything back into the
centre as the transition out — and a finale that composes all of it. A sawtooth
chiptune in A minor throughout, with a noise drum break, if a SID answers.
window, and split that origin into the first two raster bars — the raster bars
proper, a full-screen vaporwave sunset decompressed out of the listing itself, the
sprite bank going supernova — the letters fall into the middle, a fireball throws
them at the walls, and a black hole drags everything back into the centre as the
transition out — and a finale that composes all of it. A sawtooth chiptune in A
minor throughout, with a noise drum break, if a SID answers.
## What it leans on
@@ -44,6 +45,29 @@ This is a tour of the interpreter's edges, on purpose:
the window, which the silent clipping permits. The pulsing origin point strobes
through the bar ramp table because it *is* the next scene: it splits, rides the
Y axis to the band edges, and stretches into the first two raster bars in place.
- **The picture is strings, because `DATA` is a straw** — the pool is 512 items
and the font owns ~350, so the full-screen sunset rides in string literals:
160x120 cells, sixteen colours, run-length encoded two characters a run and
decoded with `INSTR` into 5x5 blocks — about 2 KB for the whole base frame.
`vaporwave.py` composes the image in palette space — dithered by *row*, not
pixel, so the gradients band like a CRT instead of shattering the RLE — and
owns the generated block between the `PICTURE-BEGIN`/`PICTURE-END` markers. Do
not hand-edit it; rerun the script. The bird gliding over it is the
counterpoint: a genuine 24x21 `SPRSAV` type-in sprite, 63 bytes, which is
everything `DATA` has room to say. The paint is the reveal, and the exit is a
stride-63 column dissolve — 63 is coprime to 160, so the walk hits every
column once and looks random while carrying no state.
- **And then the picture is video.** Six delta frames loop the floor grid toward
you and crawl the sun's slice pattern — full motion video, 1.3 KB total, about
220 bytes a frame. A delta re-encodes only the rows that changed: an `R`
record jumps the decoder's cursor (two base-36 digits of row), `Q` skips what
stayed, and black *draws*, which is how a moved grid line is erased. The rays
are not in the encoding at all; they are struck live over every frame, which
is the difference between a thirty-run grid row and a five-run one. The loop
is mathematically exact: line k sits at `B*(r^(k+t)-1)` so six frames advance
t by one and land the set on itself, and the slice period divides the frame
count. The generator simulates the decoder and asserts base-plus-deltas
reproduces every frame before it will emit a byte.
- **3D with no matrices** — the wireframe scene rotates fourteen pooled vertices
through two composed axis rotations and a perspective divide, all of it `SIN`,
`COS` and one division, with the float kept on the left of every product because