This is good if you want to understand the actual graphics format the SNES uses, well 1 way anyways. I guess it's not really necessary, but it doesn't hurt.

I am going to use a great explanation from a Gameboy document. Why? Because the original Gameboys were also 2BPP, but were only 4 different shades of grey. 2BPP means 2 bits per pixel, making 4 total possible colors (0..3 decimal is 00..11 binary). We have been using 4 color tiles because they are the simplest of the SNES to work with. You used pcx2snes last time to make the tiles, now let's see how it is actually done.

This example is from gbspec.txt, Pan's document on the Gameboy. Stuff in [] is included by me.

The tile images are stored in the Tile Pattern Tables. Each 8x8 image occupies 16 bytes, where each 2 bytes represent a line:

``````Tile:                                     Image:

.33333..                     .33333.. -> 01111100 -> \$7C
22...22.                                 01111100 -> \$7C
11...11.                     22...22. -> 00000000 -> \$00
2222222. <-- digits                      11000110 -> \$C6
33...33.     represent       11...11. -> 11000110 -> \$C6
22...22.     color                       00000000 -> \$00
11...11.     numbers         2222222. -> 00000000 -> \$00
........                                 11111110 -> \$FE
33...33. -> 11000110 -> \$C6
[. = color 0]                            11000110 -> \$C6
22...22. -> 00000000 -> \$00
11000110 -> \$C6
11...11. -> 11000110 -> \$C6
00000000 -> \$00
........ -> 00000000 -> \$00
00000000 -> \$00
``````

Do you kind of understand? Let me help if you don't. See how each line is represented by 2 bytes? Both bits make up a color. For example, in the first line, bit 0 in both bytes is 0, so that makes color 0. However, look at the line that is full of color 2. Look at both bytes - the bits go 0, then 1, but that makes color 2? How?! Because the SNES stores the low byte first, then the high! So it would store 0, then 1, not 1, then 0 - a little confusing at first. Same for when you see a 0, then 1 - it's stored as 1, then 0. It's easy to just remember that 10 = color 1, and 01 = color 2. In our VRAM example, we used the smiley tile. Let's actually write the smile ourselves.

``````  ........                     ........ -> 00000000
..1..1..                                 00000000
..1..1..                     ..1..1.. -> 00100100
..1..1..                                 00000000
........                     ..1..1.. -> 00100100
1......1                                 00000000
11111111                     ..1..1.. -> 00100100
........                                 00000000
........ -> 00000000
00000000
1......1 -> 10000001
00000000
11111111 -> 11111111
00000000
........ -> 00000000
00000000
``````

This assumes that color 1 is yellow and color 0 black to achieve the same results. Getting it? It's good to understand this, trust me.

On to Using the NMI-VBLANK!

Tutorial by bazz