Disk images

From Ninerpedia
Revision as of 18:41, 5 April 2011 by Mizapf (talk | contribs) (Protected "Disk images" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite)))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


In order to use floppy disks in an emulator we have to deliver their contents to the emulator in an appropriate format. Floppy disks are actually two-dimensional things, but files in a computer are a sequence of bytes, so we have to arrange the floppy content somehow.

Floppy disks have a structured storage area, as shown here. We cannot see these structures as they are just result of magnetizing tiny areas on the surface. Disks where these structures can be defined as required are also called soft-sectored.

Structure of data on a floppy disk

The image shows two tracks, the outermost track, and the next one in the direction of the center. Inside each track, a certain number of data areas are defined called sectors. There is no standard concerning the number of sectors, their arrangement, and the sequence of tracks.

Between the sectors the tracks contain meta-information, in particular the sector number, track number, side number (0 or 1), CRC code (for error checking), and bit sequences to allow the controller to locate the beginning and end of the whole track and of the sectors. The meta-information is usually only of interest for the floppy controller chip, and many chips consume these bytes and do not forward them to the computer system. The WD1771 controller in the original TI disk controller, however, does forward all these information, so they can be used for diagnostic purposes or for sophisticated copy protection schemes (e.g. using an uncommon arrangement of sectors in the track).

Speaking of sector arrangements we can see that the sectors are not arranged as we might expect, although the computer usually will read them in sequence as 0, 1, 2 ... 8. But the sequence as shown here has an important benefit: The computer system gets a chance to process the sector contents (which takes some time) without missing the next sector. So the disk will have to rotate four times until all sectors are read in sequence.

If we talk about sector numbers, we have to distinguish between the physical and the logical sector number. The physical sector number is always going from 0 to the maximum number in the track (8 in this example). The logical sector number increased along all sectors of the disk. Within the first track, both numbers are equal. Sector (logical) 9 is sector (physical) 0 in track 1 on side 0.

For the TI systems, while going from the first logical sector number to the last, we proceed track by track inwards on side 0 (usually the bottomside) and then change on the other side, starting with the innermost track, and going outwards. In this illustration we have a Double-Sided Double Density disk (DSDD) with 1440 sectors (18 sectors per track, 40 tracks, 2 sides).


Hence, we have two options of saving the disk contents to a file:

  • Save the complete track including meta-information in the file.
  • Save the contents of the sectors as we won't make much use of the meta-information anyway.

In the first case we would store the complete track, then append the next track, and so on, until all tracks are stored in the file. (We have to agree on how to handle the two sides, though.) In the second case we would read all sectors in logical order from the disk and store their contents in the file. As every sector has equal size there is no problem in locating the contents of a given sector within the file: Sector 1234 is located at offset 1234*256 and reaches up to 1235*256-1.


Images for TI emulators

The Classic 99 emulator does not use disk images but maps single TI files to PC files (TIFILES format), so a disk is represented as a directory. All other emulators, including MESS, need to work with disk images. There are two options, corresponding to the above concept.

  • Files which contain the whole track information are called Track Dump Format images or PC99 format images. They have a file suffix like dsk or dtk.
  • Files which contain the sequence of sector contents in logical order are called Sector Dump Format images or v9t9 images. Their file suffix is dsk.

Both alternative names refer to the first emulators for the TI to support the formats.

How do you get those images? In the simplest case you just download those images from somewhere. Otherwise you have to create such an image using an appropriate tool like imgtool which is included in the MESS distribution.