In the document '2C02 technical reference.TXT' (and various others that state the same information) there seems to be a bit of confusion.
First, it states that PPU cycles 1 - 256 are for fetching background data, in the order:
NameTable
Attribute
Pattern Lo
Pattern Hi
which consumes 8 PPU cycles. It then states "this is repeated 32 times". The first set of fetches is for the third tile. It then states that later PPU cycles are used to fetch the first two tiles of the NEXT scanline.
Doesn't this mean that the first two tiles of the NEXT scanline are fetched twice? Once as the 31st and 32nd fetches in cycles 1-256, and then again after the sprite fetches.
I managed to get full_nes_palette.nes and full_nes_palette2.nes working, which seems to require pretty close to accurate PPU timing. But in the process I have broken a few other test ROMs in my emulator that used to work when I had crappy scanline-based emulation. Now that my CPU marches along with the pixels I have an invested interest in making it as accurate as possible.
So I started looking closer at the documentation and got confused...again.
First, it states that PPU cycles 1 - 256 are for fetching background data, in the order:
NameTable
Attribute
Pattern Lo
Pattern Hi
which consumes 8 PPU cycles. It then states "this is repeated 32 times". The first set of fetches is for the third tile. It then states that later PPU cycles are used to fetch the first two tiles of the NEXT scanline.
Doesn't this mean that the first two tiles of the NEXT scanline are fetched twice? Once as the 31st and 32nd fetches in cycles 1-256, and then again after the sprite fetches.
I managed to get full_nes_palette.nes and full_nes_palette2.nes working, which seems to require pretty close to accurate PPU timing. But in the process I have broken a few other test ROMs in my emulator that used to work when I had crappy scanline-based emulation. Now that my CPU marches along with the pixels I have an invested interest in making it as accurate as possible.
So I started looking closer at the documentation and got confused...again.