Jump to content
IGNORED

NTSC check


Heaven/TQA

Recommended Posts

what is the most effective way to check if system is a NTSC or PAL one? really only the GITA/ANTIC flag?

 

I don't know what you call "GTIA/ANTIC flag" but I use this:

 

53268 D014 COLPM2

(W) Color and luminance of player and missile 2 (706).

 

PAL

® Used to determine if the Atari is PAL (European and Israeli

TV compatible when BITs 1 - 3 equal zero) or NTSC (North

American compatible when BITs 1 - 3 equal one; 14 decimal, $E).

European Ataris run 12% slower if tied to the VBLANK cycle (the

PAL VBLANK cycle is every 50th second rather than every 60th

second). They use only one CPU clock at three MHZ, so the 6502

runs at 2.217 MHZ -- 25% faster than North American Ataris.

Also, their $E000 and $F000 ROMs are different, so there are

possible incompatibilities with North American Ataris in the

cassette handling routines. There is a third TV standard called

SECAM, used in France, the USSR, and parts of Africa. I am

unaware if there is any Atari support for SECAM standards.

 

PAL TV has more scan lines per frame, 312 compared to 262.

NTSC Ataris compensate by adding extra lines at the beginning

of the VBLANK routine. Display lists do not have to be altered,

and colors are the same because of a hardware modification.

 

F.

 

 

Link to comment
Share on other sites

53268 D014 COLPM2

(W) Color and luminance of player and missile 2 (706).

 

PAL

® Used to determine if the Atari is PAL (European and Israeli

TV compatible when BITs 1 - 3 equal zero) or NTSC (North

American compatible when BITs 1 - 3 equal one; 14 decimal, $E).

European Ataris run 12% slower if tied to the VBLANK cycle (the

PAL VBLANK cycle is every 50th second rather than every 60th

second). They use only one CPU clock at three MHZ, so the 6502

runs at 2.217 MHZ -- 25% faster than North American Ataris.

Also, their $E000 and $F000 ROMs are different, so there are

possible incompatibilities with North American Ataris in the

cassette handling routines. There is a third TV standard called

SECAM, used in France, the USSR, and parts of Africa. I am

unaware if there is any Atari support for SECAM standards.

 

PAL TV has more scan lines per frame, 312 compared to 262.

NTSC Ataris compensate by adding extra lines at the beginning

of the VBLANK routine. Display lists do not have to be altered,

and colors are the same because of a hardware modification.

 

:?

 

Is this from Mapping the Atari? I like that reference overall, but there are several serious errors in that description.

Link to comment
Share on other sites

Probably something like:

 

sei

lda #0

sta nmien

lda #130

wait cmp vcount

bne wait

sta wsync

sta wsync

sta wsync

bit vcount

bmi pal

 

You could probably get away without disabling interrupts but this way ensures you don't have a longer running VBlank or something like a keypress getting in the way.

 

VCount wraps around for NTSC after 130, PAL keeps on going until 155.

Link to comment
Share on other sites

aarg... Jesus... ;)

 

again...

 

a simple check in software reading $d014 should be ok as my Atari book tells me?

 

You can use my method in all cases and you can do it manually with a stop watch or through a programmed stop watch in a high level language or a low level language. Many high level languages have the time$ variable to return time and you can use that as a stop watch. They usually return "hh:mm:ss" so if you did Right$(time$,2) and peek(77) or peek(19) and count # of seconds that elapse while those locations change say from initial count C to final count C+5, you would be able to tell the frame rate of the machine without a single ASM instruction.

 

Note: watch out for wrap around of the seconds and location 19 or 77.

Link to comment
Share on other sites

I really don't think you want a user to wait around after running something before it'll continue with or without music, especially not 9-11 mins. If it can be done in a few frames/1 second fair enough but you also don't want any user interaction.

 

Heaven, just bring up a screen advising people to go make a coffee and some toast and when they come back press a key if they want PAL or NTSC ;)

 

 

Pete

Link to comment
Share on other sites

Indeed...Jesus. It doesn't have to be complicated guys. In case of a standard machine, the PAL-flag in the GTIA-registers is enough. Otherwise, in case of a HW-mod, you could leave the option in the main game menu to manually switch to PAL or NTSC. But, possibly making separate PAL- and NTSC-versions is the easiest. Anyway, if that's the only difference, turning music on or off depending on PAL or NTSC, then it's easiest to do the PAL-flag test. If I'm correct, RMT-player already does that, to correct its execution timescheme.

 

 

You can use my method in all cases and you can do it manually with a stop watch or through a programmed stop watch in a high level language or a low level language. Many high level languages have the time$ variable to return time and you can use that as a stop watch. They usually return "hh:mm:ss" so if you did Right$(time$,2) and peek(77) or peek(19) and count # of seconds that elapse while those locations change say from initial count C to final count C+5, you would be able to tell the frame rate of the machine without a single ASM instruction.

