How it works · write-up
Typed arcade sprite output
Working notes, rendered as they are: they were written while building the game, so expect ROM addresses, register names and references to source files that are not published.
Backlog111 is complete (2026-10-15).
Live representation
ArcadeCommandContext.spriteOutput owns96 distinct ArcadeSprite objects.
createArcadeSpriteTable() fixes the table length; readers receive an
ArcadeSprites span. No live byte array backs these records.
| Field | Meaning |
|---|---|
imageCode |
Complete image index $000-$3FF, including the image bank. |
palette |
ArcadePalette, one of four sprite palettes. |
flipX, flipY |
Native image flips. |
nativeX |
Complete signed pixel position, -256..255. |
nativeY |
Complete unsigned pixel position,0..255. |
retainedAttributeBit1 |
Preserved source attribute bit $02; not used for drawing. |
Both coordinates are whole pixels. X has nine source bits: its page/sign bit comes from the attribute. Y has eight bits. Neither is an8.8 gameplay coordinate. Portrait rotation remains the renderer's responsibility.
ArcadeSpriteSlot names source slot ownership with the original address in
each enum member. Slot indices count records, not bytes. A source placement's
sprite address is converted once with spriteSlotFromSourceAddress();
linked records retain firstSpriteSlot, with null before allocation.
Writers and retained output
Player, projectile, grenade/blast, scenery, linked actors, attract/start, name entry and template helpers all write named fields. Physical slot order, overlap and retained output are preserved:
setSpriteImageIndex()changes only the low image index, retaining the bank.applyRomSpriteStyle()interprets packed ROM input, including the X page.setSpriteXWithinPage()reproduces a source low-X write within that page.hideArcadeSprite()writes only Y; expiry does not erase the other fields.copyArcadeSpritesForward()copies values in source order without aliasing objects, including overlapping source/destination spans.- Composite template cursors return
nextSpriteSlot; native Y writes wrap to eight bits and writes outside the96 output slots are ignored.
ArcadeRenderer consumes records directly, walking slots95 through0. Bank3
does not draw. nativeSpritePieces() derives relative pieces for a semantic
entity without encoding its records. Each projectile selects exactly one
physical record; a retained neighboring record cannot become its extra piece.
This adapter remains replaceable by higher resolution art or model bindings;
the sprite table is presentation output, not the gameplay entity model.
MAME boundary
mame-sprite-snapshot.ts alone packs/unpacks the source four-byte layout:
image low byte, attribute, Y, X low byte. decodeMameSprites() imports384-byte
captures once; encodeMameSprites() exports typed spans for independent native
comparisons. Production play does not import this codec. Test snapshot helpers
assemble source address spaces only at the capture boundary.
The lab's MAME frame replay decodes its capture before calling the same renderer.
Existing setup-only throw, grenade/blast, projectile and compound-gate scenarios
exercise the migrated writers through FirstSectionGame.
Verification
All422 TypeScript and37 Python tests pass without skips. Existing complete-region MAME capture comparisons remain unchanged as independent byte expectations. New tests cover all256 attribute values,96 independent objects, signed X, retained partial writes, overlapping copies, the final slot, renderer ordering and the single-record projectile span.
The actual production renderer, run locally with Canvas and the decoded MAME
frame1600 buffers/atlases, matches all57,344 pixels of the existing224×256
MAME PNG. Runtime throw, landing/blast and compound gate images were inspected.
Generated proof images remain under ignored captures/typed-sprites-*.png.
The local HTTP site was available, but the browser controller rejected URL access under its policy. Visual verification used local Canvas rendering; browser UI interaction was not reverified in this change. No behavior-coverage status is promoted by this storage migration.