Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > detecting pal, drean, ntsc or old ntsc
2012-11-26 14:21
Peiselulli

Registered: Oct 2006
Posts: 81
detecting pal, drean, ntsc or old ntsc

Hello,
I want to know if a test like this is reliable for the four different machine types PAL, NTSC, NTSC(old) and DREAN (ACME source code):

OLD_NTSC = 1
NTSC = 0
PAL = 2
DREAN = 3

        !to "detect.prg",cbm
	!cpu 6510

	* = $0801
	!by $0b,$08,$00,$00,$9e,$32,$30,$36,$31,$00,$00,$00
		
detect:	sei
w0:  	lda $d012
w1:  	cmp $d012
	beq w1
	bmi w0
	and #$03
	cmp #$01
	bne w2
	lda #OLD_NTSC
	bne detected ; unconditional
w2:	cmp #$03
	lda #$00
	rol
	beq detected	;ntsc

	;check for drean or pal
	ldx #$00
	lda #$10
l	inx
	cmp $d012
	bne l
	lda #PAL
	cpx #$70
	bcc detected
	;is a drean
	lda #DREAN
detected:
	tay
	lax offset,y
l2:	lda base_text,x
	beq end
	jsr $ffd2
	inx
	bne l2
end:	lda #$0d
	jmp $ffd2

base_text:
old_ntsc_text:	!text "OLD "
ntsc_text:	!text "NTSC",0
pal_text:	!text "PAL",0
drean_text:	!text "DREAN",0

offset:		
	!byte ntsc_text-base_text
	!byte old_ntsc_text-base_text
	!byte pal_text-base_text
	!byte drean_text-base_text


 
... 63 posts hidden. Click here to view all posts....
 
2020-11-10 10:30
Knight Rider

Registered: Mar 2005
Posts: 114
Results submited by PM
2020-11-10 14:14
hedning

Registered: Mar 2009
Posts: 4595
Yup. Sent 4 screenshots from 4 machines as well.
2020-11-10 17:49
Frantic

Registered: Mar 2003
Posts: 1627
It is good to hear that you are sending lots of messages to each other. ;) Now I am also curious to hear if the routine seemed to work well or not? :)
2020-11-10 17:50
hedning

Registered: Mar 2009
Posts: 4595
Quote: It is good to hear that you are sending lots of messages to each other. ;) Now I am also curious to hear if the routine seemed to work well or not? :)

I can send you a Pm too. :D
2020-11-10 17:52
Frantic

Registered: Mar 2003
Posts: 1627
Thanks for the offer, but on careful consideration I have come to the conclusion that I am primarily interested to hear if the aforementioned routine seemed to work well or not. Does that constitute a type of information that you would be willing to share, publicly, in a forum discussion thread like the present one?
2020-11-10 19:27
hedning

Registered: Mar 2009
Posts: 4595
Quote: Thanks for the offer, but on careful consideration I have come to the conclusion that I am primarily interested to hear if the aforementioned routine seemed to work well or not. Does that constitute a type of information that you would be willing to share, publicly, in a forum discussion thread like the present one?

Ah. No. I'll leave that to Copyfault. But I was was told my screenshots made him very happy.
2020-11-10 20:55
Knight Rider

Registered: Mar 2005
Posts: 114
My videos produced the desired results on all 4 machines.
2020-11-11 02:06
Copyfault

Registered: Dec 2001
Posts: 466
First of all: thanks to the testers!!! The routine behaves as it should on all tested real machines: in total 3 with new NTSC-VIC, one with old NTSC, two Drean-systems and two EU-PAL-systems (not counting my own system here).

So I think it's save to say the routine works. I just wrote up a (rather longish, sorry) explanation on codebase (-> yes, pswd has been found \o/).


Feel free to edit it or drop me a comment via pm if you think it should be changed/shortened/extended...
2020-11-11 07:57
Knight Rider

Registered: Mar 2005
Posts: 114
I am sure the purists will argue that the SEI in the routine could lead to false results in some circumstances
2020-11-11 10:54
JackAsser

Registered: Jun 2002
Posts: 1989
Really elegant! I might switch to that. Currently in Eye of the Beholder I use a timer and wait for a while, then check what raster line I'm on:
		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

		ldx #SYSTEM_PAL ;SYSTEM_UNKNOWN (default PAL and live with gfx glitches instead of total crash)
		cmp #$cc
		bne :+
			ldx #SYSTEM_PAL
		:
		cmp #$f5
		bne :+
			ldx #SYSTEM_NTSC
		:
		cmp #$fa
		bne :+
			ldx #SYSTEM_NTSC_OLD
		:
		cmp #$c4
		bne :+
			ldx #SYSTEM_DREAN
		:
		stx system
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - 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
Holy Moses/Role
Knut Clausen/SHAPE/F..
Smasher/F4CG
Asphodel
Dymo/G★P
macx
Apollyon/ALD
Airwolf/F4CG
iceout/Avatar/HF
Guests online: 101
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.