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

PPU Emulation O_O
http://forums.nesdev.com/viewtopic.php?f=3&t=14830
Page 1 of 1

Author:  zerojnt [ Wed Sep 14, 2016 1:42 pm ]
Post subject:  PPU Emulation O_O

Hi people, I'm writting an nes emu in Golang. The CPU already works nice; but I'm facing some problems to test the PPU emulation. Actually I wrote a basic ppu code trying to make the minium enough to have tiles in scren (no scrolling, no attributes) just background tiles with 4 colors (pattern A + pattern B) (ignoring the color palette).

Now, I just have some static "noise" on screen; I expected to have some dynamic titles (even wrong). The 0x2000 (PPUCTRL) is never called by ROM with NMI_OUTPUT on, so there are no NMI interruptions during VBLANK.

Well, you know more than I how hard it's debug an emulator. I reached in a point that I can't understand whats going on.

Can you guys look my code and try to figure out what I'm doing wrong? This is the repository: https://github.com/jonathandasilvasanto ... rc/zerojnt

The most important files are: cpu.go, ppu.go, ioports.go

Thank you. I'm looking forward any tips or suggestions :)

This is the github repository:

Author:  lidnariq [ Wed Sep 14, 2016 1:59 pm ]
Post subject:  Re: PPU Emulation O_O

Obvious tests including logging the output of writes to $2006 and $2007.

Feel free to skip the "real" renderer altogether, and just display the contents of PPU memory.

Author:  zerojnt [ Wed Sep 14, 2016 2:29 pm ]
Post subject:  Re: PPU Emulation O_O

Thank you. Your answer help me to realize that 2007 and 2006 are never called :( The problem is something before it.

At this moment the unique registers accessed are 2000 (once) and 2002 (many times)

Author:  lidnariq [ Wed Sep 14, 2016 2:35 pm ]
Post subject:  Re: PPU Emulation O_O

Most games have a delay loop at the beginning, waiting for [$2002] & $80 to be set twice before anything else happens.

(This is because the PPU rejects all writes to most registers after /RESET has been released until 262 total scanlines have been rendered by it)

Author:  tokumaru [ Wed Sep 14, 2016 4:30 pm ]
Post subject:  Re: PPU Emulation O_O

zerojnt wrote:
At this moment the unique registers accessed are 2000 (once) and 2002 (many times)

The $2000 write is probably turning rendering off, and the $2002 reads are waiting for the vblank flag to get set. All NES programs are supposed to wait a couple of frames before using the PPU. If you don't set this flag, the game will be such in this loop forever.

Author:  zerojnt [ Thu Sep 15, 2016 7:26 am ]
Post subject:  Re: PPU Emulation O_O

Spot-on! You're right :) The problem was the NMI_OCCURRED update. :)

Now I have new problems, but I'm not blocked :)

Thank you.

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