Tuesday, January 28, 2014

Absurd Commodore Disk Image Format, version 3

Whereas previously I tried to parameterize every possible physical image format, this time I'm just focusing on a more abstract but Commodore-friendly structure.  My purpose is to define a simpler format that is quite flexible, which carries data that can be transferred onto a true physical image with a minimum of fuss.

OVERVIEW

This meta-disk uses a virtual disk format with 256 sectors per track and a variable number of tracks (64k per track).  The image begins with Track 0, and has a maximum possible track number of 255. 
   
The number of tracks present in an image is always computable as:

    Number of Tracks = [Image Size in Bytes] / 65536;
Similarly, the total number of sectors present in an image is known:

    Sectors Per Track = 256;
    Number of Sectors = [Image Size in Bytes] / 256;

NO BAM

This format has no need for a Block Allocation Map (BAM). Being an image designed for virtual use rather than physical media, such a map would be presumably constructed and maintained in memory as the image is used.  If its contents are written to a physical format (e.g. a D64), the BAM would
be calculated as the target image is built, or the new image would be validated by some other means at hand.

I. Header block, 256 bytes.

   This is addressed as sector 0 of track 0, which is always a "null"
   pointer reference for data blocks.
  
   This block contains information about the disk image,
   plus meta-data found in every header block of a Commodore disk.
  
   IMAGE HEADER
  
   $00-$0c Magic Header ASCII = 'ABSURD FORMAT'
   $0d     $00    
   $0e     Header version
   $0f     $00
   $10-$1f Image Label, $a0 terminated
   $20-$21 First directory block (0/0 = none)
   $22-$23 First error block (0/0 = none)
  
   (remaining bytes thru $3f Reserved)
  
   DISK HEADER
  
   $40-$4f Disk label, $a0 terminated
   $50     $a0
   $51-$52 Disk ID
   $53     $00
   $54-$55 DOS Type and Version
   $56     $00

   (remaining bytes thru $ff Reserved)

II. Directory Block, 256 bytes.
    Standard Commodore format.  Contains up to eight directory entries.
   
III. File Block, 256 bytes.
     Standard Commodore format.
   
IV. Error Block, 256 bytes.
    Similar in structure to a file block, but contains up to 254 error bytes
    per Error Block, corresponding to sector read errors (usually for 1541 error
    protection schemes).  A full 1541 image requires three Error Blocks.

No comments:

Post a Comment