1.1 Background


void hide_bkg(); // Disable background

Calling hide_bkg(); turns all the background tiles off. The sprites are still visible. This command does not work with no$gmb.


void show_bkg(); // Enable Background

Calling show_bkg()/SHOW_BKG; turns all the background tiles. This is used to turn them on after using the hide_bkg();

* Note : On the Gameboy Color, the background tiles start automatically, however, on the gameboy and gameboy pocket, they initially start off, so call a SHOW_BKG; after you load your background data.

void scroll_bkg(int x, int y); // Scroll background x/y >=0 <=255


void set_bkg_data(int first_tile, int nb_tiles, unsigned char *data);
/* -128 <= first_tile <= 127 * -128 <= first_tile+nb_tiles <= 127 * nb_tiles >= 1 */

set_bkg_data is used to load the background tiles and palette information into memory. first_tile is the first tile that you want to load data into, usually 0. nb_tiles is the number of tiles you want to load into memory. *data is a pointer to the unsigned char that the tiles are stored in.

void set_bkg_tiles(int x, int y, int w, int h, unsigned char *tilelist);
/* 0 <= x <= 31 * 0 <= y <= 31 * 1 <= w <= 32-x * 1 <= h <= 32-y */
set_bkg_tiles puts the tile data onto the screen. You must load the tiles into memory using set_bkg_data first. x is the starting location in tiles (pixels / 8) to load the data into. y is the starting location in tiles (pixels / 8) to load the data into. w is the width of the data you want to load in tiles. h is the height in tiles of the data you want to put on the screen. *tilelist is a pointer to an unsigned char that has a tile map of what you want to be displayed.