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
$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:E255 | sep #$30 | the loop head — where the back-edge lands |
| $C0:E257 | lda $1E05 / bmi $E29D | the exit test: a negative $1E05 means the round is over |
| $C0:E25C | jsl $80:8386 | wait for vblank — everything below is one frame's work |
| ... | ... | |
| $C0:E27A | jsl $C1:0000 | the object update. JSL because it crosses banks; the callee ends in RTL |
| ... | ... | |
| $C0:E29B | bra $E255 | two bytes, and the frame starts again |
Phases share the list
$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
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
+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.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:0000means 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:A05Cand$C0:A05Care 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
jsroperand is two bytes and aJSLthree — 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.