|
| #define | CGRAM_PALETTE ((u8 *)0x2122) |
| | Palette CGRAM Data Write (W) 1st Access: Lower 8 bits (even address) 2nd Access: Upper 7 bits (odd address) (upper 1bit = PPU2 open bus) Reads and Writes to EVEN and ODD byte-addresses work as follows: Write to EVEN address --> set Cgram_Lsb = Data ;memorize value Write to ODD address --> set WORD[addr-1] = Data*256 + Cgram_Lsb Read from ANY address --> return BYTE[addr].
|
| |
|
#define | CM_DIRCOLOR (1 << 0) |
| | Color Math Control Register A & B bits.
|
| |
|
#define | M7_HFLIP (1 << 0) |
| | Mode7 screen H-Flip (0=Normal, 1=Flipped) flip 256x256 "screen".
|
| |
|
#define | M7_OUTTILE (3 << 6) |
| | Outside 128x128 tile area is filled by Tile 00h.
|
| |
|
#define | M7_OUTTRANS (2 << 6) |
| | Outside 128x128 tile area is Transparent.
|
| |
|
#define | M7_VFLIP (1 << 1) |
| | Mode7 screen V-Flip (0=Normal, 1=Flipped) flip 256x256 "screen".
|
| |
|
#define | M7_WRAP (1 << 6) |
| | Mode7 Wrap within 128x128 tile area.
|
| |
|
#define | PPU_50HZ (1 << 4) |
| | Frame Rate (PPU2.Pin30) (0=NTSC/60Hz, 1=PAL/50Hz)
|
| |
|
#define | REG_CGADD (*(vuint8 *)0x2121) |
| | Palette CGRAM Address (Color Generator Memory) (W) Color index (0..255). This is a WORD-address (2-byte steps), allowing to access 256 words (512 bytes). Writing to this register resets the 1st/2nd access flipflop (for 2122h/213Bh) to 1st access.
|
| |
| #define | REG_CGADSUB (*(vuint8 *)0x2131) |
| | Color Math Control Register B (W) 7 Color Math Add/Subtract (0=Add; Main+Sub, 1=Subtract; Main-Sub) 6 Color Math "Div2" Half Result (0=No divide, 1=Divide result by 2) 5 Color Math when Main Screen = Backdrop (0=Off, 1=On) ;\ 4 Color Math when Main Screen = OBJ/Palette4..7 (0=Off, 1=On) ; OFF: Show.
|
| |
|
#define | REG_CGWSEL (*(vuint8 *)0x2130) |
| | Color Math Control Register A (W) 7-6 Force Main Screen Black (3=Always, 2=MathWindow, 1=NotMathWin, 0=Never) 5-4 Color Math Enable (0=Always, 1=MathWindow, 2=NotMathWin, 3=Never) 3-2 Not used 1 Sub Screen BG/OBJ Enable (0=No/Backdrop only, 1=Yes/Backdrop+BG+OBJ) 0 Direct Color (for 256-color BGs) (0=Use Palette, 1=Direct Color)
|
| |
|
#define | REG_COLDATA (*(vuint8 *)0x2132) |
| | Color Math Sub Screen Backdrop Color (W) This 8bit port allows to manipulate some (or all) bits of a 15bit RGB value. Examples: Black: write E0h (R,G,B=0), Cyan: write 20h (R=0) and DFh (G,B=1Fh). 7 Apply Blue (0=No change, 1=Apply Intensity as Blue) 6 Apply Green (0=No change, 1=Apply Intensity as Green) 5 Apply Red (0=No change, 1=Apply Intensity as Red) 4-0 Intensity (0..31)
|
| |
|
#define | REG_INIDISP (*(vuint8 *)0x2100) |
| | Display Control 1 (W) 7 Forced Blanking (0=Normal, 1=Screen Black) 6-4 Not used 3-0 Master Brightness (0=Screen Black, or N=1..15: Brightness*(N+1)/16) In Forced Blank, VRAM, OAM and CGRAM can be freely accessed (otherwise it's accessible only during Vblank). Even when in forced blank, the TV Set keeps receiving Vsync/Hsync signals (thus producing a stable black picture). And, the CPU keeps receiving Hblank/Vblank signals (so any enabled video NMIs, IRQs, HDMAs are kept generated). Forced blank doesn't apply immediately... so one must wait whatever (maybe a scanline) before VRAM can be freely accessed... or is it only vice-versa: disabling forced blank doesn't apply immediately/shows garbage pixels?
|
| |
|
#define | REG_M7A (*(vuint8 *)0x211B) |
| | Rotation/Scaling Parameter A (and Maths 16bit operand) (W)
|
| |
|
#define | REG_M7B (*(vuint8 *)0x211C) |
| | Rotation/Scaling Parameter B (and Maths 16bit operand) (W)
|
| |
|
#define | REG_M7C (*(vuint8 *)0x211D) |
| | Rotation/Scaling Parameter C (W)
|
| |
|
#define | REG_M7D (*(vuint8 *)0x211E) |
| | Rotation/Scaling Parameter D (W)
|
| |
|
#define | REG_M7HOFS (*(vuint8 *)0x210D) |
| | BG1 Horizontal Scroll (X) (W)
|
| |
|
#define | REG_M7SEL (*(vuint8 *)0x211A) |
| | Rotation/Scaling Mode Settings (W) 7-6 Screen Over (see below) 5-2 Not used 1 Screen V-Flip (0=Normal, 1=Flipped) ; flip 256x256 "screen" 0 Screen H-Flip (0=Normal, 1=Flipped) ; Screen Over (when exceeding the 128x128 tile BG Map size): 0=Wrap within 128x128 tile area 1=Wrap within 128x128 tile area (same as 0) 2=Outside 128x128 tile area is Transparent 3=Outside 128x128 tile area is filled by Tile 00h.
|
| |
|
#define | REG_M7VOFS (*(vuint8 *)0x210E) |
| | BG1 Vertical Scroll (Y) (W)
|
| |
|
#define | REG_M7X (*(vuint8 *)0x211F) |
| | Rotation/Scaling Center Coordinate X (W)
|
| |
|
#define | REG_M7Y (*(vuint8 *)0x2120) |
| | Rotation/Scaling Center Coordinate Y (W)
|
| |
|
#define | REG_MPYH (*(vuint8 *)0x2136) |
| | Signed Multiply Result (upper 8bit) (R)
|
| |
|
#define | REG_MPYL (*(vuint8 *)0x2134) |
| | Signed Multiply Result (lower 8bit) (R)
|
| |
|
#define | REG_MPYM (*(vuint8 *)0x2135) |
| | Signed Multiply Result (middle 8bit) (R)
|
| |
|
#define | REG_MPYMH (*(vuint16 *)0x2135) |
| | Signed Multiply Result (middle +upper 8bit) (R)
|
| |
|
#define | REG_STAT77 (*(vuint8 *)0x213E) |
| | PPU1 Status and Version Number (R) 7 OBJ Time overflow (0=Okay, 1=More than 8x34 OBJ pixels per scanline) 6 OBJ Range overflow (0=Okay, 1=More than 32 OBJs per scanline) 5 Master/Slave Mode (PPU1.Pin25) (0=Normal=Master) 4 Not used (PPU1 open bus) (same as last value read from PPU1) 3-0 PPU1 5C77 Version Number (only version 1 exists as far as I know) The overflow flags are cleared at end of V-Blank, but NOT during forced blank! The overflow flags are set (regardless of OBJ enable/disable in 212Ch), at following times: bit6 when V=OBJ.YLOC/H=OAM.INDEX*2, bit7 when V=OBJ.YLOC+1/H=0.
|
| |
|
#define | REG_STAT78 (*(vuint8 *)0x213F) |
| | PPU2 Status and Version Number (R) 7 Current Interlace-Frame (0=1st, 1=2nd Frame) 6 H/V-Counter/Lightgun/Joypad2.Pin6 Latch Flag (0=No, 1=New Data Latched) 5 Not used (PPU2 open bus) (same as last value read from PPU2) 4 Frame Rate (PPU2.Pin30) (0=NTSC/60Hz, 1=PAL/50Hz) 3-0 PPU2 5C78 Version Number (version 1..3 exist as far as I know)
|
| |
|
#define | REG_VMADDLH (*(vuint16 *)0x2116) |
| | VMADDL - VRAM Address (lower 8bit) (W) VMADDH - VRAM Address (upper 8bit) (W) VRAM Address for reading/writing. This is a WORD address (2-byte steps), the PPU could theoretically address up to 64K-words (128K-bytes), in practice, only 32K-words (64K-bytes) are installed in SNES consoles (VRAM address bit15 is not connected, so addresses 8000h-FFFFh are mirrors of 0-7FFFh). After reading/writing VRAM Data, the Word-address can be automatically incremented by 1,32,128 (depending on the Increment Mode in Port 2115h) (Note: the Address Translation feature is applied only "temporarily" upon memory accesses, it doesn't affect the value in Port 2116h-17h). Writing to 2116h/2117h does prefetch 16bit data from the new address (for later reading).
|
| |
| #define | REG_VMAIN (*(vuint8 *)0x2115) |
| | VRAM Address Increment Mode (W) 7 Increment VRAM Address after accessing High/Low byte (0=Low, 1=High) 6-4 Not used 3-2 Address Translation (0..3 = 0bit/None, 8bit, 9bit, 10bit) 1-0 Address Increment Step (0..3 = Increment Word-Address by 1,32,128,128) The address translation is intended for bitmap graphics (where one would have filled the BG Map by increasing Tile numbers), technically it does thrice left-rotate the lower 8, 9, or 10 bits of the Word-address: Translation Bitmap Type Port [2116h/17h] VRAM Word-Address 8bit rotate 4-color; 1 word/plane aaaaaaaaYYYxxxxx --> aaaaaaaaxxxxxYYY 9bit rotate 16-color; 2 words/plane aaaaaaaYYYxxxxxP --> aaaaaaaxxxxxPYYY 10bit rotate 256-color; 4 words/plane aaaaaaYYYxxxxxPP --> aaaaaaxxxxxPPYYY Where "aaaaa" would be the normal address MSBs, "YYY" is the Y-index (within a 8x8 tile), "xxxxx" selects one of the 32 tiles per line, "PP" is the bit-plane index (for BGs with more than one Word per plane). For the intended result (writing rows of 256 pixels) the Translation should be combined with Increment Step=1. For Mode 7 bitmaps one could eventually combine step 32/128 with 8bit/10bit rotate: 8bit-rotate/step32 aaaaaaaaXXXxxYYY --> aaaaaaaaxxYYYXXX 10bit-rotate/step128 aaaaaaXXXxxxxYYY --> aaaaaaxxxxYYYXXX.
|
| |
|
#define | REG_VMDATAH (*(vuint8 *)0x2119) |
| | VRAM Data Write (upper 8bit) (W)
|
| |
|
#define | REG_VMDATAL (*(vuint8 *)0x2118) |
| | VRAM Data Write (lower 8bit) (W)
|
| |
|
#define | REG_VMDATALH (*(vuint16 *)0x2118) |
| | VRAM Data Write (lower and upper 8bit) (W)
|
| |
|
#define | RGB8(r, g, b) (((r) >> 3) | (((g) >> 3) << 5) | (((b) >> 3) << 10)) |
| | Macro to convert 5 bits or 8 bits r g b components into a single 15 bit RGB triplet.
|
| |
| #define | setPalette(palette, paletteEntry, paletteSize) dmaCopyCGram(palette, paletteEntry, paletteSize) |
| | Change a palette in CGRAM.
|
| |
| #define | setPaletteColor(paletteEntry, paletteColor) |
| | Change a color palette in CGRAM.
|
| |
|
| u8 | getFadeEffectLevel (void) |
| | Return the current software fade level.
|
| |
| unsigned short | getFPScounter (void) |
| | Return number of frames per second.
|
| |
| void | getPalette (u8 paletteEntry, u8 paletteSize, u16 *paletteColors) |
| | Get a palette from CGRAM.
|
| |
| void | getPaletteColor (u8 paletteEntry, u16 *paletteColor) |
| | Get a color palette from CGRAM.
|
| |
| u8 | isFadeEffectActive (void) |
| | Check whether the software fade effect is active.
|
| |
| u8 | isMosaicActive (void) |
| | Check whether the software mosaic effect is active.
|
| |
| void | setBrightness (u8 level) |
| | Sets the screen brightness.
|
| |
| void | setColorEffect (u8 colorMathA, u8 colorMathB) |
| | Do addition or other color effects.
|
| |
| void | setColorIntensity (u8 colorApply, u8 intensity) |
| | Change intensity for transparency.
|
| |
| void | setFadeEffect (u8 mode) |
| | Perform a blocking fade-in or fade-out effect.
|
| |
| void | setFadeEffectEx (u8 mode, u8 framesNumber) |
| | Perform a blocking fade-in or fade-out effect with a configurable step delay.
|
| |
| void | setFadeEffectIn (void) |
| | Start a non-blocking fade-in effect.
|
| |
| void | setFadeEffectInit (void) |
| | Initialize the software fade effect state.
|
| |
| void | setFadeEffectOut (void) |
| | Start a non-blocking fade-out effect.
|
| |
| void | setFadeEffectSpeed (u8 speed) |
| | Set the update speed of the software fade effect.
|
| |
| void | setMode (u8 mode, u8 size) |
| | Set the SNES hardware to operate in new display mode.
|
| |
| void | setMode7 (u8 mode) |
| | Put screen in mode 7 with generic init.
|
| |
| void | setMode7Angle (u8 angle) |
| | Change angle view in mode 7 without changing matrix.
|
| |
| void | setMode7MoveForwardBack (u8 z8) |
| | Change perspective view forward/backward in mode 7 without changing matrix.
|
| |
| void | setMode7MoveLeftRight (u8 z8) |
| | Change perspective view left/right in mode 7 without changing matrix.
|
| |
| void | setMode7Rot (u8 angle) |
| | Change angle view in mode 7 with matrix transformation.
|
| |
| void | setMode7Scale (u16 xscale, u16 yscale) |
| | Change scaling effect of screen in mode 7.
|
| |
| void | setMosaicEffect (u8 mode, u8 bgNumbers) |
| | Do a mosaic in or out effect.
|
| |
| void | setMosaicEffectSpeed (u8 speed) |
| | Set the update speed of the software mosaic effect.
|
| |
| void | setMosaicInit (void) |
| | Initialize the software mosaic effect state.
|
| |
| void | setMosaicTo (u8 size, u8 bgMask) |
| | Set the mosaic size and mask.
|
| |
|
void | setScreenOff (void) |
| | Put screen off.
|
| |
| void | setScreenOn (void) |
| | Put screen on.
|
| |
|
void | showFPScounter (void) |
| | Show on current text BG, at location 1,1 the number of frames per second.
|
| |
| void | updateFadeEffect (void) |
| | Update the software fade effect.
|
| |
| void | updateMosaicEffect (void) |
| | Update the software mosaic effect.
|
| |
contains the basic definitions for controlling the video hardware.