TRS-80 Tips and Tricks - Hard Drive
Page Index
How to Quickly Initialize a Model I-III Hard Drive
Ken Brookner had prepared a guide called "What You Really Need To Know Quick To Init a Model I/III Hard Drive. You can download that guide here.
Determining Hard Drive Geometry from CONFIG/SYS
Tim Mann, author of XTRS and the OG Catweasel Utilties was kind enough to document how to go about determining the drive geometry of a hard drive based on the CONFIG/SYS file found on LS-DOS v6.
First, export the CONFIG/SYS file to your computer. You can do this with XTRS's "EXPORT" utility or with Matthew Reed's TRSTOOLS. If you are doing this inside an emulator, LS-DOS will likely not boot without the hard drive attached, so you need to press the virtual CLEAR key at just the right time during the LS-DOS boot process.
You then need to find the DCT in the CONFIG/SYS file. It gets loaded at 4300H instead of 0470H where the DCT$ is supposed to be, probably so as not to overwrite the DCT that's actually in use based on boot disk.
Next you need to parse the CONFIG/SYS. Tim used the "cmddump" utility that comes with xtrs to parse it. It's in /CMD (load module) format. Tim ran cmddump config.sys once with no flags, to see what the highest memory address used was -- it was 0x434f. In Windows you can use George Phillips' utility trld with a command line of trld -d config.sys.
Tim then used "cmddump config.sys config.mem 0 0x4350" to get a raw memory image of the part of memory that config/sys loads into (actually he used 0x434F, but that was a mistake since it cut off the last byte). For those using Windows, that will give you the hex dump. For those on Linux you need to use Linux's "hd" to get a hex dump of that memory to work from.
Using a disk I gave Tim as an example, he found the DCT to read as follows (color added):
00004300 c3 f4 0f 0c 90 00 98 bf bf 4c c3 f4 0f 0c 38 00 |.........L....8.| 00004310 98 7f 7f 4c c3 f4 0f 0c 38 99 99 7f 7f 4d c3 f4 |...L....8....M..| 00004320 0f 0c 10 99 98 bf bf 4c c3 3d 0e 54 61 04 27 11 |.......L.=.Ta.'.| 00004330 45 14 c3 3d 0e 44 42 00 27 11 45 14 c3 3d 0e 44 |E..=.DB.'.E..=.D| 00004340 64 14 27 11 45 14 c3 3d 0e 44 68 28 4f 11 45 |d.'.E..=.Dh(O.E|
Decoding the first set (meaning Drive 0) by hand:
- C3 : DCT+0: C3=Drive enabled / C9 = Drive disabled.
- F4 0F : DCT+1,2: This is the address of the hard disk driver.
- 0C: DCT+3: 0C is 00001100 in decimal so:
- Bits 0-1: 00 = Drive 0
- Bit 2: 1 = Not removable
- Bit 3: 1 = Hard Drive
- Bit 4: 0 = Side Select 0
- Bit 5: 0 = 5.25" Drive
- Bit 6: 0 = Single Density
- Bit 7: 0 = Not Write Protected.
- 90: DCT+4: 90 is 10010000 in binary so:
- Bits 0-3: 0000 = Starting Head # 0
- Bit 4: 1 = "Controller does not return index pulses in its status register"
- Bit 5: 0 = DBLBIT = 0, so one logical cylinder = one physical cylinder
- Bit 6: 0 = "Controller is NOT capable of double density operation"
- Bit 7: 1 = "No @CKDRV will be performed by @OPEN when accessing that drive".
- 00: DCT+5: DCT+5 is not regularly used for Hard Drives.
- 98: DCT+6: 98H is 152 in decimal. Since Since DBLBIT=0, this means that the highest numbered logical cylinder on the drive is 152 in decimal (for total of 153 tracks).
- BF: DCT+7. BFH is 10111111 in binary.
- Bits 4-0: Highest numbered sector on a track numbered relative from zero. Bits 4-0 are 11111 (Decimal: 31) for 32 sectors per track.
- Bits 7-5: Number of heads assigned to the logical partition. Bits 7-5 are 101 (Decimal: 5), so there are 6 heads for this logical partition.
- BF: DCT+8. BFH is 10111111 in binary.
- Bits 4-0: Sectors per granule. Bits 4-0 are 11111 (Decimal: 31) for 32 sectors per granule.
- Bits 7-5: Granules per track. Bits 7-5 are 101 (Decimal: 5), so since DBLBIT=0, there are 6 granules per track.
- 4C: DCT+9. 4CH is 76 in decimal. Since DBLBIT=0, this means that the directory is on logical cylinder 76.
Decoding the entire DCT then gives us:
Note: DBLBIT = 1 means there are two physical cylinders per logical cylinder; DBLBIT = 0 means one physical per logical.
More Detailed Information:
The below is more detailed information about the Drive Control Table record assigned to a hard drive partition taken from RSHARD - Hard Disk Driver Package and "The Programmer's Guide to TRSDOS Version 6".
- Floppy: The field contains the step rate specification code (0-3) for the floppy disk controller. With a Western Digital 179X FDC or equivalent, the codes correspond to a step rate of 6, 12, 20, and 30ms at an FDC clock speed of 1 MHz and 3, 6, 10, and 15ms at an FDC clock speed of 2 MHz.
- Hard Drive: This field is usually associated with the drive select code of the hard disk drive (binary value 0-3).
- Floppy: This bit is set by the system to indicate the minimum time delay required after selecting a floppy disk drive whose motors are not currently running. It must be used by floppy disk drivers to adjust their time delay between selection of the floppy drive and the first poll of the status register. A "1" value indicates the minimum delay to be 0.5 seconds while a "0" value indicates the delay to be 1.0 seconds. The time delay can be introduced via a request of the @PAUSE SuperVisor Call with an appropriate count.
- Hard Drive: This bit is RESET if the drive is a REMOVABLE cartridge.
- Floppy: If set to a "1", it indicates that the floppy diskette currently being accessed is formatted in double density. If set to a "0" it indicates that the diskette is single density. The disk driver is responsible for maintaining this bit by recognizing the density of the disk it is accessing. The bit is used both by the driver in the drive selection process and by the system in informative messages by such things as DEVICE displays, DIRectory displays, and FREE displays.
- Hard Drive: This bit is not referenced by the system.
- Floppy: The field contains the physical drive address (1, 2, 4, or 8) corresponding to the drive select line (DS0, DS1, DS2, or DS3). Thus, only one of the four bits will ever be set.
- Hard Drive: Hard drive installations that partition a drive by head, may use this field to indicate the relative starting head number of the logical drive partition. This provides support for a drive of up to 16 heads although 4 heads is typical. Bit 3 contains the drive address. Bits 2-0 contains the starting head number, counting from zero. Bits 1-0 contains the number of the starting cylinder for the logical partition, noting that if DBLBIT is set, this number represents half the actual value.
- Floppy: A "1" indicates that the diskette currently mounted in the drive is a two sided diskette while a "0" indicates that the diskette is a single-sided diskette. This bit is updated whenever the disk is logged by the system or whenever a program invokes the @CKDRV SuperVisor Call. Note that if a dual sided diskette is placed into a two-headed disk drive that previously accessed a single-sided diskette, the system will not recognize the second side of the new diskette until the logging process.
- Hard Drive: Also known as the "DBLBIT" bit, this bit may be used to indicate that a logical cylinder represents two physical cylinders thereby providing support for twice as many cylinders as limited by the Granule Allocation Table (the GAT limits the number of logical cylinders to 203 - thus by using this bit, hard drives to 406 cylinders can be supported as a single logical drive). This bit will be SET if you requested more than 203 cylinders for a single logical drive.
---------------------------------------------------------------------- | C3/C9 | VECTOR | FLAG | FLAG | CUR | MAX | H M S | G S | DIR | | | ADDRESS | 1 | 2 | CYL | CYL | D A E | P P | CYL | | | | | | | | S X C | T G | | ----------------------------------------------------------------------
Notice that most of the size or max numbers are "highest value", so for example 5 in the "heads" field means there are 6 heads numbered 0-5.
Other information I have no idea what to do with ...
Using a Single Hard Drive with 2 Operating Systems
11500 Stemmons Expressway, Suite 125
Dallas TX 75229
(214) 484-2976
The Model 4/4P computer has the capability of running in two modes: Model III mode and Model 4 mode. This allows a Model 4/4P owner to use two (or more) different operating operating systems on the computer. Two operating systems, one for each mode of operation, are available from Radio Shack for use on the Model 4/4P with a Radio Shack 5-megabyte hard drive: TRSDOS 6 for Model 4 mode, and LDOS 5.1 for Model III mode. The question has arisen among users of the 5-megabyte hard drive of whether there is any way to use both operating systems on the same hard drive without having to reformat and recreate the system partition every time. There is some justification for wanting to do this. The two operating systems involved, LDOS 5.1 for the Model III mode and TRSDOS 6.1 for the Model 4 mode, are very similar. Moreover, since the software base for TRSDOS 6 is not yet as large as that for LDOS, it can be to a user's advantage to switch to LDOS to run applications which are not available for TRSDOS 6. Finally, a hard drive system provides extensive storage capacity as well as increased operating speed over floppy disks. It seems a waste to have to switch to floppies just to run a particular application.
We at PowerSOFT have been able to place both the LDOS and TRSDOS 6 operating systems on a single hard drive so that they can be used by a Model 4 running in either mode. The selection of which system to utilize is done by simply booting up the appropriate floppy system disk and letting the configuration file transfer control to the hard disk. The files on the hard disk are accessible to both operating systems. This was made possible by the media compatibility which exists between LDOS and TRSDOS 6. This means that they can read each other's directories and disk formats without requiring special software.
The key to placing both operating systems on a single hard drive lies in the flexibility of the two operating systems. Both LDOS and TRSDOS 6 allow you to split up a hard drive into one or more logical drives; and the logical drive numbers need not be the same as the physical positions of the hard disk partitions. This is what makes it all work. The hard disk partition which is assigned as Drive 0 for LDOS need not be the same as the partition which is assigned as Drive 0 for TRSDOS 6! This means that TWO independent logical drive zeros (system drives) can exist on a single hard drive, one for each operating system. And of course, each operating system sees only its own drive 0, the other one appearing to it as something else.
Drive Configuration Example
TRSDOS 6 sees ==> :0 :1 2 :3 PHYSICAL SURFACE 1 2 3 4 LDOS 5.1 sees ==> :3 :1 :2 :0
Three-Step Procedure
We present below a three-step procedure to implement the method just described, for those Model 4 hard drive owners who wish to use both LDOS and TRSDOS. Please make sure that you backup EVERY file on your hard drive before you implement this procedure, as the hard drive will be reformatted.
.Patch to INITHD3/JCL to reverse head order and skip .FORMAT D09,B8="1" D09,EB="4" D0E,6F="." D0E,9C="." D0E,C9="." .End of Patch.
Now press BREAK. The patch file will be written to disk. Now type:
PATCH INITHD3/JCL USING INITHD3/FIX
and press ENTER. The patch will be applied to the INITHD3/JCL file. There is one more patch which needs to be applied. Since it is very short, you will not build a separate patch file for it, but simply type it in on the command line. Type:
PATCH HD1/CFG.CCC (D02,F7=13:D03,15=10)
And press ENTER. The patch will be applied to HD1/CFG.
DO INITHD3 (NEW,PW=PASSWORD,HARD1,FLOPPY2,ABS)
And press ENTER.
Refer to the Model III Hard Disk Startup Manual, page 31 and following, for more details.
Initializing Hard Drives under Model 4 DOS's - F. McCloy
Following are instructions for initializing Radio Shack 12 and 35 Meg hard drives under TRSDOS 6.02.00 and LDOS 5.1.4 using TRS-80 models 4 and 4p. These drives are not directly supported by Radio Shack for use with computers listed, and therefore, the "automatic formatting" utilities provided by RS will not give you satisfactory results.
PLEASE NOTE: The 35 Meg disk has 512 actual tracks, but you can use only 404 of them due to the limitation of the TRSHD6/DCT device driver. This limits useable space to about 80% of the drive's capacity. Partitioning the drive for both TRSDOS and LDOS will not solve the problem. (All of the space on the 12 Meg drive will be available to you.)
Use the following procedure to initialize the 12 or 35 meg drive with TRSDOS 6.02.00. (A similar procedure can be used for LDOS using its utilities.):
Command:
SYSTEM (DRIVE=6,DRIVER="TRSHD6")
TRSFORM6 :6
This procedure continues for drives :1 through :5, with each drive configured with specific parameters for 12MB and 35MB systems. The final setup commands are:
BACKUP :0 :6 (SYS,INV) SYSTEM (SYSTEM=6) SYSGEN (DRIVE=6)
Your system is now set up as follows:
PLEASE NOTE: This procedure can provide guidelines for partitioning your 12 or 35 meg hard drive for use with both TRSDOS and LDOS.
Changing The Minimum Cluster Size on Radio Shack Hard Drives - Adam Rubin - June 17, 1987
This file explains how to modify your hard disk to get a granule size of 1 kilobyte. It assumes you're using a Radio Shack 5-meg Hard Disk (26-1130), TRSDOS 6.2 or LS-DOS 6.3, and the Radio Shack hard disk drivers that were included with TRSDOS 6.2.0, and that your hard disk is assigned as drives 0, 1, 2, and 3. Please read ALL of this file, and make sure you understand it, before you try to do anything!
You've probably noticed that when you first set up your hard disk, space for files was allocated in units (granules) of 16 sectors, or 4K. As a result, any file stored takes up at least 4K of space. It's possible to change the DOS's description of the drive so that space is allocated in units of 1K, which means that there will be less wasted space when storing each file.
On the other hand, reducing the granule size from 4K to 1K introduces other problems. For example, it's possible for a 12K file to be stored in 12 separate extents of 1K each, which would take considerably longer to access than, say, 3 extents of 4K each. Also, additional directory entries are needed when there are more than four extents, so there's more chance of filling up all the directory entries before the disk itself is full.
Modification Procedure
D02,EE=CD 56 33 F02,EE=3D 0F 0F D01,66=CB 3A CB 3A 87 87 3D 0F 0F C9 F01,66=00 00 00 00 00 00 00 00 00 00then RENAME TRSHD6/DCT.DRIVER:f TO TRSHD6A/DCT
(where "f" is the drive containing the backup of the boot diskette), and PATCH TRSHD6A/DCT:f USING TRSHD6A
to patch it with the patch file.
- BACKUP *all* the files on that drive.
- SYSTEM (DRIVE=d,DISABLE,DRIVER="TRSHD6A") and answer the prompts.
- TRSFORM6 :d and answer the prompts.
- LIST BOOT/SYS.LSIDOS:d (HEX) to allocate the remainder of the space necessary for BOOT/SYS. This is ESSENTIAL.
- If you're using 6.3, DATECONV :d
- Restore your files back onto the hard disk.
Booting a Model 4P from a Hard Drive - Gary Phillips - December 22, 1987
The following patch files can be used to permit a model 4P to boot directly from a hard disk that uses the standard Radio Shack 8X300 or WD1010 controller board. They use the code and technique that was originated by Adam Rubin for TRSDOS 6.2, but have been modified for LS-DOS 6.3. I have tested them with a standard RS 5 Meg drive, using either the original TRSHD6 driver or the Misosys RSHARD6 driver software.
Be sure that your hard disk is completely backed up before applying these patches, because if you have difficulty you could lose data! Remember, too, that once you have applied these patches, you should NOT use backup to copy /SYS files to or from the hard disk.
Note that the xx and yy values must be entered in hexadecimal. For a RS 5 Meg drive, xx is 32 sectors/cylinder or hex 20, for example.
HDSYS0 - Patch to SYS0/SYS
. HDSYS0 - Patch to SYS0/SYS of LS-DOS 6.3 to permit direct . booting of Model 4P from RS HD - originated by Adam Rubin . 6.3 level K mods. by Gary Phillips, 08/12/87, rev. 08/22/87 . Apply via PATCH SYS0/SYS.LSIDOS using HDSYS0/FIX . d0c,b9=00 00 00 f0c,b9=31 80 03 d0d,07=c3 8f 1e f0d,07=00 00 00 d0e,a0=00 00 00 f0e,a0=c2 a0 19 d0e,e2=00 f0e,e2=c0 d0f,14=fe f0f,14=0c . eop
Changing TRSDOS 6.2.1 to Boot a Model 4P from a Hard Drive
System Requirements:
- TRS-80 Model 4P ONLY, not Model 4 or 4D.
- TRSDOS 6.2.1.
- Radio Shack 5-meg hard disk drive. This method might work on other drives with a WD1000 or WD1010 controller, but has not been tested.
- Use of Radio Shack hard disk drivers when running under TRSDOS 6.2.1. Other drivers have not been tested.
Instructions:
All references to drive :0 refer to the first logical (and physical) drive on your hard disk.
Step 1Boot the hard disk system with your usual boot diskette. If there is an AUTO command on your boot diskette, write it down.
Step 2Backup all files from the hard disk onto floppies.
Step 3Use SYSGEN to create a CONFIG/SYS file on logical drive :0.
Step 4Fill in the values marked "xx," "yy," and "zz zz zz..." in the table of changes to BOOT/SYS.
Step 5Using a file or sector editor, CAREFULLY change the files SYS0/SYS and BOOT/SYS on logical drive :0 as specified in the tables below.
Step 6Exit from your file or sector editor to "TRSDOS Ready." If there was an AUTO command on your boot diskette, store it on drive :0.
Step 7Remove all floppy disks from the drives and press RESET. In a few seconds, you should see the familiar Tandy logo. If so, you are finished modifying your system.
Restrictions when using these modifications:
- The system will attempt to boot from the hard drive if it is turned on. To boot from a floppy, hold down the F2 key while pressing RESET.
- When booting, if the hard drive is not completely up to speed you may see either a screenful of garbage or "The floppy disk drive is not ready." Press RESET, and the system should boot properly.
- The CONFIG/SYS file must be loaded when booting from the hard drive, and cannot be suppressed.
- When booting from the hard drive, you cannot enter DEBUG by holding down the D key, as this would prevent CONFIG/SYS from being loaded.
- Do not move the modified SYS0/SYS from hard drive :0 onto another disk.
Changes to SYS0/SYS.LSIDOS:
Record,Byte From To
----------- ---- --
0C,B0 31 80 03 00 00 00
0C,FE 00 00 00 C3 86 1E
0E,7A C2 A0 19 00 00 00
0E,C0 C0 00
0E,F2 0C FE
Changes to BOOT/SYS.LSIDOS:
Record,Byte From To
----------- ---- --
00,4D 12 FD...01 87 xx 00 00 00 00 00 00 00
00,5A 06 yy
00,9F 70 04 C3 43
01,41 1E 00...B6 77 18 0D F9 43 zz zz zz zz zz zz 00 00 00 00 00
01,6F C3 38 02 18 2C 00
01,7C 96 C3
01,80 E6 1C 00 00
01,F9 00 00...00 00 3E 09 90 28 AD AF C9
01,96 thru 01,DE
From: 01 F4 81 ... 18 10 FE
To: 00 00 00 00 00 00 00 21 43 43 11 71 04 01 08 00 ED B0 C3 38
02 F3 CD C3 43 3A 78 00 D3 84 FB 3E 05 C0 3A 79 04 92 3E 06
28 01 AF A7 C9 E5 D5 3E 85 D3 84 D3 9C 4B 5A 16 00 06 0C 3E
02 CF F5 AF D3 9C 3E 86 D3 84 F1 D1 E1
All references to drive :0 refer to the first logical (and physical) drive on your hard disk.
Restrictions when using these modifications:
- The system will attempt to boot from the hard drive if it is turned on. To boot from a floppy, hold down the F2 key while pressing RESET.
- When booting, if the hard drive is not completely up to speed you may see either a screenful of garbage or "The floppy disk drive is not ready." Press RESET, and the system should boot properly.
- The CONFIG/SYS file must be loaded when booting from the hard drive, and cannot be suppressed.
- When booting from the hard drive, you cannot enter DEBUG by holding down the D key, as this would prevent CONFIG/SYS from being loaded.
- Do not move the modified SYS0/SYS from hard drive :0 onto another disk.
For "xx," "yy," and "zz zz zz...," substitute the appropriate values for drive :0 of your hard disk system.
- xx = Sectors per cylinder, in hexadecimal. For example, thirty-two sectors per cylinder would be 20 hex.
- yy = Sectors per granule, in hexadecimal. For example, sixteen sectors per granule would be 10 hex.
- zz zz zz... = values of DCT+3 through DCT+8 for hard disk drive :0. Boot the hard disk system with your boot diskette, and use DEBUG to examine the Drive Code table for drive :0.
(Ken-J-Brookner).jpg)