dmnet.st Commando

How it works · write-up

Native projectile pass and player fire

docs/NATIVE_PROJECTILES.md · 4 KB · updated 2026-10-15

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-shots.ts translates the single physical $8E9A pass over fourteen32-byte records, starting atE200 and writing fourteen sprites fromFF48. Player and enemy models are projections of those retained records through shot-models.ts; the runtime no longer updates their physics in separate loops. The lab initializes the same runtime.

Covered contracts

  • Empty records preserve output. Warmup writes raw directional pairs and adjusts displayed X by the scroll byte; explosive warmup performs the source's second timer decrement.
  • Travel uses retained signed8.8 velocities and byte/word wrapping. Nonzero scroll decrements native X high once. Bounds clear state, native Y high and sprite Y while preserving other bytes.
  • Flags01 and80 control explosive and terrain-bypass paths. Six-count expiry, state3F, state07 and the seven-count tail retain the exact codes, attributes and coordinates.
  • $903F scans exactly eight scenery records using its own unsigned rectangle. $907B uses retained+$1F parity, decoded map pointers, mirror and raw shape masks. CategoriesC0+ return before shape testing.
  • Shared blasts are produced in physical slot order. The pass returns the actual CPU A, including $8717's incremented sound address low byte. Stored sound pointers wrapED60→ED40 while A remains60.
  • $936F-$93D9 allocates the first free player slot, writes+$1F, preserves fractions/untouched bytes, uses original byte heading for velocity, +7 rounding for the muzzle and emits sound03. No slot still consumes its fire request.
  • $9329/$9358 fire counters wrap as native bytes. The same queued-fire helper supplies the production allocator.

The renderer reads retained sprite bytes for projectiles and preserves their physical ordering. Compound blast output remains one replacement entity. Other actors' aliased output retains backlog99.

Complete comparisons

capture_mame_native_shots.lua supplies256 full pool/player/scenery/sprite/sound-ring pairs,3,584 individual record updates, exact returned A and native IX/IY endpoints. It covers normal/explosive flags, all state/phase paths, warmup and lifetime boundaries, scroll0/1/3/FF, fractions, wrapping, scenery, terrain/mirror/bypass/parity and multiple simultaneous blast/sound producers.

capture_mame_native_player_shot.lua supplies384 complete birth records across every heading byte, all six first-free slots, full pool and retained residue. capture_mame_shot_queue.lua supplies1,024 queue cases across every pending byte, qualified press, active/inactive player, both histories and0/1/FF/4 clocks.

The combined caller capture capture_mame_last_shot_latch.lua records3 updates with an active unrelated grenade and3 with an empty record. A final stationary shot returns90. $9262 initially stores90; active flight retains it and the following spawner consumes oldE09D/E09E. Empty entry92C7 explicitly writes zero before input guards and keeps the spawner active. This is a controlled wider-occupancy context, not a claim that slot7 is naturally allocated in the first section.

An independent opcode/flag observer records all86 conditional outcomes at43 sites in the projectile/player-fire ranges. Two matrix gaps required explicit witnesses for odd explosive art and unmirrored terrain. Counts are recorded per obligation; the test guards every outcome against native evidence. Range ownership is not substituted for this review.

Production regressions retain the selected first-screen, gate, restart and long-route MAME state comparisons. Setup-only HTTP presets expose expiry/tail, retained active-flight contact and empty-record clearing. State displaysE200 records andFF48 output bytes.

Remaining work

Enemy birth writers are verified under119/120; linked actor02 pre-flight contact is complete106.128 completes the8E93/9100/AE95 wrapper:1024 complete native transactions,52 outcomes and six actual-host/HTTP presets verify mixed landing counts, retained command parameters and body-before-shot priority. Complete remaining scripted callers, whole-frame output aliases99/102 and IRQ/main-consumer scheduling92 retain their independent reviews.