33 #ifndef SNES_BACKGROUND_INCLUDE
34 #define SNES_BACKGROUND_INCLUDE
43 #define SC_BASE_SHIFT 2
46 #define SC_TILE_BASE(base) ((base) << SC_BASE_SHIFT)
49 #define SC_32x32 (0 << 0)
50 #define SC_64x32 (1 << 0)
51 #define SC_32x64 (2 << 0)
52 #define SC_64x64 (3 << 0)
54 #define BG_MODE0 (0 << 0)
55 #define BG_MODE1 (1 << 0)
56 #define BG_MODE2 (2 << 0)
57 #define BG_MODE3 (3 << 0)
58 #define BG_MODE4 (4 << 0)
59 #define BG_MODE5 (5 << 0)
60 #define BG_MODE6 (6 << 0)
61 #define BG_MODE7 (7 << 0)
63 #define BG1_TSIZE8x8 (0 << 4)
64 #define BG2_TSIZE8x8 (0 << 5)
65 #define BG3_TSIZE8x8 (0 << 6)
66 #define BG4_TSIZE8x8 (0 << 7)
68 #define BG1_TSIZE16x16 (1 << 4)
69 #define BG2_TSIZE16x16 (1 << 5)
70 #define BG3_TSIZE16x16 (1 << 6)
71 #define BG4_TSIZE16x16 (1 << 7)
73 #define BG1_ENABLE (1 << 0)
74 #define BG2_ENABLE (1 << 1)
75 #define BG3_ENABLE (1 << 2)
76 #define BG4_ENABLE (1 << 3)
77 #define OBJ_ENABLE (1 << 4)
79 #define BG_4COLORS0 32
81 #define BG_16COLORS 16
82 #define BG_256COLORS 256
83 #define BG3_MODE1_PRIORITY_HIGH (1 << 3)
110 #define REG_BGMODE (*(vuint8 *)0x2105)
131 #define REG_MOSAIC (*(vuint8 *)0x2106)
150 #define BG1SC_ADDR 0x2107
151 #define REG_BG1SC (*(vuint8 *)0x2107)
152 #define REG_BG2SC (*(vuint8 *)0x2108)
153 #define REG_BG3SC (*(vuint8 *)0x2109)
154 #define REG_BG4SC (*(vuint8 *)0x210A)
165 #define REG_BG12NBA (*(vuint8 *)0x210B)
166 #define REG_BG34NBA (*(vuint8 *)0x210C)
169 #define REG_BGxHOFS 0x210D
171 #define REG_BGxVOFS 0x210E
174 #define REG_BG1HOFS (*(vuint8 *)0x210D)
176 #define REG_BG1VOFS (*(vuint8 *)0x210E)
178 #define REG_BG2HOFS (*(vuint8 *)0x210F)
180 #define REG_BG2VOFS (*(vuint8 *)0x2110)
182 #define REG_BG3HOFS (*(vuint8 *)0x2111)
184 #define REG_BG3VOFS (*(vuint8 *)0x2112)
186 #define REG_BG4HOFS (*(vuint8 *)0x2113)
188 #define REG_BG4VOFS (*(vuint8 *)0x2114)
190 #define COLWIN_OB13W1ENABLEIN (1 << 0)
191 #define COLWIN_OB13W1ENABLEOUT (2 << 0)
192 #define COLWIN_OB13W2ENABLEIN (1 << 2)
193 #define COLWIN_OB13W2ENABLEOUT (2 << 2)
194 #define COLWIN_MB24W1ENABLEIN (1 << 4)
195 #define COLWIN_MB24W1ENABLEOUT (2 << 4)
196 #define COLWIN_MB24W2ENABLEIN (1 << 6)
197 #define COLWIN_MB24W2ENABLEOUT (2 << 6)
210 #define REG_W12SEL (*(vuint8 *)0x2123)
211 #define REG_W34SEL (*(vuint8 *)0x2124)
212 #define REG_WOBJSEL (*(vuint8 *)0x2125)
229 #define REG_WH0 (*(vuint8 *)0x2126)
230 #define REG_WH1 (*(vuint8 *)0x2127)
231 #define REG_WH2 (*(vuint8 *)0x2128)
232 #define REG_WH3 (*(vuint8 *)0x2129)
249 #define REG_WBGLOG (*(vuint8 *)0x212A)
250 #define REG_WOBJLOG (*(vuint8 *)0x212B)
268 #define REG_TM (*(vuint8 *)0x212C)
269 #define REG_TS (*(vuint8 *)0x212D)
284 #define REG_TMW (*(vuint8 *)0x212E)
285 #define REG_TSW (*(vuint8 *)0x212F)
288 extern u16 bg0gfxaddr;
316 void bgInitTileSet(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 tileSize, u16 paletteSize, u16 colorMode, u16 address);
327 void bgInitTileSetLz(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 paletteSize, u16 colorMode, u16 address);
344 void bgInitMapTileSet7(u8 *tileSource, u8 *mapSource, u8 *tilePalette, u16 tileSize, u16 address);
353 void bgInitMapSet(u8 bgNumber, u8 *mapSource, u16 mapSize, u8 sizeMode, u16 address);
void bgSetWindowsRegions(u8 bgNumber, u8 winNumber, u8 xLeft, u8 xRight)
Define a region on screen where map / sprite can be disable.
void bgSetGfxPtr(u8 bgNumber, u16 address)
Definition of each background address.
u16 bg3gfxaddr
Definition of each background address.
void bgSetEnableSub(u8 bgNumber)
Enable a BG from sub screen (translucent) in the actual SNES mode.
void bgInitTileSetLz(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 paletteSize, u16 colorMode, u16 address)
Initializes a Tile Set and Loads the Tile GFX compressed with LZ algo into VRAM.
void bgSetDisable(u8 bgNumber)
Disable a BG in the actual SNES mode.
void bgInitTileSetData(u8 bgNumber, u8 *tileSource, u16 tileSize, u16 address)
Add some Tile Set and Loads the Tile GFX into VRAM.
void bgSetMapPtr(u8 bgNumber, u16 address, u8 mapSize)
Change Background Map address.
u16 bg2gfxaddr
Definition of each background address.
void bgSetEnable(u8 bgNumber)
Enable a BG in the actual SNES mode.
void bgSetScroll(u8 bgNumber, u16 x, u16 y)
Sets the scroll hardware to the specified location.
void bgInitMapSet(u8 bgNumber, u8 *mapSource, u16 mapSize, u8 sizeMode, u16 address)
Initializes a Map Set and loads it into SNES VRAM.
u16 bg1gfxaddr
Definition of each background address.
void bgInitTileSet(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 tileSize, u16 paletteSize, u16 colorMode, u16 address)
Initializes a Tile Set and Loads the Tile GFX into VRAM.
void bgInitMapTileSet7(u8 *tileSource, u8 *mapSource, u8 *tilePalette, u16 tileSize, u16 address)
Initializes a Tile & Map Set and Loads the Tile & Map GFX into VRAM for Mode 7.
void bgSetDisableSub(u8 bgNumber)
Disable a BG from sub screen (translucent) in the actual SNES mode.
Wrapper functions for direct memory access hardware.
Custom types used by libsnes.
contains the basic definitions for controlling the video hardware.