Last modified on 14 March 2010, at 23:28

Super NES Programming/Super FX tutorial

When/if this tutorial is finished, it will show how to use the Super FX chip, which is included in 8 released games, most notably Star Fox, Doom, and Yoshi's Island.

InternalsEdit

As the Super FX chip is a processor itself, programming for it is done with Super FX assembly language. The Super FX chip has 4 RAM banks of 64 Kb each, or a total of 256 kb (32 kilobytes) of RAM.

RegistersEdit

The Super FX chip has 16 general-purpose registers labeled R0 to R15. They are each 16 bits.

Register Address Description
R0 3000 default source/destination register
R1 3002 pixel plot X position register
R2 3004 pixel plot Y position register
R3 3006
R4 3008 lower 16 bit result of lmult
R5 300a
R6 300c multiplier for fmult and lmult
R7 300e fixed point texel X position for merge
R8 3010 fixed point texel Y position for merge
R9 3012
R10 3014
R11 3016 return address set by link
R12 3018 loop counter
R13 301a loop point address
R14 301c rom address for getb, getbh, getbl, getbs
R15 301e program counter

There are also plenty of other internal registers:

Name Address Description Size
SFR 3030 status flag register 16 bits
3032 unused
PRAMR 3033 Backup RAM register 8 bits
PBR 3034 program bank register 8 bits
3035 unused
ROMBR 3036 rom bank register 8 bits
CFGR 3037 control flags register 8 bits
SCBR 3038 screen base register 8 bits
CLSR 3039 clock speed register 8 bits
SCMR 303a screen mode register 8 bits
VCR 303b version code register (read only) 8 bits
RAMBR 303c ram bank register 8 bits
303d unused
CBR 303e cache base register 16 bits


SFR status flag register bits:

0 -
1 Z Zero flag
2 CY Carry flag
3 S Sign flag
4 OV Overflow flag
5 G Go flag (set to 1 when the GSU is running)
6 R Set to 1 when reading ROM using R14 address
7 -
8 ALT1 Mode set-up flag for the next instruction
9 ALT2 Mode set-up flag for the next instruction
10 IL Immediate lower 8-bit flag
11 IH Immediate higher 8-bit flag
12 B Set to 1 when the WITH instruction is executed
13 -
14 -
15 IRQ Set to 1 when GSU caused an interrupt. Set to 0 when read by 658c16

Super FX AssemblyEdit