TRS-80 DOS – TRSDOS v1.3 – Disassembled


BOOT/SYS

Boot and resident part of the operating system. Must be present on any bootable disk.

A disassembly of BOOT/SYS can be found here.


SYS0/SYS (the “nucleus”)

Overlay 00 is preset as HIT Table entry 0500, meaning that it starts on Track 00. 05H = 00000101 a/k/a 0/5, so it starts at granule 0 and continues for 15 (i.e., 5 x 3) granules.

As soon as SYS0/SYS is loaded into RAM by BOOT/SYS, it does the following:

  1. Disables interrupts.
  2. Selects interrupt “mode 1” (meaning that when interrupts are enabled, all interrupts will be vectored to 0038H).
  3. Initializes 5200H (the memory location used by user called programs).
  4. Calculates the memory size and puts that into 4049H.
  5. Initializes the device address table of 43B8H-43BFH.
  6. Initializes the device mnemonic table of 43C0H-43CCH.
  7. Loads an alternate keyboard driver into 43D8H-43FBH.
  8. Sets up a keyboard buffer.
  9. Copies the video driver address, video ram buffer address, printer driver address, and printer buffer into the device tables.
  10. Copies the keyboard DCB to 4358H-435FH.
  11. Puts the clock interrupt routine location and the disk interrupt routine location into the interrupt scan list at 405B and 4059, and then tells the interrupt controller that these exist.
  12. Sets DEBUG to DISABLED and sets up the clock interrupts.
  13. Displays the TRSDOS Banner.
  14. Checks for an ENTER key and either processes AUTO if none or loads SYS1/SYS to wait for a command.

A disassembly of SYS00/SYS can be found here.


SYS01/SYS aka OVERLAY 1

Overlay 1 is preset as HIT Table entry 0210, meaning that it starts on Track 10H. 02H = 00000010 a/k/a 0/2, so it starts at granule 0 and continues for 6 (i.e., 2 x 3) granules.

Overlay 1 decodes DOS COMMANDS via 6 different routines for TRSDOS v1.3. It is the TRSDOS v1.3 command interpreter and must be available on all SYSTEM disks.

Routine
Reg A
on Entry
Routine Summary
DOS Reentry
(Error)
90H
Displays OPERATION ABORTED and then processes the next routine.
DOS Reentry
A0H
Returns to DOS READY after clearing a LOT of flags and enabling interrupts.
COMDOS
B0H
Displays the DOS READY prompt and returns to 402DH via CMDDOS (below).
SYNTAX
C0H
Check the filespec for validity (i.e., up to 8 characters, starting with A-Z, and then only A-Z,0-9; looking for an extension and putting in the “/” and verifying those characters; looking for a password and putting in the “.” and verifying those characters; and looking for a drive number and putting the “:” and making sure the drive is good).
PUTEXT
D0H
Add a default EXTENSION to the filespec
PARSER
E0H
Evaluate a parameter string (parenthesis, hex where it should be, TO/FROM)
CMDDOS
F0H
Displays the DOS READY prompt and returns to the user.

A disassembly of SYS01/SYS can be found here.


SYS02/SYS aka OVERLAY 2

Overlay 2 is preset as HIT Table entry 4210, meaning that it starts on Track 10H. 42H = 01000010 a/k/a 3/2, so it starts at granule 6 (i.e., 3 x 2) and continues for 6 (i.e., 2 x 3) granules.

Overlay 2 handles the OPEN (enters with 90H in Register A), INIT (enters with A0H in Register A), and PASSWORD ENCODE (enters with C0H in Register A) routines for TRSDOS v1.3. This overlay must be available on all SYSTEM disks.

The PASSWORD ENCODE routien takes an 8 character string pointed to by (DE) and turns it into a two byte value. This value is stored in the directory entry by INIT and ATTRIB.

A disassembly of SYS02/SYS can be found here.


SYS03/SYS aka OVERLAY 3

Overlay 3 is preset as HIT Table entry 8310, meaning that it starts on Track 10H. 83H = 10000011 a/k/a 4/3, so it starts at granule 12 (i.e., 4 x 3) and continues for 9 (i.e., 3 x 3) granules.

Overlay 3 handles the CLOSE (enters with 90H in Register A) and KILL (enters with A0H in Register A) routines for TRSDOS v1.3. This overlay must be available on all SYSTEM disks.

A disassembly of SYS03/SYS can be found here.


SYS04/SYS aka OVERLAY 4

Overlay 4 is preset as HIT Table entry A110, meaning that it starts on Track 10H. 83H = 10100001 a/k/a 5/1, so it starts at granule 15 (i.e., 5 x 3) and continues for 3 (i.e., 1 x 3) granules.

