General

RAM

HIRAM - 56KB of RAM at 7e:2000
EXRAM - 64KB of RAM at 7f:0000

PPU Display Control

PPU Display Control Registers

INIDISP                 = $2100   ;Display Control 1
SETINI                  = $2133   ;Display Control 2

inidisp()

Encode value for INIDISP

Parameters

:in:    blanking    Screen blanking       bool (1 = screen blanking, 0 = screen on)
:in:    brightness  Screen brightness     0-15

PPU Data Ports

PPU Data Port Registers

VMAINC                  = $2115   ;VRAM Address Increment Mode
VMADDL                  = $2116   ;VRAM Address (LSB)
VMADDH                  = $2117   ;VRAM Address (MSB)
VMDATAL                 = $2118   ;VRAM Data Write (LSB)
VMDATAH                 = $2119   ;VRAM Data Write (MSB)
VMDATALREAD             = $2139   ;PPU1 VRAM Data Read (LSB)
VMDATAHREAD             = $213a   ;PPU1 VRAM Data Read (MSB)

OAMADDL                 = $2102   ;OAM Address (LSB)
OAMADDH                 = $2103   ;OAM Address (MSB) + Priority Rotation
OAMDATA                 = $2104   ;OAM Data Write (WRx2)
OAMDATAREAD             = $2138   ;PPU1 OAM Data Read

CGADD                   = $2121   ;CGRAM Address
CGDATA                  = $2122   ;CGRAM Data Write (WRx2)
CGDATAREAD              = $213b   ;PPU2 CGRAM Data Read (WRx2)

rgb()

Encode RGB values to SNES color word

Parameters

:in:    r           Red                   0-15
:in:    g           Green                 0-15
:in:    b           Blue                  0-15

BG & OBJ Control

BG & OBJ Control Registers

OBJSEL                  = $2101   ;Object Size + Object Base
BGMODE                  = $2105   ;BG Mode + BG Character Size

BG1SC                   = $2107   ;BG1 Screen Base + Screen Size
BG2SC                   = $2108   ;BG2 Screen Base + Screen Size
BG3SC                   = $2109   ;BG3 Screen Base + Screen Size
BG4SC                   = $210a   ;BG4 Screen Base + Screen Size

BG12NBA                 = $210b   ;BG1/2 Character Data Area Designation
BG34NBA                 = $210c   ;BG3/4 Character Data Area Designation

BG1HOFS                 = $210d   ;BG1 Horizontal Scroll (WRx2)
BG1VOFS                 = $210e   ;BG1 Vertical Scroll (WRx2)
BG2HOFS                 = $210f   ;BG2 Horizontal Scroll (WRx2)
BG2VOFS                 = $2110   ;BG2 Vertical Scroll (WRx2)
BG3HOFS                 = $2111   ;BG3 Horizontal Scroll (WRx2)
BG3VOFS                 = $2112   ;BG3 Vertical Scroll (WRx2)
BG4HOFS                 = $2113   ;BG4 Horizontal Scroll (WRx2)
BG4VOFS                 = $2114   ;BG4 Vertical Scroll (WRx2)

MOSAIC                  = $2106   ;Mosaic Size + Mosaic Enable
M7SEL                   = $211a   ;Rotation/Scaling Mode Settings
M7HOFS                  = BG1HOFS ;Horizontal Scroll (WRx2)
M7VOFS                  = BG1VOFS ;Vertical Scroll (WRx2)
M7A                     = $211b   ;Rotation/Scaling Parameter A (WRx2)
M7B                     = $211c   ;Rotation/Scaling Parameter B (WRx2)
M7C                     = $211d   ;Rotation/Scaling Parameter C (WRx2)
M7D                     = $211e   ;Rotation/Scaling Parameter D (WRx2)
M7X                     = $211f   ;Rotation/Scaling Center Coordinate X (WRx2)
M7Y                     = $2120   ;Rotation/Scaling Center Coordinate Y (WRx2)

objsel()

Encode value for OBJSEL

Parameters

:in:    base        VRAM Base Address     uint16 (truncated to 8K word alignment)
:in:    size        OBJ Size              OBJ_8x8_16x16   / OBJ_8x8_32x32   / OBJ_8x8_64x64 /
                                          OBJ_16x16_32x32 / OBJ_16x16_64x64 / OBJ_32x32_64x64
:in:    gap         Gap between OBJ sets  uint16 (truncated to 4K word alignment)

