z80 clocks

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

z80 clocks

Post by sigflup » Thu Feb 13, 2014 7:02 pm

I'm assuming 59659 z80 clocks per ntsc vbank and 70937 z80 clocks per pal vblank. Does this sound right?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: z80 clocks

Post by Chilly Willy » Sat Feb 15, 2014 1:55 am

sigflup wrote:I'm assuming 59659 z80 clocks per ntsc vbank and 70937 z80 clocks per pal vblank. Does this sound right?
Nope. Not sure about PAL off the top of my head, but you used 60Hz for the NTSC frame rate, and that's wrong. The NTSC MD runs at 59.92Hz (off the top of my head - broadcast NTSC is 59.96Hz). You'd best look it up in the docs. In any case, it's NOT 60Hz.

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) » Sat Feb 15, 2014 2:10 am

Z80 has 228 cycles per line (exactly).

There's 313 lines in 50Hz and 262 in 60Hz

71364 cycles for 50Hz for whole frame, 20292 for VBL area in 224 line res.
59736 cycles for 60Hz for whole frame, 8663 for VBL area in 224 line res.
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

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Feb 15, 2014 2:51 am

But it's NOT 60Hz! It's 53693175/15/262/228 = 59.922743404 Hz. And those are all the values you need to figure out all the NTSC values. For PAL, use 53203424 for the master clock.

EDIT: But it's still 262x228 cycles in NTSC, which is what Tiido gave. So he's right on that, even if you rounds off his vblank rate. :lol:

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) » Sat Feb 15, 2014 3:30 am

Cycles per line is only thing that matters and it is constant regardless of region. For actual time you bring in the master clock values, but actual time does not matter, just cycles per line.
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

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Sat Feb 15, 2014 1:58 pm

Where I can read about whole trace of beam on screen?
I want to have all info about full screen
1) Its full resolution with background borders
2) Draw order of lines
3) VBLANK period lines
4) Placement of MD screen
For both: NTSC/PAL in all modes (320x224, 256x224...)
Or, can you tell it? :)

