nesdev.com
http://forums.nesdev.com/

PPU Nametables
http://forums.nesdev.com/viewtopic.php?f=3&t=8646
Page 1 of 3

Author:  Elessar [ Wed Feb 22, 2012 12:00 pm ]
Post subject:  PPU Nametables

I am in the process of implementing the PPU, but I am having problems trying to get the nametables to load properly. Here is a comparison of nametables for Donkey Kong on my emulator & FCEUXDSP.

Image

Would this be a result of improper initial PPU loading, or would it be changes to the nametables through PPUDATA?

I can provide more information and/or code if this is too obscure a problem to determine from the picture.

Author:  MottZilla [ Wed Feb 22, 2012 1:14 pm ]
Post subject: 

Are you certain the game is even running? It would also help if you had actual tile graphics showing.

Author:  Elessar [ Wed Feb 22, 2012 1:25 pm ]
Post subject: 

Yes, the game is running (the debugger runs through the code).

Quote:
It would also help if you had actual tile graphics showing.

Do you mean the tile sets? Here they are:
Image

I apologize if I misunderstood you, it's been a long day.

Author:  miker00lz [ Wed Feb 22, 2012 2:21 pm ]
Post subject: 

can you post your code to draw the tile data?

Author:  MottZilla [ Wed Feb 22, 2012 5:37 pm ]
Post subject: 

Your windows are blank. I don't see Donkey Kong's graphics at all.

Again just because code is executing and not hitting a bad opcode doesn't mean the game is running. At the very least check that the contents of name table memory match what they are in FCEUX when the title screen is up. And infact if the game is running even without any input the nametable will change after awhile as the game will run an attract mode/demo. If this isn't happening then the game isn't actually running yet.

Author:  Zepper [ Wed Feb 22, 2012 5:55 pm ]
Post subject: 

Put a screen of the game running.

Author:  Elessar [ Fri Feb 24, 2012 12:51 pm ]
Post subject: 

I realized that the tile set preview wasn't reading the bytes correctly. Here is a screenshot of the game running with the tile sets and name tables:

Image

Author:  miker00lz [ Fri Feb 24, 2012 1:48 pm ]
Post subject: 

looks like you're reading the same row of tiles over and over... and i have no idea whats going on with your main display. again, if you can post the source code we can point out what's going wrong.

Author:  cpow [ Fri Feb 24, 2012 7:10 pm ]
Post subject: 

miker00lz wrote:
looks like you're reading the same row of tiles over and over... and i have no idea whats going on with your main display. again, if you can post the source code we can point out what's going wrong.


The main emu window looks like it's just displaying uninitialized (garbage) video memory.

Author:  Elessar [ Fri Mar 09, 2012 9:38 am ]
Post subject: 

It looks like I had overlooked two essential items: NMI & DMA.

Here is what the system looks like now:
Image
Image

As you can see, the left side and some of the top is not showing correctly. What could be causing this?

(I don't have sprites implemented yet, just the background.)

Author:  MottZilla [ Fri Mar 09, 2012 11:25 am ]
Post subject: 

Your name table mirroring is broken. You shouldn't have 4 unique name tables unless the game is using "Four Screen Mirroring" whic is actually No Mirroring. If you fix name table mirroring you might fix those issues in the background.

Author:  miker00lz [ Fri Mar 09, 2012 2:02 pm ]
Post subject: 

MottZilla wrote:
Your name table mirroring is broken. You shouldn't have 4 unique name tables unless the game is using "Four Screen Mirroring" whic is actually No Mirroring. If you fix name table mirroring you might fix those issues in the background.


yeah, exactly.

Elessar, there are four mirroring cases you need to account for on reads/writes to/from your PPU memory.


for horizontal mirroring:
on accesses to $2400 thru $27FF, subtract $400 from the address
on accesses to $2800 thru $2BFF, subtract $400 from the address
on accesses to $2C00 thru $2FFF, subtract $800 from the address

for vertical mirroring:
on accesses to $2800 thru $2FFF, subtract $800 from the address

for one screen mirroring:
on accesses anywhere from $2000 thru $2FFF, you get the new address by AND'ing the given address by $03FF, then OR'ing that result with $2000.

and like MottZilla said, for four screen mirroring just leave the address as it is.

Author:  Elessar [ Fri Mar 09, 2012 2:56 pm ]
Post subject: 

I will start implementing mirroring now, but that should not be causing the glitches. I have verified that all the PPU memory accesses have stayed within the $2000 nametable, and the nametable viewer I wrote displays the nametable perfectly.

EDIT: I implemented mirroring, but the glitches still remain.
Image
Image

Is there anything else that could cause this?

Author:  Dwedit [ Fri Mar 09, 2012 3:58 pm ]
Post subject: 

Memory initialization? The game probably isn't zeroing out the second nametable. If you're not initializing memory to anything, you could get glitchy areas on the second nametable.

Author:  Zepper [ Fri Mar 09, 2012 7:29 pm ]
Post subject: 

Dwedit wrote:
Memory initialization? The game probably isn't zeroing out the second nametable. If you're not initializing memory to anything, you could get glitchy areas on the second nametable.


From experience, nametables should be initialized by the emulator with zeroes ($00), and not $FFs.

Page 1 of 3 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/