Reference on D88 disk image format

 To investigate what code gets executed when a disk is loaded in one of the Japanese computers, we can investigate the contents of the disk image. Disk images for many Japanese computers are often distributed in the D88 format. Luckily it is a simple format and there's a reference about it in English here:

https://www.z88dk.org/tools/x1/XBrowser_User_Guide.pdf

Look in Appendix II. It is a reference to a tool intended for Sharp X1 users, but the format is the same used in PC88 and other Japanese computer emulators and tools. 

The information is organized by tracks and then by sectors, as in a real disk.

File header

The file begins with a header with the following fields:

struct header {
   char[17] name;           // image name, usually empty
   u8[9]    reserved;       // reserved, usually zero
   u8       write_protect;  // non-zero value means write-protected disk
   u8       media_type;     // 0: 2D, 0x10: 2DD, 0x20: 2HD, 0x30: 1D, 0x40: 1DD
   u32      disk_size;      // image size, little-endian for the PC88
};

Track offsets

Starting at address 0x20 there is a list of track offsets, to ease access to the data. The list is composed of 164 track offsets, each one 4 bytes long. If the disk has less than 164 tracks, the extra entries will be left unused and set to zero.

Each track in the disk is divided into sectors, and in the disk image the tracks point to a series of sector blocks.

Sector blocks

Each sector block begins with a header and then the data. The header occupies 16 bytes as in the following structure:

struct sector_header {
   u8    cylinder;     // C 
   u8    head;         // H
   u8    sector;       // R
   u8    size;         // as a power of 2, 128 << size 
   u16   numb_sectors; // number of sectors in the track
   u8    density;      // 0x00: double density; 0x40: single density
   u8    ddam;         // deleted-data address-mark; usually 0
   u8    fdc;          // floppy-disk controller status code; usually 0
   u8[5] reserved;     // usually 0
   u16   actual_size;  // number of bytes following header
};

Comments

Popular posts from this blog

How many instructions per frame?