Wednesday, January 22, 2014

Graphics: Tiles

All the graphics on the game boy are based on 8x8 tiles with 4 shades (2 bits per pixel), so 16 bytes each. The CPU uploads tile "character" data (pictures) to the video memory and then the background image (an optional overlay window) and sprites are all made by putting tiles together.

For an example let's look at the heart graphic from Super Mario Land:


It is stored using the following 16 bytes:

0000 6e6e bf93 bf83 ff83 7e46 3c2c 1818
 
translated to binary:

00000000
00000000

01101110
01101110

10111111
10010011

10111111
10010011

11111111
10010011

01000110
01111110

00111100
00101100

00011000
00011000

and the pixel shade is worked out using the following table:

0 white
0

1 light
0

0 dark
1

1 black
1

You can view the tiles inside a ROM image by converting every 16 bytes into image data this way, here are a couple of examples:

 

No comments:

Post a Comment