Differences between PAL Famiclones/Dendy and official NES/Famicom timings (F.A.Q.)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Posts: 298
Joined: Sat Apr 18, 2009 4:36 am
Location: Russia (UTC+3)

Differences between PAL Famiclones/Dendy and official NES/Famicom timings (F.A.Q.)

Post by Eugene.S » Fri Sep 25, 2020 2:02 am

Old topic was totally obsolete/mess.

So it has been found over the years that there are 3 types of NES timing:

1. Official NTSC NES and Famicom.
2. Official PAL NES.
3. Pirate PAL Famiclone, including Dendy.

This timing is called Dendy mode in most of modern emulators due to historical reasons.
It is an NTSC/PAL hybrid, a described below:

- Crystal oscillator freq. (XTAL) = 26.601712 Mhz
- CPU clock freq. (XTAL/15) = 1.7734475 MHz, which is much closer to NTSC NES/Famicom, than to original European PAL NES.
- PPU clock freq. (XTAL/5) = 5.3203424 Mhz, which is same as European PAL NES.

- So, CPU:PPU clock ratio is the same for NTSC and Dendy, and equal to 1:3
In other words PPU renders 3 pixels per 1 CPU cycle. For the PAL NES this ratio is 1:3.2

- The length of VBlank after NMI is the same for NTSC and Dendy (20 scanlines), and differs from PAL NES (70 scanlines).
The full length of VBlank is as long as PAL's, but postrender period is longer (by 50 additional scanlines)
so NMI occurs toward the end of VBlank (line 291 instead of 241).
This trick makes VBlank length after NMI remain the same as NTSC, so any game using a CPU cycle-counting mapper working.

- Noise and DMC logic (APU LUTs in emulators) are same as NTSC NES/Famicom
It means that Dendy and similar PAL Famiclones were designed in order to provide the maximum compatibility to Japanese and American games of NTSC region, to the detriment of the official PAL NES library (not widely used in Asia). In other words Dendy allows running NTSC games at 50 FPS while maintaining compatibility with them, unlike official PAL NES.

* If you try running NTSC games on an official PAL NES (bypassing the lockout chip), or on an emulator in PAL mode, they will also run at 50 FPS, but many of them will start artifacting, and some will even freeze.
In addition, we will hear an imbalance between the pitch of the PSG and DMC channels (Sunsoft games with DPCM-bass for example).
On dendy it sounds correct.
All this happens due to the incompatibility of timings.

Many thanks to HardWareMan, without whom these studies would not have become reality; as well as nesdev.com community and the authors of popular emulators, who willingly supported the initiative.

The list of emulators supporting Dendy mode:
- RetroArch [libretro] (nestopia, fceumm, mesen)
- Nestopia 1.40, Nestopia UE
- FCEUX 2.2.3
- Nintendulator
- Mesen
- puNES
- BizHawk
- My NES
- Nintaco
- RetroCopy
- nes.emu (iOS/Android)
- nsfplay 2.3 (NSF player)

1. - Why is this timing called "Dendy"? Wouldn’t it be better to call it “PAL Famiclone”?
After all, a bunch of different clones all over the world worked on these timings!
The short answer is that it happened so due to historical reasons.

When our emu-russia team began this research in 2007-2008, such details were not yet known. We started to investigate the differences between Dendy and Famicom and NES, and it turned out that we found a common timing that almost all PAL Famiclones work on.
These consoles were used in Asia, the CIS countries and Eastern Europe under hundred of different brand names.

The technically correct name for this timing:
"PAL-Famiclone with NTSC-like timing" or "NTSC / PAL Hybrid", but it sounds cumbersome. Therefore, the foreign community officially agreed to call it "Dendy". Moreover, this name was already familiar to westerners. Marat Fayzullin and Alex Krasivsky, who were at the origin of NES emulation, previously mentioned it in their documents.

This timing is called "Dendy" in nesdev.wiki documentation and in the source code of almost all emulators, thus renaming everything from scratch would be a huge mess.

Moreover, it turned out that there were PAL Famiclones operating on the official PAL NES timings, but they were rare and were finally replaced by models with Dendy timing. Thus "PAL Famiclone" name can’t be used as common for all consoles operating in this mode.
2. - I'm confused! It’s written PAL on my Dendy (Lifa / Kenga / Subor / MicroGenius / Pegasus, etc.)!
Does that mean I have to use games for PAL region (Europe)?
The short answer is no, it doesn't.

Do not confuse hardware timing with video output standard. PAL NES and PAL Famiclones (including Dendy) output PAL signal (50Hz). Some clones output SECAM, but it doesn't matter in this context, and it can be equated with PAL.

Due to hardware differences:
- PAL NES must use PAL ROMs (Europe)
- PAL Famiclones (with Dendy timing), Famicom and NTSC NES must use NTSC ROMs (USA, Japan)
It’s described in detail up above why it’s so.
Only few PAL Famiclones have the original PAL NES timing, but the chance of finding them is very low.

An additional explanation can be made:
The pirates had a task: to present the already existing Famicom NTSC games to the vast PAL region (countries of Asia, CIS, Eastern Europe, Latin America), where Nintendo did not officially release PAL NES.
But you couldn’t simply make a clone of the PAL NES, since its timing wasn’t suitable for this task. It’s likely Nintendo intentionally broke its compatibility with existing NTSC games,
making different Vblank length after NMI in PPU, greatly decreasing CPU frequency, and ruining multiple CPU:PPU clock ratio (1:3). So the game developers had to tweak most of them for European release.

