-
Notifications
You must be signed in to change notification settings - Fork 14
Description
I wanted to convert https://www.hpmuseum.net/software/PORTGAME.TD0 from https://www.hpmuseum.net/display_item.php?sw=91 to a raw image so I can extract files. The wonderful scan command showed how the disk has a mess outside of the parts that I want. The data is only on side 0. It claims to have 17 sectors, but has non-existent sector 17 on every track:
[PORTGAME.TD0]
81 Cyls 2 Heads:
250Kbps MFM, 17 sectors, 256 bytes/sector:
0.0 0 11 6 1 12 7 2 13 8 3 14 9 4 15 10 5 17[n0,dc]
1.0 8 3 14 9 4 15 10 5 0 11 6 1 12 7 2 13 17[n0]
This continues until cylinder 69, and then it switches to 512 bytes/sector:
69.0 0 11 6 1 12 7 2 13 17[n0] 8 3 14 9 4 15 10 5
70.0 <blank>
250Kbps MFM, 9 sectors, 512 bytes/sector:
71.0 1 2 3 4 5 6 7 8 9
Finally there is a 2048 byte sector from floppy duplication firm "Trace Mountain Products".
79.0 1 2 3 4 5 6 7 8 9
250Kbps MFM, 1 sector, 2048 bytes:
80.0 1
250Kbps MFM, 9 sectors, 512 bytes/sector:
0.1 1 2 3 4 5 6 7 8 9
Side 1 is all 512 byte sectors like this and then the 2048 byte sector. The actual image I want is the 256 byte sectors on side 0, tracks 0 to 69, sectors 0 to 15. Seems like samdisk copy -h 0 -s 16 -c 70 PORTGAME.TD0 portgame.raw should work. But no!
Error: mixed sector sizes are unsuitable for raw output
So I comment out the code that causes that error message:
Lines 122 to 123 in ea9d202
| else if (s.header.size != fmt.size) | |
| throw util::exception("mixed sector sizes are unsuitable for raw output"); |
Still no:
Error: non-sequential sector numbers are unsuitable for raw output
Then I comment out the code which causes that message:
Lines 129 to 130 in ea9d202
| else if (max_id < fmt.base || max_id >= fmt.base + fmt.sectors) | |
| throw util::exception("non-sequential sector numbers are unsuitable for raw output"); |
Finally it works!
Now the problem is that nothing will mount the raw FAT12 image, due to 256 byte sectors and other issues. But I don't think the image is corrupt. Using documentation about the FAT file system, I quickly create a small Python program to extract files, and it extracts programs that work when uploaded to the HP Portable Plus. https://gist.github.com/dreamlayers/7a61129a1ca0d5a8911d6d107fb177bb
So, I think this program is perfectly capable of extracting from this disk image when provided with command line arguments that limit it to the parts of the image that I want. The problem is that the raw format output code aborts the extraction due to other parts of the disk, that I clearly don't want in the output image based on the command line arguments. (This wasn't hard to overcome and it was fun. Thank you for creating a program that is capable of dealing with such messed up images.)
Edit: Theoretically, another workaround, without code changes, could be converting (copying) to another format, and then to raw. However, I cannot make the unwanted sector 17 go away. I can limit the copies to side 0, and limit to cylinders 0 to 69, but the -s argument cannot be used to eliminate unwanted sectors.