OK, but I suppose Heaven's question was aimed at the context of which testing method to use, which is possible to do by the hardware itself. Then testing vcount is a nice and easy one, as it really tests whether we are dealing with a PAL or NTSC Antic.

Link to comment
Share on other sites

or compile 2 different versions... ;) PAL and NTSC version of Gridrunner... ;) why making simple things complicated... ;) at least RMT does now have consistent playback speed across the systems...

 

I was taking into account any programming language or platform. Code is actually quite simple if you make it specific to Atari. Here's some code for Atari BASIC to determine PAL/NTSC/other stuff:

 

10 T=0: REM SIMULATE TIME FUNCTION RELATIVELY FOR ATARI

20 P=PEEK(19)

30 IF P=PEEK(19) THEN 30

40 P=PEEK(19)

50 IF P=PEEK(19) THEN T=T+1:GOTO 50

60 IF T>512 THEN GOTO 100: REM PAL

70 ? "NTSC":END

100 IF T>800 THEN ?"YOU CHEATER, YOU USED AN ACCELERATOR!":END

110 ?"PAL"

 

I assumed you are running in Gr.0 or Gr. 8/9/10/11. You can compute a different cut-off T value for other modes.

It's slower than using VCOUNT because I'm making it work with high level languages, but it's definitely simpler.

QED.

Link to comment
Share on other sites

what is the most effective way to check if system is a NTSC or PAL one? really only the GITA/ANTIC flag?

 

Here is how you detect the difference from a pal from NTSC in assembler.

 

Enjoy Steve

;------------------------------------------------------------------

;checking for pal/ntsc machines

;

;

pal_ntsc

lda $d014

ora #$f0 ; masking high order bytes

cmp #$ff ;

beq ntsc

bne pal

rts

ntsc

jsr printsi

dc.b "NTSC Detected! Setting To 60hz",$9B,-1

RTS

pal

jsr printsi

dc.b "PAL Detected! Setting To 50hz",$9B,-1

RTS

;

;

; Print text

; ----------

; out:

; all registers preserved

; notes:

; This print routine will print all characters

; following the JSR PRINT until a delimiter of

; -1 ($FF) is reached. PRINT will return to the

; point one byte beyond the delimiter.

;

printsi: JSR SAVER

TSX

LDA $0105,X

STA ZOCH+1

LDA $0106,X

STA ZOCH+2

;

ldy #1

ZOCH: LDA $FFFF,Y

CMP #$FF

BEQ Zecho

JSR echo

INY

BNE ZOCH

Zecho: TYA

CLC

ADC $0105,X

STA $0105,X

LDA $0106,X

ADC #0

STA $0106,X

JMP RESALL

;

;

; SAVE & RESTORE registers

; ------------------------

;

SAVER: PHP

PHA

PHA

PHA

PHP

PHA

TXA

PHA

TSX

LDA $0109,X

STA $0105,X

LDA $0107,X

STA $0109,X

LDA $0101,X

STA $0107,X

LDA $0108,X

STA $0104,X

LDA $0106,X

STA $0108,X

TYA

STA $0106,X

PLA

TAX

PLA

PLP

RTS

;

RESALL: PLA

TAY

PLA

TAX

PLA

PLP

RTS

;

Link to comment
Share on other sites

what is the most effective way to check if system is a NTSC or PAL one? really only the GITA/ANTIC flag?

 

Here is how you detect the difference from a pal from NTSC in assembler.

 

Enjoy Steve

;------------------------------------------------------------------

;checking for pal/ntsc machines

;

;

pal_ntsc

lda $d014

ora #$f0 ; masking high order bytes

cmp #$ff ;

beq ntsc

bne pal

rts

ntsc

jsr printsi

dc.b "NTSC Detected! Setting To 60hz",$9B,-1

RTS

pal

jsr printsi

dc.b "PAL Detected! Setting To 50hz",$9B,-1

RTS

;

;

; Print text

; ----------

; out:

; all registers preserved

; notes:

; This print routine will print all characters

; following the JSR PRINT until a delimiter of

; -1 ($FF) is reached. PRINT will return to the

; point one byte beyond the delimiter.

;

printsi: JSR SAVER

TSX

LDA $0105,X

STA ZOCH+1

LDA $0106,X

STA ZOCH+2

;

ldy #1

ZOCH: LDA $FFFF,Y

CMP #$FF

BEQ Zecho

JSR echo

INY

BNE ZOCH

Zecho: TYA

CLC

ADC $0105,X

STA $0105,X

LDA $0106,X

ADC #0

STA $0106,X

JMP RESALL

;

;

