TRS-80 DOS – TRSDOS v1.3 – Disassembled


Overview

TRSDOS v1.3 is comprised of a BOOT/SYS bootstrap, and then 15 Overlays (00-14), although there is room for a 16th.

The system files do not have corresponding directory entries. Rather, they appear at byte E0H in the HIT table just as a string of hex pairs, in the order of the overlay.


The first byte of the two byte code is broken down into 2 numbers – bits 7-5, and bits 4-0. Each of those decimal values is multiplied by 3 since there are 3 sectors in a gran. The first value is the starting gran on the track and the second value is how many consecutive grans the overlay occupies.

The second byte of the two byte code represents the track number where the overlay starts.


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”)

Purpose:

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.

Location:

Overlay 00 is preset as HIT Table entry 0500H …

Last 2 Digits = 00H = Decimal 00.

First 2 Digits = 05H = Binary 00000101.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 0.
00101 = 5. 5 x 3 (3 sectors in a gran) = 15 granules long.

So … SYS00/SYS starts on Track 00 at granule 0, and continues for 15 granules.

Disassembly:

A disassembly of SYS00/SYS can be found here.


SYS01/SYS aka OVERLAY 1

Purpose:

Overlay 2 handles 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.

Location:

Overlay 01 is preset as HIT Table entry 0210H …

Last 2 Digits = 10H = Decimal 16.

First 2 Digits = 02H = Binary 00000010.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 00.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 granules long.

So … SYS01/SYS starts on Track 16 at granule 00, and continues for 6 granules.

Disassembly:

A disassembly of SYS01/SYS can be found here.


SYS02/SYS aka OVERLAY 2

Purpose:

Overlay 2 handles the following and must be available on all SYSTEM disks.

Routine
Reg A
on Entry
Routine Summary
Disk File OPEN
90H
Disk File INITialize
A0H
Password Encode (Hash)
C0H
The PASSWORD ENCODE routine 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.

Location:

Overlay 02 is preset as HIT Table entry 4210H …

Last 2 Digits = 10H = Decimal 16.

First 2 Digits = 42H = Binary 01000010.

010 = 2. 2 x 3 (3 sectors in a gran) = a starting granule of 6.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 granules long.

So … SYS02/SYS starts on Track 16 at granule 6, and continues for 6 granules.

Disassembly:

A disassembly of SYS02/SYS can be found here.


SYS03/SYS aka OVERLAY 3

Purpose:

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.

Location:

Overlay 04 is preset as HIT Table entry 8310H …

Last 2 Digits = 10H = Decimal 16.

First 2 Digits = 83H = Binary 10000011.

100 = 4. 4 x 3 (3 sectors in a gran) = a starting granule of 12.
00011 = 1. 3 x 3 (3 sectors in a gran) = 09 granules long.

So … SYS03/SYS starts on Track 16 at granule 12, and continues for 09 granules.

Disassembly:

A disassembly of SYS03/SYS can be found here.


SYS04/SYS aka OVERLAY 4

Purpose:

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.

Location:

Overlay 04 is preset as HIT Table entry A110H …

Last 2 Digits = 10H = Decimal 16.

First 2 Digits = A1H = Binary 10100001.

101 = 5. 5 x 3 (3 sectors in a gran) = a starting granule of 15.
00001 = 1. 1 x 3 (3 sectors in a gran) = 03 granules long.

So … SYS04/SYS starts on Track 16 at granule 15, and continues for 03 granules.

Disassembly:

A disassembly of SYS04/SYS can be found here.


SYS05/SYS aka OVERLAY 5

Purpose:

Overlay 5 processes DEBUG. This overlay is optional and may be deleted if there is no need for DEBUG.

Location:

Overlay 05 is preset as HIT Table entry A300H …

Last 2 Digits = 00H = Decimal 00.

First 2 Digits = A3H = Binary 10100011.

101 = 5. 5 x 3 (3 sectors in a gran) = a starting granule of 15.
00011 = 3. 3 x 3 (3 sectors in a gran) = 09 granules long.

So … SYS05/SYS starts on Track 00 at granule 15, and continues for 09 granules.

Disassembly:

A disassembly of SYS05/SYS can be found here.


SYS06/SYS aka OVERLAY 6

Purpose:

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.

Location:

Overlay 06 is preset as HIT Table entry 0612H …

Last 2 Digits = 12H = Decimal 18.

