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: 463
$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: 463
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: 2928
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: 463
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: 11386
its also not always correct, there is a slight chance the value is wrong
2014-05-15 10:50
Flavioweb

Registered: Nov 2011
Posts: 463
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: 5094
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: 11386
the initial values are set at e5a0 and come from the table at ecb9
2014-05-15 12:46
Flavioweb

Registered: Nov 2011
Posts: 463
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: 11386
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
csabanw
Flex/Artline Designs
Jammer
Chrx/Design/Chaos
Guests online: 95
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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