It is currently Sun Oct 22, 2017 10:19 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: stupid question (PPU)
PostPosted: Tue Aug 30, 2005 8:45 am 
Offline
User avatar

Joined: Tue Dec 21, 2004 8:35 pm
Posts: 600
Location: Argentina
how many ppu cycles takes a ntsc vblank.
Could it be 20 scanlines * 341 cycles?

_________________
ANes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:50 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Yes -- 20 * 341 cycles.

There are 262 scanlines in an NTSC frame (first 20 are vblank, then the 'pre-render' scanline, then 240 rendered scanlines, then 1 dummy scanline). Each scanline has 341 PPU cycles except for the pre-render scanline which alternates between 341 and 340 cycles

PAL has 70 scanlines of VBlank instead of 20, and the pre-render scanline is always 341 cycles (it does not alternate like it does on NTSC)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:11 pm 
Offline
User avatar

Joined: Tue Dec 21, 2004 8:35 pm
Posts: 600
Location: Argentina
ok that clarified my doubt. thx.

I have another question:

- Suppose we have ran 112 cpu cyles (112 * 341 = 336 ppu cycles) and the next instruction takes 4 cycles (12 ppu cycles). Results in:

336 cc + 12 cc = 348 cc !! (ppu cycles)

so taking into account that we start at "0" (zero), then 348 - 340 = 8 ppu Cycles.

What do i do with that "overflow" do i use that remaining ppu cycles for the next scanline or i throw it away and i start again with "0"?.

Thanks in advance.

_________________
ANes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 2:14 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
You must keep that overflow -- not only between scanlines, but also between frames. CPU cycles will more often than not "spill" into the next frame and will almost always spill into the next scanline. Cutting off that overflow will give the CPU several "free" cycles (more than it would get on the real system) -- so games which rely on timing will mess up.

So:

"do i use that remaining ppu cycles for the next scanline" <--- yes

"i throw it away and i start again with "0"?" <--- no


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 2:45 pm 
Offline
User avatar

Joined: Tue Dec 21, 2004 8:35 pm
Posts: 600
Location: Argentina
thx again.

and my two last questions (at least in this post):

when exactly mmc3 slcounter is hited? i mean i have been hiting it when a scanline in the range 0.. 239 reaches at cc count 340, but it seems to give me problems, some games dont run (bart vs the world, gi-joe).
Is it the 6502 "nmos programming manual" a good source to extract from it the cpu cycles?.

_________________
ANes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 3:35 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Anes wrote:
when exactly mmc3 slcounter is hited?


On the rising edge (0 -> 1) of the PPU A12 line -- but only if it's been low for several (at least 9) PPU cycles. Under "normal" conditions this occurs:

- when the game changes the PPU address to flip on bit 12 from an off state ($0xxx -> $1xxx)

- on cycle 260 in the scanline (the first sprite CHR fetch)


For the nitty gritty details (if you want a super-accurate counter), you'll have to be familair with what fetches the PPU makes and when. BT's ppu doc is a good reference:

http://nesdev.com/2C02%20techn ... erence.TXT

Although the info in that doc which actually discusses the MMC3 counter is wrong (he says A13 when it's really A12)

Quote:
Is it the 6502 "nmos programming manual" a good source to extract from it the cpu cycles?.


This doc is always good:

http://www.obelisk.demon.co.uk/6502/reference.html

Or if you want details on which bytes are read/written on which cycles... the section near the bottom of this doc is great:

http://nesdev.com/6502_cpu.txt


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 7 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