Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - SMS Timings NTSC/PAL?

Reply to topic
Author Message
Michael Montageu
  • Guest
Reply with quote
SMS Timings NTSC/PAL?
Post Posted: Tue Oct 19, 1999 12:10 am
I'm having horrible trouble getting the timing on my SMS emulator to work very well, as none of this info seems to be clearly documented.

Does anyone know how fast the Z80 is running with regards to the 60hz of NTSC? (If there are 60 VBlanks a second, how many or cycles can the Z80 perform per VBlank?)

Also, has anyone else written a complete emulator that runs native to Win9x? Maybe then I can stop mine. ;)

- Mike
 
Nyef
  • Guest
Reply with quote
Post Posted: Tue Oct 19, 1999 12:39 am
Quote
> I'm having horrible trouble getting the timing on my SMS emulator to work very well, as none of this info seems to be clearly documented.

Oh, it's very clearly documented... In the archives of an NES mailing list.

(I'm not kidding, either)

Quote
> Does anyone know how fast the Z80 is running with regards to the 60hz of NTSC? (If there are 60 VBlanks a second, how many or cycles can the Z80 perform per VBlank?)

The Z80 runs at the NTSC color subcarrier frequency (3.579545 MHz).

There are 262 scanlines per frame (synonymous with field, because we're non-interlaced).

At 192 active lines per frame we have 262 - 192 = 70 inactive lines per frame. Feel free to assume that these are the VBlank, I do.

I also worked the number of CPU cycles (T states, not M cycles) per scanline out to 227.5, for what good that does. :-)

I do not have figures for a PAL system, but I may take the time to work them out based on the figures I already have and the value of XTAL1 in my PAL SMS II.

Quote
> Also, has anyone else written a complete emulator that runs native to Win9x? Maybe then I can stop mine. ;)

I have heard reports that DarcNES + WinAllegro is servicable.

Quote
> - Mike

--Nyef
 
Michael Montague
  • Guest
Reply with quote
Post Posted: Tue Oct 19, 1999 6:54 am
Quote
> > I'm having horrible trouble getting the timing on my SMS emulator to work very well, as none of this info seems to be clearly documented.

> Oh, it's very clearly documented... In the archives of an NES mailing list.

> (I'm not kidding, either)

This might show my ignorance, but do NES timings help SMS emulation? I thought the NES was a 6502/6510 varient? I don't know much about NES hardware ...


Quote
> > Does anyone know how fast the Z80 is running with regards to the 60hz of NTSC? (If there are 60 VBlanks a second, how many or cycles can the Z80 perform per VBlank?)

[Excellent answer cut]

AWESOME! Thanks very much that is *exactly* what I was looking for. If anyone can chime in with the PAL timings I'd be interested in those as well.

Quote
> > Also, has anyone else written a complete emulator that runs native to Win9x? Maybe then I can stop mine. ;)

> I have heard reports that DarcNES + WinAllegro is servicable.

NES or SMS? My main reason for writing an SMS emulator is to have a fast, free, working SMS emulator native to Win9x/NT. (So it can run in a window or full screen.)

- Mike
 
JM Delgado
  • Guest
Reply with quote
Post Posted: Tue Oct 19, 1999 10:24 am
Hello :)

In mu emulator Calypso, the unique difference between NTSC and PAL is the timing function I used to the automatic frameskip, 60 VBlanks in NTSC and 50 in PAL. The z80 clock is the same.

You can view how to make a directX emulator in the sources of DGen, available on http://www.dtmnt.com or something else.


Saludos,
Jose Manuel Delgado
 
Michael Montague
  • Guest
Reply with quote
Post Posted: Tue Oct 19, 1999 11:13 am
Quote
> In mu emulator Calypso, the unique difference between NTSC and PAL is the timing function I used to the automatic frameskip, 60 VBlanks in NTSC and 50 in PAL. The z80 clock is the same.

> You can view how to make a directX emulator in the sources of DGen, available on http://www.dtmnt.com or something else.

So a PAL machine is 228 Tcycles a scanline, 262 scanlines a frame, and 50 frames a second? (Given of course that only 192 scanlines are actually displayed, just like NTSC.)

That would actually make sense ...

Thanks for all your help! My emulation is running almost flawlessly now. The only trouble I'm having is some sprite strangeness in AstroWarrior ...

- Mike
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Post Posted: Tue Oct 19, 1999 9:10 pm
Quote
> Also, has anyone else written a complete emulator that runs native to Win9x? Maybe then I can stop mine. ;)

Meka32 ?
*hint* *hint*
  View user's profile Send private message Visit poster's website
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Post Posted: Tue Oct 19, 1999 9:12 pm
Quote
> Thanks for all your help! My emulation is running almost flawlessly now. The only trouble I'm having is some sprite strangeness in AstroWarrior ...

Wow, if it is the only trouble then I guess you got a perfect emulator - release it! :)

