Author Topic: XDF disk extractor  (Read 79833 times)

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #45 on: November 05, 2018, 02:01:23 am »
2Rick Hodgin: Indeed, I tried two 1.8 MB diskette images from Merlin, I mounted them
successfully with fat32.ifs+loop.add. I was able to copy the diskette contents out of
the image! So, it is working, though, copying is slow, for some reason. Maybe, this is
because of sector interleave?

It shouldn't be slow if you're pulling from an XDF file.  The utility I wrote uses C Standard Library functions fopen(), fseek(), fread() and fwrite(), and I am able to extract the entire 1.8 MB in six files in about 1.5 seconds in OS/2 Warp 4.52 in VirtualBox.

Quote
Also, as far as i understand, these XDF diskettes have 128 bytes per sector? So, it's
working with such sectors! (I also successfully tested 2048-byte sectors. FAT32 can
mount CD's with FAT/FAT32/exFAT file system. And its FORMAT/CHKDSK/SYS utilities
also work with CDRW/DVD+-RW/BD-RE disks in packet mode. So, it is tested by me
too and is working).

But strange why then windows utilities have problems with XDF images? Is it only
because sector size is hardcoded in most of them to 512 bytes?

The XDF format "tricks" the FDC by indicating on the track record that it has 39 128-byte sectors.  But, the FDC does not rely upon that track record setting for each of the sectors within, and instead the OS sends sector size information for each sector.  So, it uses four separate sizes for the space around the track, resulting in one 512-byte sector, one 1024-byte sector, one 2048-byte sector, and one 8192-byte sector.

But, logically, the entire image inside the XDF is arranged as 23 sectors of 512 bytes.  Track 0 only uses 19 sectors, however, so the last 4 are simply ignored.

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #46 on: November 05, 2018, 02:01:36 am »
Regarding the OpenWatcom 2.0: I just tried a daily snapshot of OW 2.0 from here:

https://efbe.musca.uberspace.de/

I just compiled fat32.ifs with it successfully. Previously, I tried another OW 2.0 from
GitHub, and had problems with it. The FS utility DLL won't build. It contains a 32-bit
source which implements CHKDSK/FORMAT/SYS/RECOVER routines. These routines
are 16-bits. So, the 16->32-bit wrappers created with 32-bit C compiler, doesn't
compile. The 32-bit compiler is broken. But the build from the former site is working
fine. The only bad thing I noticed is that it seems to compile significantly slower
than OW 1.9.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #47 on: November 05, 2018, 02:04:38 am »

You might want to also look at OpenWatcom for a compiler, Borland is old, doesn't support certain things easily and I don't think it works as a cross compiler.

Latest beta can can be downloaded from

ftp://ftp.netlabs.org/incoming/open-watcom-c-os2-2.0-beta3.zip

Thanks, David!  I have used Open Watcom before for my ES/1 development in IBM PC DOS 7.  Look forward to seeing it in OS/2.

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #48 on: November 05, 2018, 02:17:51 am »
Interesting.

> The XDF format "tricks" the FDC by indicating on the track record that it has 39 128-byte sectors.  But, the FDC does not rely upon that track record setting for each of the sectors within, and instead the OS sends sector size information for each sector.  So, it uses four separate sizes for the space around the track, resulting in one 512-byte sector, one 1024-byte sector, one 2048-byte sector, and one 8192-byte sector.

So, this is only a trick for programming the FDC (at physical level).

> But, logically, the entire image inside the XDF is arranged as 23 sectors of 512 bytes.  Track 0 only uses 19 sectors, however, so the last 4 are simply ignored.

So, on logical level, XDF image is just an usual sequence of 23*80*2 sectors 512 bytes each == 1884160 bytes. So,
the problem of windows image programs is that it has 23 sectors, not 18?

Hm, but why then diunpack doesn't work with these images? It should.

Quote
L:\data\vm>diunpack WIN1.DSK -d aaa\


DIUNPACK.EXE Release 3.00 12-20-95
Copyright (C) IBM Corporation 1995
All rights reserved.


Reading disk image....


ERROR: Image file fat is corrupt
[/quite]
« Last Edit: November 05, 2018, 02:20:48 am by Valery Sedletski »

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #49 on: November 05, 2018, 02:27:03 am »
It's easy to publish something on Hobbes. Download the README.TEMPLATE from /pub/incoming, adjust the lines that need adjusting, rename it to the same name as your package, with txt rather then zip as a suffix and use ftp to upload both the zip and txt files to /pub/incoming. Best to stick to lower case as well.

Thank you, Dave.  Doing so now.  It will have two executables:

Code: [Select]
os2\xdflibsf.exe
win32\xdflibsf.exe

What other files should I add to it?  A readme.txt, etc?
« Last Edit: November 05, 2018, 02:34:49 am by Rick C. Hodgin »

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #50 on: November 05, 2018, 02:29:04 am »
Quote
L:\data\vm>vfctrl ?
VFDisk Control Program
  The possible commands are:
    Query VFDisks:  d:\os2\vfctrl.exe
    Help         :  d:\os2\vfctrl.exe ?
    Query VFDisk :  d:\os2\vfctrl.exe X:
    Set VFDisk   :  d:\os2\vfctrl.exe X: <nn>
       where <nn> is one of the following:
         0 EJECT
         1 1440 1440K 1440KB 1.44 1.44M 1.44MB
         2 1200 1200K 1200KB 1.2 1.2M 1.2MB
         3 720 720K 720KB
         4 2880 2880K 2880KB 2.88 2.88M 2.88MB
         5 360 360K 360KB
         6 1840 1840K 1840KB 1.84 1.84M 1.84MB

