Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
TRSDOS
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===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(s) of magnetic particles on the surface of the disk media are magnetized (during the format process) 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 (and in each granule) 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 (surface) 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 (such as extending a file while being written to), 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 (for hard drives with multiple platters of storage media) 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 (and access time) 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 ('''GAT'''). 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 (when the disk was formatted), 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''' (HIT) 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 (up to 34 sectors). 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 (Partitioned Data Set) 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 (or End Of File). The record also contains the physical area(s) 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 (surfaces), and number of cylinders are all designated, as well as the density of the media. Some of these figures (density, sides, granules per track) are written to fields in the Granule Allocation Table which is part of the disk directory. Others (sectors per track, sectors per granule, in addition to the former quantities) 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 {{mono|$FD}} 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 (main 64K Z80 RAM) above the system {{mono|HIGH$}} pointer, since room in the low memory region is usually insufficient (especially on the Model 4 since software needed to access its external memory banks cannot reside in high Z80 RAM memory because that region exists in the banked RAM swap area). 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 (FDC command or status report) 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.<ref>{{cite web |last1=Soltoff |first1=Roy |title=Programmer's Guide to TRSDOS 6 |url=https://www.tim-mann.org/trs80/doc/prgguide.pdf |website=timm-mann dot org |publisher=Misosys Inc. |accessdate=November 4, 2019}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)