It is currently Mon Oct 23, 2017 1:11 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PPU Emulation O_O
PostPosted: Wed Sep 14, 2016 1:42 pm 
Offline

Joined: Wed Sep 14, 2016 1:21 pm
Posts: 13
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:


Top
 Profile  
 
 Post subject: Re: PPU Emulation O_O
PostPosted: Wed Sep 14, 2016 1:59 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6297
Location: Seattle
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.


Top
 Profile  
 
 Post subject: Re: PPU Emulation O_O
PostPosted: Wed Sep 14, 2016 2:29 pm 
Offline

Joined: Wed Sep 14, 2016 1:21 pm
Posts: 13
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)


Top
 Profile  
 
 Post subject: Re: PPU Emulation O_O
PostPosted: Wed Sep 14, 2016 2:35 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6297
Location: Seattle
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)


Top
 Profile  
 
 Post subject: Re: PPU Emulation O_O
PostPosted: Wed Sep 14, 2016 4:30 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10067
Location: Rio de Janeiro - Brazil
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.


Top
 Profile  
 
 Post subject: Re: PPU Emulation O_O
PostPosted: Thu Sep 15, 2016 7:26 am 
Offline

Joined: Wed Sep 14, 2016 1:21 pm
Posts: 13
Spot-on! You're right :) The problem was the NMI_OCCURRED update. :)

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

Thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group