Sailor Moon S · Jougai Rantou!? · SFC

One frame, as the cartridge runs it

The in-match loop lives at $C0:E255. It waits for the NMI, runs nineteen calls, and branches back — and every question this project keeps asking (why a hit lands a frame late, where a patch attaches, what runs in Practice) is a question about that list. Everything below was disassembled out of the clean ROM, not assumed from how such engines usually work.

The frame

MAIN LOOP · $C0:E255 · one pass = one frameNMI · $C0:D4C9wait for vblankspins on DP $6C until the NMI sets it — the frame gateJSL $80:8386at $E25Cpause / startreads $1E04, +0x76 and the fresh joy1 edgesJSR $C0:E071at $E260input + camera snapshotcopies $A3/$A5 aside, indexes on joy1 held ($5C)JSR $C0:9633at $E263apply reactionsthe code left on +0x47 LAST frame becomes an actJSL $C1:0E26at $E266animation scriptsduration into +0x06, pose into +0x05JSL $80:A05Cat $E26Aposes to boxesclass +0x18, box indices +0x40/41/42 ($C0:9CCD)JSL $80:9C96at $E26Eeffect poolthe $1200 object slotsJSL $C1:2584at $E272projectile poolthe $1100/$1180 slotsJSL $C1:16EEat $E276object updatejsr ($00A6,X) by id — hits are detected in hereJSL $C1:0000at $E27Aresolve celsthe ROM address and size the DMA will streamJSL $80:9FB8at $E27Eworld to screen+0x21 - camera $0A00 + 0x2C -> +0x28JSR $C0:8BCBat $E282build draw orderthe live object slots, listed at $0B00JSR $C0:9CE2at $E285emit spritessprite records -> the OAM shadow $7E:0200JSL $80:9A0Eat $E288HUD producerstaging $0806-$0815 — never runs in PracticeJSR $C0:D5E8at $E28Cround statereads $1E3D, sets $71/$1E04JSR $C0:DB35at $E28Fstage scroll`ldx $8E / jmp ($B32B,X)` — one scroll routine per stageJSR $C0:B321at $E292unidentifiedreads flag $B1 bit 1JSR $C0:8CAFat $E295advance the RNGstirs DP $90 — the byte the misfire roll readsJSR $C0:8BF9at $E298bra $E255 — the next framequeued transfers$8448OAM + CGRAM -> the PPU$9EF5unidentified$8C4DHUD uploader -> VRAM$D56Funidentified$B3D7read the pads$8353sets DP $6C
One frame. The loop does not poll a timer: it spins in $80:8386 until the NMI writes DP $6C, then runs its stages in this order and branches back. The pad read at the bottom of the NMI leaves the held state in $5C-$5F and the press edges in $60/$62. Every address is the instruction's own site, so a stage that moves fails --check.

Reading it as assembly

Three things in the listing below read oddly if you know 65816 but not this cartridge. JSL is a long call and jsr a same-bank one, which is why a hook that replaces a jsr has three bytes to work with and one replacing a jsl has four. The $80 and $C0 banks are the same ROM — $80:A05C and $C0:A05C are one routine, and the game executes from the fast mirror. And dispatch is a table: jsr ($00A6,X) is how one line of code becomes twenty-eight different characters.

$C0:E255sep #$30the loop head — where the back-edge lands
$C0:E257lda $1E05 / bmi $E29Dthe exit test: a negative $1E05 means the round is over
$C0:E25Cjsl $80:8386wait for vblank — everything below is one frame's work
......
$C0:E27Ajsl $C1:0000the object update. JSL because it crosses banks; the callee ends in RTL
......
$C0:E29Bbra $E255two bytes, and the frame starts again

Phases share the list

ENTRANCE $C0:E21AROUND $C0:E255wait for vblank$8386pause / start$E071added by the roundinput + camera snapshot$9633added by the roundapply reactions$0E26added by the roundanimation scripts$A05Cposes to boxes$9C96effect pool$2584added by the roundprojectile pool$16EEadded by the roundobject update$0000resolve cels$9FB8world to screen$8BCBbuild draw order$9CE2emit sprites$9A0EHUD producer$D5E8added by the roundround state$DB35added by the roundstage scroll$B321unidentified$8CAFadded by the roundadvance the RNG$8BF9
Six phase loops, one stage list. The engine has a loop per match phase ($C0:E21A, E255, E2E2, E30F, E41E, E8D3). They call the same routines in the same order; what a phase does not do is what it leaves out. The entrance animates and draws — it just never fights. (It also runs two stages of its own, $C0:877C and $C0:D99E, which the round loop has no use for.)

Where a hit happens

