What are the 68K/Z80 clock spes for NTSC v PAL machines?

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
sbroumley
Interested
Posts: 29
Joined: Wed Feb 11, 2009 11:23 pm

What are the 68K/Z80 clock spes for NTSC v PAL machines?

Post by sbroumley » Fri Apr 03, 2009 8:07 pm

I'm looking into an issue where I've setup the emulated IO system VMOD and MODE into I'm running a PAL rom:

PSG/YM2612 music tempo and frequency is playing at the correct speed, but YM2612 DAC sample playback is pitched down. The DAC is being driven by the Z80 which for my current PAL implementation is running about 16% slower (as it the 68K) than NTSC.

Do PAL machines have slower running Z80's than NTSC machines or should the clock speed be the same speed for both?

cheers
Steve.
Last edited by sbroumley on Fri Apr 03, 2009 8:16 pm, edited 1 time in total.

Jorge Nuno
Very interested
Posts: 374
Joined: Mon Jun 11, 2007 3:09 am
Location: Azeitão, PT

Post by Jorge Nuno » Fri Apr 03, 2009 8:09 pm

PAL have little slower clocks in everything becuase the oscillator is 53.2034MHz instead of 53.69??MHz in NTSC machines

Z80 is 53.2034/15 MHz
68k and YM are 53.2034/7 MHz
(in PAL MDs)

sbroumley
Interested
Posts: 29
Joined: Wed Feb 11, 2009 11:23 pm

Post by sbroumley » Fri Apr 03, 2009 8:32 pm

Okay I think I might know what my issue is then. I'm not taking into account that PAL has more scan lines than NTSC.

My current emulation main loop grabs a DAC sample once per NTSC scan line (224 active, 38 vblank = 262). I assume my main loop will need updating to take into account the extra PAL scan lines then DAC pitch should be correct. Is that what other people are doing for PAL emulation?

thanks for your help,
Steve

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Apr 03, 2009 8:40 pm

Exact PAL master clock is 53203424Hz, I have forgotten NTSC one, its only slightly higher... all stuff is divided from the master clock

...and checking if something is written to DAC reg of YM2612 on a scanline is lousy... my MD music system will have terrible PCM if things work like that...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

sbroumley
Interested
Posts: 29
Joined: Wed Feb 11, 2009 11:23 pm

Post by sbroumley » Fri Apr 03, 2009 8:46 pm

...and checking if something is written to DAC reg of YM2612 on a scanline is lousy... my MD music system will have terrible PCM if things work like that...
Haha..yes it is, but the platform I'm coding on is very slow....

sbroumley
Interested
Posts: 29
Joined: Wed Feb 11, 2009 11:23 pm

Post by sbroumley » Fri Apr 03, 2009 8:55 pm

Ok - I think I'm going crazy. Extra lines or no extra lines 50hz is 50hz. So if a game ROM is for both NTSC and PAL, sample play back for PAL will be lower pitched unless the z80 code compensates for it.

I might be missing reporting my genesis emulator is in PAL mode correctly (what does the z80 read for this?).
The related systems I've implemented so far are the VMOD/MODE settings in the IO system and bit 0 of reading the VDP control port.

Are there any other systems that need to report the system is a PAL system?

cheers,
Steve.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Apr 03, 2009 9:27 pm

the PCM pitch should not change at all (well, only minimally, 0.1KHz perhaps)... but only if you swap out master clock... if you just change 50/60Hz setting then nothing but Vint ant line count changes, and a bit in the ID reg and VDP status port... and fast VDP data transfer period... in 50Hz you have ~50% more fast DMA time.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Fri Apr 03, 2009 11:03 pm

sbroumley wrote:Ok - I think I'm going crazy. Extra lines or no extra lines 50hz is 50hz. So if a game ROM is for both NTSC and PAL, sample play back for PAL will be lower pitched unless the z80 code compensates for it.
Nope - because the framerate has nothing to do with how fast the Z80 whacks out samples. Give it the proper number of scanlines (313 for PAL) and it'll all be fine, the difference ends up being minimal.

If it helps to think of it this way - z80 putting out one sample per scanline would get:

NTSC: 262 scanlines * 60 fps = 15720 per sec
PAL: 313 scanlines * 50 fps = 15650 per sec.

sbroumley
Interested
Posts: 29
Joined: Wed Feb 11, 2009 11:23 pm

Post by sbroumley » Fri Apr 03, 2009 11:33 pm

I got it guys and it all makes sense given your info Snake.

My problem was simply for PAL I was still doing an NTSC inner loop (262 lines) so playback was stretching 262 samples instead of 313 samples over 1/50 sec (so it slowed the sample down compared to NTSC playback).

cheers,
Steve

notaz
Very interested
Posts: 193
Joined: Mon Feb 04, 2008 11:58 pm
Location: Lithuania

Post by notaz » Sat Apr 04, 2009 8:42 pm

sbroumley wrote: Haha..yes it is, but the platform I'm coding on is very slow....
What platform are you coding for?

Post Reply