bgmode()

Encode value for BGMODE

Parameters

:in:    mode        Mode                  0-7
:in:    bg3_prio    BG3 Priority          bool (0 = normal, 1 = high)
:in:    bg1sz       BG1 Size              BG_SIZE_8X8 / BG_SIZE_16X16
:in:    bg2sz       BG2 Size              BG_SIZE_8X8 / BG_SIZE_16X16
:in:    bg3sz       BG3 Size              BG_SIZE_8X8 / BG_SIZE_16X16
:in:    bg4sz       BG4 Size              BG_SIZE_8X8 / BG_SIZE_16X16

bgsc()

Encode value for BGnSC

Parameters

:in:    base        VRAM Base Address     uint16 (truncated to 1K word alignment)
:in:    size        BG Size               SC_SIZE_32X32 / SC_SIZE_64X32 / SC_SIZE_32X64 / SC_SIZE_64X64

bgnba()

Encode value for BG12NBA+BG34NBA

Parameters

:in:    bg1         BG1 Character Area    uint16 (truncated to 4K word alignment)
:in:    bg2         BG2 Character Area    uint16 (truncated to 4K word alignment)
:in:    bg3         BG3 Character Area    uint16 (truncated to 4K word alignment)
:in:    bg4         BG4 Character Area    uint16 (truncated to 4K word alignment)

bg12nba()

Encode value for BG12NBA

Parameters

:in:    bg1         BG1 Character Area    uint16 (truncated to 4K word alignment)
:in:    bg2         BG2 Character Area    uint16 (truncated to 4K word alignment)

bg34nba()

Encode value for BG34NBA

Parameters

:in:    bg3         BG3 Character Area    uint16 (truncated to 4K word alignment)
:in:    bg4         BG4 Character Area    uint16 (truncated to 4K word alignment)

Window Mask

Window Mask Registers

W12SEL                  = $2123   ;Window Mask Settings (BG1/2)
W34SEL                  = $2124   ;Window Mask Settings (BG3/4)
WOBJSEL                 = $2125   ;Window Mask Settings (OBJ/COLOR)

WH0                     = $2126   ;Window 1 Left Position
WH1                     = $2127   ;Window 1 Right Position
WH2                     = $2128   ;Window 2 Left Position
WH3                     = $2129   ;Window 2 Right Position

WBGLOG                  = $212a   ;Window 1/2 Mask Logic Settings (BG1-4)
WOBJLOG                 = $212b   ;Window 1/2 Mask Logic Settings (OBJ/MATH)

Screen Designation

Screen Designation Registers

TM                      = $212c   ;Main Screen Designation
TS                      = $212d   ;Sub Screen Designation
TMW                     = $212e   ;Window Mask Designation for Main Screen
TSW                     = $212f   ;Window Mask Designation for Sub Screen

tm()

Encode value for TM/TS/TMW/TSW

Parameters

:in:    bg1         BG1 Enable            bool
:in:    bg2         BG2 Enable            bool
:in:    bg3         BG3 Enable            bool
:in:    bg4         BG4 Enable            bool
:in:    obj         OBJ Enable            bool

Color Math

Color Math Registers

CGSWSEL                 = $2130   ;Initial settings for fixed color/screen addition
CGADSUB                 = $2131   ;Addition/Subtraction Designation
COLDATA                 = $2132   ;Fixed Color Data

MMIO Math

MMIO Math Registers

MPYL                    = $2134   ;PPU1 Signed Multiply Result (lower 8-bit)
MPYM                    = $2135   ;PPU1 Signed Multiply Result (middle 8-bit)
MPYH                    = $2136   ;PPU1 Signed Multiply Result (upper 8-bit)

WRMPYM7A                = M7A     ;PPU1 Signed 16-bit Multiplicand
WRMPYM7B                = M7B     ;PPU1 Signed 8-bit Multiplier

RDDIVL                  = $4214   ;Unsigned Division Result (Quotient) (LSB)
RDDIVH                  = $4215   ;Unsigned Division Result (Quotient) (MSB)
RDMPYL                  = $4216   ;Unsigned Division Remainder / Multiply Product (LSB)
RDMPYH                  = $4217   ;Unsigned Division Remainder / Multiply Product (MSB)

