TRSDOS


TRSDOS is the operating system for the Tandy TRS-80 line of eight-bit Zilog Z80 microcomputers that were sold through Radio Shack from 1977 through 1991. Tandy's manuals recommended that it be pronounced triss-doss. TRSDOS should not be confused with Tandy DOS, a version of MS-DOS licensed from Microsoft for Tandy's x86 line of personal computers.
With the original TRS-80 Model I of 1977, TRSDOS was primarily a way of extending the MBASIC with additional I/O commands that worked with disk files rather than the cassette tapes that were used by non-disk Model I systems. Later disk-equipped Model III computers used a completely different version of TRSDOS by Radio Shack which culminated in 1981 with TRSDOS Version 1.3. From 1983 disk-equipped TRS-80 Model 4 computers used TRSDOS Version 6, which was a development of Model III LDOS by Logical Systems, Inc. This last was updated in 1987 and released as LS-DOS 6.3.
Completely unrelated was a version of TRSDOS by Radio Shack for its TRS-80 Model II and TRS-80 Model 12 professional computers from 1979, also based on the Z80 and equipped with 8-inch disk drives. The later machines in this line, the Models 16 & 16B and Tandy 6000, used the Z80 as an I/O processor to its main Motorola 68000 chip when running operating systems on the 68000, and could run the Model II version of TRSDOS for backwards compatibility with older Z80 applications software. When running the older Z80 operating systems, the 68000 was unused.

History

's TRS-80 microcomputer did not have a disk drive or disk operating system at release. The first version of TRSDOS, by Randy Cook, was so buggy that others wrote alternatives, including NewDOS and LDOS. After disputes with Cook over ownership of the source code, Tandy hired Logical Systems, LDOS's developer, to continue TRSDOS development. TRSDOS 6, shipped with the TRS-80 Model 4 in 1983, is identical to LDOS 6.00.

Dates

  • October, 1979 – Radio Shack releases TRSDOS 2.3
  • May 1, 1981 – Radio Shack releases Model III TRSDOS 1.3
  • April 26, 1983 – Radio Shack introduces TRSDOS Version 6.0 with the new Model 4s
  • 1984 – Radio Shack releases Version 6.2, the definitive version for the Model 4
  • 1984 – Logical Systems publishes The Source, the commented assembler source code to TRSDOS 6.2
  • Late 1986 – Logical Systems releases LS-DOS 6.3, the functionally equivalent update to TRSDOS 6.2. From this date, Tandy/Radio Shack ships it with the Model 4D.

    Features and capabilities

Radio Shack's Z80-based line of TRS-80 computers support up to four physical floppy drives which use 5¼-inch diskettes. The original TRSDOS for the Model I supported only single-sided disks with 35 tracks formatted in single density. Model III TRSDOS supported 40-track disks formatted in double density. Model Is retrofitted with double density controllers and Models I/III equipped with 80-track drives or double-sided drives could not use TRSDOS; RadioShack sold Logical System's LDOS operating system which could control these types of drives. The Model 4's TRSDOS 6 is a development of LDOS and has the same capabilities.
Hard disk drives required custom driver software supplied by their manufacturers. These drivers permitted any TRSDOS installation to access them with up to eight possible drive partitions, each assigned to drive numbers zero through seven. Actually, a large hard drive could be formatted with more than eight partitions, but TRSDOS can only access eight during any one session. Hard drives could have some partitions formatted under TRSDOS and others under the CP/M OS. Each floppy drive in the system would also take up one drive number assignment. The Model 4, with its ability to set up a ramdisk, also required a drive number assignment for this.
All versions of TRSDOS use overlays to satisfy most system requests and disk directories are not maintained in memory. This has two implications for system performance. First, upon initial file access the DOS always references the disk directory to obtain information giving the physical mapping of disk space allocated to the file. After the initial access this information is maintained in a File Control Block, the memory space for which is supplied by the calling application. Further references do not need to read the disk directory. For this reason system performance depends greatly on how close a file's allocated disk space is/are to the directory cylinder, and how fragmented the file is as a whole. The farther away the directory cylinder is, the more the drive's read/write head will need to move, which slows disk access and produces more mechanical wear on the drive. TRSDOS has commands permitting the user to optimize placement of particular files on the disk's physical space, and the command to display a map of a file's physical placement on a drive.
The second implication of the overlay-based architecture is that a disk containing TRSDOS system files must always be present in whichever drive is assigned as logical drive number zero.. LDOS and TRSDOS 6 have a SYSRES command which loads selected system files into Z80 RAM, thus freeing space on the system disk for non-system data. All versions have variants of the SYSTEM command which can reassign logical drive numbers to physical drives. It is possible to assign drive numbers such that a physical drive is unassigned a logical drive number; this is sometimes useful to guarantee that the drive cannot be accessed for security or safety purposes. Drives may be set to be write protected by the DOS, also.

Disk management

