LDA $00

GameBoy Tutorial Two for the Adventurous - Sprite Magic

Contents

Intro

Now you might be wondering how to get something onto the screen. The GameBoy's screen is basically three parts: The background, an extra background layer called the window and a sprite layer made of separate, moveable objects. Alright, now you wanna make something display on the screen right? Fair enough. The easiest thing to do, might be to make an 8x8px sprite and display that. To do that, one would have to load in the sprite data into the proper tile memory and then edit the Object Attribute Memory (OAM) to display the sprite.

Setting Up The Screen

First is setting up the screen. We will need to set the LCD Control Register according to our needs. If you take a gander at the pandocs, you will see that we have 8 bits to deal with. Starting from the least significant, we have the BG display. We don't need that to display objects so that will be empty. The next bit is the OBJ display enable so that will be on for our sprite to show up. The size bit will be cleared for 8x8px sprites. The tile map will be set to 0

 ld a, %00000000
ldh ($40), a