As for Astro Warrior, well.. it take advantages of the VDP latch feature.
When setting a VDP address for reading, the address is set, the value latched is a buffer, then the address is incremented.
So if you set the VDP for reading and then write to it, it will actually write to address+1
  View user's profile Send private message Visit poster's website
Michael Montague
  • Guest
Reply with quote
Re: VDP Latches [Was: SMS Timings NTSC/PAL?]
Post Posted: Tue Oct 19, 1999 11:55 pm
Quote
> > Thanks for all your help! My emulation is running almost flawlessly now. The only trouble I'm having is some sprite strangeness in AstroWarrior ...

> Wow, if it is the only trouble then I guess you got a perfect emulator - release it! :)

> As for Astro Warrior, well.. it take advantages of the VDP latch feature.
> When setting a VDP address for reading, the address is set, the value latched is a buffer, then the address is incremented.
> So if you set the VDP for reading and then write to it, it will actually write to address+1

Yeah, this isn't emulated 100% correctly by my emulator yet. Omar[MEKA] also pointed out that problem. That should be fairly easy to fix as my VDP emulation needed cleaning up anyway!

I'll definatly release it once it is in a stable state, but there is so much more to add! Joystick support, sound, music, GG emulation. I guess those are the major things.

I imagine I'll have a whole set of new questions when I start emulating the sound!

- Mike
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Who is that Omar ?
Post Posted: Wed Oct 20, 1999 9:37 am
Quote
> Yeah, this isn't emulated 100% correctly by my emulator yet. Omar[MEKA] also pointed out that problem.

For your information, Omar Cornut = Zoop.

Quote
> I'll definatly release it once it is in a stable state, but there is so much more to add! Joystick support, sound, music, GG emulation. I guess those are the major things.
> I imagine I'll have a whole set of new questions when I start emulating the sound!

Depends if you wrap the music/sound to the Adlib (as in Master Gear) or if you want to do realtime wave synthesis (as in Meka)
  View user's profile Send private message Visit poster's website
Michael Montague
  • Guest
Reply with quote
Re: Who is that Omar ?
Post Posted: Wed Oct 20, 1999 10:39 am
Quote
> For your information, Omar Cornut = Zoop.

Wow, now I feel *REALLY* stupid!

Quote
> Depends if you wrap the music/sound to the Adlib (as in Master Gear) or if you want to do realtime wave synthesis (as in Meka)

Most likely I'll end up using wave synthesis since the target platform is Windows and there is no reliable way to access Adlib hardware specifcally.

Juding by all the bugs I found tonight I still have a lot more to do. The VDP now acts properly, however I seem to have added a bug in the horizontal scrolling. That's going to be a fun bug to find, especially since it worked fine yesterday. :)

-Mike
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
VDP lines..
Post Posted: Wed Oct 20, 1999 8:23 pm
Quote
> Juding by all the bugs I found tonight I still have a lot more to do. The VDP now acts properly, however I seem to have added a bug in the horizontal scrolling. That's going to be a fun bug to find, especially since it worked fine yesterday. :)

Hehe good luck :)
Are you using a line-per-line graphic engine?
  View user's profile Send private message Visit poster's website
Michael Montague
  • Guest
Reply with quote
Re: VDP lines..
Post Posted: Thu Oct 21, 1999 12:12 am
Quote
> > Juding by all the bugs I found tonight I still have a lot more to do. The VDP now acts properly, however I seem to have added a bug in the horizontal scrolling. That's going to be a fun bug to find, especially since it worked fine yesterday. :)

> Hehe good luck :)
> Are you using a line-per-line graphic engine?

Yup! It draws each scanline every 228 T States of the Z80 and sends the appropriate interrupts. For some reason every so often my emu decides to ignore H-Scroll for a frame. Very ugly I must say.

I guess if I don't find it soon I can just start by rewriting the scan line draw code. Its amazing how trying to speed up rendering can totally break that function. (static variables are your friend!)

Sometime soon I'll have to send you the code so you can laugh. It's all C++ and I'm having to do so many tricks for speed its humerous. :)

- Mike
 
  • Joined: 29 Jun 1999
  • Posts: 383
  • Location: Brazil
Reply with quote
hum :/
Post Posted: Thu Oct 21, 1999 1:27 pm
Quote
> I'm having horrible trouble getting the timing on my SMS emulator to work very well, as none of this info seems to be clearly documented.

> Does anyone know how fast the Z80 is running with regards to the 60hz of NTSC? (If there are 60 VBlanks a second, how many or cycles can the Z80 perform per VBlank?)

> Also, has anyone else written a complete emulator that runs native to Win9x? Maybe then I can stop mine. ;)

> - Mike


I would love to understand what you all talked in this discussion :/
  View user's profile Send private message Visit poster's website
Michael Montague
  • Guest
Reply with quote
Post Posted: Sat Oct 23, 1999 8:44 am
Quote
> Meka32 ?
> *hint* *hint*

Oh? I hadn't heard about it until you just mentioned it.

How does one obtain it?

- Mike
 
Reply to topic



Back to the top of this page

Back to SMS Power!