The primary function of any disk operating system is to provide the user with a facility for managing and accessing files stored on disk storage devices. Since the user must not be burdened with the physical details of the storage devices themselves, it is the operating system's responsibility to translate file record access requests into specific drive, track, sector, and head parameters that pinpoint the storage location of each record.
The system also maintains in Z80 memory within TRSDOS a Drive Control Table that stores the parameters associated with each of the eight logical drives. Disk drive parameters refer to how the total storage space on a drive is divided up into addressable units. The layer of magnetic particles on the surface of the disk media are magnetized into concentric circles of storage areas called TRACKS. Each track is divided into 256-byte sub-areas called SECTORS. Each sector is uniquely identified by a pattern of information preceding each sector called an ID FIELD. Although the number of sectors per track may vary from one media type to another, the number of sectors in each track of the same media must always be a constant.
Disks are organized as follows: each track is formatted into a specific number of 256-byte sectors with a maximum capacity of 32 sectors per track. Sectors are grouped into blocks called granules which vary in size according to total track capacity of the disk media, though granule size for each disk format is constant. For forty-cylinder disks formatted in double density, standard for the drives installed in the TRS-80 Models III and 4, the granule size is six 256-byte sectors, or 1.5 KB. Each track has three granules for 4.5 KB of storage. Each side of the disk is normally formatted with 40 tracks, yielding 180 KB per side. The Model 4D, with its double-sided drives, yields 360 KB of storage. Whenever additional disk space is needed for a file, an additional granule is allocated. The granule thus becomes the minimum size storage unit.
TRSDOS assigns numbers to every sector, every track, and every surface. Surfaces are numbered consecutively starting from zero. Tracks are numbered consecutively starting from zero at the outermost edge of the disk giving the innermost track the highest number. Where multiple headed drives are in use, the track numbers on a surface are duplicated on each surface with all similarly numbered tracks constituting a cylinder. For a double-sided floppy disk as formatted on a Model 4D, track zero of surface zero and track zero of surface one are grouped together into cylinder zero. Cylinder capacities also have an upper limit of 256 sectors per cylinder or eight granules per cylinder, while the system supports a maximum of eight heads per drive.
The disk's directory cylinder is placed during the format process on the middle-numbered cylinder; thus a standard 40 cylinder disk has its directory installed on cylinder 20. This reduces the average distance that the drive's read/write head must move to access the directory. The first sector of the disk directory contains the Granule Allocation Table. The GAT is bit mapped to each granule of space on the drive. Other fields in the GAT contain the PACK NAME, DATE of creation, pack PASSWORD, and data pertaining to the configuration of the drive.
When a file is to be opened for access, the system needs to search the directory for its directory record. Search time is minimized by using a hashing technique to reduce the 11-character string formed from the file name and extension to a one byte value. The hash code for each file is stored in a Hash Index Table which is the second sector of the directory. Each position in this table corresponds to a specific directory entry record. The hash table, being one sector in length, can index a maximum of 256 directory records or files. The directory itself is sized according to disk capacity by being a maximum of one cylinder. Thus, the larger the disk storage capacity, the larger its directory, and the greater the number of file names that can be stored on the disk.
The directory record contains information such as the date the file was last modified, its update and access password codes, its access level, and other attributes such as whether it is a SYStem or PDS file and if a backup has been made, the relative number of the last sector in the file, and the last byte within the last sector. The record also contains the physical area in use by the file, by pointing to the cylinder, relative starting granule, and number of contiguous granules for each extent comprising the file. When a file has more than four extents, additional directory records are used as required with forward and backward pointers linking each record of each file. Thus the theoretical maximum of 256 files possible on a floppy diskette is realizable only if there is no file fragmentation.
When TRSDOS formats a disk, all of the parameters associated with the diskette are predetermined. Thus the number of sectors per track, number of sectors per granule and thus the granules per track, number of sides, and number of cylinders are all designated, as well as the density of the media. Some of these figures are written to fields in the Granule Allocation Table which is part of the disk directory. Others are part of the Drive Control Table fields. When the system attempts to open a file on a disk, it uses the @CKDRV SVC to ascertain the availability of the disk, and then logs the disk once it finds it available. This "logging" function will update the DIRCYL field, then update the DBLBIT and MAXCYL fields based on information stored in the GAT. This procedure frees the user from having to manually log a newly inserted disk; he is at liberty to change differently formatted disks in any drive without concern that the system will incorrectly access it.
The SVC disk primitives are funneled through common system routines contained in the driver software installed for each type of disk storage device. The driver for Model III or Model 4 floppy drives is named and is located in the TRSDOS low memory region. Hard disk drives are supplied with their own driver software, and are usually installed in high memory above the system pointer, since room in the low memory region is usually insufficient. These driver routines establish a linkage protocol between the application requesting disk access and the computer's Floppy Disk Controller hardware. TRS-80s use controller chips from the Western Digital series: the WD1791 in the Model 4 non-gate array version, and the WD1773 in the Model 4 Gate Array version. When an I/O request is invoked by a higher level SVC, such as a request to READ a file record, the request is translated to that disk primitive needed to satisfy the function request. The linkage protocol is uniform across all disk devices that are connected to the system. This makes the access of files transparent to size or nature of the disk device within the scope of the parameters stored in the DCT for that drive.