VirtuaNES region constants

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

VirtuaNES region constants

Post by Eugene.S »

Hi, nesdev. I want to add Hybrid(Dendy) mode into VirtuaNES 0.97 for personal desire.

nes.cpp (original v0.97):

Code: Select all

NESCONFIG NESCONFIG_NTSC = {
	21477270.0f,	// Base clock
	1789772.5f,		// Cpu clock

	262,			// Total scanlines

	1364,			// Scanline total cycles (15.75KHz)

	1024,			// H-Draw cycles
	340,			// H-Blank cycles
	4,			// End cycles

	1364*262,		// Frame cycles
	29830,		// FrameIRQ cycles

	60,			// Frame rate (Be originally 59.94Hz)
	1000.0f/60.0f	// Frame period (ms)
};

NESCONFIG NESCONFIG_PAL = {
	26601714.0f,		// Base clock
	1662607.125f,		// Cpu clock

	312,			// Total scanlines

	1278,			// Scanline total cycles (15.625KHz)

	960,			// H-Draw cycles
	318,			// H-Blank cycles
	2,			// End cycles

	1278*312,		// Frame cycles
	33252,		// FrameIRQ cycles

	50,			// Frame rate (Hz)
	1000.0f/50.0f	// Frame period (ms)
};

But i doubt about constants.
How was calculated FrameIRQ cycles, scanline total cycles, H-Draw, H-Blank and End cycles?

P.S. I've already able to slowdown NTSC-mode to 50FPS, so it looks like Dendy. But i want to do it "right" way.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: VirtuaNES region constants

Post by lidnariq »

Without knowing how these numbers are used elsewhere, it's hard to say, but a naïve interpretation (based on the NTSC numbers here) implies the PAL numbers are all weird.
I'm really confused by that 1278. The number "ought" to be 1705. ((5 chroma phases per pixel)×(341 pixels) on each scanline).
Similarly, all the subsequent numbers are weird too: 960 "should" be 1280 (5×256), 318 "should" be 425 (5×85), "end cycles" "should" be 0 (there's no prerender missing pixel on the 2C07).

The Frame IRQ timing was measured manually on the NTSC NES. I don't know that anyone's ever sat down and measured that timing on a PAL NES or Dendy.
Post Reply