; SAVE & RESTORE registers

; ------------------------

;

SAVER: PHP

PHA

PHA

PHA

PHP

PHA

TXA

PHA

TSX

LDA $0109,X

STA $0105,X

LDA $0107,X

STA $0109,X

LDA $0101,X

STA $0107,X

LDA $0108,X

STA $0104,X

LDA $0106,X

STA $0108,X

TYA

STA $0106,X

PLA

TAX

PLA

PLP

RTS

;

RESALL: PLA

TAY

PLA

TAX

PLA

PLP

RTS

;

 

It doesn't work if you have repaired machines and GTIAs have been swapped between pal/ntsc machines. The $d014 doesn't reflect the true state of PAL/NTSC frame rate but is a hardcoded value in the chip.

Link to comment
Share on other sites

what is the most effective way to check if system is a NTSC or PAL one? really only the GITA/ANTIC flag?

 

The question is really, how to detect it, and then, yeah, Hardware flag NTSCPAL ($D014) (AND #$0E eq 0 for PAL, $E for NTSC) is the way to go I guess. Although bootstrap also does some things.

 

NTSCPAL$ ($0062) is $00 for NTSC, and $01 for PAL, also KEYREPDELY ($02D9) is $30 for NTSC or $28 for PAL, and KEYREP ($02DA) is $06 for NTSC, $05 for PAL. This all assuming of course, normal hardware and standard OS.

Link to comment
Share on other sites

53268 D014 COLPM2

(W) Color and luminance of player and missile 2 (706).

 

PAL

® Used to determine if the Atari is PAL (European and Israeli

TV compatible when BITs 1 - 3 equal zero) or NTSC (North

American compatible when BITs 1 - 3 equal one; 14 decimal, $E).

European Ataris run 12% slower if tied to the VBLANK cycle (the

PAL VBLANK cycle is every 50th second rather than every 60th

second). They use only one CPU clock at three MHZ, so the 6502

runs at 2.217 MHZ -- 25% faster than North American Ataris.

Also, their $E000 and $F000 ROMs are different, so there are

possible incompatibilities with North American Ataris in the

cassette handling routines. There is a third TV standard called

SECAM, used in France, the USSR, and parts of Africa. I am

unaware if there is any Atari support for SECAM standards.

 

PAL TV has more scan lines per frame, 312 compared to 262.

NTSC Ataris compensate by adding extra lines at the beginning

of the VBLANK routine. Display lists do not have to be altered,

and colors are the same because of a hardware modification.

 

:?

 

Is this from Mapping the Atari? I like that reference overall, but there are several serious errors in that description.

Very true, it took me a lot of figuring aswell though. European (PAL) Atari's actually run slower than the NTSC counterparts. 1.77MHz against 1.79MHz respectively. They just can do more cycles in a VBI because the VBI calls are less frequent.

 

I'm one of the lucky dutch multilinguists. Combining "Mapping"(en) with "Intern"(de) and the OS reference manual turns up quite a number of discrepancies in Mapping's text.

Link to comment
Share on other sites

The "PAL is slower overall" is very debatable (disregarding of course that probably 98% of games use VBlank timings)

 

DMA overhead Gr. 0 for an NTSC machine =

60 frames * (

262 scanlines * 9 refresh

+ 24 scanlines * 73 (deduct skipped refresh cycles)

+ 168 scanlines * 40

+ 8 (DList stuff, 3 blank, 2 LMS, 3 JVB)

)

 

Total = 650,280

 

 

DMA overhead Gr. 0 for a PAL machine =

50 frames * (

312 scanlines * 9 refresh

+ 24 scanlines * 73 (deduct skipped refresh cycles)

+ 168 scanlines * 40

+ 8 (DList stuff, 3 blank, 2 LMS, 3 JVB)

)

 

Total = 564,400

 

Difference = 85,880 less DMA cycles for PAL

 

Of course, the actual frame rate of both machines isn't 50/60 per second, IIRC it's actually a bit less for both.

But, in many typical screen situations a PAL machine will have more free cycles over a given time period.

Additional to that, having a VBlank NMI 10 less times per second means less cycles lost to OS overhead.

Link to comment
Share on other sites

Going back to my original suggestion, surely all that's needed (even for high level languages) is a tiny assembly routine which simply monitors VCOUNT for a couple of frames and returns the highest value the register reached? For example, from BASIC:

 

    	pla ; remove # args
loop1: lda vcount
   	bne loop1
loop3: lda vcount
   	beq loop3
loop2: lda vcount
   	beq done
   	sta $d4
   	bne loop2
done: lda #0
   	sta $d5
   	rts

 

This will return either 130 (NTSC) or 155 (PAL), and could be put in a string or a few short data statements.

Edited by flashjazzcat
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...