Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user hllerena78 ! (Registered 2019-08-20) You are not logged in 
CSDb User Forums


Forums > C64 Coding > Concerning PAL-NTSC-Differences: exact amount of available cycles per second
2016-04-07 11:21
Copyfault

Registered: Dec 2001
Posts: 254
Concerning PAL-NTSC-Differences: exact amount of available cycles per second

Don't know if this is the right forum to ask this, but I'll give it a try...

I'm wondering about the exact amount of cycles per second on a PAL machine compared to a NTSC machine. Up to now, my simple approach was as follows:

PAL-TV-Norm: 625 interlaced lines/frame, 50Hz
PAL-C64: 312 frames (=floor(625/2))
63 cycles per rasterline (no badline, no sprites)
20 cycles per rasterline (badline, no sprites)
-> total number of cycles per second (standard PAL-screen with badlines, no sprites) =
(no.of nonbadlines*cycles + no.of badlines*cycles)*no.of frames per second =
((312-25)*63 + 25*20)*50 = (287*63 + 25*20)*50 = (18081 + 500)*50 = 18581*50 = 929050 cycles/second

NTSC-TV-Norm: 525 interlaced lines/frame, 60Hz
NTSC-C64: 262 frames (=floor(525/2))
65 cylces per rasterline (no bl, no spr)
22 cylces on a badline (no spr)
-> total number of cycles per second (standard NTSC-screen with badlines, no sprites) =
(no.of nonbadlines*cycles + no.of badlines*cycles)*no.of frames per second =
((262-25)*65 + 25*22)*60 = (237*65 + 25*22)*60 = (15405 + 550)*60 = 15955*60 = 957300 cycles/second

However, I found different values on the internet. For example, AAY64 has a table with the following values:
+----------+--------+-------+---------+---------+---------+------------+
|   VIC    | Video  | # of  | Cycles/ | Cycles/ | Frames/ | System     |
|   Type   | system | lines |  line   | frame   | second  | Clock (Hz) | +----------+--------+-------+---------+---------+---------+------------+
|   6569   |  PAL-B |  312  |   63    |  19656  | 50.125  |   985248   |
|  6567R8  | NTSC-M |  263  |   65    |  17095  | 59.826  |  1022727   |
+----------+--------+-------+---------+---------+---------+------------+

While it is clear that my calculations take bl into consideration while the other values don't, I'm stuck with the following questions:
i. How does it come that there are 263 rasterlines on an NTSC-machine, while the TV-Standard is 525 interlaced lines which should give 525/2 = 262.5 -> 262 (just like the math would be in PAL world)?
ii. Is the no. of frames/second really as stated in the table? Does it mean that the 51st PAL-frame is already started before the end of the respective second? And for NTSC, that the 60th frame is not fully finished?

Every hint's welcome!
 
... 11 posts hidden. Click here to view all posts....
 
2019-05-05 21:14
JackAsser

Registered: Jun 2002
Posts: 1534
Quote: Don't know if this is the right forum to ask this, but I'll give it a try...

I'm wondering about the exact amount of cycles per second on a PAL machine compared to a NTSC machine. Up to now, my simple approach was as follows:

PAL-TV-Norm: 625 interlaced lines/frame, 50Hz
PAL-C64: 312 frames (=floor(625/2))
63 cycles per rasterline (no badline, no sprites)
20 cycles per rasterline (badline, no sprites)
-> total number of cycles per second (standard PAL-screen with badlines, no sprites) =
(no.of nonbadlines*cycles + no.of badlines*cycles)*no.of frames per second =
((312-25)*63 + 25*20)*50 = (287*63 + 25*20)*50 = (18081 + 500)*50 = 18581*50 = 929050 cycles/second

NTSC-TV-Norm: 525 interlaced lines/frame, 60Hz
NTSC-C64: 262 frames (=floor(525/2))
65 cylces per rasterline (no bl, no spr)
22 cylces on a badline (no spr)
-> total number of cycles per second (standard NTSC-screen with badlines, no sprites) =
(no.of nonbadlines*cycles + no.of badlines*cycles)*no.of frames per second =
((262-25)*65 + 25*22)*60 = (237*65 + 25*22)*60 = (15405 + 550)*60 = 15955*60 = 957300 cycles/second

However, I found different values on the internet. For example, AAY64 has a table with the following values:
+----------+--------+-------+---------+---------+---------+------------+
|   VIC    | Video  | # of  | Cycles/ | Cycles/ | Frames/ | System     |
|   Type   | system | lines |  line   | frame   | second  | Clock (Hz) | +----------+--------+-------+---------+---------+---------+------------+
|   6569   |  PAL-B |  312  |   63    |  19656  | 50.125  |   985248   |
|  6567R8  | NTSC-M |  263  |   65    |  17095  | 59.826  |  1022727   |
+----------+--------+-------+---------+---------+---------+------------+

While it is clear that my calculations take bl into consideration while the other values don't, I'm stuck with the following questions:
i. How does it come that there are 263 rasterlines on an NTSC-machine, while the TV-Standard is 525 interlaced lines which should give 525/2 = 262.5 -> 262 (just like the math would be in PAL world)?
ii. Is the no. of frames/second really as stated in the table? Does it mean that the 51st PAL-frame is already started before the end of the respective second? And for NTSC, that the 60th frame is not fully finished?

Every hint's welcome!


Can you guys help me fill in a complete table f.e. with for the following VICE types c64/c64c/c64old, ntsc/newntsc/oldntsc, drean, jap, c64gs, pet64, ultimax?

