Image File Format for CP/M computers ------------------------------------ This document contains details of a proposed image file format for use with the Tatung Einstein and other CP/M-based computers. The image files have three components, in the following order: 1. Header 2. Directory 3. Images Images will be complete disc images usually, although other images are possible, such as RAM or ROM images. Image files are intended to be used on memory cards, as a convenient way of exchanging data between CP/M computers and PCs or other systems. Each component is now described in turn. ---------------------------------------- 1. Header The header is at the start of the file and is one or more sectors long. A sector is defined here as 512 bytes, aligned on a 512-byte boundary. Normally sector 0 is enough for the header, but it could be larger. Sector 0 format: Address Name Description Length ------- ---- ----------- ------ 0000H-0003H FILE_ID File ID 4 0004H FILE_VER File Version 1 0005H-0006H FILE_END Last sector of file 2 0007H-0008H DIR_START Start sector of directory 2 0009H-000AH IMG_START Start sector of images 2 000BH-000CH IMG_SIZE Sector size of images 2 000DH-000EH IMG_COUNT Number of images 2 000FH IMG_TYPE Type of images 1 0010H-001FH IMG_DESC Description of images 16 0020H-002FH OEM_NAME OEM name 16 0030H-003FH COMP_NAME Computer name 16 0040H+ {Type specific data} {varies} FILE_ID 43H, 50H, 2FH, 4DH ("CP/M" without quotes) Indicates to CP/M hosts that this is start of valid image file FILE_VER Packed binary decimal format for version x.x Defined as 10H for version 1.0 This byte allows format to change in future if required What follows is valid for version 1.0 FILE_END This value + 1 gives size of image file in sectors Maximum file size is (65535+1)*512 bytes = 32 megabytes DIR_START This value allows header to vary in size Directory is described fully later IMG_START Defines start of image 1 and, using IMG_SIZE, start of all other images as there are no gaps between them IMG_SIZE Defines size of images inside image file Multiple images within same file all have same size IMG_COUNT Defines total number of images available in file Not all of these may be in use Provided to avoid host CPU calculation IMG_TYPE 01H if image file contains disc images Other values > 1 if RAM or ROM images (to be decided) This byte determines Type specific data at 0040H+ IMG_DESC Text string describing images e.g. "200KB floppy " (without quotes) OEM_NAME Text string for computer manufacturer with space padding e.g. "Tatung " (without quotes) COMP_NAME Text string for computer name with space padding e.g. "Einstein " (without quotes) Type specific data This varies depending on Image type byte at address 0005H For Image type=01H (disc image), data defined as follows: 0040H DSC_VER CP/M disc version 1 byte DSC_VER Packed binary decimal format for CP/M version x.x Possible values are 22 or 31 or 41 Defined as 22 for Einstein images This byte determines following data: If 22 then 0041H-004FH DPB Disc parameter block 15 bytes If 31 or 41 then 0041H-0051H DPB Disc parameter block 17 bytes DPBs for CP/M 3.1 or 4.1 have two extra bytes at the end For all versions, block size given by BSH or BLM in DPB, at addresses 0043H and 0044H respectively All bytes after DPB in sector 0 are unused N.B. If image file not yet in use all bytes in sector 0 are zero, except FILE_ID, FILE_VER and FILE_END (addresses 0000H-0006H). ---------------------------------------- 2. Directory The directory is a list of user-defined names for each image in numerical order, with 16 bytes reserved for each entry. Format of directory entry: Option 1 Address Description Length ------- ----------- ------ 0000H-000FH Name 16 bytes or Option 2 copied from CP/M 3 & 4 Disc label Address Description Length ------- ----------- ------ 0000H 20H 1 byte 0001H-000BH Name 11 bytes 000CH 01H 1 byte 000DH-000FH 00H, 00H, 00H 3 bytes In both cases, byte at 0000H is 0E5H if image not yet in use First byte of first entry is 0E5H if no images yet in use Directory space needed is Maximum image number/32 sectors, rounded up to next whole sector ---------------------------------------- 3. Images Images are in a contiguous block after the directory Disc images are in logical sector order with no skews or gaps ---------------------------------------- Draft Version 1.0.1 by Tony Brewer, September 2010 Changes from 1.0: Added names for header fields Change order of fields to make them more logical