Therefore, the Taiwanese pirates invented their alternative PAL, compatible with NTSC timing. You didn’t need to tweak anything in this case. Existing NTSC games just worked, only slower, with virtually no glitches. In other words, pirates made more adequate PAL than Nintendo had made in PAL NES. At least that was the opinion of emulators’ developers and engineers at nesdev.
3. - How can I check the timing of my console? How to check ROM in different operating modes using an emulator?
If you have a flash cartridge your best bet is to download the test ROM 240pee (by Damian Yerrick).
Timing (NTSC / PAL / Dendy) will be displayed in the lower right corner, and we can see additional details if we go to the "CPU Clock Speed" section.
Here is a screenshot showing which values correspond to different modes. That’s what real hardware should show, as well as cycle-accurate emulators: Mesen, puNES, Nintendulator, BizHawk, Nestopia. FCEUX is less accurate in this test.

If you don't have a flash cartridge you can take a game that is extremely sensitive to timing and evaluate its behavior visually.
For example let’s take the NTSC version of Battletoads and Double Dragon (U):

- There are no artifacts if playing on NTSC NES and Famicom.
- If launched on PAL NES (do not forget to bypass the lockout chip protection) the game will show artifact on the start screen and on the character selection screen, and also freeze before the start of level 1. If you jump directly to the third level with some cheating, you will see a shifted/shaky background. This is shown here.
- While running on PAL Famiclone (with Dendy timing), the start screen and the character select screen will occasionally shake simultaneously to the beat of the drum, as shown here.

There should be no other bugs. This solidly proves the high compatibility of Famiclones, since a game will totally freeze if VBlank length after NMI is other than NTSC.
The opposite example is also correct. European PAL version of Battletoads and Double Dragon (E) is also extremely sensitive to timing and will work fine only on the official PAL NES.
You can check that yourself if interested.
There are many other games for testing but the example above is illustrative enough, and it is quite sufficient for this F.A.Q.
All of the procedures with Battletoads described above can be carried out using emulators.
4. - What are the swapped duty cycles? I've heard something about it but I don't know what it is!
The NES sound generator can create square waves, which pulse width modulation can be equal to 12.5%, 25%, 50% and 75%. This allows you to get 3 different tones of the wave. The fourth tone (75%) is mirrored copy of 25% tone and sounds the same.

Some models of the chips used in the NTSC and PAL Famiclones had a hardware bug that the 25% and 50% tones were swapped. It’s not so bad, just "musical instruments" sound a little differently. This is especially well heard in Prince of Persia game.
Many emulators including FCEUX, puNES and Mesen can simulate this bug. See "Swap Duty Cycles" option. Having a flash cartridge you can check if the duty cycles on your clone are swapped using this test.
- "select" = 12.5%
- "start" = 25%
- "B" = 50%
- "A" = 75%

It's easy to check: If the chip has normal duty cycles then 25% and 75% sound the same.
If the duty cycles in the chip are swapped then 50% and 75% will sound the same.
5. - In my childhood Prince of Persia was freezing on my Famiclone, Jungle Book was very dark, and Lion King’s starting animation was completely green!
Glitches all around! Do you really want to emulate this too?
The short answer is no.

Famiclones were based on many different chips from different manufacturers. If you try to count all revisions there were several dozen of these chips (separated CPU/PPU, single-crystal CPU/PPU with external RAM, fully NoACs). And almost each of them had its own specific bugs/flaws.
Somewhere the duty cycles were swapped; somewhere there were obvious sound troubles (problems with the DMC, clicks of triangle channel); somewhere emphasis bits colored/darkened the picture more than necessary. And some of early UM6561 models even had serious issues with compatibility.

But despite all the flaws of specific chips they were all united by a common timing. And our main goal was to separate the main point from the secondary: Emulate the timing to run NTSC games with high compatibility, but not to emulate bugs that interfere with normal operation and which differs from model to model.
The only exception is the swapped duty cycles. It doesn’t negatively affect the operation of games, and it’s even can be considered as a feature that gives some Famiclone models its unique sound. This feature is strictly optional and is disabled everywhere by default.
6. - And why do we need emulation of this pirate staff?
NTSC games must be played on NTSC timing at 60FPS. Exactly how it’s intended to be by developers!
The answer is that first of all it is a technical and historical interest, and only after that the notorious "nostalgia".

We are primarily interested in emulating this unique timing. The nesdev.com community found it to be quite interesting, and technically even more adequate than in Nintendo’s official PAL NES.

Mainly due to Dendy mode the emulators creators came up with the idea of implementing an "overclock" by adding additional scanlines to pre- and post-render (Goodbye, Contra Force slowdowns!).
Besides there are around a dozen of pirate games that work correctly only on this hybrid timing.

We would like to add that this mode was highly appreciated abroad. And now the developers add it to emulators as a mandatory standard along with the official NTSC and PAL NES timings; similar as they do with Pentagon timings for ZX-spectrum.
emu-land and emu-russia topics

Technical information:
CPU Signals and Frequencies
Detect TV System
UMC UA6538 PPU die-shot
(3.45 MiB) Downloaded 119 times
(223.29 KiB) Downloaded 119 times

Post Reply