Nintendo NES-001 User Guide - Page 24

end of a line. When incremented from 29, it wraps to 0 and bit 11 is switched. If - games value

Page 24 highlights

It is clear that the status bar area of the screen is not scrolled in the same way as the rest and is fully resident on the first name table. This is typical of status information and is handled in Super Mario Bros. by using the sprite 0 hit flag and in Super Mario Bros. 3 by generating an IRQ. The general picture of horizontal and vertical scrolling is shown in figure 3-12. The name table shown here as A is specified by bits 0-1 of $2000 and B is the name table after (which depends on the mirroring technique). This does not apply to games which allow simultaneous horizontal and vertical scrolling [7]. The background image will span across the name tables as shown in figure 3-13. Figure 3-12. Horizontal and vertical scrolling. Adapted from [7]. Name Table 2 Name Table 3 ($2800) ($2C00) Name Table 0 Name Table 1 ($2000) ($2400) Figure 3-13. Name tables used for background. Adapted from [7]. The way scrolling works is described in [8] and is summarised here. The system maintains a 16-bit VRAM address register, the value of which is set by $2006. The layout of this register is as follows: • Bits 0-11 - Stores the address in the name table as an offset from $2000. Bits 0-4 are the x-scroll and is incremented as the line is drawn. As this is incremented from 31, it wraps to 0 and bit 10 is switched. Bits 5-9 are the y-scroll and are incremented at the end of a line. When incremented from 29, it wraps to 0 and bit 11 is switched. If the value is set above 29 by a write to $2007, then it will wrap to 0 when it reaches 31, but bit 11 is not affected. • Bits 12-14 are the tile y-offset. Since the x-scroll and the y-scroll indicate tile numbers, this allows 32 tiles across the screen (256 pixels) and 30 tiles down the screen (240 pixels), for a total of 960 tiles. There is a second, temporary VRAM address register which is also 16-bits long. Finally there is a 3-bit tile x-offset. These are updated by writes to registers and as the frame is drawn. 24

  • 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

24
It is clear that the status bar area of the screen is not scrolled in the same way as the rest
and is fully resident on the first name table. This is typical of status information and is
handled in Super Mario Bros. by using the sprite 0 hit flag and in Super Mario Bros. 3 by
generating an IRQ.
The general picture of horizontal and vertical scrolling is shown in figure 3-12. The name
table shown here as A is specified by bits 0-1 of $2000 and B is the name table after (which
depends on the mirroring technique). This does not apply to games which allow
simultaneous horizontal and vertical scrolling [7]. The background image will span across the
name tables as shown in figure 3-13.
Figure 3-12. Horizontal and vertical scrolling. Adapted from [7].
Name Table 0
($2000)
Name Table 2
($2800)
Name Table 1
($2400)
Name Table 3
($2C00)
Figure 3-13. Name tables used for background. Adapted from [7].
The way scrolling works is described in [8] and is summarised here. The system maintains a
16-bit VRAM address register, the value of which is set by $2006. The layout of this register
is as follows:
Bits 0-11 - Stores the address in the name table as an offset from $2000. Bits 0-4 are
the x-scroll and is incremented as the line is drawn. As this is incremented from 31, it
wraps to 0 and bit 10 is switched. Bits 5-9 are the y-scroll and are incremented at the
end of a line. When incremented from 29, it wraps to 0 and bit 11 is switched. If the
value is set above 29 by a write to $2007, then it will wrap to 0 when it reaches 31,
but bit 11 is not affected.
Bits 12-14 are the tile y-offset.
Since the x-scroll and the y-scroll indicate tile numbers, this allows 32 tiles across the screen
(256 pixels) and 30 tiles down the screen (240 pixels), for a total of 960 tiles.
There is a second, temporary VRAM address register which is also 16-bits long. Finally there
is a 3-bit tile x-offset. These are updated by writes to registers and as the frame is drawn.