• Please review our updated Terms and Rules here

Possible to construct ImageDisk .IMD from raw sector image with different encodings per track?

FozzTexx

Member
Joined
Aug 4, 2013
Messages
23
It seems like it's pretty common for CP/M systems that supported double density MFM to use FM encoding on the first two tracks, and then MFM encoding on the rest of the tracks. Or sometimes they use 128 byte sectors for some tracks, and larger sector sizes for other tracks.

As I'm trying to get my Altos 8000 working I'm finding a lot of the disk images archived online don't boot or have some other corruption. I think I might be able to repair some of them by working with an image made entirely of raw sectors, but then I have no way of converting the raw sector data back into an .IMD which describes how each track is encoded, so I can write it out to a real 8" floppy. It seems like the ImageDisk conversion tools only support having all tracks use the exact same number of sectors and encoding.

As an example, one of the disks I'm trying to repair needs to have the first 2 tracks replaced. The first two tracks contain the OS (seems to be not quite CP/M) and are 128 byte 26 sector FM encoding. But the rest of the tracks are 128 byte 48 sector MFM encoding. Some others use 512 byte 15 sector MFM encoding for the non-OS tracks.

Is there a way to construct an ImageDisk .IMD file from a raw sector image that uses different encodings on different tracks?
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
39,699
Location
Pacific Northwest, USA
If the question is "Can IMD handle disks with FM on one track and MFM on the other?" The answer is sure; I do it all the time.
As far as the question of preexisting utilities, I can't say.
 

FozzTexx

Member
Joined
Aug 4, 2013
Messages
23
If the question is "Can IMD handle disks with FM on one track and MFM on the other?" The answer is sure; I do it all the time.

No, that's not the question, I've been working with images that contain multiple encodings too. The challenge is if there is a way to create an .IMD with multiple encodings without reading it in from a physical disk. I have raw sector images that I'd like to convert to an .IMD with different encodings per track.
 

ldkraemer

Veteran Member
Joined
Mar 14, 2013
Messages
2,222
Location
Chaffee, MO
Sure, but you need to make sure that Dave has posted the latest update for BIN2IMD.

ref:
Hi Larry,

sorry for the delayed response.

Well... it's been a long time since I have looked at IMD!

I wrote a little test program "TIMBDIN" to generate a .BIN file with
a raw disk image that I could convert to a .IMD and be able to match
up the sectors. You won't need it but I have included it in case you
want to do further tests - just run with no options to see how to use.

It was in fact a very simple problem, a single source line:

s = head ? Side0 : Side1;

should have been:

s = head ? Side1 : Side0;

Odd that nobody ever found this. I guess because it would only occur when you
had different sector layouts on different side of the same track.
Thanks for finding it!

I will update my downloads within the next few days, in the meantime,
here is a new BIN2IMD which should work.

PS due to ISPs not allowing binaries in emails, you will need DECZIP from my site to decode the attached encoded .ZIP file!

Dave


Updated BIN2IMD located here: https://u.pcloud.link/publink/show?code=kZ2yzYVZ6spVHsghdMBJmzMaE3bUYRW9UqvX

All you need to do is define the Name.B2I file