WRMPYA                  = $4202   ;Unsigned 8-bit Multiplicand
WRMPYB                  = $4203   ;Unsigned 8-bit Multiplier
WRDIVL                  = $4204   ;Unsigned 16-bit Dividend (LSB)
WRDIVH                  = $4205   ;Unsigned 16-bit Dividend (MSB)
WRDIVB                  = $4206   ;Unsigned 8-bit Divisor

APU & WRAM Data Ports

APU & WRAM Data Port Registers

APUIO0                  = $2140   ;Sound CPU Communication Port 0
APUIO1                  = $2141   ;Sound CPU Communication Port 1
APUIO2                  = $2142   ;Sound CPU Communication Port 2
APUIO3                  = $2143   ;Sound CPU Communication Port 4

SMPIO0                  = APUIO0  ;Aliases for APUIO
SMPIO1                  = APUIO1
SMPIO2                  = APUIO2
SMPIO3                  = APUIO3

WMDATA                  = $2180   ;WRAM Data Read/Write
WMADDL                  = $2181   ;WRAM Address (lower 8-bit)
WMADDM                  = $2182   ;WRAM Address (middle 8-bit)
WMADDH                  = $2183   ;WRAM Address (upper 1-bit)

Joypad

Joypad Registers

JOYFCL                  = $4016   ;Joypad Input Register (LSB)
JOYFCH                  = $4017   ;Joypad Input Register (MSB)
JOYWR                   = $4016   ;Joypad Output (W)
JOYA                    = $4016   ;Joypad Input Register A (R)
JOYB                    = $4017   ;Joypad Input Register B (R)

WRIO                    = $4201   ;Joypad Programmable I/O Port
RDIO                    = $4213   ;Joypad Programmable I/O Port

JOY1L                   = $4218   ;Joypad 1 (LSB)
JOY1H                   = $4219   ;Joypad 1 (MSB)
JOY2L                   = $421a   ;Joypad 2 (LSB)
JOY2H                   = $421b   ;Joypad 2 (MSB)
JOY3L                   = $421c   ;Joypad 3 (LSB)
JOY3H                   = $421d   ;Joypad 3 (MSB)
JOY4L                   = $421e   ;Joypad 4 (LSB)
JOY4H                   = $421f   ;Joypad 4 (MSB)

Interrupt & Status

Interrupt & Status Registers

NMITIMEN                = $4200   ;Interrupt Enable / Joypad Request

HTIMEL                  = $4207   ;H-Count Timer Setting (LSB)
HTIMEH                  = $4208   ;H-Count Timer Setting (MSB)
VTIMEL                  = $4209   ;V-Count Timer Setting (LSB)
VTIMEH                  = $420a   ;V-Count Timer Setting (MSB)

MEMSEL                  = $420d   ;Access Cycle Designation

RDNMI                   = $4210   ;V-Blank NMI Flag / CPU Version Number
TIMEUP                  = $4211   ;H/V-Timer IRQ Flag
HVBJOY                  = $4212   ;H/V-Blank Flag / Joypad Busy Flag

SLHV                    = $2137   ;PPU1 Latch H/V-Counter
OPHCT                   = $213c   ;PPU2 Horizontal Counter Latch (read-twice)
OPVCT                   = $213d   ;PPU2 Vertical Counter Latch (read-twice)

STAT77                  = $213e   ;PPU1 Status/Version
STAT78                  = $213f   ;PPU2 Status/Version

DMA

DMA Registers

MDMAEN                  = $420b   ;General Purpose DMA Channel Designation & Trigger
HDMAEN                  = $420c   ;H-DMA Channel Designation

DMA Control (channel n = 0-7)
DMAPn                   = $43n0   ;DMA Parameters
BBADn                   = $43n1   ;DMA I/O-Bus Address (B-Bus)
A1TnL                   = $43n2   ;HDMA Table Start Address / DMA Current Address (LSB)
A1TnH                   = $43n3   ;HDMA Table Start Address / DMA Current Address (MSB)
A1Bn                    = $43n4   ;HDMA Table Start Address / DMA Current Address (BANK)
DASnL                   = $43n5   ;Indirect HDMA Address / DMA Byte-Counter (LSB)
DASnH                   = $43n6   ;Indirect HDMA Address / DMA Byte-Counter (MSB)
DASBn                   = $43n7   ;Indirect HDMA Address (BANK)
A2AnL                   = $43n8   ;HDMA Table Current Address (LSB)
A2AnH                   = $43n9   ;HDMA Table Current Address (MSB)
NTRLn                   = $43na   ;HDMA Line-Counter