It is currently Mon Dec 10, 2018 4:43 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: PPU Questions
PostPosted: Thu Feb 09, 2006 10:59 am 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
To keep from crowding out the forum this will be the resident thread for my PPU questions (and there'll be a few).

First up: What in the heck do I do CHR-ROM? Is it loaded into VRAM sort of like PRG-ROM? Or does the program do this? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 11:21 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1211
Location: Berlin, Germany
Robin: Holy smokes Batman, where now?
Batman: To the Batmobile! I mean, to the Newbie Help Center!

CHR-ROM is loaded into $0000-1FFF in PPU memory. If there isn't any present in the ROM then $0000-1FFF is VRAM. It can be switched in and out of that area via memory mappers.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 1:07 pm 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Holy scanlines, Batman!

Which brings me to the next quesiton: how in blazes does one handle screen drawing? Should I draw the screen one pixel at a time, or fake v/hblank times? What I currently have set up now (sort of) is to redraw the screen every 1000/59.97 ms and call NMI after that. The time in between is set to vblank. I'm guessing this'll probably screw timing up something terrible. EDIT: Also, how do fields come into play, PCs being progressive? Thanks again :)

EDIT: Another thing. How does $2006 work exactly? I know it takes two writes to set the address, but how does that work? I assume save the low byte somewhere temporarily and wait for the high byte?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 8:55 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20851
Location: NE Indiana, USA (NTSC)
The NES is also progressive.

The CPU and PPU run in parallel, with 341 PPU cycles per line (except 340 in some cases that you can worry about later) and 5 CPU cycles for every 15 or 16 PPU cycles (depending on region). You can emulate the CPU up to the point where it reads or writes a PPU register ($2000-$3FFF or $4014), and then render pixels up to that point.

And about $2005 and $2006: Loopy's document "The skinny on NES scrolling" explains how writes to $2005 and $2006 are translated into writes to internal V and T registers.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 12:44 pm 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Okay, got that working. Next question: is sprite ram actually seperate from vram?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 11, 2006 1:03 pm 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1211
Location: Berlin, Germany
dxprog wrote:
Okay, got that working. Next question: is sprite ram actually seperate from vram?


lmao, er yes it is. There are three memory maps on the NES, CPU, PPU and Sprite. It has 256 bytes of it's own memory, enough to hold data for 64 sprites.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 12, 2006 2:08 am 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Ack! I've been n00bd! Anyways, no more questions at the moment. SMB seems to have gotten itself stuck in an infinite loop (8057: JMP 8057). Actually, I do have a question. Can an NMI fire while the NMI routine is executing (gives you an idea of how porly timed my code is :-P)?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 12, 2006 4:33 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1211
Location: Berlin, Germany
SMB is supposed to get itself into an infinite loop (8057: JMP 8057). It is a method of waiting until the VBlank time starts. The loop is exited by executing an NMI.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:10 am 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
I assume that the internal VRam counter wraps after &H3FFF?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 4:21 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1211
Location: Berlin, Germany
Well here is where it gets tricky. PPU Memory is 14 bits wide, enough for $0000-$3FFF, BUT the PPU VRAM Address/Temp Address are 15 bits wide enough for $0000-$7FFF. If you try to access PPU memory above $3FFF then actual address accessed in the same minus $4000, (i.e. $63FC would return the value at $23FC. As far as incrementing the PPU Address whenever $2007 is accessed, I assume that the Address goes up to $4000.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 10:54 am 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Well, after a little searching (amazing feature, eh?) and reading I found that I'm handling $2005/$2006 all wrong anyways. Hopefully when I get that written properly I won't have out of bounds problems (at least, not with SMB).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 10:16 pm 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Okay, a question that isn't quite as n00bish as the last one. One pixel is drawn every PPU clock and there are 340/341 PPU clocks per scanline yet the screen is only 256 pixels wide. What's the PPU doing after that last pixel is drawn?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 10:33 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1440
dxprog wrote:
Okay, a question that isn't quite as n00bish as the last one. One pixel is drawn every PPU clock and there are 340/341 PPU clocks per scanline yet the screen is only 256 pixels wide. What's the PPU doing after that last pixel is drawn?


Loading sprite data, HBLANK, pre-fetching the first two tiles for the next scanline.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 12:57 pm 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
The boards were down all day yesterday and I was sad :-(.
I assume all the scroll values (written to 2005) esentially say where to start reading tiles (y * 32 + x + $2000)? And how is $2006 updated every frame during rendering (+1 every 8 pixels to point to the next tile)?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 19, 2006 2:24 am 
Offline

Joined: Thu Nov 17, 2005 2:44 pm
Posts: 34
Ignore the previous question for now (actually I may have figured it out).
New question, though. What do you do when a palette entry is greater than 51?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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