Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Nicron ! (Registered 2024-05-21) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > TOD registers in CIA1 and CIA2 and their behaviour on the real thing compared to VICE...
2008-02-14 12:06
JackAsser

Registered: Jun 2002
Posts: 1994
TOD registers in CIA1 and CIA2 and their behaviour on the real thing compared to VICE...

Hi!

I tried writing to the TOD-registers of CIA1 and CIA2 in VICE and read the values back after a while. The values read back were the same as written except for the AM/PM bit.

How are those registers supposed to behave? More specifically, is it possible to use them as more or less general purpose read/write registers much like f.e. the sprite position registers?

/JackAsser
 
... 11 posts hidden. Click here to view all posts....
 
2008-02-15 21:21
TNT
Account closed

Registered: Oct 2004
Posts: 189
Quote: Very interesting topic. As a side note: if you use timer A for NMI source to disable NMI than quiting from NMI interrupt procedure with plain RTI will not acknowledge it.

RTI correctly placed will :)
2008-02-16 12:24
JackAsser

Registered: Jun 2002
Posts: 1994
Quote: Very interesting topic. As a side note: if you use timer A for NMI source to disable NMI than quiting from NMI interrupt procedure with plain RTI will not acknowledge it.

Since all opcodes are atleast 2 cycles long that means that the CPU always reads 2 consecutive bytes and with NOP, RTI etc. it will simply reject the 2nd byte read. Now, imagine you place the RTI on $dd0c, then the CPU will also automatically read $dd0d and thus automatically acknowledge the NMI. Simple as that.
2008-02-16 18:40
AlexC

Registered: Jan 2008
Posts: 293
Quote: Since all opcodes are atleast 2 cycles long that means that the CPU always reads 2 consecutive bytes and with NOP, RTI etc. it will simply reject the 2nd byte read. Now, imagine you place the RTI on $dd0c, then the CPU will also automatically read $dd0d and thus automatically acknowledge the NMI. Simple as that.

Point taken :)
2010-05-30 11:37
Conrad

Registered: Nov 2006
Posts: 837
Can anyone advise on how to get the TOD registers to read back at the correct increment speed? By this I mean assuring that the clock increases at the correct timing in PAL rather than NTSC.

My C64C has always increased the clock slower than a real clock, which I assume will be to do with the CIA chip in my C64 being an NTSC model...? As I have a PAL machine, the computer is running at 50hz, but the CIA clock seems that it will increase correctly at 60hz. However, when I test my TOD reading on Vice, it increases at the right rate on PAL mode.

My 6526A chip is labelled "3591 216A".... does this identify anything for PAL/NTSC?
2010-05-30 12:27
assiduous
Account closed

Registered: Jun 2007
Posts: 343
you can set the TOD clock frequency with DC0E bit7.

also testing TOD in Vice is not recommended- the emulation is rather bad and has had issues with afew demos like Denaturation/Blacksun.
2010-05-30 13:05
Conrad

Registered: Nov 2006
Posts: 837
hmmm... now that's fixed the problem :), but that's because I've now set bit 8 of $dc0e/$dd0e to 1 instead of 0 (little mistake on my behalf). Yet, with bit 8 set to 0, the TOD still runs correctly at 50hz on Vice PAL mode... so there's an emu bug?
2010-05-30 13:21
chatGPZ

Registered: Dec 2001
Posts: 11147
vice 2.2 had a bug, it doesnt honour the 50/60 bit at all :) its fixed in trunk (grab the exe from the other thread)
2010-05-30 18:51
Devia

Registered: Oct 2004
Posts: 401
I did this little "article" last year: http://codebase64.org/doku.php?id=base:initialize_tod_clock_on_..

Don't ask about how I came up with the number of cycles... I did a huge spreadsheet and didn't save it for some reason.. bummer ;-)

Edit: the "article" was the result of a discussion in this thread: C64 Clock/Time routine
2021-10-17 12:41
Zibri
Account closed

Registered: May 2020
Posts: 304
How to write in DC0B ?
In VICE it always reads 01
Obviously I wrote 80 to DC0F before.
2021-10-17 13:55
Krill

Registered: Apr 2002
Posts: 2854
Quoting Zibri
How to write in DC0B ?
In VICE it always reads 01
Obviously I wrote 80 to DC0F before.
When writing $80 to $dc0f, subsequent writes to $dc08..$dc0b will set the alarm time. Reading from $dc08..$dc0b will always give you the current time.
The alarm time is hidden state that you cannot read directly, and only determine via setting the current time and seeing whether the alarm triggers.
Previous - 1 | 2 | 3 - Next
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
Scrap/Genesis Project
Icecube/Light
Colt45RPM
Mason/Unicess
bugjam
Flavioweb/🇮🇹HF..
t0m3000/HF^BOOM!^IBX
Grue/Extend
Shez/House Designs
Guests online: 104
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 No Bounds  (9.6)
7 Comaland 100%  (9.6)
8 Uncensored  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 Layers  (9.6)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Crest  (9.3)
4 Censor Design  (9.3)
5 Nostalgia  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Jazzcat  (8.6)

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