Display a single static 32x32 sprite. More...
#include <snes.h>Functions | |
| int | main (void) |
| Entry point: display a single static 32x32 sprite at screen center. | |
Variables | |
| u8 | palsprite32 [] |
| 16-color palette for the 32x32 sprite | |
| u8 | sprite32 [] |
| 4bpp 32x32 sprite tile data (defined in data.asm, stored in ROM) | |
| u8 | sprite32_end [] |
Display a single static 32x32 sprite.
Minimal example showing how to load and display one hardware sprite on the SNES. Sprite tile data is DMA'd to VRAM, a 16-color palette is loaded to CGRAM at address 128 (sprite palette 0), and the OBJ size register (OBJSEL, $2101) is configured for small=8x8 / large=32x32 mode.
The sprite is placed at screen center using oamSet(), which writes to the 544-byte OAM buffer that the NMI handler DMAs to the PPU each VBlank. The tile number is calculated from the offset between the OBJSEL name base and the VRAM address where the tile data was loaded.
| int main | ( | void | ) |
Entry point: display a single static 32x32 sprite at screen center.
This is the simplest possible sprite example. It demonstrates the complete pipeline for getting one hardware sprite on screen:
|
extern |
16-color palette for the 32x32 sprite
|
extern |
4bpp 32x32 sprite tile data (defined in data.asm, stored in ROM)
| u8 sprite32_end[] |