ATARI HARD DISK FILE SYSTEMS REFERENCE GUIDE Jean Louis-Guérin (DrCoolZic) Version 1.
Table of Content How to Read this Document ............................................................................................... 5 PART I – ATARI HARD DISK FILE SYSTEM PARTITIONING GUIDE............................... 7 Chapter 1. Partitioning Information ................................................................................. 8 1.1 1.2 1.3 Hardware Consideration ..........................................................................................................
4.5.4 Accessing DOS Partitions ................................................................................................. 23 4.5.5 Accessing TOS&DOS Partitions ........................................................................................ 23 4.5.6 Driver usage ...................................................................................................................... 23 4.6 ICD AdSCSI Pro 6.5.5 Driver Package ........................................................................
9.4.1 TOS Extended Root Sector ............................................................................................... 44 9.4.2 Example of layout with TOS extended partitions ............................................................... 45 9.5 TOS Partition Structures ........................................................................................................ 46 9.5.1 TOS Boot sector .......................................................................................................
How to Read this Document I have created this document as a reference manual that I use personally to find specific information related to usage of Hard Disks. It provides technical information about the different File Systems used on the Atari platform as well as a practical short guide for using and partitioning Hard Disks on Atari (more specifically SD Cards connected to Satan / UltraSatan / CosmosEx devices). Therefore most probably you do not want to read this document from front to back.
The Information about DOS/FAT Partitions provides an in-depth presentation of the DOS/FAT file system. The Information about TOS&DOS Partitions provides an in-depth presentation of the TOS&DOS file system as created and used by PPDRIVER and HDDRIVER. Notes: Although the information presented here applies to generic ASCI/SCSI Hard Drives, specific details are provided for the CosmosEx, UltraSatan and Satan Devices.
PART I – ATARI HARD DISK FILE SYSTEM PARTITIONING GUIDE © Jean Louis-Guérin – V1.
Chapter 1. Partitioning Information This section provides basic information about Atari & PC hard disk partitioning (layout). For technical details on the TOS and FAT file systems please refer to the second part of this document. 1.1 Hardware Consideration Atari ST / STE computers provide an external DMA bus connection through the Atari Computer System Interface (ASCI) connector.
There are two types of partitions: The Primary partition contains several control structures and the actual file and directory data. The Extended partition is a special kind of partition which is itself subdivided into one or several primary (aka as secondary) partitions allowing a number of partitions superior to 4 on the disk. A primary partition contains: The Boot Sector located at the very beginning of the partition (logical sector 0).
Chapter 2. Types of Partition used on Atari Before we detail the partitioning procedures for several hard disk drivers, we need to understand the basic types of partitions used on Atari and their limitations. 2.1 TOS Partitions This is the “native” type of partition used an Atari as described in the Atari AHDI documentation. It is supported by all the Atari hard disk drivers and in fact some of the old drivers only support this type of partition.
As we have seen due to the constraints imposed by the TOS file systems and the DOS file systems it seems that it is only possible to access Small FAT16A (≤ 32 MB) DOS partitions with an Atari. However the BigDOS freeware allow access to Large DOS partitions. BigDOS works with several hard disk driver for example HDDRIVER and CBHD. But unfortunately it does not work with some other drivers like the ICD AdSCSI or PPDRIVER hard disk driver. See BigDOS section for more information.
The following table shows the minimum logical sector size required for specific partition sizes: Partition Size6 Up to 32MB 32MB – 64MB 64 MB – 128MB 128 MB – 256MB 256MB – 512MB 512MB – 2GB7 Logical Sector Size 512 1024 2048 4096 8192 32768 During partitioning you only need to specify the size of the partitions you want to create and the driver will compute for you the optimum logical sector size. However it is possible in some cases to modify this size during the “initialize” command.
Chapter 3. TOS/GEMDOS Limitations We have seen that the file system used to partition a hard disk introduces some limitation. On top of that the TOS/GEMDOS OS adds more limitations which are different for different versions of TOS and GEMDOS. The following sections present some of these limitations. 3.1 TOS and Long File Name (LFN) On Atari the file names recognized by TOS/GEMDOS system are limited to 8+3 Characters.
Relevant information: Entry 1 at 0x2A000 is a file entry (FA = 0x20 – Archive bit at 0x2A00B). As the file has a short name it is entered directly in the DOS file name field. In this case “SHORT.TXT” Entries 2 to 5 starting at 0x2A020 are dummy LFN entries (FA = 0x0F – RO +Hidden + System + Volume at 0x2A02B). This is where the long name is coded using UTF-16 Format. The name is scattered in each record (shown in blue above). The first byte of each entry is the sequence number.
files that belong somewhere else. Or you get “0 files in 0 items” box, making you think everything has just been erased. If this happens, reboot immediately; if you write anything to that hard disk, you're going to damage the directory structure. Your data is probably still out there and still okay. Upon restarting, go immediately to the offending directory, and try again; if it works this time you were lucky. Atari has released an "official" 40-folder bug fixer program, called FOLDRXXX.
Technically, the limits are as follows: there are 80 blocks in the system's “OS pool” two blocks are used per active folder. An “active” folder is one which is the root directory of the device it's on, or which has open files, or which is somebody's current directory, or which has an “active” child (subdirectory). Yes, this is a recursive definition.
3.7.2 MEGA TOS 1.02 - 520ST, 1040ST, Mega 2/4 This version of TOS fixes some minor problems in TOS 1.0 and has support for the BLiTTER chip and Real-Time Clock chip. This version is relatively slow and has a lot of problems with disk I/O. You should try to avoid using hard disks with this version. Utilities: FOLDRXXX.PRG 3.7.3 Rainbow TOS 1.04 – 520ST, 1040ST, Mega 2/4 TOS 1.04 or Rainbow TOS, as it is commonly known is the latest version of TOS released for 520/1040/MEGA owners.
Chapter 4. Atari Hard Disk Drivers Packages This chapter provides a quick guide of several Atari hard disk drivers usage. It is primarily written for users of CosmosEX, UltraSatan, and Satan devices. If you want to use these drivers with other hardware or need more advance options you should refer to the original documentation. For each driver we provide detailed procedures to: Partition and initialize a drive, Install the hard disk driver, and Eventually configure the installed hard disk driver. 4.
4.4 HDDRIVER 9.02 Driver Package This section presents a quick procedure to follow to use HDDRIVER 9.02 hard disk driver package on CosmosEx or UltraSatan device. The HDDRIVER package is a commercial application that you can buy from Uwe Seimet HERE. For detail information please refer to the provided documentation. Many improvements and bug fixes has been included in V9.x. For UltraSatan and CosmosEx users on ST machine the most important feature added (actually added on version 8.
4.4.1.4 Actual Partitioning Once you have defined the compatibility options for the partitions you are returned to the main partition window. In the MB field you have to specify the size of every partition you want to create. Usually you do not want to enter any value in the TYPE fields unless you know exactly what you are doing (please refer to the HDDRIVER documentation). Enter the size for all the partitions you want to create. Remember that for example with TOS 1.
4.4.3 Configuring the HDDRIVER Hard Disk Driver Run the HDDRUTIL.APP. The hddriver.sys driver of the boot partition is automatically selected for you. With HDDRIVER 9.x most of the default values required for CosmosEx, and UltraSatan users are already set to what you want. 4.4.3.1 Devices & Partitions managed by HDDRIVER From the Settings menu select the Devices and Partitions… command. You are presented a window with the Devices and Partitions options. Make sure that all devices 0.
4.5 PPDRIVER 1.0 Driver Package This section presents a quick procedure to use PPDRIVER 1.0 hard disk driver package with UltraSatan or CosmosEx devices. The PPDRIVER package is a cheap 10€ application developed by P.Putnik that you can buy from HERE. This driver has limitations compared to HDDRIVER as it has been designed almost exclusively for Satan, UltraSatan and CosmosEX devices. It provides: + + + + + + + + + 4.5.
4.5.2 Installing the Auto boot Driver To install the auto boot driver you need to execute the USAB10.TOS program. The driver installer will show all attached ACSI devices with target # and capacity detected. You first have to select the device you want by typing the target value and press I key to confirm installation (any other key will result in exit without install). The program will install the driver in few seconds and will confirmed the installation. The drive is now ready.
4.6 ICD AdSCSI Pro 6.5.5 Driver Package This section presents the ICD AdSCSI Pro 6.5.5 hard disk package. This package used to be a commercial package but is now widely available as an abandon-ware. You can find it here. 4.6.1 Partitioning a drive In order to use the ICD utilities the ICD hard disk driver has to be loaded first. If you boot your Atari with the ICD distribution diskette inserted in the floppy drive, the driver should load automatically as a copy of the ICDBOOT.
Now you should click PARTITION. You are now presented the partition Main form. If the drive had already been partitioned you will see the values from the previous partitioning otherwise you will see some computed default values. The window has many fields that you can modify but the most useful ones are: The Size that specifies the size for each partition. Here you can enter the desired sizes for all the partitions that you want to create.
If you are using removable media (for example a SD card on an UltraSatan) the program also displays a window indicating that a removable drive has been formatted and the maximum number of bytes for the logical sectors. Write down this value as you will need it to set the driver parameters and click OK. A new window is presented to indicate that the partitions have changed and offers you to reboot the computer, click OK.
4.6.3 Configuring the AdSCSI Hard Disk Driver Run the ICD utility program HDUTIL.PRG. This brings you to the main menu. Click Config: All parameters are grayed because you first have to select the driver you want to configure. Select the driver from your boot partition (for example C:\ICDBOOT.SYS). You should see all the current parameters of the driver installed.
4.7 CBHD 5.0.2 Driver Package This section presents procedures for partitioning and using a drive with the CBHD package. This CBHD 502 package is widely available as a freeware. Note: The original CBHD package is in German. However most of the program and utilities have been translated to English. This is the version presented below. 4.7.1 Partitioning a drive In order to use the CBHD utility the SCSIDRV.PRG program needs to be executed first.
4.7.3 Configuring the CBHD Hard Disk Driver Run the SCSIDRV.PRG then Run CBHDCONF.APP. Load the CBHD.SYS from your boot partition using Driver menu Load… command. You can now modify several parameters according to your host adapter and drives. For UltraSatan Drive I only found one parameter that need to be checked. From the Driver menu select SCSI Driver… Verify that the Identify ICD is check marked (it should be by default). 4.7.
4.9 Which Hard Disk Driver Should I use Here we will only consider PPD1x, HDD9xx, ICD655, and CBHD502 drivers used with CosmosEX, UltraSatan, and Satan devices on Atari ST. The CBHD502 driver is very old and do not support well the new devices designed by Jookie and therefore it should be avoided. If you want a free solution then you have no other choice than using ICD655. This driver is not maintained anymore but work relatively well with CosmosEx and UltraSatan disk.
Chapter 5. PC Utilities This chapter describes few programs that can be useful in relation with Atari Hard disk. For example to partition, display content, and work with images of hard disks to be used on an Atari System. 5.1 Accessing Multiple Partitions from SD Cards To access the SD card you will need a SD card reader on your PC. This can be for example an USB card adapter. On this kind of adapter Windows allows access to only one partition even if your card has multiple DOS&TOS partitions.
5.2 Creating DOS Partitions on a PC As we have seen most of the Atari Hard disk drivers do not provide a utility to create DOS partitions. It is therefore very convenient to create DOS partitions directly on a PC. If you connect directly a drive (for example a SCSI drive) to a PC it is possible to create multiple partitions directly.
5.3 Working with Disk Images A disk image is a file that contains an exact binary copy of the raw content of the disk. Images are useful to backup/restore SD card, to transfer information, and to run with Atari emulators. There many tools available for creating and reading disk images. One nice tool for imaging/restoring SD card plugged into a card reader is the USB-Image tool (currently in version 1.68) that you can get from HERE.
5.4 Partition Table Editor Ptedit is a Free Portable Partition Table Editor created by Powerquest (Symantec). Ptedit32 can be used to quickly and easily edit Partition Tables. For example it could be used to mark a partition active "toggle the bootable flag" from within Windows. This is done by changing the boot indicator from 00 to 80. This tool can be stored and run from a USB device. You can download the Portable Partition Table Editor HERE. Some technical details HERE or HERE (in French).
Chapter 6. Atari Utilities 6.1 BigDOS BigDOS freeware Copyright© 1995 by Rainer Seitel BigDOS is an ISO 9293 file system that replaces the GEMDOS of TOS. 6.1.1 Features GEMDOS / ISO 9293:1987 / MS-DOS file system 32 Drives: A..Z 1..6 or A..Z [\]^_` Up to 65518 cluster. 1 to 64 sectors per cluster. More than 65535 sectors and therefore every MS-DOS partition possible. That means also more than 32 MB. 1 or 2 FAT.
6.2 FOLDRXXX Utility FOLDRXXX.PRG will add more entries into your OS Pool. In TOS 1.0 and TOS 1.02, the limit for the number of directories that you can enter is around 40. With this program you can extend that limit much higher. If you are using a hard drive, this program is recommended highly. It will work with all TOS versions and will improve the performance of your system. 6.3 TOS14FIX Utility TOS14FIX.
Chapter 7. File System Problems and Solutions In this section we do not cover hardware problems. However in case of problem this is the first thing to check. For examples: proper connection, proper termination … The problems reported in Red are usually pretty bad and can cause loss of data on drives. I do not see all my drives.
PART II – ATARI HARD DISK FILE SYSTEMS TECHNICAL INFORMATION © Jean Louis-Guérin – V1.
Chapter 8. Hard Disk Presentation The goal of the second part of this document is to provide in-depth technical information about Atari hard disks partitioning (layout). For that matter I describe in detail the TOS File System as well as the DOS/FAT File System as both of them are used on the Atari platform. However the DOS/FAT File System study is limited to what is useful in the Atari platform context.
8.2 Hard Disk Preparation Steps Before a hard disk can be used to store data it must be “prepared”. This is done in three steps: The first step is called low-level formatting (often referred as formatting in Atari world): It is used to create the actual structures on the surface of the media that are used to hold the data. The magnetic medium on the surfaces must be divided into tracks that contain numbered sectors that the controller can find.
8.3 TOS Partition Size The following table indicates the minimum sector size based on TOS partition sizes: Partition Size11 Up to 32MB 32MB – 64MB 64 MB – 128MB 128 MB – 256MB 256MB – 512MB 512MB – 2GB12 Logical Sector Size 512 1024 2048 4096 8192 32768 With most of the partitioning programs you only need to specify the size of the partition you want to create and the driver will compute for you the optimum Sector Size.
Chapter 9. Information about TOS Partitions In this chapter we will describe the layout and various information concerning the Atari Hard Disks TOS partitioning as defined in the AHDI 3.00 specification. Compared to the initial Atari AHDI specification, AHDI 3.00 adds support for hard disks with more than four partitions, and for partitions of size greater or equal to 32 MB (16 MB if TOS < 1.04). 9.
Each partition (standard or extended) is defined by an entry in the partition table: Offset $00 Length 1 $01 3 $04 4 $08 4 9.
TOS ≥ 1.04 and ≤ 4.x Maximum size of a cluster in number of bytes = 2^14 = 16384 Size of a cluster in number of logical sectors = 2 Maximum size of a logical sector in number of bytes = 16384 / 2 = 8192 Maximum number of logical sectors = 2^16 = 65536 Maximum size of a partition in number of bytes = 65536 * 8192 = 512 MB TOS 4.
For the standard partition description, the definitions of the fields in the partition table entry are: Offset Length Description $00 1 Flag: indicate the state of the partition bit 0 when set partition exist, bit 1-7 reserved $01 3 Id: a 3-bytes ASCII field that identifies the type of partition GEM for regular (< 32MB) partition BGM for big (≥ 32MB) partition $04 4 Offset to the beginning of the standard partition from the beginning of the extended root sector that this structure reside
9.5 TOS Partition Structures This section details the content of a TOS primary partition 9.5.1 TOS Boot sector The Boot Sector is located in the first logical sector of a logical drive (standard partition) and it occupies one logical sector. When a logical sector contains more than one physical (512-byte) sectors, the Boot Sector will be bigger than 512 bytes. However, only the first 512 bytes of a Boot Sector are used, no matter how big the Boot Sector might be.
9.5.2 TOS File Allocation Table The File Allocation Table structures (FAT) is an array used by the TOS to keep track of which clusters on a drive have been allocated for each file or directory. As a program creates a new file or adds to an existing one, the system allocates sectors for that file, writes the data to the given sectors, and keeps track of the allocated sectors by recording them in the FAT.
medium, not by a fixed number of entries. The TOS initially allocates only a single cluster for the directory, allocating additional clusters only when they are needed. Every directory except the Root Directory has two entries when it is created. The first entry specifies the directory itself, and the second entry specifies its parent directory (the directory that contains it). These entries use the special directory names “.” (An ASCII period) and “..” (Two ASCII periods) respectively.
9.5.4 Size and Position of the TOS Partition Structures With the information given in the MBR and the information given in the Root sector, it is possible to compute the size and position of the different TOS partition structures. EQ-1 The position of the Boot Sector PBS (the beginning of a logical partition) is directly given in the Root Sector or in an Extended Root Sector of the MBR.
9.6 TOS Boot Sequence In this section we describe a typical sequence to load a hard disk driver from a bootable hard disk partition. The actual implementation differs from driver to driver. During the TOS ROM System initialization an attempt is made to load Root Sector (RS) from the DMA bus. For each of the eight DMA bus devices the TOS attempts a read operation on the first physical sector 0.
Chapter 10. Information about DOS/FAT Partitions In this chapter I describe the layout and various information concerning the DOS/FAT Hard Disks partitioning. PC hard disk partitioning is a vast subject and I will only present here information that can be useful in the context of its usage on Atari. The layout of PC DOS hard disks is similar but not identical to layout of Atari hard disks. 10.
The table of partitions has four 16-byte structures to describe each partition: Offset 0x00 Length 1 Description Status 0x80 = bootable (active), 0x00 = non-bootable, other = invalid CHS address of first sector in partition (next 3 bytes): Head Sector is in bits 5–0; bits 9–8 of Cylinder are in bits 7–6 bits 7–0 of Cylinder Partition entry locations $1BE, $1CE, $1DE, $1EE 0x01 3 0x04 0x05 1 3 partition type CHS address of last sector in partition (next 3 bytes): Head Sector is in bit
10.4.1 Example of layout with DOS/FAT standard partitions In the following example we have a hard disk with 3 primary partitions. The Master Boot Record contains 3 pointers to the 3 partitions. These partitions can be either regular or big partitions. 10.5 DOS/FAT Extended Partition An extended partition is a special partition which contains secondary partition(s). A hard disk may contain only one extended partition; which can then be sub-divided into many logical drives. 10.5.
The first entry of an EMBR partition table points to the logical partition belonging to that EMBR: Starting Sector = relative offset between this EMBR sector and the first sector of the logical partition. Note: This will be the same value for each EMBR on the same hard disk; usually 63. Number of Sectors = total count of sectors for this logical partition. Note: Any unused sectors between EBR and logical drive are not considered part of the logical drive.
10.5.2 Example of layout with DOS/FAT extended partitions In the following example we have a hard disk with 3 primary partitions and an extended partition that contains two embedded primary partitions. The Master Boot Record contains 3 pointers to the 3 standard partitions and a pointer to the extended partition. The first logical sector of the extended partition contains the first Extended Master Boot Record.
RES 0x0e 2 Reserved sector count. The number of sectors before the first FAT in the file system image (including boot sector). Typically 1 for FAT12/FAT16 and 32 for FAT32. NFATS 0x10 1 Number of file allocation table following the reserved sectors. Almost always 2. The second FAT is used by recovery program if the first FAT is corrupted. NDIRS 0x11 2 Maximum number of root directory entries18. This value should always be such that the root directory ends on a sector boundary (i.e.
0x1FE 2 Boot sector signature (0x55 0xAA) 10.6.2 FS Information Sector The FS Information Sector was introduced in FAT32 for speeding up access times of certain operations (in particular, getting the amount of free space). It is located at a sector number specified in the boot record at position 0x30 (usually sector 1, immediately after the boot record).
FAT16, used for dirty volume management: high order bit 1: last shutdown was clean; next highest bit 1: during the previous mount no disk I/O errors were detected. 10.6.4 DOS/FAT Directory Table A Directory Table is a special type of file that represents a directory (also known as a folder). Each file or directory stored within it is represented by a 32-byte entry in the table.
Directory entries, both in the Root Directory region and in subdirectories, are of the following format: Byte Offset Length Description DOS file name (padded with spaces). The first byte can have the following special values: 0x00 Entry is available and no subsequent entry is in use 0x05 Initial character is actually 0xE5. 0x2E 'Dot' entry; either '.' or '..' 0xE5 Entry has been previously erased and is available.
10.6.
Here a Practical example of a disk with only 4 entries: Dump of the directory table: Offset 0002A000 0002A010 0002A020 0002A030 0002A040 0002A050 0002A060 0002A070 0002A080 0002A090 0002A020 0002A0B0 0002A0C0 0002A0D0 0002A0E0 0002A0F0 0002A100 0002A110 0002A120 0002A130 0002A140 0 53 8D 44 FF 03 47 02 4F 01 53 54 8D 53 8D 42 FF 01 4F 4C 8D 00 1 48 3B 54 FF 52 00 41 00 54 00 48 3B 48 3B 41 FF 4C 00 4F 3B 00 2 4F 8D 00 FF 00 20 00 46 00 20 49 8D 4F 8D 00 FF 00 4C 4E 8D 00 3 52 3B 58 FF 59 00 4D 00 48 00
10.7 DOS/Windows Boot Sequence The first program executed in the boot sequence is built into your computer's motherboard. This program is called the BIOS. The BIOS search for the next program to execute. It will look in the place you want it to – Floppy, CD, hard drive, etc. If you are booting an OS from a hard drive then the next program is, unsurprisingly, on the hard drive. It is always right at the very beginning of the drive, starting on the very first byte of the very first sector.
Chapter 11. Information about TOS&DOS Partitions There is no standard for TOS&DOS partitions. They are only available with the PPDRIVER and HDDRIVER hard disk driver but with different implementation. In this chapter we will detailed the technique used by these two drivers. Most of the problems of compatibility between the TOS and FAT file systems are located in the BPB area of the Boot Sector.
11.2 TOS&DOS MBR / EMBR The Master Boot Records created by HDDRIVER and PPDRIVER hard disk drivers are different. They have in common that when multiple partitions are defined the first partition is a primary partition, and the following partitions are extended partitions that each contains a unique primary partition.
11.2.2 HDDRIVER 9.02 MBR / EMBR For TOS&DOS partitions HDDRIVER hard disk driver uses a non-standard format for MBR / EMBRs. The format used is a combination of DOS MBR and TOS RS formats. Yet it is designed to be interpreted normally by Windows and DOS utilities. The format is the following Offset Length Description 0x0000 440 Boot loader code. Filled with zero if disk is not bootable.
The same MBR is interpreted differently by the HDDRIVER on the Atari platform: The content of the MBR is ignored until 0x01DE and from this point the MBR is interpreted as TOS partition The first entry is at location 0x01DE: The first byte at location 0x01DE is interpreted as the state of the partition and is set to 0x01 for a non-bootable partition and to 0x81 for a bootable partition.
11.3 TOS&DOS Partition Structure 11.3.1 TOS&DOS Boot Sector DOS&TOS partitions contain two Boot Sectors: one for DOS and one for TOS. 11.3.1.1 HDDRIVER As we have seen in previous section HDDRIVER have the first partition entry in the MRB pointing to a DOS Boot Sector at location 0x07E00. This boot sector follows the DOS standard and you can go to DOS/FAT Boot sector section for more information.
The sector following the DOS/FAT boot sector is the TOS boot sector at location 0x08000. This boot sector follows the TOS standard and you can go to TOS Boot sector section for more information. Example of TOS boot sector created by PPDRIVER: Offset 00008000 00008010 00008020 0 1 2 3 4 5 6 7 EB 3C 90 50 50 47 44 4F 02 00 02 EF FE F8 21 00 BC FB 03 00 00 00 00 00 8 9 A B C D E F 44 42 43 00 08 02 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ë<.PPGDODBC..... ...ïþø!......... ¼û..............
References Master boot record from Wikipedia CHS conversion from Wikipedia Partition types - Andries Brouwer Disk partitioning from Wikipedia File Allocation Table From Wikipedia, the free encyclopedia MS-DOS Partitioning Summary – Microsoft 2007 Hard Disk Partitioning Primer - Mikhail Ranish AHDI 3.0 Release Notes – Atari, April 1980 XHDI 1.30 Specifications – J.F.