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 > $D019 to check for PAL/NTSC.
2014-05-14 04:49
Flavioweb

Registered: Nov 2011
Posts: 442
$D019 to check for PAL/NTSC.

I saw the kernal check for bit 0 of $D019 to set video mode flag.
This fail with super cpu since the check is done too early to work.
So i want to know: what exactly set this bit to 1 for Pal and 0 for NTSC?
Is an internal vic operation, or there is something else that modify it?
And when exactly is modified during startup?
2014-05-14 08:49
Graham
Account closed

Registered: Dec 2002
Posts: 990
The Kernal simply sets the raster comparator to $0137 which is the last rasterline of a PAL system and then checks if the IRQ flag is set after a while.

Anyway, the PAL/NTSC detection is broken anyway since the Kernal reset routine checks the PAL/NTSC flag at $02A6 to set PAL/NTSC timer values BEFORE $02A6 has been set by the $D019 check routine.
2014-05-14 09:17
Flavioweb

Registered: Nov 2011
Posts: 442
Looking at kernal code, i noticed that $02A6 is changed before the $D019 check, but usually, both on emulated or rh stock machines, the value of the flag is correct...
So i thought that isn't "always" broken...

Thanks anyway for explanation...
2014-05-14 20:15
Moloch

Registered: Jan 2002
Posts: 2886
I've heard its broken quite a few times, but I know most, if not all, fixers used it and it worked.
2014-05-14 20:52
Flavioweb

Registered: Nov 2011
Posts: 442
I think i understand the meaning of "broken": the kernal implementation of checking $02A6 to identify PAL/NTSC is broken, but $02A6 "setup" works as well (on stock machines).
So: value in $02A6 is correct but is badly "used" by kernal.
2014-05-14 20:59
chatGPZ

Registered: Dec 2001
Posts: 11088
its also not always correct, there is a slight chance the value is wrong
2014-05-15 10:50
Flavioweb

Registered: Nov 2011
Posts: 442
I'm sorry... but i can't understand how things works...
As Graham pointed out, kernal setup raster comparision to $0137, then check $D019 for irq.
But i can't find into kernal code the right point where $D012 is writed with some values for the comparision.
Accordingly with AAY:
Kernal-Reference: LDA $D012 : $FF5E
and no other references of $d012 exist...
So...
Where the comparision value is set?
2014-05-15 11:22
Oswald

Registered: Apr 2002
Posts: 5007
look for d019, as pointed out kernal checks d019 if irq flag has been set.
2014-05-15 11:34
chatGPZ

Registered: Dec 2001
Posts: 11088
the initial values are set at e5a0 and come from the table at ecb9
2014-05-15 12:46
Flavioweb

Registered: Nov 2011
Posts: 442
Looking at the table seems that $D01A is set to 00...
How can irq start?
Maybe $D01A is update somewhere else...?
Ghosh...
2014-05-15 12:51
chatGPZ

Registered: Dec 2001
Posts: 11088
d01a controls whether the VIC generates an external IRQ, the bit in d019 is always set, regardless of that.
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
Twoflower/ΤRIΛD
Dave/SIDNIFY
csabanw
Acidchild/Padua
Guests online: 301
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

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