Nintendo NES-001 User Guide - Page 19

Pattern Tables, 6 Name Tables / Attribute Tables - adapter

Page 19 highlights

colours in each palette is 13, not 16 [5]. The total number of colours onscreen at any time is therefore 25 out of 52. Both palettes are also mirrored to $3F20-$3FFF. The colour palette is shown in Appendix F. 3.5 Pattern Tables The NES has two pattern tables at $0000 and $1000. The pattern tables store the 8x8 pixel tiles which can be drawn on the screen. Many games store the pattern tables in CHR-ROM on the cartridge, however, games without CHR-ROM will use RAM for the pattern tables and fill them during execution. The pattern tables store the least significant two bits of the 4-bit number needed to identify the image or sprite palette entry used by that pixel such that 00b is palette entry 0, 01b is 1, 10b is 2 and 11b is 3. Figure 3-2. Pattern tables. Adapted from [7]. Figure 3-2 shows how the pattern tables work. The character 'A' is the final result, shown at the bottom. The character is constructed pixel by pixel by taking one bit from the top left and one from the top right to make a 2-bit colour. The other two bits of the colour are taken from the attribute tables. The colours shown are not genuine NES colour palette values. 3.6 Name Tables / Attribute Tables Name tables are essentially a matrix of tile numbers, pointing to the tiles stored in the pattern tables. The name tables are 32x30 tiles and since each tile is 8x8 pixels, the entire name table is 256x240 pixels. Each name table has an associated attribute table. Attribute tables hold the upper two bits of the colours for the tiles. Each byte in the attribute table represents a 4x4 group of tiles, so an attribute table is an 8x8 table of these groups. Each 4x4 group is further divided into four 2x2 squares as shown in figure 3-3 [9]. The 8x8 tiles are numbered $0-$F. The layout of the byte 19

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47

19
colours in each palette is 13, not 16 [5]. The total number of colours onscreen at any time is
therefore 25 out of 52. Both palettes are also mirrored to $3F20-$3FFF. The colour palette is
shown in Appendix F.
3.5 Pattern Tables
The NES has two pattern tables at $0000 and $1000. The pattern tables store the 8x8 pixel
tiles which can be drawn on the screen. Many games store the pattern tables in CHR-ROM
on the cartridge, however, games without CHR-ROM will use RAM for the pattern tables and
fill them during execution. The pattern tables store the least significant two bits of the 4-bit
number needed to identify the image or sprite palette entry used by that pixel such that 00b
is palette entry 0, 01b is 1, 10b is 2 and 11b is 3.
Figure 3-2. Pattern tables. Adapted from [7].
Figure 3-2 shows how the pattern tables work. The character ‘A’ is the final result, shown at
the bottom. The character is constructed pixel by pixel by taking one bit from the top left and
one from the top right to make a 2-bit colour. The other two bits of the colour are taken from
the attribute tables. The colours shown are not genuine NES colour palette values.
3.6 Name Tables / Attribute Tables
Name tables are essentially a matrix of tile numbers, pointing to the tiles stored in the pattern
tables. The name tables are 32x30 tiles and since each tile is 8x8 pixels, the entire name
table is 256x240 pixels.
Each name table has an associated attribute table. Attribute tables hold the upper two bits of
the colours for the tiles. Each byte in the attribute table represents a 4x4 group of tiles, so an
attribute table is an 8x8 table of these groups. Each 4x4 group is further divided into four 2x2
squares as shown in figure 3-3 [9]. The 8x8 tiles are numbered $0-$F. The layout of the byte