English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 28 December 2019, 22:39   #1
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 240
Detect PAL o NTSC

Can I somehow detect if I'm running on a PAL or an NTSC system using KS1.3?


I was thinking that I might use the CIA timers to wait for one second and count the VBIs. On NTSC I should count to 60, right?


Or is there some easier approach?
sparhawk is offline  
Old 28 December 2019, 22:49   #2
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,037
GfxBase->DisplayFlags

Extracted from gfxbase.i

* flag bits for DisplayFlags

NTSCn equ 0
NTSC equ 1<<NTSCn

GENLOCn equ 1
GENLOC equ 1<<GENLOCn

PALn equ 2
PAL equ 1<<PALn

Last edited by kamelito; 28 December 2019 at 23:29. Reason: c
kamelito is offline  
Old 28 December 2019, 22:58   #3
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,526
Region protected Psygnosis games check for region using simple hardware code. I didn't check recently, but in NTSC VPOSR vertical read probably cannot go as far as on a PAL mode.

It would have been easy at the time to write a small tool that would just boot, switch to NTSC (or PAL) and wait for another disk to boot on, defeating this protection
jotd is offline  
Old 28 December 2019, 23:08   #4
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,309
Either read Exec's VBlankFrequency or create a simple loop which tries to wait for a raster line in the PAL area, if that fails your code is running on a NTSC machine.
StingRay is online now  
Old 28 December 2019, 23:22   #5
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 46
Posts: 7,452
Quote:
Originally Posted by sparhawk View Post
Can I somehow detect if I'm running on a PAL or an NTSC system using KS1.3?


I was thinking that I might use the CIA timers to wait for one second and count the VBIs. On NTSC I should count to 60, right?


Or is there some easier approach?
move.l 4.w,a6
cmp.b #50,$212(a6)
beq _pal
else _ntsc

If you don't want to assume the default opposite to to PAL is NTSC, you could always put in an extra specific cmp.b #60 for NTSC, but theres really no need.

I've literally had to do this very same thing. If you have includes then:

include includes/exec/execbase.i

move.l 4.w,a6
cmp.b #50,VBlankFrequency(a6)
beq.s _PAL
else _ntsc
Galahad/FLT is offline  
Old 28 December 2019, 23:42   #6
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 240
Thanks! I was reading gfxbase, as I opened it anyway, but somehow I like the exec value better.


However, I tried to tests, this, but when I switch to NTSC option in WinUAE, it always gets switched back to PAL and the value I read is PAL. Is there some additional option or condition required for enabling NTSC?
sparhawk is offline  
Old 29 December 2019, 12:53   #7
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 46
Posts: 7,452
Quote:
Originally Posted by sparhawk View Post
Thanks! I was reading gfxbase, as I opened it anyway, but somehow I like the exec value better.


However, I tried to tests, this, but when I switch to NTSC option in WinUAE, it always gets switched back to PAL and the value I read is PAL. Is there some additional option or condition required for enabling NTSC?
If you go under CHIPSET options, there is a tickbox for NTSC.

But for the Amiga environment to accept it is now NTSC properly, you must then use the RESET option in WinUAE, so that exec and the Amiga environment accepts the new changes and obviously updates the relevant exec details.

WinUAE cannot know that exec is still present in memory (because a game might have wiped it out), so it can't update exec with the change, only a RESET can do that.
Galahad/FLT is offline  
Old 29 December 2019, 13:16   #8
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,421
There is a bug in detection code in KS 1.x exec (and cascade to graphics.library) which reports it is an NTSC machine when it is PAL (it happens anyway very rarely).
In my code I do a check on the number of video lines available to differentiate.
ross is offline  
Old 29 December 2019, 15:17   #9
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 240
Quote:
Originally Posted by Galahad/FLT View Post
If you go under CHIPSET options, there is a tickbox for NTSC.

Yeah, that did it. There are two other NTSC options under Display, which I was changing. The one in the middle listbox always jumps back to PAL. Didin't notice that there is yet another option in the chipset section as well.


Quote:
But for the Amiga environment to accept it is now NTSC properly, you must then use the RESET option in WinUAE, so that exec and the Amiga environment accepts the new changes and obviously updates the relevant exec details.

Yes, of course. I always reset it, but I was using the wrong NTSC option.
sparhawk is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to switch PAL Rev 6A A500 between PAL/NTSC? BarryB support.Hardware 10 03 August 2016 15:41
Detect NTSC or PAL highpuff Coders. Asm / Hardware 14 18 March 2015 18:23
NTSC A500 Pal/NTSC mod pics kipper2k Hardware pics 2 29 March 2009 08:56
NTSC to PAL ...what's next? NfernalNfluence support.Hardware 7 28 July 2007 13:19
Ntsc / Pal killergorilla project.SPS (was CAPS) 3 09 July 2003 19:25

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.08062 seconds with 15 queries