TRS-80 DOS - VTOS v4.0 - Disassembled

Overview

VTOS v4.0 (Virtual Technology Operating System) was developed by Randolph Cook and published by Virtual Technology Inc. It is a third-party replacement DOS for the TRS-80 Model I, designed to provide enhanced capabilities over the standard TRSDOS. VTOS uses an overlay-based architecture with a resident core (SYS0/SYS) and swappable overlays (SYS1 through SYS10) loaded via an RST 28H overlay loader mechanism.

Unlike TRSDOS, which stores system files without directory entries and encodes their disk locations in the HIT table, VTOS maintains standard directory entries for its system files. The system disk contains the core operating system files (BOOT/SYS, SYS0-SYS10, CONFIG/SYS, DIR/SYS), device drivers (KSM/DVR, PR/DVR, RS232/DVR), utilities (BACKUP/CMD, FORMAT/CMD, KSR/CMD, PATCH/CMD, VTCOMM/CMD), BASIC support files (BASIC/CMD, BASIC/KSM, BASIC/OVN, BASIC/OVX), and JCL batch files (MAKE/JCL, SYSTEM/JCL).

The resident DOS core at SYS0/SYS occupies memory from 3C00H through approximately 50F8H and provides all fundamental file I/O, disk access, keyboard input, clock/date display, overlay loading, and system initialization services. SYS0/SYS employs several notable techniques including self-modifying code for write verify control, synthetic stack frames for automatic register preservation during FCB validation, and an RST 28H-based overlay loader that swaps SYS overlays into the overlay region as needed.

BOOT/SYS

Boot sector and initial loader for the VTOS operating system. This code resides in the first sector of the disk and is responsible for loading the resident DOS core (SYS0/SYS) into memory and transferring control to the cold boot initialization entry point.

A disassembly of BOOT/SYS can be found here.

SYS0/SYS - Resident DOS Core

The resident DOS core, loaded into memory at 3C00H by BOOT/SYS. SYS0/SYS remains in memory at all times and provides all fundamental operating system services. Major functional areas include:

Address RangeFunction
3C00H-3CFFHRST vector table and core entry points
3D00H-44FFHDisk I/O primitives, directory management, sector read/write, GAT/HIT processing
4500H-483DHFile control block management, buffer handling, space allocation
483FH-4A11HRecord-level I/O (read/write records, byte-level file access), FCB validation with synthetic stack frames, sector write with self-modifying verify flag
4A12H-4ABBHFile space allocation, extent chain walking, overlay allocation
4ABCH-4B6AHExtent allocation, sector mapping, directory read/write, track cache
4B6CH-4BA8HMath routines: 8-bit multiply, 8-bit divide, 24-bit multiply
4BA9H-4BBBH16-bit divide
4BBCH-4C27HKeyboard input and character processing
4C28H-4CA8HRST 28H overlay loader
4CA9H-4CF7HOverlay error display, load and execute, program loader entry
4CF8H-4DAAHProgram load core, sector read helper
4DABH-4DFFHClock display, date display, hex display
4E00H-4FEDHCold boot entry, initialization, date/calendar, CONFIG/SYS processing, DOS ready jump
4FEEH-50F8HSystem startup finalization, date/day/month name strings, patch routine, drive activity timeout

A disassembly of SYS0/SYS can be found here.

SYS1/SYS

SYS1/SYS is the command line interpreter overlay, loaded into the overlay region via RST 28H whenever the system needs to accept user input or process a DOS command. It provides six request codes (10H-70H) handling the "VTOS READY" prompt display, keyboard input acceptance, command parsing against a 36-entry library command table, filespec extraction in NAME/EXT.PASSWORD:DRIVE format, default extension insertion, and parenthesized parameter parsing with support for decimal numbers, hexadecimal values (X'nn' format), quoted strings, and YES/NO/ON/OFF booleans. Of the 36 library commands, 35 dispatch through the SYS6 overlay mechanism via RST 28H with SVC code 88H; only BOOT uses a direct address (4EA9H, a HALT instruction that freezes the CPU until hardware reset). The command table search at 50BCH is shared between the main command table and the parameter keyword table, using an efficient 8-byte-per-entry linear scan with short-name space-padding match support.

A disassembly of SYS1/SYS can be found here.

SYS2/SYS - File Open, Kill, and New File Creation

SYS2 is the file management overlay, handling three core operations: opening an existing file (request code 10H), killing/deleting a file (request code 20H), and creating a new file (request code 30H). It also provides shared utility routines for filespec parsing (request code 50H), password hash computation (request code 60H), and drive select with write-protect detection (request code 40H).

The Open Existing File handler performs a two-level directory search: an 8-bit CRC hash of the filename provides fast first-pass matching across directory sectors, followed by a full 11-byte filename comparison to confirm matches. Password verification uses a 16-bit polynomial CRC hash with a special case allowing blank passwords (hash 61A2H equivalent) to match any file. The directory search scans up to 8 sectors, advancing through directory entries in 32-byte increments within each 256-byte sector buffer.

The Kill File handler clears the system mode flag (bit 2 of 430FH) before delegating to the Open Existing File routine, then proceeds to deallocate the file's resources. The Open New or Existing File handler searches for a free directory slot using the system tick counter at 4040H as a pseudo-random starting offset to distribute new files across the directory, reducing clustering.

