• Please review our updated Terms and Rules here

Kaypro disk tool enclosed

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
2,255
Location
USA
Kaypro's DSDD disks use a different sort of sector naming where apparently on the second side of the disk the sectors are numbered 10-19 and claim to be head 0 instead of head 1. I tried using the imagedisk tool to generate an IMD file with the correct sector layout, but it would have required a raw image that has the sectors in interleave order, so I just ended up writing a disk tool that converts from raw images to IMD images and back again. Samdisk can already go from IMD to RAW, but it can't go from RAW to IMD.

The thought was that one can convert or build a raw disk with it, then convert it to IMD, write it with ImageDisk and use it on real hardware.

It supports both SSDD or DSDD disks. You can also export CP/M (boot track and allocation block 1) to a file and then import it again to a different disk image.

I still have some more ideas about what I want to add to this utility, but for now here is what it can do:

This is a WIN32 console application.

Code:
KAYDISK 1.00

Usage: KAYDISK command options

Commands:
copy inputimage outputimage ["optional IMD description if output is IMD"]
make outputimage ssdd|dsdd
exportcpm inputimage cpmfile
importcpm modifiedimage cpmfile

It uses the file extension to determine the file format:
.IMD = ImageDisk format
.RAW = raw flat binary format
 

Attachments

  • kaydisk_100.zip
    33.5 KB · Views: 9
The continous sector numbering was probably because CP/M < 3.0 has no notion of 'heads', only tracks and (128 byte) sectors. The bios takes care of the conversion.
 
That makes sense - I wondered if they also used it to detect if a disk was SSDD or DSDD. All they have to do is read track 1 to determine. On a SSDD disk it is real track 1 with sectors numbered 0-9, and on a DSDD disk it is real track 0 with sectors 10-19. I've tested booting CP/M for the IV which knows about DSDD disks and then trying to log in a SSDD disk in B:. It properly determines that it is a SSDD disk and stat dsk: will report correctly. It does this by looking for valid track data on the backside of the disk I think. If I format a DSDD disk using SSCOPY as a SSDD disk, it may try to wipe that second side track, but I am not sure. It will hang trying to log it in and I can't read it with IMD. If I use a magnet on the disk or bulk erase it, then format it with SSCOPY, it works fine.
 
In fact, if you cruise the CP/M format world, the sector IDs can be anything you'd like. Back in the day, we used sector numbers starting with 1 for single-sided media and 128 for double-sided. You need only do a single READ ID to figure out which was being used. But in reality anything that will fit into 8 bits can be used for a sector number. Same for cylinder number. IDs, with the exception of the sector length code are just that--a way of naming sectors. Some controllers can increment the sector number automatically if a multi-sector operation is specified, but that's a feature, not a requirement.

How many different Kaypro formats can your tool support? In particular, the Advent and Pro-8 ROMs have interesting differences from standard Kaypro formats.
 
You should be able to convert the Kaypro 4 *.RAW file to an K4.IMD file with Mr Dunfield's BIN2IMD utility.
His current version on his website has a BUG and has not been updated yet. He has corrected the problem
and has a newer version of BIN2IMD which he should release as time permits.

The BIN2IMD utility converts raw binary disk images into ImageDisk .IMD format by adding Mode, Cylinder, Head, and Sector information
to each track/side record.

BIN2IMD can be useful to convert raw disk images (such as those used by many emulators) into ImageDisk images. It can also be
useful in converting images from other sources - even if those images contain embedded format information, it may be easier to
convert them to raw binary format and then use BIN2IMD to generate a .IMD file than it is to try and convert directly to the .IMD
format.

You just need to create a K4.B2I file for the configuration.

K4.B2I
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
;
;BIN2IMD has been updated by Mr. Dunfield, but his website hasn't been updated.
;
;Be sure to add the /1 or /2 at the end of the stanzas
;
; 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
;
;
;KAYPRO IV
;
;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 K4file.RAW K4file.IMD K4.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


C:\> BIN2IMD K4file.RAW K4file.IMD K4.B2I

Give it a try with the updated BIN2IMD file.

Larry
 
Last edited:
Back
Top