SpartaDOS disk format

From: Michael Current (mcurrent@carleton.edu)
Date: 08/27/98-09:44:56 PM Z


From: Michael Current <mcurrent@carleton.edu>
Subject: SpartaDOS disk format
Date: Thu Aug 27 21:44:56 1998

From: "Belitz" <matz@kawo2.rwth-aachen.de>
Date: 18 Jul 1998 07:59:36 GMT

Hallo !

The following information is taken from "BW-DOS" manual, chapter 6.


Matt




        DISK FORMAT

  BW-DOS uses the same disk format as SpartaDOS. There are four kinds of
sectors: Boot sectors, Bitmaps, Sector maps, and Data sectors.

  Boot sectors are sectors 1, 2, and 3 on every disks. These sectors are
allways 128 bytes long, and contains a small program, which is started
while you turn the computer on - this program is loading DOS (or other file
specified by the "BOOT" command). The Boot loader is not the same on BW-DOS
and SpartaDOS disks, but the function of both the loaders is almost
identical.
  In the sector 1, there is an important table, which gives to the system
several informations about the whole disk (the numbers are positions in the
sector 1):

     7: Allways $80. This byte is used as an identification of SpartaDOS
compatible disk. When this value is different, you'll get the Error 148
while accessing such a disk.
     9: Sector, where is the first Sector map of the main directory. (2
bytes)
    11: Number of every sectors on the disk. (2 bytes)
    13: Number of free sectors. (2 bytes)
    15: Number of Bitmaps.
    16: Sector used for the first Bitmap. (2 bytes)
    18: The first sector, where may be allocated a data sector for a file.
This counter speeds up write operations, because the DOS need not to search
a free sector in the whole Bitmap. In addition, it'll leave a few sectors
on first tracks of the disk unused to provide space for directories. Such a
space will be used for files only when there is no other free sector on the
disk.
    20: The first sector, where may be allocated a sector for directory.
    22: Volume name of the disk. (8 bytes) This name - together with the
sequential and random numbers - is used for identification of the disk.
(The DOS bases its decision if the sectors in buffers are correct on this.)
    30: Number of tracks; when the bit D7 is set, then the drive is double
sided.
    31: Size of sectors (excepting Boot sectors). Possible values are 128,
or 0 (for 256 bytes/sector).
    32: Version of disk format. BW-DOS (and every SpartaDOS versions 2.x
and later) uses the same format marked as $20 in this byte. Older disks
($11 - created by SpartaDOS 1.x) may not be used under BW-DOS.
    33-37: Reserved for different SpartaDOS versions.
    38: Sequential number of the disk. This number is incremented every
time you're making any changes on the disk using BW-DOS functions.
    39: Random number of the disk. This number is created while formatting
the disk.
    40: Sector, where is the first Sector map of file specified for
booting. (2 bytes)
    42-47: Reserved for different SpartaDOS versions.

  The Bitmap contains the information, which sectors are free, and which
are used. Each byte holds the information for eight sectors - the highest
bit D7 is for the first, and the lowest bit D0 for the last of these eight
sectors. The bit set to 1 means, that the sector is free. The first byte
contains the information for sectors 0-7, second byte for 8-15 etc.
  When more than one sector is necessary for the map, it is stored on the
disk as a compact block (it may be for example in sectors 4, 5, and 6).

  Sector maps contains information, which sectors are used for a file.
There are physical numbers of sectors (2 bytes each) in a Sector map.
  The first number in every Sector map (in fact two bytes!) points to the
next Sector map of the file. Zero indicates the last map.
  Second number points to the previous map of the file; zero indicates the
first map.
  The rest of the map contains numbers of data sectors used for the file.
There are 62 (128 bytes/sector) or 126 (256 bytes/sector) numbers. When the
number is zero, it indicates a non allocated part of the file - see the
description of "HEXEDIT" command for more info.

  Data sectors are simply full of data.


        FORMAT OF DIRECTORIES

  Directories are in fact special files; they may be directly accessed by
adding 16 or 32 to the "aux1" value while opening the file. The directories
contains information about every files and subdirectories, 23 bytes each.
(The numbers are positions in this - 23 bytes long - block.)

     0: The status. Single bits are used:
          D0: The file is protected.
          D3: Block in directory is used.
          D4: The file is erased (block in directory is free).
          D5: Flag for a subdirectory.
         The status equal to zero means the end of directory.
     1: Sector, where is the first Sector map of the file.
     3: Length of the file (3 bytes - not for a subdirectory).
     6: Name and extension (11 bytes).
    17: Date and time in the same format as "DATER" and "TIMER".

  The first block is different; it contains an information about the
directory itself. When you want to read or write this block using BW-DOS,
you must use the POINT function - every OPEN in direct mode will set the
file position to 23.
  The information in the first block is this:

     1: Sector, where is the first map of parent directory.
     3: Length of the directory in bytes (3 bytes).
     6: Name of the directory (8 bytes).


-----------------------------------------
Return to message index