Specifically, master clock frequency, number of cycles per raster line and frame rate.
2019-05-05 22:44
JackAsser

Registered: Jun 2002
Posts: 1534
TLL pointed me into the correct direction: https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/sr..

So four different types to handle:
		C/Line	        Lines	        Clock
PAL		63		312		985248
NTSC		65		263		1022730
Old NTSC	64		262		1022730
DREAN		65		312		1023440

2019-05-05 23:21
JackAsser

Registered: Jun 2002
Posts: 1534
My (at least in VICE) functional detection code:

;			C/Line	Lines	Clock		Val
;PAL		63		312		985248		516%312 = 204 cc
;NTSC		65		263		1022730		508%263 = 245 f5
;Old NTSC	64		262		1022730		512%262 = 250 fa
;DREAN		65		312		1023440		508%312 = 196 c4
;
;16384/63 = 260+256 = 516   
;16384/64 = 256+256 = 512 
;16384/65 = 252+256 = 508

.segment "START"

.export systemDetect
.proc systemDetect
		sei
		lda #0
		sta $d011
		sta $dc0e
		sta $dc0f
		bit $d011
		bpl *-3
		bit $d011
		bmi *-3

		lda #$7f
		sta $dc0d
		bit $dc0d

		lda #<(16384-1)
		sta $dc04
		lda #>(16384-1)
		sta $dc05
		lda #%10011001

		bit $d011
		bpl *-3
		
		sta $dc0e

		:lda $dc0d
		beq :-

		lda $d012
		; cc => PAL
		; f5 => NTSC
		; fa => Old NTSC
		; c4 => DREAN
               rts
.endproc
2019-05-05 23:42
Krill

Registered: Apr 2002
Posts: 1241
Interesting approach you took there, quite elegant. :)

Is this for your game? And do you really want to support all these platforms, including the weirder ones? I didn't even know PET 64 existed.
2019-05-05 23:52
JackAsser

Registered: Jun 2002
Posts: 1534
Quote: Interesting approach you took there, quite elegant. :)

Is this for your game? And do you really want to support all these platforms, including the weirder ones? I didn't even know PET 64 existed.


For Eye of the Beholder. And no I don't HAVE to support them, but if it's a matter of simple detection and a few patches here and there, why not? Let's not be lazy here when I've been honoring details on everything else.

Basically I just need to know the master clock to set the correct master game timer (55ms ticks). Then I need to know cycles per line (63 / 64 / 65) for the raster code in the intro. The above code gives me all the info I need.
2019-05-06 15:05
Frantic

Registered: Mar 2003
Posts: 1373
All contributions welcome:

http://codebase64.org/doku.php?id=base:detect_pal_ntsc

:)
2019-05-06 17:18
JackAsser

Registered: Jun 2002
Posts: 1534
Quote: All contributions welcome:

http://codebase64.org/doku.php?id=base:detect_pal_ntsc

:)


Not much to contribute imo. My method is not better than the others and I just forgot about checking Codebase first.
2019-05-06 19:43
AlexC

Registered: Jan 2008
Posts: 272
As far as c64gs goes I don't know if gs had any other version than PAL, all I've got is PAL anyway. If you like to detect it, it has different ROM so this is probably the easiest method to check for it. Probably due to lack of keyboard and tape port someone could come up with some clever method of detecting it otherwise but VIC timing still should be the same as for c64 PAL and ROM check method may probably fail in case of VICE or any other emulator I guess there aren't many users with c64 and kernal switch including gs ROM ;)

BTW: care to tell us more about PET 64?
2019-05-06 20:50
JackAsser

Registered: Jun 2002
Posts: 1534
Quote: As far as c64gs goes I don't know if gs had any other version than PAL, all I've got is PAL anyway. If you like to detect it, it has different ROM so this is probably the easiest method to check for it. Probably due to lack of keyboard and tape port someone could come up with some clever method of detecting it otherwise but VIC timing still should be the same as for c64 PAL and ROM check method may probably fail in case of VICE or any other emulator I guess there aren't many users with c64 and kernal switch including gs ROM ;)

BTW: care to tell us more about PET 64?


I will not need to detect GS. Pet64, dunno, just copied the values from VICE
2019-05-07 09:44
Count Zero

Registered: Jan 2003
Posts: 914
I own an Educator64 (or PET64 or ...) - it is very heavy! :)

https://en.wikipedia.org/wiki/Commodore_Educator_64
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Speedball/Cyber Design
Alakran_64
Røly/MYD^STHD^TSA
Don Kichote/Samar Pr..
MaD ][/Starship
Lynx/ΤRIΛD
Guests online: 53
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.5)
9 C=Bit 18  (9.5)
10 Old Men in Used Cars  (9.5)
Top onefile Demos
1 LSR 64 V0.31  (10)
2 Smile to the Sky  (9.5)
3 Dawnfall V1.1  (9.5)
4 Crystal Gazer  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Rewind  (9.5)
7 Instinct  (9.5)
8 Pandemoniac Part 5 o..  (9.5)
9 Innervasion  (9.4)
10 Bad Boy  (9.4)
Top Groups
1 Fossil  (9.8)
2 PriorArt  (9.7)
3 Performers  (9.6)
4 Oxyron  (9.4)
5 Censor Design  (9.4)
Top Graphicians
1 Mirage  (9.7)
2 Archmage  (9.7)
3 DocJM  (9.7)
4 Veto  (9.7)
5 Electric  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.078 sec.