home *** CD-ROM | disk | FTP | other *** search
/ Futura 16 / Futura_Issue_16_1995_NOSAUG_Side_A_BASIC.atr / hardware.doc < prev    next >
Text File  |  2023-02-26  |  5KB  |  1 lines

  1. ¢HARDWARE WAREHOUSE¢¢ATARI DOS DISK STRUCTURE¢by Alan Hitchen¢¢    This article will attempt to describe, as simply as possible, the layout and main features of the standard Atari DOS disk.¢¢    The disk is formatted into 40 tracks containing 18 sectors in single density, or 26 sectors if in enhanced density.  This adds up to 720, or 1040 sectors, which can hold 128 bytes of information each.¢¢    Out of this total some deductions must be made.  The drive reads sectors 1 to 720, while DOS 1.0/2.0 looks for sectors 0 to 719.  This mismatch means that sector 0 means nothing to the drive, and sector 720 can't be used by DOS.  Therefore DOS 2.5 does not use sector 720 either, to maintain compatibility.  Sectors are reserved for the bootstrap, the program that loads DOS at bootup.  DOS 1.0 needs, and therefore reserves, only sector 1.  DOS 2.0/2.5 reserves sectors 1 - 3, but seems to use only the first two.  Sector 360 is for the VTOC, and 361-368 holds the  directory information.  On an enhanced density disk DOS can't use any sector above 1023, with sector 1024 holding the extended VTOC.  This leaves 707 free sectors with DOS 2.0, 709 with DOS 1.0, or 1010 with DOS 2.5.¢¢    This is not to say that your programs can't use the 'invisible' sectors, or even some of the reserved sectors, but they will be ignored by Atari DOS.  Other forms of DOS may use these 'invisible sectors', hence incompatibility problems can arise.¢¢    The Volume Table of Contents (VTOC) contains the following information about sector allocation.¢¢Byte 0 has the directory type, 1 for DOS 1.0, and 2 for DOS 2.0/2.5.¢¢Bytes 1 & 2 hold the total sector count in the Lo-Hi format, it should be 707, 709 or 1010.¢¢Bytes 3 & 4 hold the free sector count.¢¢Bytes 10 to 99 hold the sector status table, eight sectors per byte, as shown below.  If the bit is clear, the sector is in use, if set, it is available.  The unavailable sector 0 is always marked as being in use.¢¢Byte 10 bit 7 6 5 4 3 2 1 0¢     sector 0 1 2 3 4 5 6 7¢¢    In enhanced density, sector 1024 holds another VTOC, that holds the status of sectors 48 to 1023, in bytes 0 - 121.  Bytes 122 & 123 hold the number of extra free sectors available over the single density total, up to a maximum of 303 (+ 707 = 1010).¢¢    The directory is situated in sectors 361 to 368, and can hold eight entries per sector, hence the maximum file number of 8 x 8 = 64.  The format of the entries is as follows.¢¢    Byte 0 is the status byte, and can have the following values:¢¢3   DOS 2.5 file using sectors 721 and higher.  The directory display will bracket this file to show it will be invisible to DOS 2.0.¢35  As above, but locked.¢64  DOS 1.0 file.¢66  DOS 2.0/2.5 file.¢96  DOS 1.0 locked file.¢98  DOS 2.0/2.5 locked file.¢128 Deleted file of any DOS.¢¢Bytes 1 & 2 hold the total number of sectors used by the file.¢¢Bytes 3 & 4 hold the first sector number.¢¢Bytes 5 to 12 hold the file name.¢¢Bytes 13 to 15 hold the extension.¢¢    When a file is deleted it is flagged as such, and the VTOC shows its sectors to be free, but the file contents are not disturbed unless written over, thus allowing file recovery with any appropriate utility.  It is also the case, that there is usually enough spare room in the directory to allow the addition of a header, as per the Page 6 disks, or you could even use some of the unused directory sectors, if you are careful.¢¢    The files themselves, have the following format.  Bytes 0 to 124 hold the program information.  Byte 125 holds the file number (0 - 63) in bits 2 - 7.  Bits 0 & 1 and the whole of Byte 126 form the next sector pointer.  These ten bits can only manage a number up to 1023, hence sectors 1025 to 1040 can't be used by DOS 2.5.  The last sector in a chain always points to sector 0.  Byte 127 holds the number of data bytes present.  This should be 125 in all but the last sector, which is likely to be a lesser figure.  DOS 1.0 seems to use this byte as a sector count, 0, 1, 2, 3, et cetera, with a random (?) figure in the last sectors.¢¢    For those who are unfamiliar with it, DOS 1.0, dated 9/24/79, consists of one 64 sector file.  Once loaded, DOS is instantly available from memory, and no MEM.SAV file is needed.  The penalty of this approach is that only 28,814 bytes are left free, compared to 32,274 with DOS 2.0, and 32,418 with DOS 2.5.  In compensation, the disk has 645 free sectors with DOS 1.0 on board, against 626/628 for DOS 2.0/2.5.¢¢    DOS 2.0/2.5 can deal with a DOS 1.0 disk with no problems.  However, DOS 1.0 has problems with DOS 2.0/2.5 files, it throws up 139 errors, when trying to copy or duplicate, and will not load binary files.  All other DOS functions seem to be unaffected.  Finally, the DOS 1.0 menu has an extra command, define device, but what this does I can't say. ¢