SpartaDOS X Reference Manual

Technical Information




C h a p t e r    7 — Technical Information

Index


SpartaDOS Disk Format

There are four distinct types of sectors on a SpartaDOS format disk. These are boot, bit map, sector map, and data sectors. Data sectors may contain either directory data or file data. The following is a detailed discussion of each type of sector.
 

Boot Sectors

As with most other DOS types for the 8-bit Atari computer, the first three sectors on the disk are boot sectors. These contain a program to load the file designated into the system when booted and other information needed to be able to store and retrieve data to and from the disk. The boot sectors are always single density, regardless of the density of the rest of the disk.

Sector 1 from offset $30 to offset $7F and all of sectors 2 and 3 are the boot code that loads a file under SpartaDOS 2.x and 3.x if specified (with the BOOT command). This code is not used with SpartaDOS X. The first part of sector 1 is a data table containing the values listed below as offsets into the sector. A disk can be a floppy disk, a RAMDISK, or a hard drive partition unless otherwise specified. All two or three byte numbers are stored in standard low byte/high byte format.

These are the sector 1 values, given as offsets into the sector:

9   The sector number of the first sector map of the MAIN directory. 2 bytes.
11   The total number of sectors on the disk (2 bytes).
13   The number of free sectors on the disk (2 bytes).
15   The number of bit map sectors on the disk.
16   The sector number of the first bit map sector (2 bytes).
18   The sector number to begin the file data sector allocation search. This is the first sector checked when an unallocated sector is needed. This serves two purposes; it relieves the necessity of searching the bit map from the beginning every time a file is to be allocated, and it allows sectors to be reserved after the main directory for directory expansion (2 bytes).
20   The sector number to begin the directory data sector allocation search. This is the first sector checked when a directory is to be expanded or added. Keeping this separate from the search number above will help keep directory sectors close together to speed searches (2 bytes).
22   The disk volume name. SpartaDOS uses this as part of the disk change identification procedure (8 bytes).
30   The number of tracks on the disk. If the drive is double-sided bit 7 will be set. If it is not a floppy disk (a RAMDISK or hard drive partition, for example) this location will contain a 1.
31   The size of the sectors on this disk (other than the boot sectors). A 0 indicates 256 bytes per sector, while a 128 indicates 128 bytes per sector.
32   The major revision number of the disk format. SpartaDOS 1.1 disks will have a $11 here. Disks formatted for SpartaDOS 2.x, 3.x, and SpartaDOS X will all have a $20 here, since they all use identical disk formats.
38   Volume sequence number. This number is incremented by SpartaDOS every time a file is opened for write on the disk. This is used to identify the disk.
39   Volume random number. This is a random number created when the disk is formatted. It is used with volume name and volume sequence number to positively identify a disk, to determine whether or not the data in the disk buffers is still valid.
40   The sector number of the first sector map of the file to be loaded when the disk is booted. This is usually a .DOS file. It is set by XINIT.COM from the SpartaDOS Construction Set and the BOOT command.
Bit Maps A bit map is used to determine the allocation status of each sector on the disk. Each bit in every byte in the bit map shows whether the corresponding sector is in use, so each byte represents the status of eight sectors. Bit 7 represents the first sector of each group and bit 0 represents the eighth sector of each group. The bytes are in sequential order. Byte 0 of the first bit map sector represents sectors 0 through 7 (although sector 0 does not exist), byte 1 represents 8 through 15, and so on. If the bit representing a sector is SET (1), the sector is not in use. If it is CLEAR (0), then the sector is allocated. If more than one bit map sector is needed, any additional bit maps will follow on consecutive sectors.
 
Sector Maps

Sector maps are lists of the sectors that make up a file. The first two entries are the sector numbers of the next and previous sector maps of the file. The rest of the sector is a list of the sector numbers of the data sectors of the file or directory. The following are listed as offsets into the sector map:

0   The sector number of the next sector map of the file or directory. This will be 0 if this is the last sector map (2 bytes).
2   The sector number of the previous sector map of the file or directory. This will be 0 if this is the first sector map (2 bytes).
4   The sector numbers of the data sectors for the file in the proper order. If the sector number is 0, then that portion of the file has not been allocated. All sector numbers are two bytes long. See the Programming With SpartaDOS X chapter under the POINT command for a description of sparse files.

Previous page

Next page