FDF Image

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name FDF Image
Ontology
Extension(s) .fdf
Released 1991

Contents

Overview

Floppy Disk File (FDF) are disk images used by the DOS software EZ-DisKlone Plus. Introduced in 1991, the format is a compressed disk image validated by a 16bit CRC.

File Identification

FDF files have the header "1A 46 44 46".

Specifications

The FDF file format is reverse engineered in 86Box, the source code can be found at:

86Box-master\src\floppy\fdd_img.c

Basically FDF used RLE compression.

Integers are stored as little-endian.

EZ-DisKlone truncates the image, the unused sectors filled with 0xF6 at end of the disk are not stored.

  • Each track/head is stored as a block.
  • So number of bytes per block is equal to number of bytes per track.
  • If two heads then the number of blocks is even.
  • The number of stored blocks is equal/less then the number of track/heads.
  • The number of stored tracks is in the file header.
  • The CHS geometry is derived from the DiskType field.


//------------------------------------------------------------------------------
// Limits
//------------------------------------------------------------------------------

// string lengths
#define FDFFILE_LEN_DESCR     64

// sector size
#define FDFFILE_SECTOR_SIZE  512


//------------------------------------------------------------------------------
// File header
//------------------------------------------------------------------------------

// file signature
#define FDFFILE_SIGNATURE   MAKE_FOURCC(0x1A, 'F', 'D', 'F')

// disk (geometry) types
#define FDFFILE_DT_360K    0x03   /* 40/2/9  = 4608 bytes/track */
#define FDFFILE_DT_720K    0x04   /* 80/2/9  = 4608 bytes/track */
#define FDFFILE_DT_120M    0x05   /* 80/2/15 = 7680 bytes/track */
#define FDFFILE_DT_144M    0x06   /* 80/2/18 = 9216 bytes/track */


// file header
// - 128 bytes
typedef struct
{
  // equal to FDFFILE_SIGNATURE
  UINT32 Signature;

  // always zero
  UINT8  Reserved1;

  // one of FDFFILE_DT_xxx
  UINT8  DiskType;

  // description
  CHAR   Descr[FDFFILE_LEN_DESCR];

  // all zero
  UINT8  Reserved2[8];

  // unknown (0x0100)
  UINT16 Unknown1;

  // number of stored tracks
  // - must be multiplied by number of heads to get number of blocks
  UINT16 TrackCnt;

  // all zero
  UINT8  Reserved3[46];

  //
} TFdfFile_FileHdr;


//------------------------------------------------------------------------------
// Block header
//------------------------------------------------------------------------------

// block compression method
#define FDFFILE_METHOD_STORED   0x00
#define FDFFILE_METHOD_RLE      0x01
#define FDFFILE_METHOD_EOD      0xFF   /* end of data */


// block header
// - 5 bytes
// - followed by RLE compressed data
typedef struct
{
  // one of FDFFILE_METHOD_xxx
  UINT8  Method;

  // CRC16L checksum (LHA)
  UINT16 CRC;

  // number of compressed bytes
  UINT16 Size;

  //
} TFdfFile_BlkHdr;



//------------------------------------------------------------------------------
// RLE compression
//------------------------------------------------------------------------------
// - if FDFFILE_METHOD_EOD    then end of file
// - if FDFFILE_METHOD_STORED then block is stored uncompressed
// - if FDFFILE_METHOD_RLE    then:
//   * if b7 is set then the lower 7 bits are the repeat count and the next
//     byte is the byte to repeat
//   * If b7 is zero then its a store count, followed by the stored bytes
//------------------------------------------------------------------------------

Software

Sample Files

Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox