initial fce ultra 0.81 import
[fceu.git] / Documentation / tech / ppu / loopy1.txt
1 Subject: [nesdev] the skinny on nes scrolling\r
2 Date: Tue, 13 Apr 1999 16:42:00 -0600\r
3 From: loopy <zxcvzxcv@netzero.net>\r
4 Reply-To: nesdev@onelist.com\r
5 To: nesdev@onelist.com\r
6 \r
7 From: loopy <zxcvzxcv@netzero.net>\r
8 \r
9 ---------\r
10 the current information on background scrolling is sufficient for most games;\r
11 however, there are a few that require a more complete understanding.\r
12 \r
13 here are the related registers:\r
14         (v) vram address, a.k.a. 2006 which we all know and love.  (16 bits)\r
15         (t) another temp vram address (16 bits)\r
16            (you can really call them 15 bits, the last isn't used)\r
17        (x) tile X offset (3 bits)\r
18 \r
19 the ppu uses the vram address for both reading/writing to vram thru 2007,\r
20 and for fetching nametable data to draw the background.  as it's drawing the\r
21 background, it updates the address to point to the nametable data currently\r
22 being drawn.  bits 0-11 hold the nametable address (-$2000).  bits 12-14 are\r
23 the tile Y offset.\r
24 \r
25 ---------\r
26 stuff that affects register contents:\r
27 (sorry for the shorthand logic but i think it's easier to see this way)\r
28 \r
29 2000 write:\r
30         t:0000110000000000=d:00000011\r
31 2005 first write:\r
32         t:0000000000011111=d:11111000\r
33         x=d:00000111\r
34 2005 second write:\r
35         t:0000001111100000=d:11111000\r
36         t:0111000000000000=d:00000111\r
37 2006 first write:\r
38         t:0011111100000000=d:00111111\r
39         t:1100000000000000=0\r
40 2006 second write:\r
41         t:0000000011111111=d:11111111\r
42         v=t\r
43 scanline start (if background and sprites are enabled):\r
44         v:0000010000011111=t:0000010000011111\r
45 frame start (line 0) (if background and sprites are enabled):\r
46         v=t\r
47 \r
48 note!  2005 and 2006 share the toggle that selects between first/second\r
49 writes.  reading 2002 will clear it.\r
50 \r
51 note!  all of this info agrees with the tests i've run on a real nes.  BUT\r
52 if there's something you don't agree with, please let me know so i can verify\r
53 it.\r
54 \r
55 ________________________________________________________\r
56 NetZero - We believe in a FREE Internet.  Shouldn't you?\r
57 Get your FREE Internet Access and Email at\r
58 http://www.netzero.net/download.html\r
59 \r
60 ------------------------------------------------------------------------\r
61 New hobbies? New curiosities? New enthusiasms?\r
62 http://www.ONElist.com\r
63 Sign up for a new e-mail list today!\r