dmnet.st Commando

How it works · write-up

Linked actors $01/$02

docs/NATIVE_LINKED_ACTORS.md · 4 KB · updated 2026-10-14

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.

Production uses native-linked-actors.ts against retained $E500 records. linked-actor-models.ts projects those records without advancing time. The three records remain components of compoundActor_01_02 for replacement art. Their physical object identity beyond this evidenced group is unresolved.

Complete bounded call path

$272F allocates through $2747 before $2A3E walks eight physical records. Accepted linked births therefore update in that same pass. $2792 writes placement coordinates, physical sprite pointer, kind, count and pool phase. $299C increments $E0BC for side $02; center $01 enters $29A0 without that increment. $29A0/$15B9/$6C64 decodes heading and cached velocity from raw ROM data. Unwritten record fields, including X fraction, are retained.

  • $1D10 subtracts one X high byte for any nonzero scroll pulse. Wait phase changes when X is below $A0. Moving records accept Y before X, with 16-bit wrap; either high byte at $F8+ releases the record and discards its caller.
  • $1D63 moves side $02, then $1D78 scans the six shots in physical order. Every state $FF qualifies, including expiry. Wrapped X difference must be below $10; biased Y difference must be below $11. First contact writes both states $3F and clears actor Y fraction. The active pose still draws.
  • $1CF4 increments $E055 only for an active center. Counter $E0BC=0 takes $1CEB, writing $3F/zero Y fraction without motion or drawing.
  • Death dispatch calls $3A8D before $2BC9/$2BF0. This scroll uses the different packed X word at offsets $04/$05, and may release the actor before its death handler runs.
  • Side first death decrements $E0BC, queues sound $14, then score event $08. Center first death queues event $08, then sound $19 via $86AC. Both change $3F→$3E without drawing. Later counts draw destruction poses until $01→$00, then hide sprite Y only.

$E0BC is retained RAM, not the number of active models. Hit-pending sides still contribute until first death. Offscreen removal has no decrement writer. The ordinary checkpoint restore path does not clear it; $07F3 clears it at the startup cinematic's explicit source point.

Physical output and contact handoff

First placements use sprite pointers $FE38, $FE40, $FE30. They alias the scenery output span. Production renders their final shared bytes once; model presentation keeps the semantic compound and component identities. Scenery may hide the old Y bytes before a first death that writes no pose. This differs from a gate context where those pixels can remain visible.

Linked contact occurs before $8E9A, so its shot $3F becomes $07 in the same frame. The adapter preserves the shot's original phase, timer, lifetime and sprite coordinates; its state countdown is separate from flight lifetime.

Verification

  • 512 complete actor-pass pairs: all eight retained actor records, six shot records, all 384 sprite bytes, counters, both queues/pointers and ordered effects. The matrix includes paused, inactive, active, pending/death states, motion exits, scroll/page/wrap guards and mixed physical linked occupants.
  • 256 complete allocation pairs: both real initializer entries, all free/full slot positions, varied coordinate/residue bytes and counter wrap.
  • 32 combined native actor-to-projectile pairs compare complete actor/shot records and both relevant physical sprite spans through the model adapter.
  • Independent opcode flag observers witness all 36 outcomes at 18 handler and shared-scroll conditional sites. Counts do not replace buffer checks.
  • Shared-runtime tests cover moving-shot contact before flight, active-expiry contact, three-update counter/score/sound collapse, no center-shot/grenade damage path, retained offscreen count and the natural exit seed.

Raw captures are ignored under captures/mame/native_linked/; reproducible fixture/observer scripts and tests are tracked. Four new HTTP lab presets were visually checked. Existing controlled collapse, center-shot, grenade, motion, single-shot and natural-exit presets now initialize production state. The older natural-route/pool-stall diagnostic harness still needs migration; it does not certify production behavior. Wider cross-kind aliases and the whole frame scheduler remain their separate backlog scopes.