I gave it some thoughts and here's what I've come up with.
The Idea is to make it possible to handle it on a real SAM using
CD-ROM and CF in the future.

----------------------------------------------------------------------
SDI or Sam DiskImage is a new diskimage format to replace the
.DSK .MGT and .SAD diskimages. Key features are crc protection,
a flexible format and smaller diskimages. Diskimage sizes are
reduced by not including unused or empty sectors on a disk.
Information to keep track of the sectors that are used is
achieved with a minimum of overhead.

A SDI diskimage can be seen as just an array of sectors where the
first sector (header) tells where the other (used data) sectors belong.

The diskimage has following structure:

+- header sector -----------+
| 16 byte diskimage info    |
| sectormap                 |
| discription               |
| [zero filed gap]          |
+---------------------------+
+---------------------------+
|     First used sector     |
+---------------------------+
...
+---------------------------+
|     last used sector      |
+---------------------------+

 16 byte diskimage info 
-----------------------

bytes      Discription

[3] 'SDI' magic number in capitals. 

[4] 32-bit crc. calculated from next byte onward to the last
    byte of the header. This crc should be used to validate
    the header.
  
[4] 32-bit crc. calculated over all the data sectors in the
    image excluding the header.
    32-bit crc are calculated in the same way as ZMODEM,ZLIB
    and PKZIP

[2] disk geometry:
    bit  7     = sides: 0 for single sided 1 for double sided
    bits 6-0   = tracks 1 to 127 tracks
    bit  15    = start sector: 0 start with 0, 1 start with 1
    bits 14,13 = sector size: 00 128 byte sectors
                              01 256 byte sectors
                              10 512 byte sectors
                              11 1024 byte sectors

    bits 12-8  = sectors per track 1..31 sectors

    DEFAULT: value is D0CAh 

[1] empty sector value. A sector completely filled with this
    value is considered empty and are not included in the sector
    data.
    DEFAULT = 00h

[1] image flags:
    bit 7 = Write Protect: When set no changes are allowed to
            data sectors in the image. Header info can be edited
            regardless of the state of this bit. To protect the
            header. The read only file attribute of the image
            file should be set.
            DEFAULT = 0

    bit 6 = Dynamic Image: When set, disk geometry may be
            dynamically resized to minimum geometry or expanded
            depending of the changes made. For example when this
            bit is set and the image is formatted the a geometry
            is changed to a single sided disk with just one track
            contain one sector.
            when writing a non empty sector outside the images 
            geometry then the geometry will be extended if the
            sector allocation map can also be extended.
            When this bit is clear then the geometry will not change
            and any sector access outside the geometry will produce
            an error.
            DEFAULT = 0

    bit 5 = emulator boot preference. When this bit is set then
            it is prefered to always do a cold boot when F9 is
            pressed or BOOT is executed.
            DEFAULT = 0

    bit 4 = reserved and should be 0
    
    bits 3-0 = dos emulator. On the real hardware this flag can
               be used to decide which diskimage emulator is
               loaded to emulate the diskimage.

               0 = no preference
               1 = SAMDOS
               2 = MasterDOS
               3 = MASTERDOS+MasterBASIC
               4 = Pro-DOS
               6 = B-DOS

               DEFAULT = 0 no preference

[1]  Reserved and should be 00h
    
[xx] sector adress map or SAM. Like in a directory slot the SAM
     represents which sectors are used and the position in the
     map determines which track and sector status it reflects.
     A '0' bit means that the sectors data is not included in
     the diskimage a '1'bit means the sectors data is included.
     the SAM has the same makeup as in a directory slot. starting
     with bit 0 for the first track and sector up on side one.
     Side two follows after the last sector on the last track starting
     with bit 0. In case of odd track or sector numbering each side
     may have some gap bits which should always be 0.
     So incase of a standard disk layout of 2 sides 80 tracks 10
     sectors starting with sector 1. Track 0, sector 1 starts at
     bit 0,byte 0 and track 128, sector 1 starts at bit 0,byte 100  

     The sector allocation maps size can be calculated by the
     following formula:

     size = sides *int((tracks * sectors-per-track + 7)/8) any
     unused bits should be set to 0.

     DEFAULT SIZE = 200 (double sided 80 track 10 sector disk)

[xx] diskimage discription. The diskimage discription is optional
      and can contain one or more zero terminated strings.
     the first zero terminated string should have the following
     make-up:

     Title[0]
     Copyright/Release[0]
     Author(s)/Programmers/Artists[0]
     Discription[0]

     example:

     SAMDOS V1.0[0]
     (C) 1989 MGT[0]
     BRUCE GORDON[CR]
     ANDREW J.A. WRIGHT[0]
     The DOS that wouldn't boot[0]

     Note that empty strings consist of just a terminating zero.
     This zero is used to count to the strings. and determine
     the gap size.

     DEFAULT SIZE = 4 bytes ( zero terminators) 

[xx] gap filled with zeros to get the header length of 512 bytes.
     This Gap may have a length of 0 in some cases. The size of
     this gap should be calculated by substracting the position
     after the discriptions terminating zero from 512.

     DEFAULT SIZE =292 bytes

---------------------------------------------------------------

Edwin

Reply via email to