L:\data\vm>vfctrl x: 6

L:\data\vm>loaddskf WIN1.DSK x:

Unsupported disk type

So, vfdisk doesn't support XDF disks too, and disks of "6" format having
1840 bytes per sector, differ from XDF ones. But I think, it's possible to add
support of 23 sectors * 80 tracks * 2 sides disks to vfdisk, and it should
work.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #51 on: November 05, 2018, 02:31:00 am »
So, on logical level, XDF image is just an usual sequence of 23*80*2 sectors 512 bytes each == 1884160 bytes. So,
the problem of windows image programs is that it has 23 sectors, not 18?

Hm, but why then diunpack doesn't work with these images? It should.

Do not know.  But if you look at the file size, it's 80 * 2 * (512 + 1024 + 2048 + 8192).  They are literally a byte-per-byte transfer of the full data across the track in logical form.  It's only when they're written to a physical device that they have unusual data layouts.

Quote
Code: [Select]
L:\data\vm>diunpack WIN1.DSK -d aaa\

DIUNPACK.EXE Release 3.00 12-20-95
Copyright (C) IBM Corporation 1995
All rights reserved.

Reading disk image....

ERROR: Image file fat is corrupt

Is the .DSK file there a 1.44 MB disk image, or a 1.88 MB XDF image?  For IBM PC DOS 7.0 the first disk is a .DSK image, and it's a 1.44 MB image in standard format.  The disks 2 thru 5 are XDF format.
« Last Edit: November 05, 2018, 02:33:40 am by Rick C. Hodgin »

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #52 on: November 05, 2018, 02:44:25 am »
Yes, the same in OS/2. The boot disks 0-2 are standard 1.44 images, and disks 3-...N are
1884160 bytes == 1.796875 MB XDF images. diunpack won't extract them.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #53 on: November 05, 2018, 02:55:12 am »
I'm made the XDF/LibSF utility available for direct download.  If you want to try it out please do.  Please report any bugs.

Direct download:  http://www.libsf.org/es2/xdflibsf.zip

Code: [Select]
os2\
os2\xdflibsf.exe
win32\
win32\xdflibsf.exe
readme.txt
xdflibsf_info.txt

David Graser

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +108/-0
    • View Profile
Re: XDF disk extractor
« Reply #54 on: November 05, 2018, 02:55:29 am »

You might want to also look at OpenWatcom for a compiler, Borland is old, doesn't support certain things easily and I don't think it works as a cross compiler.

Latest beta can can be downloaded from

ftp://ftp.netlabs.org/incoming/open-watcom-c-os2-2.0-beta3.zip

Thanks, David!  I have used Open Watcom before for my ES/1 development in IBM PC DOS 7.  Look forward to seeing it in OS/2.

Rick, I found a site that may be of interest to you.

http://www.os2site.com/sw/upgrades/index.html

Although I am not a programmer, I am enjoying the sharing of information you and Valery are doing.

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #55 on: November 05, 2018, 03:07:19 am »
Rick, I tried to extract this file: ftp://osfree.org/upload/win1.dsk with your
program and see that the setup.inf file corrupted. If I extract it with my
method, the same file contents are ok, it's a simple text file. But most
files seem to be extracted fine.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #56 on: November 05, 2018, 03:11:19 am »
Rick, I tried to extract this file: ftp://osfree.org/upload/win1.dsk with your
program and see that the setup.inf file corrupted. If I extract it with my
method, the same file contents are ok, it's a simple text file. But most
files seem to be extracted fine.

I'll take a look at it.  Was it the correct file size?  If so, I may not be honoring the number of reserved sectors properly and it could be skewed by reading the wrong sectors on the disk.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #57 on: November 05, 2018, 03:12:47 am »
Rick, I found a site that may be of interest to you.

http://www.os2site.com/sw/upgrades/index.html

Although I am not a programmer, I am enjoying the sharing of information you and Valery are doing.

Thank you, David.  I can't speak for Valery, but one of my most enjoyable things is to do things for others.  My goals are to empower people, and not hinder or hobble them behind EULAs and the like, but to give them source code, teach them how to use it, allow them to move in the ways they're best suited / desiring to do.

We are all stronger when we help each other achieve more than we can do on our own.

Valery Sedletski

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +2/-0
    • View Profile
Re: XDF disk extractor
« Reply #58 on: November 05, 2018, 03:15:17 am »
Yes, the file size is 1884160 (you can download it and see). The reserved sectors are == 1.
It seems to be the same for all diskettes.

RickCHodgin

  • Guest
Re: XDF disk extractor
« Reply #59 on: November 05, 2018, 03:25:10 am »
Yes, the file size is 1884160 (you can download it and see). The reserved sectors are == 1.
It seems to be the same for all diskettes.

Can you post the first few lines of the correct setup.inf file?