CPU_PPU.i

Summary
CPU_PPU.i
Macros
HDMA_set_absoluteSet up absolute mode HDMA
HDMA_set_indirectSet up indirect mode HDMA
CGRAM_setcolorSet color at index with a 15 bit “packed” color
CGRAM_setcolor_rgbSet color at index with a constant RGB triplet
OAM_initInitialize shadow OAM table in RAM
OAM_memcpyCopies shadow OAM table (512+32 bytes) to the PPU
WAIT_vblWait furiously until next vertical blanking period
WAIT_framesWait for #num vertical blanking periods
PPU_is_ntscCheck if system is NTSC

Macros

HDMA_set_absolute

Set up absolute mode HDMA

Parameters

:in:    ch        Channel (0-7)                 constant
:in:    mode      Mode (0-7)                    constant
:in:    dest      Destination register (uint8)  constant
:in:    table     Table location (uint24)       constant

HDMA_set_indirect

Set up indirect mode HDMA

Parameters

:in:    ch        Channel (0-7)                 constant
:in:    mode      Mode (0-7)                    constant
:in:    dest      Destination register (uint8)  constant
:in:    a1_table  A1 Table location (uint24)    constant
:in:    a2_table  A2 Table location (uint24)    constant

CGRAM_setcolor

Set color at index with a 15 bit “packed” color

Parameters

:in:    index     CGRAM index (uint8)           a
                                                constant
:in:    color     Color (uint16)                x/y         0x0bbbbbgggggrrrrr
                                                constant

CGRAM_setcolor_rgb

Set color at index with a constant RGB triplet

Parameters

:in:    index     CGRAM index (uint8)           a
                                                constant
:in:    r         Red component (uint8)         constant    5 significant bits
:in:    g         Green component (uint8)       constant    5 significant bits
:in:    b         Blue component (uint8)        constant    5 significant bits

OAM_init

Initialize shadow OAM table in RAM

Parameters

:in:    table     Table address (uint24)        constant
:in:    xpos      X position (9 bits)           constant
:in:    ypos      Y position (8 bits)           constant
:in:    size      Size bit                      constant

OAM_memcpy

Copies shadow OAM table (512+32 bytes) to the PPU

Disables DMA and uses channel 7 for transfer.

Parameters

:in:    table     Table address (uint24)        constant

WAIT_vbl

Wait furiously until next vertical blanking period

WAIT_frames

Wait for #num vertical blanking periods

Parameters

:in:    num       Number of frames (uint16)     constant

PPU_is_ntsc

Check if system is NTSC

Returns

a = 0 / z = 1 if system passes as NTSC
a = 1 / z = 0 otherwise