Donate-large

If you like this blog, please make a little donation.

It's a secure process, and with your generosity I will be able to review more hardware and software.

Just click the "Donate" button below and follow the easy instructions, and I will thank you eternally.

Tuesday, April 19, 2011

IDEFile to Disk Copy 4.2 conversion

For a while I've been searching for any Twiggy disk image from an Apple Lisa 1 computer, if possible of the Lisa Office installation disks and its applications. However I've had no luck at all.

One day I found on YouTube a video of a guy repairing his Twiggy floppy drive, and I asked him for images. Unfortunately he did not have any, but sent me an image that he used for booting, using the IDEFile adaptor on his Lisa 1.

The image is not in Disk Copy 4.2 as expected by any of the emulators (LisaEm or IDLE), but seemed a simple dump of the 532 bytes per sector disk (yeah, Lisa uses 532 bytes per sector instead of 512, but that's another history).

I checked the image with a hexadecimal editor and saw that the first 20 bytes are the tags for the sector and the remaining 512 bytes are the data of the sector. So I started to create a simple converting tool that read the tags, and the sectors, and using libdc42 from Ray Arachelian, created a Disk Copy 4.2 image with the same data.

However when I checked the sectors of the DC42 image, and checked it on lisafsh-tool (from LisaEm too), they were out of order.

It was time to sleep, and in my dreams I started thinking about interleaving.

The day returned and I went on the work, checking the correct order for the sectors, I saw that indeed there was some kind of interleaving on the IDEFile image.

Sector 0 become 0 on IDEFile, 1 become 5, 2 become 10, so on.

After checking 64 sectors I saw that the sequence was always [0, 4, 8, 12, 0, 4, 8, -4, 0, 4, -8, 0, -12, -8, -4].

It was then a simply math modulus of the expected sector and 16 to get the exact offset inside that sequence, adding it to the expected sector and getting then the IDEFile sector. Multiplied by 532 gives the exact byte offset where to start reading.

I added that piece of code to my little tool, and converted the IDEFile image again to DC42.

Trying to boot it with LisaEm (romless) just made LisaEm enter in an infinite loop.

I booted LisaEm in Lisa Office 3.1 and inserted the converted image as an alternate profile, configured Lisa Office to see that profile, rebooted and voilá!

LisaFSv1Detected

Lisa Office 3.1 recognized the disk as from an older Lisa OS version. You MUST read it very carefully, because the dialog is practically the same as when you insert an uninitialized disk. I clicked "Update".

Updating

Waited for 5 minutes and...

contents

Here they are, the contents of the IDEFile image as seen by LisaEm :p

Just of curiosity, I checked out the attributes of the disk.

attributes

As you can see, the filesystem version is 14 (0x0E), the same used by Lisa Office 1 and Lisa Pascal Workshop 1.

So the update is not updating the filesystem structures, just the Lisa Office on disk structures.

I've made the source of my utility under the BSD license, that is compatible with libdc42's GPL license, and published it in this link.

From what I've read on IDEFile's webpage it stores more than one image on the hard disk using some "partition" scheme, but I don't know how to extract individual images from them unless I get a whole dump.