31 #ifndef SNES_VIDEO_INCLUDE
32 #define SNES_VIDEO_INCLUDE
42 VRAM_INCHIGH = (1 << 7),
56 #define MOSAIC_BG1 (1 << 0)
57 #define MOSAIC_BG2 (1 << 1)
58 #define MOSAIC_BG3 (1 << 2)
59 #define MOSAIC_BG4 (1 << 3)
61 #define CM_DIRCOLOR (1 << 0)
62 #define CM_SUBBGOBJ_ENABLE (1 << 1)
63 #define CM_ALWAYS_ENABLE (0 << 4)
64 #define CM_MATWIN_ENABLE (1 << 4)
65 #define CM_NOMATWIN_ENABLE (2 << 4)
66 #define CM_NEVER_ENABLE (3 << 4)
67 #define CM_SCBLK_ALWAYS_ENABLE (0 << 6)
68 #define CM_SCBLK_MATWIN_ENABLE (1 << 6)
69 #define CM_SCBLK_NOMATWIN_ENABLE (2 << 6)
70 #define CM_SCBLK_NEVER_ENABLE (3 << 6)
72 #define CM_SUB_MAINSUB (1 << 7)
73 #define CM_DIV2_DIVIDE (1 << 6)
74 #define CM_MSCR_BACK (1 << 5)
75 #define CM_MSCR_PAL47 (1 << 4)
76 #define CM_MSCR_BG4 (1 << 3)
77 #define CM_MSCR_BG3 (1 << 2)
78 #define CM_MSCR_BG2 (1 << 1)
79 #define CM_MSCR_BG1 (1 << 0)
81 #define CM_APPLY_BLUE (1 << 7)
82 #define CM_APPLY_GREEN (1 << 6)
83 #define CM_APPLY_RED (1 << 5)
85 #define M7_HFLIP (1 << 0)
86 #define M7_VFLIP (1 << 1)
87 #define M7_WRAP (1 << 6)
88 #define M7_OUTTRANS (2 << 6)
89 #define M7_OUTTILE (3 << 6)
91 #define PPU_50HZ (1 << 4)
110 #define REG_INIDISP (*(vuint8 *)0x2100)
139 #define REG_VMAIN (*(vuint8 *)0x2115)
155 #define REG_VMADDLH (*(vuint16 *)0x2116)
162 #define REG_VMDATAL (*(vuint8 *)0x2118)
163 #define REG_VMDATAH (*(vuint8 *)0x2119)
164 #define REG_VMDATALH (*(vuint16 *)0x2118)
173 #define REG_CGADD (*(vuint8 *)0x2121)
205 #define CGRAM_PALETTE ((u8 *)0x2122)
215 #define REG_CGWSEL (*(vuint8 *)0x2130)
229 #define REG_CGADSUB (*(vuint8 *)0x2131)
240 #define REG_COLDATA (*(vuint8 *)0x2132)
255 #define REG_M7SEL (*(vuint8 *)0x211A)
260 #define REG_M7A (*(vuint8 *)0x211B)
261 #define REG_M7B (*(vuint8 *)0x211C)
262 #define REG_M7C (*(vuint8 *)0x211D)
263 #define REG_M7D (*(vuint8 *)0x211E)
264 #define REG_M7HOFS (*(vuint8 *)0x210D)
265 #define REG_M7VOFS (*(vuint8 *)0x210E)
266 #define REG_M7X (*(vuint8 *)0x211F)
267 #define REG_M7Y (*(vuint8 *)0x2120)
273 #define REG_MPYL (*(vuint8 *)0x2134)
274 #define REG_MPYM (*(vuint8 *)0x2135)
275 #define REG_MPYH (*(vuint8 *)0x2136)
276 #define REG_MPYMH (*(vuint16 *)0x2135)
290 #define REG_STAT77 (*(vuint8 *)0x213E)
300 #define REG_STAT78 (*(vuint8 *)0x213F)
304 #define RGB8(r, g, b) (((r) >> 3) | (((g) >> 3) << 5) | (((b) >> 3) << 10))
305 #define RGB5(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
307 #define SCREEN_HEIGHT 224
308 #define SCREEN_WIDTH 256
388 #define setPalette(palette, paletteEntry, paletteSize) dmaCopyCGram(palette, paletteEntry, paletteSize)
395 #define setPaletteColor(paletteEntry, paletteColor) \
396 REG_CGADD = paletteEntry; \
397 *CGRAM_PALETTE = (paletteColor)&0xFF; \
398 *CGRAM_PALETTE = (paletteColor) >> 8;
406 void getPalette(u8 paletteEntry, u8 paletteSize, u16 *paletteColors);
Custom types used by libsnes.
#define BIT(n)
bit field
Definition: snestypes.h:34
u8 videoMode
Current value of REG_TM.
void setMode7MoveForwardBack(u8 z8)
Change perspective view forward/backward in mode 7 without changing matrix.
void setBrightness(u8 level)
sets the screens brightness.
void setMode7Rot(u8 angle)
Change angle view in mode 7 with matrix transformation.
u8 videoModeSub
Current value of REG_TS.
void getPalette(u8 paletteEntry, u8 paletteSize, u16 *paletteColors)
Get a palette from CGRAM.
VideoControl
Bit defines for the video control registers.
Definition: video.h:38
@ VRAM_ADRTR_9B
Address Translation (0..3 = 0bit/None, 8bit, 9bit, 10bit)
Definition: video.h:45
@ VRAM_INCLOW
Increment VRAM Address after accessing High/Low byte (0=Low, 1=High)
Definition: video.h:41
@ VRAM_ADRTR_8B
Address Translation (0..3 = 0bit/None, 8bit, 9bit, 10bit)
Definition: video.h:44
@ VRAM_ADRSTINC_32
Address Increment Step (0..3 = Increment Word-Address by 1,32,128,128)
Definition: video.h:48
@ VRAM_ADRSTINC_128
Address Increment Step (0..3 = Increment Word-Address by 1,32,128,128)
Definition: video.h:49
@ VRAM_ADRTR_10B
Address Translation (0..3 = 0bit/None, 8bit, 9bit, 10bit)
Definition: video.h:46
@ VRAM_ADRTR_0B
Address Translation (0..3 = 0bit/None, 8bit, 9bit, 10bit)
Definition: video.h:43
@ DSP_FORCEVBL
Forced Blanking (0=Normal, 1=Screen Black)
Definition: video.h:39
@ VRAM_ADRSTINC_1
Address Increment Step (0..3 = Increment Word-Address by 1,32,128,128)
Definition: video.h:47
unsigned short getFPScounter(void)
Return number of frames per second.
void setMode7Scale(u16 xscale, u16 yscale)
Change scaling effect of screen in mode 7.
void setColorEffect(u8 colorMathA, u8 colorMathB)
Do addition or other color effects.
void setMosaicEffect(u8 mode, u8 bgNumbers)
Do a mosaic in or out effect.
void setScreenOff(void)
Put screen Off.
u16 snes_frame_count
Number of frame per second (need a call to videoGetFrames() once a frame)
void setScreenOn(void)
Put screen On.
void setFadeEffect(u8 mode)
Do a fadein or fadeout effect.
void setMode7Angle(u8 angle)
Change angle view in mode 7 without changing matrix.
void getPaletteColor(u8 paletteEntry, u16 *paletteColor)
Get a color palette from CGRAM.
void setFadeEffectEx(u8 mode, u8 framesNumber)
Do a fadein or fadeout effect.
void setMode7MoveLeftRight(u8 z8)
Change perspective view left/right in mode 7 without changing matrix.
void setColorIntensity(u8 colorApply, u8 intensity)
Change intensity for transparency.
void setMode7(u8 mode)
Put screen in mode 7 with generic init.
void setMode(u8 mode, u8 size)
Set the SNES hardware to operate in new display mode.