SAMPLE:
Code:
;
;DM=0 -> FM  SD 500 kbps
;DM=1 -> FM  SD 300 kbps
;DM=2 -> FM  SD 250 kbps
;DM=3 -> MFM DD 500 kbps
;DM=4 -> MFM DD 300 kbps
;DM=5 -> MFM DD 250 kbps
;
;
;FOR CYL 0 SIDE 0 USE DM0=X, SS0=X, SM0=X
;FOR CYL 0 SIDE 1 USE DM1=X, SS1=X, SM1=X
;
;
; Example command option file to demonstrate a 40 Cylinder
; double-sided disk which is formatted 10x256 bytes sectors
; at 250kbps FM on the first two Cylinders, and 10x512 byte
; sectors at 250kbps MFM on the remaining 38 Cylinders.
;
;0   N=40 DM=2 SS=256 SM=1-10 /2
;2   DM=5 SS=512 SM=1-10 /2
;
;
;
;
;Assuming 1:1 for Binary output
; 0/0 250 kbps SD  16x128 = 2048 = 0x800
;      0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15
;      D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D
; 0/1 500 kbps DD  16x256
;      0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15
;      D   D   D   D   D   D   D   D   D   D   D   D   D   D   D   D
; 1/0 500 kbps DD  9x512
;      0   1   2   3   4   5   6   7   8 
;      D   D   D   D   D   D   D   D   D 
; 1/1  D   DE5 D   DE5 DE5 DE5 DE5 DE5 DE5
;
;
;BIN2IMD RCEMY2.RAW RCEMY2.IMD RCEMY2.B2I
;
;0  N=77 DM1=2 SS0=128 SM=0-15 DM0=3 SS1=256
;1  DM=3 SS=512 SM=0-8 /2
;
;
;
;
; 0/0 500 kbps SD  26x128 = 3328 = 0x0D00
;     1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
;     D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D 
; 1/0 500 kbps DD  15x512
;      1   2   3   4   5   6   7   8   9   10  11  12  13  14  15
;      D   D   D   D   D   D   D   D   D   D   D   DE5 D   D   DE5
; 2/0  D   D   D   D   D   DE5 D   D   D   DE5 D   D   D   DE5 D 
; 3/0  D   DE5 D   D   D   DE5 D   D   D   D   D   D   DE5 D   D 
;
; 77 tracks  Track 0 500 kbps 26 x 128
;            Track 1 500 kbps 15 x 512
;
;BIN2IMD RCEMY2.RAW RCEMY2.IMD RCEMY2.B2I
;
;PICCOLO RC702 8 INCH SETTING WRITING ON 8 INCH HIGH DENSITY DRIVE
;0  N=77 DM0=0 SS0=128 SM0=1-26
;1  DM=3 SS=512 SM=1-15  /2
;
;
; 0/0 500 kbps SD  26x128 = 3328 = 0x0D00
;     1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
;     D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D 
; 1/0 D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D 
; 2/0 D  DE5DE5D00D  D  D  DE5DE5D00D  D  D  DE5DE5D00D  D  D  D  DE5D00D  D  D  D 
; 3/0 D00D  D  D  D  D  D00D  D  D  D00D  D00D  D  D  D  D  D00D  D  D  D  D  D  D
;
; BIN2IMD BB1.RAW LKBB1.IMD BB1.B2I
;0  N=77 DM=0 SS=128 SM=1-26 /1
;1  DM=0 SS=128 SM=1-26 /1
;
;KAYPRO II
;
;IMD TD 1.4 5.25 LD FM S-step, 2 sides ADV
;
;Assuming 1:1 for Binary output
; 0/0 250 kbps SD  10x512
;      0   8   3   6   1   9   4   7   2   5 
;      D   D   D   D   D   D   D   D   D   D 
; 0/1  10  18  13  16  11  19  14  17  12  15
; HD:  0   0   0   0   0   0   0   0   0   0 
;      D   D   DE5 D   D   D   D   DE5 DE5 D 
; 1/0  0   8   3   6   1   9   4   7   2   5 
;      D00 D   D   D   D   D   D   D   D   D 
; 1/1  10  18  13  16  11  19  14  17  12  15
; HD:  0   0   0   0   0   0   0   0   0   0 
;      D   D   D   D   D   D   D   DE5 D   D 
; 2/0  0   8   3   6   1   9   4   7   2   5 
;      D   D   D   D   D   D   D   D   D   D
;
; BIN2IMD K48367F8.RAW K4836768.IMD K2.B2I
;
;0  N=40 DM=2 SS=512 SM=0,8,3,6,1,9,4,7,2,5 /1
;1  DM=2 SS=512 SM=10,18,13,16,11,19,14,17,12,15 /1
;


That makes it easy to cut and paste (.RAW = Sector Dump files) using an editor like DD in Linux.


Larry
 

FozzTexx

Member
Joined
Aug 4, 2013
Messages
23
All you need to do is define the Name.B2I file

Ah, so there was a "secret" way to do it! Thanks for the info. I didn't realize there was a B2I file that would allow specifying more detailed information than could be passed on the command line. I was able to replace the OS tracks on one of the Altos disk images and write it out and it booted! It's too bad that BIN2IMD doesn't have a way to specify interleave, apparently I have to pre-scramble the sectors in the raw file using a different tool.
 
Top