Topics

UTTORI ASM ยท IN DEVELOPMENT

Super FX architecture

Use super fx architecture in SNES projects, with syntax and behavior notes.

arch superfx selects the GSU encoder. The wiki's Super FX opcode matrix is a convenient hardware-level grid, while arch-superfx.asm is the byte-parity language tour.

arch superfx
org $008000

iwt r1,#$1234
move r2,r1
add #3
stw (r4)
bra .again
.again:
  nop

Super FX ALT variants are emitted automatically for mnemonics such as ADC, BIC, UMULT, STB, and LDB. Explicit ALT1, ALT2, and ALT3 remain available. Register constraints are checked-for example, jumps use R8 through R13, while increment/decrement top out at R14.

The disassembly API exports SuperFxDecoder, superFxOpcodeMatrix, superFxSpecifications, superFxFusedSpecifications, buildSuperFxCatalog(), and formatSuperFxInstruction(). The decoder fuses canonical ALT and WITH/TO/FROM selector sequences, retains explicit ambiguity when incoming state is unknown, and identifies direct and indirect R15 control transfers. SuperFxRomImage and analyzeSuperFxRom() keep GSU addresses in the distinct snes.superfx.rom address space while using the shared CFG, evidence, annotations, and target-override contracts. renderSuperFxRomSource() emits byte-exact native source and preserves unsafe tails as data.

One compatibility wrinkle deserves a spotlight. Hardware encodes short LMS/SMS addresses as a word index (address >> 1). Asar writes the raw low byte. The plugin defaults to hardware-correct behavior. Set asarSuperFxMoveShortAddress: true only when reproducing Asar bytes is the actual goal.