Stop the artwork breakout drawing its screen into two sprites

It captured the HUD strip into sprite 1 and the whole play field into sprite 2,
and its own header called them "the screen". That was never a choice: a drawing
lasted one frame, so a sprite was the only thing the interpreter would redraw for
nothing. Both slots are free now, and five things went with them.

**`WINDOW 0, 35, 49, 36` is the first executable line.** The text layer repaints
every row it owns and by default owns the whole window; moved to two rows at the
bottom, it leaves the other thirty-five to the drawing verbs, and what the
program draws stays.

**`PACE` is gone.** It spun on `TI#` until a batch boundary so an `SSHAPE`
capture would not be cut in half by a present. Nothing is captured, so a drawing
spanning two batches simply arrives over two frames and the layer keeps both
halves. The 256-line drawing deadline that shaped every draw routine in this
listing does not apply to it any more.

**The flattened live list is gone** -- `BUILDLIVE`, `BUILDROW`, `STAMPROW` and
the four arrays behind them. They existed so a full-field redraw could be one
stamp and an advance per brick, and a full-field redraw existed because removing
one brick meant rebuilding all sixty. A broken brick is now erased in place with
a blank stamp, so the field is drawn once per level and not again.

**`BALLBRICKS` and `TESTCELL` are gone** -- about sixty lines that turned the
ball's box into a range of candidate cells, walked them with a nested `DO`, and
computed an overlap rectangle to pick an axis. `SOLID` registers each brick as
the level is laid out, `COLLISION 2` fires, and `RCOLLISION` says which brick,
which way out, how far, and which axis to reverse.

**The `SSHAPE` pool accounting is gone.** `SHN#` counted slots because every
frame's capture spent another and `GRAPHIC 5` had to throw them all away
periodically; eight are now spent once and never again.

Three mistakes worth recording, because each was silent:

- **The bricks were registered and then immediately thrown away.**
  `GOSUB BUILDLIVE` sat *after* the fill loop in `SETUPLEVEL` and meant "rebuild
  the list of what is standing"; replaced in place by a bare `SOLID`, it meant
  "retire everything" and ran after all sixty had been registered. Nothing
  failed -- the ball simply passed through the wall.
- **The handler tested the wrong bits.** `BUMP` is a mask by *sprite*, and the
  balls are sprites 5, 6 and 7, so their bits are 16, 32 and 64. Testing 1, 2 and
  4 asked about the HUD and field sprites that no longer exist.
- **The eraser stamps were undeclared**, so `SSHAPE` filled them inside
  `DRAWPROTOS` and they were empty everywhere else -- exactly the scope trap
  chapter 17 Step 3 is about, found by printing the handle inside the routine and
  again outside it.

Verified by driving it: a copy with a tracking paddle and auto-relaunch breaks
thirteen bricks in sixty seconds with no error line, and the shipped listing runs
clean. Both suites green.

Chapter 18 still describes the architecture this commit removed; that is the rest
of section 6 item 39.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwxGB6TdoVvZ11KQQME9cL
This commit is contained in:
2026-08-02 12:58:08 -04:00
parent 8da8d717c8
commit 39d1d0c80c
2 changed files with 171 additions and 188 deletions

View File

@@ -2,11 +2,11 @@
Breakout, written entirely in BASIC for the AKGL BASIC interpreter, using downloaded CC0
sprite artwork for the paddles, the balls and the powerup gems. The bricks, the HUD and
the lettering are drawn, captured with `SSHAPE` and installed as sprites — because a
sprite is the one thing this interpreter puts on the screen for nothing. The text layer
owns every row of the window unless a program takes some back with `WINDOW`, and even
then a drawing has to be re-issued every frame; a sprite is drawn from state the
interpreter keeps.
the lettering are drawn`WINDOW` moves the text layer to two rows at the bottom, and
everything the program draws then stays on the screen without being redrawn or captured.
The bricks are also **collidable without being sprites**: `SOLID` registers a rectangle
the interpreter collides against, so sixty of them cost none of the eight slots.
```sh
../../../build-akgl/basic breakout.bas