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 > Keeping a few bits of information in a hostile environment
2021-04-18 09:24
Krill

Registered: Apr 2002
Posts: 2850
Keeping a few bits of information in a hostile environment

If not reserving space in RAM, where would read-writable data be most likely to survive throughout the run-time of any random demo or game?

$D800-$DC00 is often overwritten entirely, $00/$01 in RAM are too cumbersome to access.

$DD03 (parallel port data direction register) might be good, or maybe the 2x4 CIA TOD registers at $DC08 and $DD08.

Or are they? What else could be usable for that purpose? =)
 
... 72 posts hidden. Click here to view all posts....
 
2021-04-19 10:28
Krill

Registered: Apr 2002
Posts: 2850
Please refrain from posting unhelpful non-information.

The problem is somewhat solved (unless somebody has a better idea than $dd03), and now we're at the esoteric academic what-if "fun" part.
2021-04-19 13:41
Martin Piper

Registered: Nov 2007
Posts: 636
Quote: If not reserving space in RAM, where would read-writable data be most likely to survive throughout the run-time of any random demo or game?

$D800-$DC00 is often overwritten entirely, $00/$01 in RAM are too cumbersome to access.

$DD03 (parallel port data direction register) might be good, or maybe the 2x4 CIA TOD registers at $DC08 and $DD08.

Or are they? What else could be usable for that purpose? =)


Use $100-$107 and check for identical values to detect corruption?

Or use the Vice's memmap to detect what memory isn't written to during the game/demo.
2021-04-19 14:45
Krill

Registered: Apr 2002
Posts: 2850
Quoting Martin Piper
Use $100-$107[...]Vice's memmap to detect what memory isn't written to
Stack bottom has been ruled out (FBUFFR), and does VICE "memmap" also log chip register access?
2021-04-19 14:47
chatGPZ

Registered: Dec 2001
Posts: 11126
it provides a seperate map for i/o, yes
2021-04-19 15:44
Copyfault

Registered: Dec 2001
Posts: 466
Hmm...

Bit5 of $D016 doesn't do anything but (being described as a VIC reset bit) seems to be "connected".

So, unless someone finds a brandnew vic trick using this bit, it could be used to store one bit of information. Downside (sadly rendering it unsuitable imo) is that most routines "out there" don't care about this bit position and are likely to destroy it sooner or later...


Will continue searching ;)
2021-04-19 16:22
Krill

Registered: Apr 2002
Posts: 2850
Quoting Copyfault
most routines "out there" don't care about this bit position and are likely to destroy it sooner or later...
Indeed. That goes for everything VIC though, it's not uncommon to call PANIC at $E5A0 (yes, they called it that) to reset all VIC registers after pressing space. =)
2021-04-19 17:37
tlr

Registered: Sep 2003
Posts: 1717
It's not uncommon to call $fda3 either, which breaks both the $00 and $dd03 approaches but perhaps not the TOD approach.
2021-04-19 17:46
Krill

Registered: Apr 2002
Posts: 2850
Quoting tlr
It's not uncommon to call $fda3 either, which breaks both the $00 and $dd03 approaches but perhaps not the TOD approach.
Yes, but calling $FDA3 causes the loader drive code to reset to ROM, so that should not happen in a finished production. =)
2021-04-19 19:21
aeeben

Registered: May 2002
Posts: 42
Use TOD alarm time:

TOD registers may be easily overwritten if a program inits the CIA state from a lookup table.

But if you write your important number to TOD alarm time instead of TOD time, by setting bit 7 in $dx0f...

"$dx0f Bit 7: 0 = Writing into the TOD register sets the clock time, 1 = Writing into the TOD register sets the alarm time."

...you can then later recover the stored value by writing all possible values to TOC time in a loop and checking which write sets Bit 2 (1 = Time of day and alarm time is equal) in $dx0d
2021-04-19 20:22
Krill

Registered: Apr 2002
Posts: 2850
That's a neat trick. =) TOD alarm is basically never used. And it's pretty much what i meant with "hidden state".

Should work on SX-64 as well, despite no clocked TOD, yeah? :)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - 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
Credo
hedning/G★P
Luca/FIRE
Exile/Anubis
Frostbyte/Artline De..
Airwolf/F4CG
CA$H/TRiAD
Tim/Silicon Limited
iceout/Avatar/HF
Sentinel/Excess/TREX
Guests online: 170
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 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 S!R  (9.7)
5 Faayd  (9.7)

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