The FCB Population routine transfers directory metadata into the caller's FCB (File Control Block), filling fields from IX+00H through the extent chain data. Extent entries are copied from the directory into the FCB with FFH padding for unused slots. The drive select routine uses a 3-phase FDC index pulse polling technique to detect write-protect status, reading the WD1771 status register's bit 6 after synchronizing with the disk rotation.

A disassembly of SYS2/SYS can be found here.

SYS3/SYS

SYS3/SYS serves as the "cleanup" module for the VTOS 4.0 file management system. It ensures that all data is safely recorded, that disk space is correctly managed, and that file control blocks are properly finalized.

  • CLOSE Processing (Request Code 10H): When a program finishes writing to a file, SYS3/SYS updates the directory entry with the final EOF offset and extent chain position. It also date-stamps the entry using the system date, walks the extent chain to count total allocated granules, computes how many the file actually requires, and deallocates any excess by clearing the appropriate bits in the Granule Allocation Table (GAT).
  • Filespec Builder (Request Code 30H): Constructs a NAME/EXT:D filespec string from a directory entry and stores it directly into the FCB, terminated with a 03H load marker.
  • FCB Initialization (Request Code 00H): Initializes a File Control Block for an unopened file reference, setting the FCB status to 2AH and recording the drive number, directory info byte, and default buffer pointer.

Commented Disassembly:

A disassembly of SYS3/SYS can be found here.

SYS4/SYS

SYS4/SYS is the error display overlay for VTOS 4.0, loaded into the overlay area at 4E00H-51DDH when an error condition triggers SVC code 86H via RST 28H. It is a pure display overlay containing no disk I/O logic except a single CALL to 4797H to read a directory sector for filename extraction.

SYS4 uses a dictionary-based message system to convert numeric error codes (00H-29H) into human-readable text. The system decomposes 42 error messages into 55 reusable words stored in a contiguous string pool, referenced through a 3-level lookup: an offset table maps each error code to a descriptor chain, each descriptor byte encodes a word index plus continuation and context flags, and a DEFW address table provides the start address and implied length of each word in the pool. The overlapping-entry scheme computes word length by subtraction of adjacent DEFW entries, eliminating stored lengths or delimiters. Total message system storage is approximately 613 bytes, roughly 20-25% smaller than individual full-text strings.

Error display includes three diagnostic components: an error code prefix ("*** ERRCOD=XX, "), a device/file context section with the associated drive and filename, and a return address display ("REFERENCED AT X'nnnn'") identifying the triggering instruction. The filename is extracted from either the FCB filespec string or from a directory entry via disk read. Fatal errors (bit 7 set) trigger a cold restart via JP M,0000H; recoverable errors exit to DOS READY via JP 4030H.

Compared to TRSDOS 2.3 SYS4, VTOS extends the error code range from 40 to 42 codes, adding "DEVICE IN USE" (27H) and "PROTECTED SYSTEM DEVICE" (28H), and expands the word dictionary from 53 to 55 entries.

A disassembly of SYS4/SYS can be found here.

SYS5/SYS

SYS5 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

SYS6/SYS

SYS6 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

SYS7/SYS

SYS7 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

SYS8/SYS

SYS8 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

SYS9/SYS

SYS9 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

SYS10/SYS

SYS10 overlay. Loaded into the overlay region via RST 28H as needed.

Disassembly coming soon.

BACKUP/CMD

Disk backup utility. Creates a duplicate copy of a VTOS disk.

Disassembly coming soon.

BASIC/CMD

BASIC language interpreter/loader. Provides Disk BASIC functionality under VTOS.

Disassembly coming soon.

BASIC/KSM

Keyboard macro definitions for use within BASIC.

Disassembly coming soon.

BASIC/OVN

BASIC overlay file (OVN). Contains additional BASIC routines loaded as an overlay.

Disassembly coming soon.

BASIC/OVX

BASIC overlay file (OVX). Contains extended BASIC routines loaded as an overlay.

Disassembly coming soon.

CONFIG/SYS

System configuration file. Read by SYS0/SYS during cold boot initialization to configure system parameters.

Disassembly coming soon.

DIR/SYS

Directory display overlay. Handles the DIR command for listing disk contents.

Disassembly coming soon.

FORMAT/CMD

Disk format utility. Initializes blank diskettes for use with VTOS.

Disassembly coming soon.

KSM/DVR

Keyboard macro (Key Stroke Multiplier) device driver. Provides programmable keyboard macro capability.

Disassembly coming soon.

KSR/CMD

Keyboard macro setup/reset utility. Used to configure or clear KSM driver settings.

Disassembly coming soon.

MAKE/JCL

JCL (Job Control Language) batch file. Automates disk creation or system setup tasks.

Disassembly coming soon.

PATCH/CMD

Disk/file patching utility. Allows direct modification of disk sectors or file contents.

Disassembly coming soon.

PR/DVR

Printer device driver. Provides printer output support for VTOS.

Disassembly coming soon.

RS232/DVR

RS-232 serial communications device driver. Provides serial port support.

Disassembly coming soon.

SYSTEM/JCL

System startup JCL batch file. Executed automatically during VTOS boot to perform initialization tasks.

Disassembly coming soon.

VTCOMM/CMD

Virtual Technology communications program. Provides terminal emulation and file transfer capabilities via the RS-232 port.

Disassembly coming soon.

VTOS/KSM

Default keyboard macro definitions for the VTOS operating system environment.

Disassembly coming soon.