CPCWiki forum

General Category => Emulators => Topic started by: MaV on 11:11, 21 April 11

Title: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: MaV on 11:11, 21 April 11
Hi!

Some may probably know that I'm helping Markus out with his CPC-Emulator in Java at the moment.

I'm trying to implement reading and writing to DSK-Files. Due to a misunderstanding, my code only read normal DSK-Files, while Markus actually needs the whole nine yards. So I'm adding the Extended Disk-specifications. The code seems to read the disks quite fine now, but I'd still like to have some examples to be sure that I've done everything correctly. Once I have that the next part will be reading the directory (almost done) and reading files, then writing

What I need are disk files which contain (almost) all the extended disk spec peculiarities, in order to test those routines. Any help is appreciated.

MaV

Title: Re: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: arnoldemu on 11:34, 21 April 11
Quote from: MaV on 11:11, 21 April 11
Hi!

Some may probably know that I'm helping Markus out with his CPC-Emulator in Java at the moment.

I'm trying to implement reading and writing to DSK-Files. Due to a misunderstanding, my code only read normal DSK-Files, while Markus actually needs the whole nine yards. So I'm adding the Extended Disk-specifications. The code seems to read the disks quite fine now, but I'd still like to have some examples to be sure that I've done everything correctly. Once I have that the next part will be reading the directory (almost done) and reading files, then writing

What I need are disk files which contain (almost) all the extended disk spec peculiarities, in order to test those routines. Any help is appreciated.

MaV

I'll see what I can dig out.

I thought I did this already, but in fact I did it just for cdt.
Title: Re: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: MaV on 14:57, 21 April 11
Quote from: arnoldemu on 11:34, 21 April 11
I'll see what I can dig out.

I thought I did this already, but in fact I did it just for cdt.

That would be really nice!
Title: Re: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: arnoldemu on 10:54, 24 April 11
Quote from: MaV on 14:57, 21 April 11
That would be really nice!
http://www.cpctech.org.uk/testdsk.7z

DSK, EDSK and others examples.
Really you only need to support DSK and EDSK.

I'm still looking for some examples of copyprotected DSK (not EDSK). I had some once, perhaps I will need to write a tool to convert from EDSK to DSK.
The examples don't show all yet, but show some things (short files, longer files, double sided, single sided, various formats, some copyprotected).
Title: Re: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: Executioner on 05:40, 25 April 11
CPC Power has loads of "Original" DSK images with the protection intact. These include Speedlock and ERE loaders which have data in the gap and/or multiple copies of sectors etc. You can start with Jim Power :)
Title: Re: DSK-Image reading/writing in Java - need good EDSK-examples
Post by: MaV on 09:57, 26 April 11
Quote from: arnoldemu on 10:54, 24 April 11
http://www.cpctech.org.uk/testdsk.7z (http://www.cpctech.org.uk/testdsk.7z)

DSK, EDSK and others examples.
Really you only need to support DSK and EDSK.

I'm still looking for some examples of copyprotected DSK (not EDSK). I had some once, perhaps I will need to write a tool to convert from EDSK to DSK.
The examples don't show all yet, but show some things (short files, longer files, double sided, single sided, various formats, some copyprotected).

Excellent! :)

To be honest, I'm not even sure what to implement.

Markus likes to have a substitute for the cpcxfs tool to run this all natively in Java. That means support for reading DSK and EDSK (normal and copyprotected), and write-support to normal DSKs and EDSKs only. Beyond reading the disks at track- and sector-level, I *just* need to find a safe way to determine copyprotection (everything that's not formatted normally?), and then the ability to read and write files from and to these disks.

I'm thinking about offering him the following methods:
new Disk(File disk)
public something showDirectory() - DirEntry being the complete structure of a file entry in the directory, list of DirEntry objects (to change filename, status, etc.)
public byte[] loadFile(String fileName)
public byte[] loadFile(DirEntry fileName)
public void saveFile(String fileName, byte[] bytes)
public void saveDisk()

and of course a bunch of Exceptions.

The basic disk read/write-functions should work regardless of the disk format.

MaV
Powered by SMFPacks Menu Editor Mod