MESS HD Preparation

From Ninerpedia
Revision as of 00:12, 9 December 2009 by Mizapf (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using MESS and its tools has changed a little, so you may also study the Previous MESS HD conversion procedure.

From outside to MESS

Dumping

Unix-like operating systems are the well-known Linux, FreeBSD, and Mac OS X. These system represent devices as special files in their file system and provide the dd command for reading from every kind of file. The dd command can also be used to read raw sectors from a SCSI hard drive. The details are described in Interfacing with the outside world.

TODO: Someone to provide details how to dump a SCSI disk to Windows.

The maximum reasonable file size is 268435456 bytes (248 MiB). Files that are greater cannot be used and must be truncated.

Calculating the CHS values

As long as MESS does not offer a SCSI emulation for the TI/Geneve family, we must try to make the HFDC emulation accept the SCSI image. This should not be too complicated, as both are working with the same sector sizes and the same file system. However, there are some subtle differences, especially in the Volume Information Block. SCSI does not use the geometry parameters cylinder/head/sector, so we must provide resonable values for that.

The HFDC can handle up to 2048 cylinders, up to 16 heads, and up to 256 sectors per track. You can calculate the size as follows:

size = 256 bytes/sector * number of sectors per cylinder per head * number of cylinders * number of heads

and vice versa, if you have the size, you can choose suitable values here. Take care: We need those values a second time. So for a drive with maximum capacity of 248 MiB, we can calculate

248 MiB = 256 * 32 * 1984 * 16

1984 cylinders
16 heads
32 sectors/track

You must now write the values for sectors/track and heads into the Volume Information Block, for instance, by using a hex editor. I recommend to do this before you create the MESS image. A suitable editor for Linux is ghex2. The VIB should already contain the number of sectors per AU (we take the maximum, >F, which gets a one added to make it 16). Similarly, you put the number of heads minus one into the second half-byte. Put the sectors per track into the corresponding field.

The other values are not so important for emulation, but you can use the following defaults:

Step speed = 1
Reduced write current = >3A
Buffered step = 0
Write precompensation = >1D

If you have done this, you should already have a useable HFDC image. However, in some cases, there are some more field to fix.

Repairing invalid Maximum AU numbers

There are SCSI images which have an invalid maximum number of allocation units, due to a bug in a formatting tool. While the SCSI DSR does not care, the HFDC shows problems. The maximum AU value must be limited to >F800 even if the device is larger. This value must be corrected in the Volume Information Block and all Directory Descriptor Records. (Experiments showed that it may suffice to correct the VIB and the DDRs of all direct children, i.e. the directories in the root directory.)

You must find all these DDRs (which can be tedious) by manually following the directory tree and correct bytes 10 and 11 (>0A and >0B).

Converting to MESS HD

This applied for MESS version 0.135 and higher.

Finally we can create the image file for MESS. You need to use the CHD manager tool (chdman). CHD stands for Compressed Hunks of Data and is basically a kind of zip file for large images. However, for hard drives we need to get uncompressed images. chdman got a new option to simplify the process of getting an uncompressed, writeable image:

chdman -createuncomphd inputhd.raw output.chd [ident.bin] [inputoffs [cylinders heads sectors [sectorsize [hunksize]]]]

As our dump is not headered, the input offset is 0. We should also define (logical) sector sizes as 256. And the output file may also be suffixed by "hd" instead of "chd" which is not important for MESS, but just to remember that this is an uncompressed image.

So for our example, if our SCSI dump is stored in the file scsi.raw and already corrected as describe above, we should use it in this way:

chdman -createuncomphd scsi.raw scsi.hd 0 1984 16 32 256

Note that you must use the exact values for cylinders, heads, sectors as you calculated above, or you will get an unreadable image.

And now this image should be useable in MESS.

mess ti99_4a -hard1 scsi.hd

From MESS to outside

You may also be interested in the opposite process: We have a MESS HD image, and now we want to use it with the real TI or Geneve again. You basically have to follow the reverse process.

Extracting the raw image from the MESS image

At first we need to get the raw image from the CHD container. This is also possible with chdman. Use the extract command:

chdman -extract input.chd output.raw

Here:

chdman -extract scsi.hd scsi.raw

Converting to SCSI

Good news: You do not need to put in the MaxAU bug. For converting to SCSI, you just drop the CHS values from the VIB. Clear the heads half-byte, leaving a >F0 value. Clear the sectors/track, step speed, reduced write current, buffered step flag and write precompensation in the Volume Information block.

Writing to the device

Connect the SCSI drive to your PC SCSI controller. Then you should continue with reading Interfacing with the outside world.