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.

TRSDOS 1.3 Overlay Guide

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, selects interrupt mode 1 and sets the stack to 409FH.
  2. Sends 00H to port E4H (no disk NMIs), 20H to port ECH (video wait states on) and 04H to port E0H (only the real time clock interrupt allowed).
  3. Copies the serial number from the boot sector (43F4H) into the sign on message as ASCII digits.
  4. Finds the end of RAM by testing FFFFH, BFFFH and 7FFFH, stores it in 4411H (MEMEND), 40A0H and 4415H (MEM2), clears the screen and puts 48, 32 or 16 into the memory size line.
  5. Selects drives 0 to 3 in turn and restores each to track 0 to count the drives, then stores the highest drive number in 4413H (MAXDRV) and the count in the sign on message.
  6. Displays the Model III picture, the version line and the copyright notice, and reads the whole keyboard (38FFH) to see whether a key is held down.
  7. Enables interrupts. If 42B5H already holds 4455H the date and time questions are skipped; otherwise it stores 4455H there and asks for the date (MM/DD/YY) and the time (HH:MM:SS, which may be left blank or typed as HH:MM), checking each value.
  8. Copies the saved date (42B7H-42B9H) to the clock (421AH-421CH).
  9. If a key was held down during the boot it goes straight to TRSDOS READY. Otherwise it reads the GAT of drive 0 and, when the GAT holds an AUTO command (offset E0H), makes the BREAK vector at 42AEH a RET, copies the command into the command buffer at 4225H, displays AUTO Function Engaged and runs it; with no AUTO command it goes to TRSDOS READY.

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 sector of 0.
00101 = 5. 5 x 3 (3 sectors in a gran) = 15 sectors long.

So ... SYS00/SYS starts on Track 00 at sector 0, and continues for 15 sectors.

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.

RoutineReg A
on Entry
Routine Summary
DOS Reentry
(Error)
90HDisplays OPERATION ABORTED and then processes the next routine.
DOS ReentryA0HReturns to DOS READY after clearing a LOT of flags and enabling interrupts.
COMDOSB0HDisplays the DOS READY prompt and returns to 402DH via CMDDOS (below).
SYNTAXC0HCheck 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).
PUTEXTD0HAdd a default EXTENSION to the filespec
PARSERE0HEvaluate a parameter string (parenthesis, hex where it should be, TO/FROM)
CMDDOSF0HDisplays 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 sector of 00.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 sectors long.

So ... SYS01/SYS starts on Track 16 at sector 00, and continues for 6 sectors.

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.

RoutineReg A
on Entry
Routine Summary
Disk File OPEN90H
Disk File INITializeA0H
Password Encode (Hash)C0HThe 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 sector of 6.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 sectors long.

So ... SYS02/SYS starts on Track 16 at sector 6, and continues for 6 sectors.

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 03 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 sector of 12.
00011 = 3. 3 x 3 (3 sectors in a gran) = 09 sectors long.

So ... SYS03/SYS starts on Track 16 at sector 12, and continues for 09 sectors.

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 sector of 15.
00001 = 1. 1 x 3 (3 sectors in a gran) = 03 sectors long.

So ... SYS04/SYS starts on Track 16 at sector 15, and continues for 03 sectors.

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 sector of 15.
00011 = 3. 3 x 3 (3 sectors in a gran) = 09 sectors long.

So ... SYS05/SYS starts on Track 00 at sector 15, and continues for 09 sectors.

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 sector of 00.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 sectors long.

So ... SYS06/SYS starts on Track 18 at sector 00, and continues for 18 sectors.

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 sector of 06.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 sectors long.

So ... SYS07/SYS starts on Track 01 at sector 06, and continues for 18 sectors.

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 sector of 0.
00110 = 6. 6 x 3 (3 sectors in a gran) = 18 sectors long.

So ... SYS08/SYS starts on Track 19 at sector 00, and continues for 18 sectors.

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 sector of 0.
00101 = 5. 5 x 3 (3 sectors in a gran) = 15 sectors long.

So ... SYS09/SYS starts on Track 20 at sector 0, and continues for 15 sectors.

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 sector of 0.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 sectors long.

So ... SYS10/SYS starts on Track 15 at sector 0, and continues for 6 sectors.

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 sector of 15.
00100 = 4. 4 x 3 (3 sectors in a gran) = 12 sectors long.

So ... SYS11/SYS starts on Track 20 at sector 15, and continues for 12 sectors.

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 sector of 6.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 sectors long.

So ... SYS12/SYS starts on Track 15 at sector 6, and continues for 6 sectors.

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 sector of 12.
00010 = 2. 2 x 3 (3 sectors in a gran) = 6 sectors long.

So ... SYS13/SYS starts on Track 15 at sector 12, and continues for 6 sectors.

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 sector of 9.
00001 = 1. 1 x 3 (3 sectors in a gran) = 3 sectors long.

So ... SYS14/SYS starts on Track 21 at sector 9, and continues for 3 sectors.

Disassembly:

A disassembly of SYS14/SYS can be found here.