How it works · write-up
Shared scripted-actor scroll
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.
src/gameplay/scripted-actor-scroll.ts translates $3A8D-$3AB9 once.
Stationary $12/$14/$1A/$1B/$22 helpers use its word rule. A zero $E062
returns before touching coordinates or testing offscreen state. Any nonzero
value subtracts one from IX+$04/$05, including carry and wrap.
A zero high byte stays active. With nonzero high byte, a low byte at or above
$C0 stays active; below $C0 the routine clears state, discards its immediate
caller's return address and clears each sprite Y. Sprite count comes from
IX+$1A. Code, attribute and X bytes are retained, and IY advances by four for
each cleared slot. The zero DJNZ count represents256 iterations; ordinary
active actor class data has a nonzero count.
Caller structure matters. $22/$1A/$1B/$12 call it directly and skip the rest
of their handler on removal. $14 calls through $39E5, so it skips that
inner handler's phase update but continues its draw after the cleared block.
The gate-door native adapter uses the same clear/pointer contract.
native-piece-coordinates.ts applies wrapped Y and ninth-bit X to stationary
composite pieces. Raw actor words stay in the domain state, and signed X is
exposed separately in diagnostics. Replacement model anchors retain geometry.
$2732 copies the preceding $E0A4 request to $E0A5, clears the producer
field, then enters the actor loop. $20D7 requests the next pass's suppression
of $22. Both fields are captured separately in production state.
Verification:150 full helper comparisons include all32 actor bytes, all384
sprite bytes, IY and stack displacement.150 complete $22 handler comparisons
cover20 sprite writes, Y wrap, X pages, offscreen clear and retained suppressed
output.150 latch comparisons test the transfer before the pass. The HTTP lab
Actor bridgeOverlay_22 → shared scroll boundary and pool release uses
production stepping and shows retained $FFC0, then released $FFBF.
This verifies these contracts. The raw ASM has23 incoming calls/jumps to this helper. Other actor adapters and shared hardware sprite-buffer aliasing are tracked under backlog67/99; a handler comparison does not certify their mix.