dmnet.st Commando

How it works · write-up

Background video writer $A759-$A791

docs/NATIVE_BACKGROUND_VIDEO.md · 2 KB · updated 2026-10-16

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 command06 consumer expands four macro tiles, writes the collision ring, then copies64 tile/code pairs to the background ring. The writer uses four columns of16 cells, advances16 cells between columns, and selects/clears the color-plane bit for every cell. Clearing that bit before incrementing the next code destination matters at unaligned bank boundaries.

native-background-video.ts preserves held source values and split pointer loads/stores across explicit read/write boundaries. The existing production command calls this writer. This is not a CPU-cycle scheduler: the host still drains commands synchronously.

Verification: all10 captured background commands, including four actual IRQ interruptions, match full background, expansion/collision, settings and work records. Ten additional controlled pauses compare cached values and split pointer writes. Foreground07/09 comparisons also preserve the queue contents already emitted before their two captured interruptions. All nine captured interruptions restore the seven observed caller registers.

The HTTP background-video-wrap preset initializes destinationDBFE, then executes the ordinary shared command06. A single step visibly updates the terrain and leaves destinationD87E. Browser proof is stored locally at captures/background-video-wrap-browser.png; captures are not tracked.

Storage migration under109 is implemented for this subsystem: work fields, stage parameters, expansion/collision and output have explicit typed owners. The writer reads/writes dedicated tile buffers. Captured memory is converted only by tests/helpers/background-snapshot.ts. A runtime regression poisons the old D800/EF00/F000 locations and verifies they remain untouched, while the ordinary command still finishes atD87E. The migrated HTTP preset matches the checkpoint output. Host scheduling and unrelated producers remain open.

Complete instruction continuations (152)

The whole9F8B caller now shares exact source continuations for difficulty, macro expansion, collision metadata, video and stream reset.512 additional complete native calls/437 controlled changes/512 actual RST08 pauses match every instruction/time and full owned buffers/pointers. The previous four actual frame IRQ cases remain active. Normal execution still completes these cursors synchronously; live physical scheduling remains152/92. See the existing routine_9F8B review for source-proved9FA6 exclusion and retained-field details.