NTSC vs. PAL - Round 2, The Hardware Challenge

Modding and Technical Issues

Moderator: Moderators

Post Reply
User avatar
JonBrawn
Vic 20 Devotee
Posts: 225
Joined: Sat Sep 11, 2021 10:47 pm
Website: http://youtube.com/@vicenary
Location: Austin TX USA
Occupation: CPU design engineer

NTSC vs. PAL - Round 2, The Hardware Challenge

Post by JonBrawn »

Over in the Programming forum a little while back, I asked:
JonBrawn wrote: Mon Jul 11, 2022 9:34 pmI was thinking the other day about how to tell the difference between an NTSC VIC-20 and a PAL VIC-20. I have one of each, and I'm going to be doing some software work that needs to know if this is the NTSC or a PAL one.
With the FPGA I'm putting together, it'd be nice if it auto-detected if it were in an NTSC or a PAL environment. Currently, I have a 100MHz clock on the board, so I could just count cycles of the incoming crystal clock - around 14MHz, it's NTSC. Around 4MHz? it's PAL. That's easy enough.

As an academic exercise, I was thinking about ways of differentiating the two systems without relying on that external 100MHz clock.

Suppose the VIC chip had write ability - you could divide the incoming crystal clock by four and try to use that to perform a bunch of read-modify-write cycles. If every write operation can be read back correctly, you're on a PAL system. If any of them fail, you're on NTSC because you'd be reading and writing 400-450ns RAM with a 140ns cycle time. Unfortunately, VIC is not a writer.

Using the same clock-divided-by-four technique, you could, I suppose, try reading the character generator ROM. If it comes back as all $00 or all $FF, that's a dead giveaway that you're going too fast. Or you could checksum it a few times and see if you get different values to check if it's returning varying values.

Any other thoughts?

[And yes, I am posting a lot at the moment - I'm stuck at home with a bad back, and I can't go out much, so y'all are "benefitting" from that]
Working on FPGA replacement for 6560/6561
https://youtube.com/@vicenary
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: NTSC vs. PAL - Round 2, The Hardware Challenge

Post by chysn »

This question keeps coming up and people say lots of things, but I don't understand why looking at $e475 fails to do the trick. It seems like the simplest thing on earth.

Code: Select all

bit $e475
bmi is_pal
etc.
Am I just nuts?

Meanwhile, I hope your back feels better soon!
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: NTSC vs. PAL - Round 2, The Hardware Challenge

Post by tlr »

chysn wrote: Tue Aug 23, 2022 9:18 pm This question keeps coming up and people say lots of things, but I don't understand why looking at $e475 fails to do the trick. It seems like the simplest thing on earth.

Code: Select all

bit $e475
bmi is_pal
etc.
Am I just nuts?
Is that really accessible from within the VIC? Besides it’s far nicer to rely on direct detection. That said I think the reference clock comparison is the best way.

Which FPGA is this? There might be some internal reference availible if you just want to get rid of your external oscillator.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: NTSC vs. PAL - Round 2, The Hardware Challenge

Post by Mike »

chysn wrote:I don't understand why looking at $e475 fails to do the trick.
I thought we had sorted that out some time ago, see here, Reliving VIC20, and to quote from there:
Mike wrote:$E475 is a spare byte to define the ROM checksum, the byte which happens to be different for PAL and NTSC KERNALs due to all the differences that need to be accounted for, but it is not especially related to the installed VIC type. [...] I prefer checking the default register value for XPOS ($9000) in $EDE4, which is 5 for NTSC or 12 for PAL. [...] I checked against the Japanese VIC-1001 KERNAL (901486-02). Here, the value at $E475 is $D6, which falsely identifies the VIC-1001 as PAL. $EDE4 contains the expected value for NTSC, $05.
...
tlr wrote:Is [$E475] really accessible from within the VIC?
No. BASIC and KERNAL ROM are on the "wrong" side of the bus buffers. VIC-I has no access.
JonBrawn wrote:Any other thoughts?
A jumper on the PCB of the VIC-I replacement to set NTSC/PAL operation mode?
User avatar
JonBrawn
Vic 20 Devotee
Posts: 225
Joined: Sat Sep 11, 2021 10:47 pm
Website: http://youtube.com/@vicenary
Location: Austin TX USA
Occupation: CPU design engineer

Re: NTSC vs. PAL - Round 2, The Hardware Challenge

Post by JonBrawn »

Mike wrote: Wed Aug 24, 2022 3:05 pm A jumper on the PCB of the VIC-I replacement to set NTSC/PAL operation mode?
Yes, that's almost certainly where I'll end up if I don't use an onboard oscillator. This was more intended as an exercise in "what weird and whacky way could I implement this?" rather than anything serious.
Working on FPGA replacement for 6560/6561
https://youtube.com/@vicenary
Post Reply