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 > Detect sd2iec, mmc, vice without true drive emu enabled
2021-10-10 19:26
Frantic

Registered: Mar 2003
Posts: 1626
Detect sd2iec, mmc, vice without true drive emu enabled

Is there a simple way to detect devices along the lines of sd2iec, mmc, or vice without true drive emulation enabled?

I'd like to make some simple detection for those type of devices, to use kernal fallback instead, but only if it is actually simple. If each of these devices requires some special way to be detected, I don't think I would bother...
2021-10-10 19:31
Krill

Registered: Apr 2002
Posts: 2804
See https://sourceforge.net/p/vice-emu/code/HEAD/tree/testprogs/dri.. - you memory-read a RAM value, then try to memory-execute some code in the drive that flips that value, and read it back.
2021-10-10 19:32
Frantic

Registered: Mar 2003
Posts: 1626
How convenient that the mighty Krill walked by just when I posted my question. Thanks a lot, sir!
2021-10-10 20:37
rosettif

Registered: Apr 2016
Posts: 10
Send out a "ui" (aka soft-reset) to the drive via the command channel, wait a while, then read back the prompt message. Then you can search it for some strings (better to search for some two- or three-letter abbreviations, that must be enough).

If it contains "iec", then it must be any of those devices (either SD2IEC, uIEC, or MMC2IEC etc.).

If it contains "vi" (whether for "vice" or "virtual"), then it signs a kind of virtual device (e.g. VICE's virtual file system).

If it contains "emu", then it means a kind of emulation, too (e.g. 64HDD prompts as this).

If it contains "jif", then it is a Jiffy drive. (Then you should also check the Kernal for being a Jiffy one, and if so, you won't need a fastloader.)

You can also detect the drive type by searching for "54", "57" or "58" (and so on).
2021-10-10 21:52
Krill

Registered: Apr 2002
Posts: 2804
Quoting rosettif
Send out a "ui" (aka soft-reset) to the drive via the command channel, wait a while, then read back the prompt message. Then you can search it for some strings (better to search for some two- or three-letter abbreviations, that must be enough).
Doesn't UI cause head-bumping on some drives? And maybe also reset any folder/sub-directory back to root?

It seems like the objective is to check for general capability of running custom drive code, and scanning for a couple of known strings has a hazard of failing whenever the next new mass-storage retro toy comes around. =)
2021-10-10 22:04
chatGPZ

Registered: Dec 2001
Posts: 11088
indeed, do not rely on the powerup strings.

also, ALWAYS have an option to let the user change whatever was detected. your detection WILL fail in some situation :)
2021-10-10 22:07
Krill

Registered: Apr 2002
Posts: 2804
There's no such option in Krill's Loader, Repository Version 184 (needs to select drive code for 1541/71/81). So far without reported problems. :) (It does an initial custom drive code check, though.)
2021-10-10 22:08
chatGPZ

Registered: Dec 2001
Posts: 11088
So far... :)
2021-10-10 22:41
rosettif

Registered: Apr 2016
Posts: 10
Quote: Quoting rosettif
Send out a "ui" (aka soft-reset) to the drive via the command channel, wait a while, then read back the prompt message. Then you can search it for some strings (better to search for some two- or three-letter abbreviations, that must be enough).
Doesn't UI cause head-bumping on some drives? And maybe also reset any folder/sub-directory back to root?

It seems like the objective is to check for general capability of running custom drive code, and scanning for a couple of known strings has a hazard of failing whenever the next new mass-storage retro toy comes around. =)


As much as I know, the most of the modern mass-storage drives mainly do nothing else on soft-reset, but put the string on the error channel (or even just nothing at all). On very old 1541 drives, you need to wait a considerable amount of time before reading back (like 0.1 sec or more) otherwise it freezes due to not ready with the reset sequence yet.

In case of any modern replacement drive reports itself as being the same as the old ones (e.g. using the same prompt message as the 1541), then I believe it, and expect it to also behave the same (or else, if not, then it is the fault of the drive, and not yours).

However, for safety's sake, of course, better to build in an option for skipping the drive test (e.g. when pressing C= or CTRL it won't be called, but asked the user instead).
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
Exile/Anubis
Mr SQL
Guests online: 305
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

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