HDInit - BBC Hard Drive Initialiser =================================== HDInit is used to initialise BBC hard drives. It must be run on the BBC I/O processor as it does low level hardware access when accessing IDE devices. When run you get a menu similar to the following, with the header indicating what type of drive hardware is being used. BBC IDE Hard Drive Initialiser 1.16 ===================================== Current drive: 0 (IDE device 0) Device width: 8 bits Model: .U.N.U. .I.F.O.1.8.A. . . Firmware: .0...3. Serial: .3.6.6.4.0.3. . . . Total sectors: &00265400 (613.0M) Physical size: C:&09BC H:16 S:63 Logical size: C:&2654 H: 4 S:64 8-bit Size: 313984K (306.5M) ADFS drives: 0: 306.5M 1: 0M =================================== D: Select drive I: Investigate drive S: Scan for size Z: Set drive size F: Format drive W: Wipe data (off) R: Randomise data Toggle width Press a key or X to exit: D: Select drive --------------- This option allows you to select the logical drive to use. The drive information is cleared until the drive is investigated or scanned. If you select drive 0 to 3, then the ADFS partition information is displayed. If you select drive 4 to B then the HADFS partition information is displayed. On startup a suitable drive for the currently selected filing system is selected. I: Investigate drive -------------------- This option interrogates and IDE drive using the IDE_Identify command (&EC). With an 8-bit IDE interface only part of the drive information is readable, but enough is readable to find the drive size. The parts of the drive information that cannot be read is displayed as '.'s. With non-IDE drives the 'Scan for size' option must be used. S: Scan for size ---------------- Non-IDE drives may not have an Identify command, and sometimes some IDE drives do not respond properly to the IDE_Identify command, or with the 8-bit interface the reported size may be truncated. This option manually scans the drive to find the maximum sector that can be accessed. On some drives this operation fails as the drive does not respond to testing past the end of available disk space. Z: Set drive size ----------------- Very occasionally, all attempts to interrogate a drive to find its size fails or returns incorrect information. This option allows you to manually specify the drive size to use. You are prompted to enter a drive size to use. You can enter the maximum sector number as a hexadecimal number prefixed with &, or a drive size as a decimal number in bytes, kilobytes with a 'K' suffix or megabytes with an 'M' suffix. F: Format drive --------------- This options initialises a blank hard drive. If the drive size hasn't been found or set manually, the drive will be investigated as with the 'I' option. A drive can be initialised with an ADFS and an HADFS filesystem on the same drive. You are asked if you want to reserve space for the other filesystem so two can co-exist on the same drive. You are asked for the size you want to reserve for the partition. The drive size will then be displayed and you will be prompted to confirm the initialisation before continuing. Enter YES to confirm - all upper case. W: Wipe data ------------ By default, the format option just blanks out enough of the drive's root directory and free space map to create a blank disk. This means that, with care, a drive that has been accidently formatted can be recovered. Setting Wipe Data On makes future format operations completely wipe the root directory and free space map. Only the root directory is blanked, so any data in file not in the root directory may be recoverable, but recovering the root directory is no longer possible. R: Randomise data ----------------- This option becomes available if Wipe Data is set on. IMPORTANT ALL DATA ON THE SELECTED DRIVE WILL BE IRRETRIEVABLE AFTER THIS OPERATION! This fills all sectors on the drive with random data until Escape is pressed. This can be used for testing purposes or to thoroughly overwrite all data on a drive. : Toggle data width ------------------------ Pressing toggles between accessing 8-bit IDE data and 16-bit IDE data. With a 16-bit IDE interface and using 16-bit access you can find the full drive information with the Investigate option. This option has no effect with non-IDE drive hardware. BBC filing systems are 8-bit filing systems, they store 256 8-bit bytes in each disk sector. IDE devices store 256 16-bit words in each sector, the BBC discards half of each 16-bit word, so the usable drive space is half the actual drive size. Using a 16-bit IDE interface does not change this. You still have to transfer a whole sector of 256 16-bit words, you can't just stop transfering data halfway through a 512-byte sector or start transfering data halfway through. To use all 512 bytes (256 16-bit words) in an IDE sector you'd have to load all 512 bytes into a buffer, modify the 256 bytes you want to modify and then write all 512 bytes back out again. IDE devices tend to be so large that throwing away half the storage space is irrelavent for BBC computers anyway. The maximum that ADFS can access is 512M, so throwing away half the capacity of a 2G IDE drive doesn't make any difference as ADFS can only see two paritions of 512M anyway. However, if you want to write software or a filing system to access CD-ROMs or hard drives with a DOS file system on them then a 16-bit interface will be needed. Shift : Display full information ------------------------------------- Pressing Shift will toggle between displaying full information about the selected drive. Version History =============== v1.02 - Drives 0-7 all allowed v1.03 - Drive reversably initialised, selects drive 0 v1.04 - Allows drive size to be set explicitly v1.05 - Displays sizes in M as well as K v1.06 - Wipes full root if 'safe' turned off v1.07 - Full drive investigation v1.08 - Partitions v1.09 - New FNsum routine v1.10 - Displays full firmware info and device type v1.11 - Allows ADFS/HADFS partitions v1.12 - Display full info by default, Randomise made safe v1.13 - Attempts to use API call before making direct hardware access v1.14 - Allows 4G HADFS partitions v1.15 - ADFS partition size selectable v1.16 - Detects ADFS hard drive device type and ADFS revision