Author Topic: DSK-Image reading/writing in Java - need good EDSK-examples  (Read 3696 times)

0 Members and 1 Guest are viewing this topic.

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.120
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 418
  • Likes Given: 850
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

Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
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.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.120
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 418
  • Likes Given: 850
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!
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
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).
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
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 :)

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.120
  • Country: at
  • Ius summum saepe summa est malitia.
  • Liked: 418
  • Likes Given: 850
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
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."