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 > $DC08 / TOD issue in Vice?
2015-09-13 23:41
mhindsbo

Registered: Dec 2014
Posts: 51
$DC08 / TOD issue in Vice?

I am using $DC08 as the seed value for a random function and in Vice it always reads as 0 whereas when I run it on real hardware it has the expected behavior.

I do "unlatch" the TOD in my initialization code and when I use the monitor in Vice it shows values != 0 in $DC08 - $DC0B (as you would expect), but lda $DC08 always returns 0 in AR.

Is this a known Vice issue or am I doing something wrong?
2015-09-14 04:36
Flavioweb

Registered: Nov 2011
Posts: 463
If you see right values with monitor, i guess is your fault.
Do you modify $01 to turn off I/O in your code?
Do you have some irq code that trashes .A?
2015-09-14 10:54
chatGPZ

Registered: Dec 2001
Posts: 11386
are you using autostart? then you might always get the same value. also there were a couple odd bugs in the TOD emulation in 2.4 - try a nightly build from vice.pokefinder.org
2015-09-15 00:00
mhindsbo

Registered: Dec 2014
Posts: 51
thanks. yes using auto start, but checking at different intervals. the weird thing was that the value read (0), as shown in the vice monitor was different than what the memory window showed. I am using 2.4 so will try a nightly build.

as mentioned on actual hardware it was working as expected.

thanks again for the pointer.
2015-09-15 00:15
chatGPZ

Registered: Dec 2001
Posts: 11386
the monitor can not always be trusted, unfortunately... sometimes the value doesnt show what it should be, and sometimes (even worse imho) when you show it it will have side effects (like reading $dd0d will ACK the irq, or sth like that)
2015-09-15 00:27
mhindsbo

Registered: Dec 2014
Posts: 51
is this also true when you simply looking at the memory window? or only when stepping through code and watching the register window? I was not entering code in the monitor, just watching it.
2015-09-15 04:37
TheRyk

Registered: Mar 2009
Posts: 2246
Some of the CIA regs are even initialised/set zero by LDA. Spooky stuff if ViceMon really does the same after entering IO to display values. Wouldn't have expected that, but hopefully is not the case :) Edit: Not sure about AR/other cartridge monitors though...

Workaraound to make it a little "more random"
a) Implement some "Press Space/Any Key" before you call TOD for the first time, so that most users won't always trigger your TOD stuff at always exactly the same cycle
b) Combine TOD with other stuff such as SID noise, Frame counters, or even weirder stuff

PS: Wasn't there some Autostart option to prevent exactly this issue...?
2015-09-15 06:28
Bitbreaker

Registered: Oct 2002
Posts: 508
Quoting TheRyk
Some of the CIA regs are even initialised/set zero by LDA. Spooky stuff if ViceMon really does the same after entering IO to display values. Wouldn't have expected that, but hopefully is not the case :) Edit: Not sure about AR/other cartridge monitors though...


Built in monitors like AR will for sure just read the registers via some ld* opcode and by that also trigger things like irq acknowledgements. As for the VICE monitor i thought it might show values without really touching the registers. At least here it would be technically possible.
2015-09-15 09:20
MagerValp

Registered: Dec 2001
Posts: 1078
Syntax: sidefx [on|off|toggle]
Abbreviation: sfx

Control how monitor generated reads affect memory locations that have read side-effects. If the argument is 'on' then reads may cause side-effects. If the argument is 'off' then reads don't cause side-effects. If the argument is 'toggle' then the current mode is switched. No argument displays the current state.
2015-09-15 10:17
soci

Registered: Sep 2003
Posts: 480
Quoting TheRyk
PS: Wasn't there some Autostart option to prevent exactly this issue...?

-autostart-delay-random
Enable random initial autostart delay.
2015-09-15 10:26
soci

Registered: Sep 2003
Posts: 480
Quoting mhindsbo
I am using $DC08 as the seed value for a random function and in Vice it always reads as 0 whereas when I run it on real hardware it has the expected behavior


Same on some real machines running off switching power supplies. I think I've put in a 50Hz oscillator in most of my machines by now, for rare cases like above. Still I don't like to use the TOD as a clock in my code as it might not run for everyone.
 
... 1 post hidden. Click here to view all posts....
 
Previous - 1 | 2 - 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
csabanw
Magic/Nah-Kolor
psych
Guests online: 111
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.06 sec.