Macros

  • Get Tile Position — NTADR_A(x, y)

Metasprites

A metasprite is represented as a const unsigned char array[] and uses 4 bytes to represent each sub-sprite (these being x offset, y offset, tile, and attribute). Metasprites are ended with 128.

Example

const unsigned char metasprite[] = {
	0, 0, 0x80, 0,
	8, 0, 0x81, 0,
	0, 8, 0x90, 0,
	8, 8, 0x91, 0, 
	128 // terminate
};
// Set sprite in OAM buffer
unsigned char __fastcall__ oam_meta_spr(unsigned char x, unsigned char y, unsigned char sprid, const unsigned char *data);

Palette

//set bg and spr palettes, data is 32 bytes array
void __fastcall__ pal_all(const char *data);
 
//set bg palette only, data is 16 bytes array
void __fastcall__ pal_bg(const char *data);
 
//set spr palette only, data is 16 bytes array
void __fastcall__ pal_spr(const char *data);
 
//set a palette entry, index is 0..31
void __fastcall__ pal_col(unsigned char index, unsigned char color);
  
//reset palette to $0f
void __fastcall__ pal_clear(void);
 
//set virtual bright both for sprites and background, 0 is black, 4 is normal, 8 is white
void __fastcall__ pal_bright(unsigned char bright);
  
//set virtual bright for sprites only
void __fastcall__ pal_spr_bright(unsigned char bright);
 
//set virtual bright for sprites background only
void __fastcall__ pal_bg_bright(unsigned char bright);