First 2 Digits = 06H = Binary 00000110.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 00.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 granules long.

So … SYS06/SYS starts on Track 18 at granule 00, and continues for 18 granules.

Disassembly:

A disassembly of SYS06/SYS can be found here.


SYS07/SYS aka OVERLAY 7

Purpose:

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

Location:

Overlay 07 is preset as HIT Table entry 4601H …

Last 2 Digits = 01H = Decimal 01.

First 2 Digits = 46H = Binary 01000110.

010 = 2. 2 x 3 (3 sectors in a gran) = a starting granule of 06.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 granules long.

So … SYS07/SYS starts on Track 01 at granule 06, and continues for 18 granules.

Disassembly:

A disassembly of SYS07/SYS can be found here.


SYS08/SYS aka OVERLAY 8

Purpose:

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

Location:

Overlay 08 is preset as HIT Table entry 0613H …

Last 2 Digits = 13H = Decimal 19.

First 2 Digits = 06H = Binary 00000110.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 0.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 granules long.

So … SYS08/SYS starts on Track 19 at granule 00, and continues for 18 granules.

Disassembly:

A disassembly of SYS08/SYS can be found here.


SYS09/SYS aka OVERLAY 9

Purpose:

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

Location:

Overlay 09 is preset as HIT Table entry 0514H …

Last 2 Digits = 14H = Decimal 20.

First 2 Digits = 05H = Binary 00000101.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 0.
00101 = 5. 5 x 3 (3 sectors in a gran) = 15 granules long.

So … SYS09/SYS starts on Track 20 at granule 0, and continues for 15 granules.

Disassembly:

A disassembly of SYS09/SYS can be found here.


SYS10/SYS aka OVERLAY 10

Purpose:

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

Location:

Overlay 10 is preset as HIT Table entry 020FH …

Last 2 Digits = 0FH = Decimal 15.

First 2 Digits = 02H = Binary 10100100.

000 = 0. 0 x 3 (3 sectors in a gran) = a starting granule of 0.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 granules long.

So … SYS10/SYS starts on Track 15 at granule 0, and continues for 6 granules.

Disassembly:

A disassembly of SYS10/SYS can be found here.


SYS11/SYS aka OVERLAY 11

Purpose:

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

Location:

Overlay 11 is preset as HIT Table entry A414H …

Last 2 Digits = 14H = Decimal 20.

First 2 Digits = A4H = Binary 10100100.

101 = 5. 5 x 3 (3 sectors in a gran) = a starting granule of 15.
00100 = 4. 4 x 3 (3 sectors in a gran) = 12 granules long.

So … SYS11/SYS starts on Track 20 at granule 15, and continues for 12 granules.

Disassembly:

A disassembly of SYS11/SYS can be found here.


SYS12/SYS aka OVERLAY 12

Purpose:

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

Location:

Overlay 12 is preset as HIT Table entry 420FH …

Last 2 Digits = 0FH = Decimal 15.

First 2 Digits = 42H = Binary 01000010.

010 = 2. 2 x 3 (3 sectors in a gran) = a starting granule of 6.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 granules long.

So … SYS12/SYS starts on Track 15 at granule 6, and continues for 6 granules.

Disassembly:

A disassembly of SYS12/SYS can be found here.


SYS13/SYS aka OVERLAY 13

Purpose:

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

Location:

Overlay 13 is preset as HIT Table entry 820FH …

Last 2 Digits = 0FH = Decimal 15.

First 2 Digits = 82H = Binary 10000010.

100 = 4. 4 x 3 (3 sectors in a gran) = a starting granule of 12.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 granules long.

So … SYS13/SYS starts on Track 15 at granule 12, and continues for 6 granules.

Disassembly:

A disassembly of SYS13/SYS can be found here.


SYS14/SYS aka OVERLAY 14

Purpose:

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

Location:

Overlay 14 is preset as HIT Table entry 6115H …

Last 2 Digits = 15H = Decimal 21.

First 2 Digits = 61H = Binary 01100001.

011 = 3. 3 x 3 (3 sectors in a gran) = a starting granule of 9.
00001 = 1. 1 x 3 (3 sectors in a gran) = 3 granules long.

So … SYS14/SYS starts on Track 21 at granule 9, and continues for 3 granules.

Disassembly:

A disassembly of SYS14/SYS can be found here.