simonowen / samdisk

A portable disk image utility, specialising in copy-protected PC-compatible formats.
http://simonowen.com/samdisk
MIT License
86 stars 11 forks source link

KryoFlux device writing is not supported #22

Open simonowen opened 4 years ago

simonowen commented 4 years ago

It's possible to read directly from KryoFlux devices but not write to them, as only the read commands are understood.

The KryoFlux device creators do not provide a library or any documentation on how to drive the device from 3rd party software. The only officially supported method is to use the dtc application, either directly, or spawned from 3rd party applications to do the work. This gives little control over the process and is not an attractive solution for SAMdisk.

The only alternative is to reverse-engineer the USB protocol used by the dtc application and use the same requests directly. This has been completed for reading support only, with further work required to identify the commands and surrounding behaviour. The limited on-board buffering also requires USB streaming mode to be used to keep sufficient buffers queued up to avoid underflow during the process.

The current lack of write support is mostly due to the effort required to reverse-engineer the remaining device commands, and the availability of a fully documented competiting product (SuperCard Pro), which already supports writing.

claunia commented 4 years ago

Personally I would never add support for writing.

SM7I commented 4 years ago

I would love the write support. It really does not make any sense not to include write support. If making image from physical disk is possible, then the other way around ought to work as well. I would even make a donation to see this being done.

simonowen commented 4 years ago

I'd like add write support, but the benefit to effort ratio is still too low for it to be on my radar. I feel the time needed to reverse-engineer the application and protocol would be better spent on other projects.

The situation would be different if the KryoFlux team document the USB API or provide a library to talk directly to the device. Their current stance of spawning the CTA application to do any work is a non-starter.

I'm open to pull requests if anyone else wants to do it in the meantime.

tomas-nestorovic commented 3 years ago

Hi Simon,

I've implemented the write support in my Real and Imaginary Disk Editor, more particularly under its Issue 57. The problem consisted of two major parts - input correction, and writing.

You can find the input correction in CCapsBase::TCorrections structure which holds user's settings - correction of revolution timing, correction of number of cells per revolution, jitter correction, and correction of first sector appearance. The last one is the least important but the previous three corrections should always be applied in order make a track as much predictable and well timed as possible.

Having such well formed track, the user is free to modify its sectors (e.g. import new files to the disk, etc.).

The writing itself was more tricky to crack. The best way to adopt it in SamDisk is to simply follow the path of code in CKryoFluxDevice::SaveTrack method where you will find

However, please note that the implementation as of today is the first functional version with many drawbacks and speed concerns. Also, I haven't yet much tested it with HD floppies (much = I only know that the "KFW\1" format is the same also for them). The method is proved to work well only with 2DD 3.5"/5.25" floppies.

RIDE has adopted most of the reading support from SamDisk (plus here and there added some of its own), so I'd be very pleased to at least indirectly requite SamDisk 👍

Tomas

SM7I commented 3 years ago

Hi Tomas,

Does your software allow dor connection of an Amstrad 3” single sided drive to read/write EDSK images ?

Does it need same driver in background as SAMdisk ?

//Johan

Hämta Outlook för iOShttps://aka.ms/o0ukef


Från: tomas-nestorovic @.> Skickat: Saturday, April 3, 2021 5:35:15 PM Till: simonowen/samdisk @.> Kopia: SM7I @.>; Comment @.> Ämne: Re: [simonowen/samdisk] KryoFlux device writing is not supported (#22)

Hi Simon,

I've implemented the write support in my Real and Imaginary Disk Editorhttps://github.com/tomas-nestorovic/RIDE, more particularly under its Issue 57https://github.com/tomas-nestorovic/RIDE/issues/57. The problem consisted of two major parts - input correction, and writing.

You can find the input correction in CCapsBase::TCorrections structure which holds user's settings - correction of revolution timing, correction of number of cells per revolution, jitter correction, and correction of first sector appearance. The last one is the least important but the previous three corrections should always be applied in order make a track as much predictable and well timed as possible.

Having such well formed track, the user is free to modify its sectors (e.g. import new files to the disk, etc.).

The writing itself was more tricky to crack. The best way to adopt it in SamDisk is to simply follow the path of code in CKryoFluxDevice::SaveTrack method where you will find

However, please note that the implementation as of today is the first functional version with many drawbacks and speed concerns. Also, I haven't yet much tested it with HD floppies (much = I only know that the "KFW\1" format is the same also for them). The method is proved to work well only with 2DD 3.5"/5.25" floppies.

RIDE has adopted most of the reading support from SamDisk (plus here and there added some of its own), so I'd be very pleased to at least indirectly requite SamDisk 👍

Tomas

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/simonowen/samdisk/issues/22#issuecomment-812881415, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEZ5QPO3USIFL3P2OO7OHVDTG4YTHANCNFSM4KWMLSZQ.

tomas-nestorovic commented 3 years ago

Hi Johan,

I regretably never had a computer with 3" floppy drive, so these are not yet supported. But internal PC floppy drives are, and their support sits on the same driver as SamDisk, that is Simon's fdrawcmd.

Standard and Extended DSK images are supported - I needed them many years ago :-) But +3DOS isn't supported, so you won't see the files stored in the DSK image, unless the DSK contains one of the implemented filesystems, e.g. MS-DOS :-( Otherwise, you'll be able just to dump the DSK image to an internal PC floppy drive (3.5"/5.25") and browse its sectors in hexa-mode.

Also please note that current release is 1.5.5 (now finishing 1.5.6, to be released next week). KryoFlux R/W support is planned for 1.6 which shall be released either at the end of April or beginning of May after I've done some more tests 💾🙂

Tomas

tomas-nestorovic commented 3 years ago

A community preview version of RIDE with KryoFlux write support (2DD floppies only) has been released (a poor machine translation of Czech original, link to download at the end of forum comment). Hopefully Simon will have time to adopt (and further improve) it :-)

SM7I commented 3 years ago

This is great. Will you support 3” drives connected as either A or B drive ?

Hämta Outlook för iOShttps://aka.ms/o0ukef


Från: tomas-nestorovic @.> Skickat: Tuesday, April 27, 2021 10:14:44 AM Till: simonowen/samdisk @.> Kopia: SM7I @.>; Comment @.> Ämne: Re: [simonowen/samdisk] KryoFlux device writing is not supported (#22)

A community preview version of RIDEhttps://github.com/tomas-nestorovic/RIDE with KryoFlux write support (2DD floppies only) has been released (a poor machine translationhttps://translate.google.com/translate?sl=cs&tl=en&u=http://oldcomp.cz/viewtopic.php?f%3D54%26t%3D4920%26start%3D153 of Czech originalhttp://oldcomp.cz/viewtopic.php?f=54&t=4920&start=153). Hopefully Simon will have time to adopt (and further improve) it :-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/simonowen/samdisk/issues/22#issuecomment-827411936, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEZ5QPP6PI4IJEGBW5NRSP3TKZW7JANCNFSM4KWMLSZQ.

tomas-nestorovic commented 3 years ago

I just bought myself the starter pack for dummies, https://www.ebay.co.uk/itm/133458588651 Now yet the drive itself :-)

tomas-nestorovic commented 1 week ago

This is great. Will you support 3” drives connected as either A or B drive ?

Hi, just to revisit this topic, I've added support for 3" drives last year in Version 1.7.4 (the current version is 1.7.7). Will be more than happy if you test it and let me know your opinion. I've tested it with just one 3" drive that was yet single-sided and just borrowed for couple of weeks. Thanks! 🙏