It is currently Mon Jun 24, 2019 2:43 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Nov 19, 2018 6:37 am 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 514
I'd like to compile a list of common time measurements to serve as a programming reference.
Code:
NTSC Scanline = 113.667 CPU cycles
NTSC NMI = 2273 CPU cycles
NTSC Frame = 29780.667 CPU cycles
NTSC PPU cycles / CPU cycles = 3

PAL Scanline = 106.5625 CPU cycles
PAL NMI = 7459.375 CPU cycles (too low?)
PAL Frame = 33247.5 CPU cycles
PAL PPU cycles / CPU cycles = 3.2

OAM DMA = 513 cycles (+1 on odd CPU cycles)

Do these numbers look right? Most of them I had to calculate myself because I couldn't find them on the wiki, and I'm pretty sure I made mistakes.

I'd also like to include a reference to the delay DMC can add, but I've had a real tough time finding information on this. I think in the worst case it can add 4 cycles every 432 cycles? Is that correct?


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 12:04 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4115
Location: A world gone mad
The only pages that mention CPU cycle correlations are these:

https://wiki.nesdev.com/w/index.php/PPU#Notes
https://wiki.nesdev.com/w/index.php/Con ... ronization
https://wiki.nesdev.com/w/index.php/PPU_frame_timing

Other places are nesdev forum threads, which are not as helpful (re: not as organised). We really should have a cycle breakdown chart somewhere (i.e. I'm sorry you had to calculate these by hand).


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 12:09 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8387
Location: Seattle
I'd say that that information is all here, but since these are mostly properties of the PPU we expressed them there in terms of pixels and scanlines, not CPU cycles.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 2:14 pm 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 896
Location: Denmark (PAL)
Yeah it would be a really good idea to expand that list with exact cycle counts. Or create a dedicated page for that. It's something I need a lot, and I always forget where to look.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 4:33 pm 
Online
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 618
Location: Central Illinois, USA
I spent awhile digging through the wiki when I first started a couple years ago, and was bummed that this didn't exist in a page. Thanks for putting it in one place.

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 4:51 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4115
Location: A world gone mad
lidnariq wrote:
I'd say that that information is all here, but since these are mostly properties of the PPU we expressed them there in terms of pixels and scanlines, not CPU cycles.

Not to mention, only two pages on the entire Wiki reference that "Clock rate" page:

https://wiki.nesdev.com/w/index.php/NES_reference_guide -- "Clock rate of various components in different variants of NES"
https://wiki.nesdev.com/w/index.php/Detect_TV_system -- "A game can use it to compensate for differences in clock rate among various NES models."

Nothing else links to it, not even in References or See also or Notes or anything. It's no wonder nobody can find this page of super useful info! :-) (I've seen that page a couple times but I never remember where to find it either.)

And yes, having correlating CPU cycle counts (or at what particular CPU cycle something happens at from start of VBlank) would be super useful, as coders are going to need to know exactly this. I don't know if such information should go into the "Clock rate" page, or a separate page.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 4:58 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7509
Location: Canada
Sumez wrote:
Yeah it would be a really good idea to expand that list with exact cycle counts. Or create a dedicated page for that. It's something I need a lot, and I always forget where to look.

I would say that "Clock rate" is already the dedicated page for it. The problem is more about naming and discovery.

My question would be: what name for such an article would have permitted you to find it? What search terms did you use when looking for it?


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 6:23 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2302
Location: Fukuoka, Japan
It could be accessible from the nes reference guide and could be created as a link under clock rate. The name could be something like "cycle reference chart", which an explanation after the link that say it explain this is contains a chart for CPU cycle for specific task on the nes.

It could be a start and the naming (and english) could be improved later.

edit:

created place holder, always wanted a page like that:

http://wiki.nesdev.com/w/index.php/Cycl ... ence_chart


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 7:20 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11371
Location: Rio de Janeiro - Brazil
If this is supposed to be accurate, I don't think we should be rounding numbers.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 7:32 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2302
Location: Fukuoka, Japan
Sure, this is why it's a place holder and we can improve it anyway we like. It just a start and we now have a page for it ;)


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 8:00 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7509
Location: Canada
I think that page should either redirect to the Clock rate article or the other way around, rather than create two parallel articles with subtly different sets of the same information. "Cycle reference chart" is probably the better name, so my vote is to make "Clock rate" the redirect.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 8:32 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2302
Location: Fukuoka, Japan
This is perfectly fine too. For some reason the clock rate never got my attention by the title only so I never thought of looking there ^^;;

The goal was to get the ball rolling so now it is! The new chart is basically more some reference so developer knows what to do with their code so it could be an addendum to the current article with a proper link at the top so it could this be easily found.

What I would like to make someday (which I was hoping to do 10 years ago) is a section with simple "how-to" for dev and I think that chart is one of those since it's not specifically technical on "how" it happen behind the scene but more on "how much" a unit take time, which is very useful for timing code.

No rush to move it yet but will check the clock rate later to see how to incorporate it inside.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 10:07 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4115
Location: A world gone mad
I'll take care of merging the two pages, and making "Clock rate" redirect to the new page.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 10:48 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4115
Location: A world gone mad
All done. I fixed some typos, properly made references, and added Dendy details.

I'm still in the process of cleaning up redirections on all the other pages (I know I don't have to do this, but consistency is good).

Edit: all pages have been updated, excluding the Talk pages, which I opted to leave alone for obvious reasons.


Top
 Profile  
 
PostPosted: Mon Nov 19, 2018 11:23 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2302
Location: Fukuoka, Japan
All in one table, even better now.

Should hblank be added too? I think it was useful information when timing raster.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] 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