How it works · write-up
Main command queue
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.
The shared queue is gameplay state. Both playlab.html and runtime lab presets
advance it through FirstSectionGame. The lab supplies initial state and
inputs; it has no alternative queue or collision step.
main-command-queue.ts translates $0038/$8007: append D/E pairs to the
64-byte ring, consume the next pair, clear both bytes to $FF, wrap the
pointers and retain $ED84/$ED85. The original producer has no full-ring
guard. The TypeScript state stores pointer offsets within the physical ring.
video-commands.ts uses named MainCommandId handlers for all fifteen
selectors in the raw $8029 table. $00/$01 print/erase extracted text;
$02/$03/$05 draw/update scores; $04 draws credits; $07/$08 draw
high-score/title output; $09/$0A/$0B/$0D/$0E handle clear and HUD work.
$0D includes $811D's fallthrough into the grenade display. Drawing
modifies persistent foreground RAM, preserving cells the ROM does not write.
Two selectors delegate domain work. $06 runs the macro, collision and
background-ring writer in background-commands.ts. $0C checks player
shots against core enemies through queued-core-shot-contact.ts. $AE95
queues the latter on even ticks; odd ticks run player body/enemy-shot contact.
Enemies hit earlier in one transaction are unavailable to later shots.
Both adapters use the same unsigned rectangle rule. Sprite-free actor state
and replacement bindings continue to be owned by the gameplay model.
restart-commands.ts preserves the distinct setup and ready HUD command
orders and the $07A9 wait/blink requests. $0609 clears only the visible
foreground rectangle; outside rows and the score HUD survive game over.
tools/extract_video_commands.py reads supplied ROM data into ignored
assets/arcade/video_commands.json. Regenerate it with
python -m tools.extract_video_commands. The tables and captures stay out of
Git. Tests use native BCD fixtures, explicit byte expectations and controlled
MAME transactions; a stored BCD unit is ten displayed points.
The current host drains commands atomically after each modeled update. MAME can interrupt a consumer with another IRQ. Those captured transactions remain an explicit scheduling obligation (backlog 92), rather than being certified by the uninterrupted byte comparisons. Full producer/RAM order, sprite writes, start/attract flow and transition rebuild scheduling remain in items 67/88/90.
The source-boundary cursor in NATIVE_QUEUED_CONTACT.md now verifies all1109 core-contact transactions, including3 actual IRQ suspensions and8 controlled cached-operand cases. The model adapter uses that same pass. Ordinary host scheduling is still synchronous; four BG/two foreground interruptions and live pending-consumer timing retain92.