How it works · write-up
Queued player-shot/core contact — $AF28-$AF78
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.
native-queued-core-contact.ts owns the physical six-shot/eight-core scan.
The model adapter in queued-core-shot-contact.ts uses this same pass;
production has no separate array collision rule. The source entry queues on
even ticks through $AE95/$AF23; the scan itself has no parity guard.
The cursor contains its next source read/write boundary, physical slots,
cached state/coordinates and retained IY. begin, advance and finish
separate initialization, resumable work and synchronous completion. A plain
snapshot preserves all held operands. The states are source boundaries;
they do not pretend to be a cycle-accurate Z80 instruction interpreter.
Source reads shot state, then Y and X, then each enemy's state/X/Y. An IRQ
between reads preserves values already held in registers. Only $FF records
qualify; wrapped X bias/span is $04/$15, and Y bias/span is $07/$0F.
The first matching enemy receives $3F, the shot receives $01, and that
shot stops scanning. Subsequent shots read the updated enemy state. Fractions
and all other record bytes remain untouched. Final IX is $E2C0; IY retains
its last enemy position, including $E700 after an exhausted scan.
Native evidence
The command capture now records actual interrupted PC, seven caller registers
and complete before/after IRQ snapshots. All nine native command interruptions
restore those registers exactly. Three are command $0C: one interrupts at
$AF3A after shot state has been loaded; two interrupt dispatch at $0028 or
$0032 before the scan starts.
All 1,109 $0C transactions now compare complete six-shot/eight-core records,
including those three suspended transactions. The test injects captured IRQ
memory effects solely as isolated verification evidence; application code
never reads captures. It verifies the pre-suspension records as well as the
resumed output.
Eight additional controlled native cases alter memory at $AF3A/$AF40/$AF43/
$AF4C/$AF53/$AF5C/$AF65/$AF69. They prove that already-read state/coordinates
are retained and that an interruption between the two hit writes can change
the final record state. The TypeScript cursor is serialized/restored at each
pause before the full 448-byte record comparison.
Reproduce with tools/capture_mame_video_commands.lua and
tools/capture_mame_queued_contact_suspension.lua. Raw evidence is ignored
under captures/mame/; source tests and address-only cursor definitions are
tracked. The existing shared-runtime queue-contact lab preset uses this pass.
Exact instruction boundaries (152)
The same cursor now includes source setup atAF28, every arithmetic/branch/EXX step, live IX/IY writes and AF76 conditional return/AF77 backedge.512 additional actual native bodies compare every PC/T-state and complete owned regions;443 controlled changes verify cached operands and partial writes. Existing real-IRQ comparisons remain active. The scan stores named domain locals; it adds neither shared RAM nor a CPU register file.
Caller scheduling still required
Normal production currently completes each command synchronously. These comparisons complete the contact consumer and its resumable state, not the host's CPU-time scheduler. Scheduling a pending cursor across a live IRQ, four background interruptions and two foreground interruptions remains backlog92. A lab may initialize a real pending state; it must not invent a separate stepping loop or replay captured state as runtime behavior.