object updatestage 9 of the frame$C1:0000proc dispatchjsr ($00A6,X) by object id$C1:0080the character's procUranus, 5040 bytes$C1:79F2hit resolution192 call sites, all bank $C1$80:BFBBpending codewritten on the VICTIM+0x47apply reactionsstage 4 — NEXT frame$C1:0E26JSLwritesone frame later
Nothing in the frame list checks a hitbox. Detection lives in the attacker's own proc — JSL $80:BFBB, 192 sites, every one of them in bank $C1 — and it leaves a code on the victim's +0x47. The loop's fourth stage turns that into an act on the FOLLOWING pass, which is the whole reason this engine's timing reads one frame late and why a move announced only on its first active frame loses the guard race.

Where the patches attach

wait for vblank$80:8386stage 1patch 11rides the joy_read chainpatch 12the next link in that chainposes to boxes$80:9C96stage 6patch 6overrides the hurtbox indexpatch 7one box-height byteobject update$C1:0000stage 9patch 1gates the 2HP dash cancelpatch 2clears the stale invuln flagpatch 5the dash's X-speed operandpatch 8one byte of the hold scriptpatch 9the fireball's boxpatch 13the eight damage-apply sitespatch 14the 7-byte tails of two of thempatch 1bthe same gate, one frame tighterHUD producer$C0:D5E8stage 14patch 10producer here, uploader in the NMIpatch 10bthe same pair, plus glyphs
Every hook, on the stage it changes. Patches 11 and 12 ride the pad read the NMI performs before the loop wakes; 10 and 10b bracket the HUD, producer on this side and uploader on the NMI's; 6 and 7 change what the pose writer puts in +0x40/41; everything else lives inside the object update, because that is where a character's own code runs. The offsets come from the edit-region map, which checkpatchmap.py re-derives from the shipped patches.
HONEST GAPS

Three stages are drawn in grey because they are not identified: $C0:9633 (copies $A3/$A5 aside and indexes on the held pad), $C0:DB35 (reads $1E3D, writes $71/$1E04) and $C0:8CAF (reads flag $B1). Naming them would make a nicer diagram and a worse document.

Glossary

Two vocabularies meet on this page, and nobody arrives with both.

The console

NMI
the interrupt the PPU raises once per frame, at the start of vblank. Here it is the whole reason the loop advances: it writes DP $6C and the loop is spinning on that byte
vblank
the gap between drawing the last scanline and the first of the next frame — the only safe window to write video memory
DMA
the chip that copies a block without the CPU. Sprites, palettes and the HUD all reach the PPU this way, which is why they are written to shadow copies in RAM first
OAM
the 544 bytes the PPU reads to know where every sprite is. This game keeps a shadow at $7E:0200 and sends the whole thing every frame
CGRAM / VRAM / WRAM
the palette memory, the video memory and the console's 128 KB of work RAM
DP (direct page)
a movable 256-byte window the CPU can address in one byte instead of two — this engine parks its per-frame flags there ($6C, $88, $90)
bank
a 64 KB slice of the 24-bit address space. $C1:0000 means offset $0000 in bank $C1
FastROM mirror
the same cartridge visible again at banks $80-$BF, where the console reads it a third faster. $80:A05C and $C0:A05C are one routine, which is why a breakpoint on the wrong one never fires
jsr / JSL / RTL
call within a bank, call across banks, and the return that matches the long one. A jsr operand is two bytes and a JSL three — which decides how much room a hook has
jsr ($00A6,X)
an indirect call: the address is looked up in a table at $00A6. One instruction, twenty-eight different characters
hook / stub
how every patch here works — overwrite a call with one to your own code (the stub), do the extra work, then do what the original instruction did and return

The engine

object
anything the update loop drives: the two fighters, projectiles, effects. All of them are 128-byte structs with the same layout
act
the object's current state number, at +0x01 — walking, 2LP's startup, hitstun. Everything else follows from it
pose
one drawn frame, at +0x05. The act's script picks poses; a pose record picks the boxes and the sprite list
hitbox / hurtbox
the rectangle that hits and the rectangle that can be hit, chosen per pose by the indices at +0x40/41. Invulnerable means hurtbox index 0 — an empty box, not a flag
hitstun / blockstun
the frames a defender cannot act after being hit, or after blocking. The difference between them is most of what makes a combo a combo
guard cancel (GC)
cancelling blockstun directly into a special. This game's defining mechanic, and why the reaction stage runs where it does
meaty
an attack timed so it becomes active exactly as the defender leaves stun. At one frame of margin it cannot be blocked on reaction — the Uranus infinite is built on this
proc block
one character's own code, ~4-5 KB of it, reached through the dispatch table. Uranus's is $C1:79F2

Generated by tools/mkenginepage.py from the clean ROM bc0e29ee…. --check re-reads every instruction drawn here and fails if one moved. Companion page: the data architecture.