Written by Natesh Narain
on
on
Gameboy Display Information
This post is a work in progress.
General
- Screen buffer is
256x256pixels. Or32x32tiles (tiles are8x8pixels) - Only
160x144pixels can be displayed on the screen - Background wraps around to other side
Display

Uses register WX and WY to set starting position of the window display.
Scroll Registers

Scrolls the background screen horizontally and vertically.
LCD Display RAM

Character RAM
- Also called Tile RAM
- 192 tiles
- Each tile is
8x8pixels. Each pixel is 2 bit color. Therefore 2 bytes per row of pixels. - First byte is LSB and second is MSB
![]()
- There are 2 Tile pattern tables.
$8000 - $8FFFand$8800 - $97FF- First is used for sprites and the background, uses tile numbers 0 - 255
- The second can be used for background and window display, uses tile numbers -128 - 127 where
$9000is the center- Select using bit 4 of LCDC control register.
Background Map Data
- There are 2 Background map data locations in the memory map. One at
$9800 - $98FFthe other at$9C00 - $9FFF - Selected using bit 3 in the LCDC control register.
Window Overlay
- Tiles can be drawn over the background tiles.
Bringing it together

How to read tile patterns for background tile map
- Determine which memory range is being used for background map
- Either
$9800 - $98FFor$9C00 - $9FFF. - Selected using Bit 3 of LCDC control register
- Either
- Determine Character Data range
- Either
$8000 - $8FFF(Range 1) or$8800 - $97FF(Range 2) - Bit 4 of LCDC control register.
- Either
- Iterate through bytes in background tile map range that was determined (1)
- If Range 1 of Character Data is selected
- interpret byte from background map data as unsigned (0 - 255) and read tiles starting at
$8000* If Range 2 of Character Data is selected - interpret byte as signed (-128 - 127) and read tiles staring at
$9000
Character Composition
8x8dot composition8x16dot composition- 4 shades of gray
Object Attribute Memory
- Used for drawing sprites or objects (OBJ)
- There can be up to 40 OBJs
- OAM RAM
$FE00 - $FE9F - 10 OBJs can be displayed on the same Y line
- Display data for OBH characters is stored in OAM
$FE00 - $FE9F- y-axis coordinate (1 byte)
- x-axis coordinate (1 byte)
- character code - tile number (1 byte)
- attribute data (1 byte)

DMA Transfer
- DMA transfers
40x32bits of data. - From RAM area
$8000 - $DFFFto OAM$FE00 - $FE9F - In DMG mode, data cannot be transferred from ROM area
$0000 - $7FFF - Transfer time is 160 us
Example routine for using DMA
