| |
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.... |
| |
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 :) |
| |
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. |
| |
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 :) |
| |
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? |
| |
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. |
| |
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? |
| |
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) |
| |
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 |
| |
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. |
| |
Krill
Registered: Apr 2002 Posts: 2854 |
Quoting ZibriHow 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 |