It is currently Wed Sep 19, 2018 5:27 pm

 All times are UTC - 7 hours

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: stupid question (PPU)Posted: Tue Aug 30, 2005 8:45 am

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

 Post subject: Posted: Tue Aug 30, 2005 8:50 am

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
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

 Post subject: Posted: Tue Aug 30, 2005 1:11 pm

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"?.

_________________
ANes

Top

 Post subject: Posted: Tue Aug 30, 2005 2:14 pm

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
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

 Post subject: Posted: Tue Aug 30, 2005 2:45 pm

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

 Post subject: Posted: Tue Aug 30, 2005 3:35 pm

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 6 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: Google [Bot] and 6 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki