[Coco] .DSK Partition extract/inject tool?

Aaron Wolfe aawolfe at gmail.com
Mon Sep 23 22:43:49 EDT 2013


On Mon, Sep 23, 2013 at 10:10 PM, Chad H <chadbh74 at hotmail.com> wrote:
> I was just wondering if there existed a tool in any Toolshed or elsewhere
> that made it easy to take a single virtual disk (0-255) out of a .DSK
> partition and inject it into another .DSK partition at a specified virtual
> disk (0-255).  Anyone?
>

Well... I don't know if this qualifies as "easy", but you can do it with DW4 :)

It involves offsets, so maybe this will help explain those too.

First, you need to understand "HDBDOS translation mode".  This setting
is found under the Tools menu in the GUI and it changes how disk
sector requests are routed to "drives" in DW4.

Historically, HDBDOS uses partitions of 256 disk images as "drives".
This makes sense when talking to a partition on a CF card, but not so
much when talking to disks on a connected DriveWire server since most
.dsk images you will find available on the internet are single disk
images, not 256 disk images.  I used to get some form of the question
"why doesn't drive 2 work" or "why does the disk in drive 0 get bigger
when I write to drive 1" etc because people did not expect or
understand the way HDBDOS works.

This lead to the addition of "HDBDOS translation" in DW4.  When this
mode is enabled, DW4 actually ignores the Drive # parameter
completely.  Instead, it routes requests for sectors 0 - 629 to the
image in "drive 0" of the DW4 server, 630 - 1259 to drive 1, and so
on.
This has the effect of allowing a user to insert arbitrary single disk
images into any of the drives on the server, copy between them without
any special tricks, and overall just acts more like users seem to
expect things to act.  It's important to remember though that the
server is really not working as HDBDOS would expect, and it is not
possible to use 256 disk images "normally" in this mode.

You *can* still use 256 disk images however, and this is how you can
copy between individual disk images inside two different 256 disk
image files.  The trick is to set your offset correctly so that the
630 sectors corresponding to the disk you wish to access are mapped
into the 630 sectors that correspond to the requests that will come
from HDBDOS.  It's not actually difficult, though there is a lot of
translation happening.

Maybe an example will make things clear(er?):

Example:  You have 2 files called big1.dsk and big2.dsk.  These are
both 256 disk images.  You wish to copy disk #6 in big1.dsk to disk #2
in big2.dsk.

Step 1:  Insert big1.dsk in DW4 Drive 0.  Right click on Drive 0 and
choose "Drive 0 Parameters..".   In the parameters dialog, set
"offsetdrv" to 6.  (You could also do the math and set "offset" to the
starting sector # for disk 6, but offsetdrv is more convenient when
dealing with 630 sector DOS images.)

Step 2:  Insert big2.dsk in DW4 Drive 1.  Right click on Drive 1 and
choose "Drive 1 Parameters..".  In the parameters dialog, set
"offsetdrv" to 2.

In HDBDOS, you can now type DIR 0 and see the contents of Disk 6 from
big1.dsk, or DIR 1 and see the contents of Disk 2 from big2.dsk.  You
can copy between these images using normal BASIC commands.

Note that you can also mount different sections of the same image file
in two or more DW4 drives simultaneously if needed.  Turning HDBDOS
translation off and doing this just right would allow a single image
file to contain 256*256 disk images.  It would be quite ridiculous,
but possible :)

Hopefully that explains both HDBDOS translation and offsets.  Another
reason to use the offset setting would be an image containing both an
HDBDOS partition with DECB disks and an OS9 partition with an RBF
filesystem.  OS9 expects the RBF filesystem to start at sector 0, so
you can use offset to align that section of the image file and OS9 is
happy.



More information about the Coco mailing list