I've been working on some modules for the Ghidra reverse engineering tool.

Ghidra is written in Java, which I'd always avoided when I was more actively programming so this is an opportunity to learn it while in semi-lockdown.

Amstrads and Spectrum +3's both used different partly-compatible extended variants of the CP/M disk layout.

DSK is a disk image format for representing standard disks in this family, regardless of the variants as mentioned above. EDSK is an extension the DSK that can also represent non-standard disks such as those with copy protection. Basically DSK is compatible with the OSes that used these disks whereas EDSK is compatible with what the floppy drive hardware could do at a low level.

There are tons of Amstrad emulators around and even more Spectrum emulators. But only a fraction are in Java, and not all support floppy drive emulation. And I suppose some are not open source.

I hunted for any public Java libraries that can handle the disk layout, the disk image formats, or both. So far I haven't found one but I'm new to Java so might not be good at finding them. A stronger possibility is that one of the Java emulators includes some modular code for those functions that I could turn into a library or adapt in some way.

  • Don't rely on it. You are trying to find a point where two distinct wolds touch. You will probably have to write such a module yourself. – Thorbjørn Ravn Andersen May 20 at 13:06
  • @ThorbjørnRavnAndersen Well yeah I'm working on it, but as I've been told many thousands of times as a programmer, don't reinvent the wheel. Anyway an answer saying for sure that there are no such libraries is a correct and useful answer too. – hippietrail May 20 at 13:14
  • Don't reinvent the wheel if it is useful to you. A typical example is if you have the blueprints for a complex machine in metric units. You cannot just take that to the USA and expect to be able to use imperially unitted parts to build it. Same her. But what you ask, is essentially for someone to do your research for you. That normally requires a juicy bounty to make people do. Even if there was a library you would still have to adapt it to Ghidra, which you may not be experienced enough yet to do. – Thorbjørn Ravn Andersen May 20 at 15:29

It seems there is.

There is an open source C library by John Elliot for working with a selection of disks and disk image formats called LibDsk, active as of August 2019. Among the supported formats it includes

  • .DSK files, as used in CPCEMU, JOYCE and other Sinclair/Amstrad emulators.

The JOYCE emulator mentioned is by the same author.

The author added Java support via JNI in 2002 with the v0.8.0 release:

* Support added for Java Native Interface bindings (requires JDK 
 v1.1 or later). Use ./configure --with-jni to build them.
* Java versions of dskid, dskform and dsktrans added.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.