Overlay 4 is the TRSDOS v1.3 DOS Error Handler. It first starts by checking memory location 4CFDH to see if chaining is active (and if so, ending the chaining). It then gets the error message (by POPing Register Pair AF), and the return address from the top of the stack, prints the error, and exits. This overlay must be available on all SYSTEM disks.

A disassembly of SYS04/SYS can be found here.


SYS05/SYS aka OVERLAY 5

Overlay 5 is preset as HIT Table entry A300, meaning that it starts on Track 00H. 83H = 101 00011, so it starts at granule 15 (i.e., 5 x 3) and continues for 9 (i.e., 3 x 3) granules.

Overlay 5 is the TRSDOS v1.3 DEBUG Handler. This overlay is optional and may be deleted if there is no need for DEBUG.

A disassembly of SYS05/SYS can be found here.


SYS06/SYS aka OVERLAY 6

Overlay 6 is preset as HIT Table entry 0612, meaning that it starts on Track 12H. 06H = 000 00110, so it starts at granule 0 (i.e., 0 x 3) and continues for 18 (i.e., 6 x 3) granules.

Overlay 6 processes the APPEND, ATTRIB, AUTO, BUILD, CLEAR, CLOCK, CREATE, DATE, DIR, DO, DUMP, ERROR, FREE, LIB, LOAD, PAUSE, PROT, RENAME, and TIME library commands. This overlay is optional.

A disassembly of SYS05/SYS can be found here.


SYS07/SYS aka OVERLAY 7

Overlay 7 is preset as HIT Table entry 4601, meaning that it starts on Track 01H. 46H = 010 00110, so it starts at granule 6 (i.e., 2 x 3) and continues for 18 (i.e., 6 x 3) granules.

Overlay 7 processes the BACKUP and FORMAT commands. This overlay is optional.


SYS08/SYS aka OVERLAY 8

Overlay 8 is preset as HIT Table entry 0613, meaning that it starts on Track 13H. 05H = 000 00110, so it starts at granule 0 (i.e., 0 x 3) and continues for 18 (i.e., 6 x 3) granules.

Overlay 8 processes the HELP command. This overlay is optional.


SYS09/SYS aka OVERLAY 9

Overlay 9 is preset as HIT Table entry 0514, meaning that it starts on Track 14H. 05H = 000 00101, so it starts at granule 0 (i.e., 0 x 3) and continues for 15 (i.e., 5 x 3) granules.

Overlay 9 processes the COPY, DUAL, FORMS, KILL, MASTER, PATCH, RELO, ROUTE, SETCOM, and WP commands. This overlay is optional.


SYS10/SYS aka OVERLAY 10

Overlay 10 is preset as HIT Table entry 020F, meaning that it starts on Track 0FH. 02H = 000 00010=2, so it starts at granule 0 (i.e., 0 x 3) and continues for 6 (i.e., 2 x 3) granules.

Overlay 10 processes the $DSPDIR and BASIC Error Messages. This overlay is optional.


SYS11/SYS aka OVERLAY 11

Overlay 11 is preset as HIT Table entry A414, meaning that it starts on Track 14H. A4H = 101 00100=4, so it starts at granule 15 (i.e., 5 x 3) and continues for 12 (i.e., 4 x 3) granules.

Overlay 11 processes the LIST, PURGE, and TAPE commands. This overlay is optional.


SYS12/SYS aka OVERLAY 12

Overlay 12 is preset as HIT Table entry 420F, meaning that it starts on Track 0FH. 42H = 010 00010=2, so it starts at granule 6 (i.e., 2 x 3) and continues for 6 (i.e., 2 x 3) granules.

Overlay 12 processes the BASIC Commands: NAME and CMD “C”. This overlay is optional.


SYS13/SYS aka OVERLAY 13

Overlay 13 is preset as HIT Table entry 820F, meaning that it starts on Track 0FH. 82H = 100=4 00010=2, so it starts at granule 12 (i.e., 4 x 3) and continues for 6 (i.e., 2 x 3) granules.

Overlay 13 processes the BASIC Commands: CMD “J”, CMD “O”, and CMD “X”. This overlay is optional.


SYS14/SYS aka OVERLAY 14

Overlay 14 is preset as HIT Table entry 6115, meaning that it starts on Track 15H. 61H = 011 00001=1, so it starts at granule 9 (i.e., 3 x 3) and continues for 3 (i.e., 1 x 3) granules.

Overlay 14 processes the $FILPTR and $RAMDIR routines. This overlay is optional.