Edit:
TmEE co.(TM) wrote:There's 313 lines in 50Hz and 262 in 60Hz
English wikipedia says: 312.5 and 262.5.
625 and 525 all lines, and 576 visible lines compared with 480 lines in NTSC.
In wikipedia no info about horizontal resolution, and where is those 480 visible lines :(
Image

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Feb 15, 2014 6:19 pm

The half lines mentioned in wikipedia are for interlaced mode. In interlaced mode on the MD, you'll have that half line. 240 line progressive (NTSC) is just 262 lines at 59.92Hz.

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Sat Feb 15, 2014 6:31 pm

Do you telling me that MD connected to TV is showing Progressive image instead of interlaced? I thought that TV is always show in interlaced mode.

And another question, when you connecting witch composite AV cabble, is image same? (in Interlaced/Progressive terms).

I don't want to speak about MD internal image, because there is no such image. There is always one beam on screen calculated from VDP memory (planes, sprites, backdrop...)

I want to understand RAW image output of MD (I want to call it so).
Image

LocalH
Very interested
Posts: 152
Joined: Tue Dec 19, 2006 5:04 pm

Post by LocalH » Sat Feb 15, 2014 7:49 pm

Speaking from NTSC land here. The half-line causes the TV's raster to "fill in the spaces" between the lines of the first field with those of the second field, generating a 525-line interlaced display. Literally the only difference between 240p and 480i is that half-line. Technically, in 240p, you still have "upper" and "lower" fields, but they're superimposed on top of each other rather than being offset approximately half the thickness of a standard scanline.

This is true regardless of the connection method, whether it be RF' composite, RGB, or a modded system outputting s-video or component. Although it's increasingly common for new sets to lack the capability to handle 240p over component for some reason, although it seems like it'd take more work not to support it than to support it, but I digress as that's not relevant to the actual output of the MD.

LocalH
Very interested
Posts: 152
Joined: Tue Dec 19, 2006 5:04 pm

Post by LocalH » Sat Feb 15, 2014 7:49 pm

Edit: delete please, for some reason my iPad double-posted, and tis isn't the only time I've had it happen. Perhaps a side effect of using Chrome's "reduce data usage" feature.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Feb 16, 2014 8:47 pm

LocalH wrote:Speaking from NTSC land here. The half-line causes the TV's raster to "fill in the spaces" between the lines of the first field with those of the second field, generating a 525-line interlaced display. Literally the only difference between 240p and 480i is that half-line. Technically, in 240p, you still have "upper" and "lower" fields, but they're superimposed on top of each other rather than being offset approximately half the thickness of a standard scanline.
Exactly right.
This is true regardless of the connection method, whether it be RF' composite, RGB, or a modded system outputting s-video or component. Although it's increasingly common for new sets to lack the capability to handle 240p over component for some reason, although it seems like it'd take more work not to support it than to support it, but I digress as that's not relevant to the actual output of the MD.
Yeah, it's irritating when TVs assume the signal is always 480i. Makes your old consoles look weird. I've kept my old Toshiba TIMM CRT monitor just for that reason... and it works great with those old lightguns, which is another pain associated with new TVs and old consoles.

@r57shell - Most MD games are progressive, but there are a few that use interlaced, like two player Sonic games.

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Mon Feb 17, 2014 2:59 pm

Chilly Willy wrote:@r57shell - Most MD games are progressive, but there are a few that use interlaced, like two player Sonic games.
As I told, I don't want to speak about "internal" MD screen. I want to know about output signal.

There ARE many games that works on 60 framerate with non-interlaced mode in VDP settings, and EVERY 60 frames are DIFFERENT. And my question is what TV will show. As I think, it will show 480 lines where 240 lines from one frame, and 240 from previous frame (at lower brightness, because of falloff) at top of each other (Interlaced).

And, there still no answers for other questions. :(
Image

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Mon Feb 17, 2014 4:33 pm

r57shell wrote: As I told, I don't want to speak about "internal" MD screen. I want to know about output signal.
output signal is either interlaced (used in only a very few games) or non-interlaced (most games). The later is not really progressive video signal but rather a slightly desynced interlaced video signal which makes each field appearing on top of each other (instead of being "interlaced")

Some stuff to remember to understand how it works:

(1) one interlaced frame (480 lines) is composed of two fields: one is used to display even lines (240 lines) and the other is for odd lines (240 lines)

(2) each field is refreshed every 1/60s (approx.) so a whole frame (480 lines) is refreshed every 1/30s

(3) TV are only driven by the analog signals and they will "jump" to the next line/field depending on the SYNC signal they receive from MD

And my question is what TV will show. As I think, it will show 480 lines where 240 lines from one frame, and 240 from previous frame (at lower brightness, because of falloff) at top of each other (Interlaced).
(1) when MD is configured to output a non-interlaced signal, TV will only show even lines (240 lines) on each field: odd lines are never displayed and will appear as blank lines.

(2) when MD is configured to output an interlaced signal, TV will display even lines during 1st field and odd lines during 2nd fields, which make all 480 lines being refreshed.

There is no lower brightness because lines overlaps.
And, there still no answers for other questions. :(
full Horiz. resolution with borders is 283 pixels (13 + 256 + 14) or 347 (13 + 320 + 14), cf. this thread:
viewtopic.php?t=519


full Vert. resolution with borders should be 243 lines in NTSC mode(11+224+8 ) and 294 lines in PAL modes (38+224+32 or 30+240+24), cf. some notes from Charles:
viewtopic.php?t=768&start=4

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Mon Feb 17, 2014 5:03 pm

Eke wrote:(3) TV are only driven by the analog signals and they will "jump" to the next line/field depending on the SYNC signal they receive from MD
I got it, so TV is still in interlaced mode but always show only odd (or even) line. Now everything clear for me.
May be it's somehow depends on VDP register corresponding to interlaced mode, that one which always alternating 0/1 in interlaced mode?

Thank you so much.
I'll check links later.
Image

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Wed Feb 19, 2014 12:32 pm

Eke wrote:full Horiz. resolution with borders is 283 pixels (13 + 256 + 14) or 347 (13 + 320 + 14),
Now I wonder how stretching in 256 mode is working?

And, if both fields on same lines then is it still 525 lines or 524 or 526?
In NTSC standard odd number of lines chosen not accidentally.
Image

Post Reply