Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Lotmamordun ! (Registered 2021-05-11) You are not logged in 
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: 1879
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? =)
 
... 68 posts hidden. Click here to view all posts....
 
2021-05-04 12:30
Krill

Registered: Apr 2002
Posts: 1879
Quoting Copyfault
couldn't you always send the 1541-save routine and have some watch-dog-alike routines on 1571- and 1581-side that will cancel the send-procedure and request "their" routine when the watch-dog detects the (first bytes of the) 1541-save-routine incoming?
Quoting Groepaz
All in 4 Bytes :=)
Quoting Copyfault
Oh noes, that's not much /o\ Got the impression that there's still more free space, at least for drivecode on the non-1541-drives.
The main problem with such an approach (it's nothing to do with watchdogs, though) is that it would most likely add bytes either to the 1541's regular loader code or the C-64-side resident loader code. Bytes i don't have or don't want to afford. =)

The custom code upload part re-uses the C-64->drive routines normally used to send the filename.

Some kind of receive-rejection could be implemented by the receiver permanently asserting the data line and the sender detecting that the bit it put on the bus isn't the same it reads back.
Works only with one of the two bit values, though, but should work with a canary byte that is neither $00 nor $ff.

I am still not quite certain if this can or cannot work without the mentioned drawbacks...
But then i think the simple and safe solution of having the user shuffle over the drive type from installer return values struct to save/code upload parameter struct is acceptable.
Not as elegant, of course. =)
2021-05-04 13:03
Krill

Registered: Apr 2002
Posts: 1879
Quoting Rastah Bar
Switching codes $00 and $ff for one of the drives might provide one bit of information.
So one type of drive would send $00 and mean "GOOD", the other would send $00 and mean "EVIL", and vice versa for $ff? How would the C-64 side know which is which? :)

Quoting Flavioweb
why don't reserve a file name/file number which return a byte containing drive model value?
Would have to be implemented on all drives, and 1541 doesn't have space for that code.

Quoting Rastah Bar
Can't you just always upload the highscore saver right away, that is, together with the loader code?
No, there are just 2KB of RAM in the drive, almost all of it used for load operation.

Quoting Rastah Bar
How does a random user know in the first place that the loader has been installed on the drive?
User in this context means a person consciously using the loader library and putting loader calls all over their program, starting with "jsr install". They should know.
2021-05-04 13:33
Rastah Bar

Registered: Oct 2012
Posts: 296
Quoting Krill
Quoting Rastah Bar
Switching codes $00 and $ff for one of the drives might provide one bit of information.
So one type of drive would send $00 and mean "GOOD", the other would send $00 and mean "EVIL", and vice versa for $ff? How would the C-64 side know which is which? :)

By this clumsy method of trying to load a nonexisting file. The C64-side code expects a "file not found" error and when it receives $00 it knows it's dealing with a 1571 drive, while $ff means 1581.

Quoting Rastah Bar
Can't you just always upload the highscore saver right away, that is, together with the loader code?
Quote:
No, there are just 2KB of RAM in the drive, almost all of it used for load operation.

So the goal is to replace loader code by highscore saver code?

Quote:
User in this context means a person consciously using the loader library and putting loader calls all over their program, starting with "jsr install". They should know.

Oh, I see. I was thinking that the problem was something like this: someone ran a demo or played a game that installed the loader. Then he swaps disks because he now wants to play another game, which has a hiscore saver. And now your hiscore saver code has to be uploaded. Does that make any sense, or not?
2021-05-04 13:47
Krill

Registered: Apr 2002
Posts: 1879
Quoting Rastah Bar
Quoting Krill
[How would the C-64 side know which is which? :)
By this clumsy method of trying to load a nonexisting file.
Then the regular load code would also have to do this prior to loading an expected (but not guaranteed) existing file.

Quoting Rastah Bar
So the goal is to replace loader code by highscore saver code?
Yes. Swap out loader code to C-64 memory, swap in saver code, save, swap back loader code.

Quoting Rastah Bar
someone ran a demo or played a game that installed the loader. Then he swaps disks because he now wants to play another game, which has a hiscore saver. And now your hiscore saver code has to be uploaded. Does that make any sense, or not?
Running another program usually involves resetting the computer, which would cause the drive-side loader code to reset the drive as well.
2021-05-04 13:52
Rastah Bar

Registered: Oct 2012
Posts: 296
Thanks for the explanations!
2021-05-05 03:45
Cruzer

Registered: Dec 2001
Posts: 1002
Had to look up heuristics, and found this very useful definition...

2021-05-05 07:15
map

Registered: Feb 2002
Posts: 20
Quoting Krill
But then i think the simple and safe solution of having the user shuffle over the drive type from installer return values struct to save/code upload parameter struct is acceptable.
Not as elegant, of course. =)


From all mentioned approaches this one sounds the best from my point of view. Leave the responsibility to find a good spot in the memory to the integrator of the Loader. Agreed, that it is less elegant.
Maybe having the Drive code to send some identification would be a good aproach as well as mentioned before but will cost not available resources and creates overhead.
2021-05-06 15:41
Sparta

Registered: Feb 2017
Posts: 25
While waiting for Krill's saver plug-in, try out Sparkle 2's hi-score file saver! :)
2021-05-07 12:32
Zibri

Registered: May 2020
Posts: 151
Quoting Cruzer
Had to look up heuristics, and found this very useful definition...


lol for the "useful definition", anyway:

Heuristic comes from ancient greek and it's root is the verb EURISKO which means "to find".
A heuristic algorithm is a non deterministic one, is an algorithm, usually slower but sometimes needed, which employs a search function for a predetermined pattern or behaviour. Our brain for example uses both but mainly the heuristic method.
In short, any heuristic program or line of thought, basically does an "educated guess".
2021-05-07 13:33
Krill

Registered: Apr 2002
Posts: 1879
The better your heuristics, the more (H)EUREKA! moments you'll have.
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - 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
TheRyk/MYD
Lotmamordun
E$G/-/OKUTO FORCE
Krill/Plush
MWR/Visdom
JackAsser/Booze Design
hedning/G★P
alwyz/udi
Guests online: 153
Top Demos
1 Edge of Disgrace  (9.6)
2 Comaland 100%  (9.6)
3 Uncensored  (9.6)
4 Coma Light 13  (9.6)
5 Unboxed  (9.6)
6 Lunatico  (9.5)
7 Memento Mori  (9.5)
8 Wonderland XII  (9.5)
9 Christmas Megademo  (9.5)
10 The Shores of Reflec..  (9.5)
Top onefile Demos
1 Copper Booze  (9.8)
2 Daah, Those Acid Pil..  (9.6)
3 To Norah  (9.5)
4 Lovecats  (9.5)
5 Dawnfall V1.1  (9.5)
6 Square Booze  (9.4)
7 Quadrants  (9.4)
8 Elite Code Mechanics  (9.4)
9 For Your Sprites Only  (9.4)
10 Remembrance  (9.4)
Top Groups
1 Booze Design  (9.4)
2 Censor Design  (9.3)
3 Oxyron  (9.3)
4 Fossil  (9.3)
5 PriorArt  (9.3)
Top Original Suppliers
1 hedning  (9.8)
2 Baracuda  (9.6)
3 Derbyshire Ram  (9.4)
4 Irata  (9.2)
5 Jazzcat  (8.9)

Home - Disclaimer
Copyright © No Name 2001-2021
Page generated in: 0.039 sec.