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


Forums > C64 Coding > $DC08 / TOD issue in Vice?
2015-09-13 23:41
mhindsbo
Account closed

Registered: Dec 2014
Posts: 50
$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?
 
... 1 post hidden. Click here to view all posts....
 
2015-09-14 10:54
chatGPZ

Registered: Dec 2001
Posts: 11101
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
Account closed

Registered: Dec 2014
Posts: 50
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: 11101
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
Account closed

Registered: Dec 2014
Posts: 50
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: 2053
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: 499
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: 1055
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: 473
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: 473
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.
2015-09-15 10:35
chatGPZ

Registered: Dec 2001
Posts: 11101
- yes, the monitor _should_ not have side-effects when accessing I/O. however, that part of the code apparently wasn't implemented properly in all cases (i have fixed a bunch of things related to that since 2.4, but i still would'nt guarantee it works 100%)
- the random autostart delay is 5 frames maximum (by default anyway), you'd have to make that value quite a bit larger to see values other than 0 in dc08 often enough (iirc the TOD cant expected to be running after plain reset/kernal init though)
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
acrouzet/G★P
Guests online: 88
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.5)
2 Black Beard  (9.4)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

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