TRS-80 DOS - TRSDOS 6.2 and 6.2.1 (Model 4)
Page Index
Background
TRSDOS 6.2 is the third of the four Model 4 operating systems Logical Systems, Inc. (LSI) wrote for Tandy, and the last one Tandy sold under its own TRSDOS name before LSI took the line over as LS-DOS 6.3. It runs the Model 4 in native mode. The boot sector's fifth instruction sends 86H to the Operation Register at port 84H, which takes the ROM out of the memory map, so every address below F400H is RAM: the resident system holds 0000H-1DFFH, the system overlays run in 1E00H-23FFH, libraries, drivers and filters load at 2400H, and programs load at 2600H or 3000H. A program asks the system for a service by putting its number in register A and executing RST 28H rather than by calling a fixed address, and 6.2 answers 99 of those numbers.
TRSDOS 6.2 and 6.2.1 (1984-1985)
Tandy did not give 6.2 away. Where 6.1 had been a free update for 6.0 owners, 6.2 was a catalog item, 26-316 at $39.95, from late 1984, and 80 Micro reported in January 1986 that Tandy's position was that the differences from 6.1 were fundamental enough to make it a new operating system rather than a revision. The 1985 Radio Shack catalog claimed it ran 20 per cent faster than 6.1, gave every library command a HELP screen, and let a programmer define system calls of his own; it came with replacement pages for the Model 4 Technical Reference Manual. The HELP screens are the visible part: HELP/CMD and the 20K text file DOS/HLP are both new at 6.2, and so is SYS13/SYS, which is a zero byte file on every 6.0 and 6.1 diskette. MAILLIST and a HERTZ job control file, which 6.0 and 6.1 carried, are gone.
TRSDOS 6.2.1 followed in the second half of 1985, and the Model 4D shipped with it. Tandy's Model 4 buyer told 80 Micro in October 1985 that it was meant to clear up something like 29 bugs in the original system, and that anything beyond that would have to be called 6.3. It added double-sided formatting. Tandy pushed it hard enough that two of the upgrade documents in the archive carry the word mandatory in their titles, and one owner wrote to 80 Micro in October 1986 to say he had waited four months at his Computer Center for the update diskette.
What 6.2.1 did not fix is the date. Every TRSDOS 6 through 6.2.1 refuses a date after 31 December 1987, which is what made an upgrade unavoidable and what LSI sold against: it began taking orders for LS-DOS 6.3 in November 1986. The later history is on the LS-DOS page, and the whole TRSDOS line from the Model I onward is on the TRSDOS page.
Patch Levels
TRSDOS 6.0 and 6.1 stamp themselves with a release date. TRSDOS 6.2 stamps a patch level instead, in the system name string PAKNAM$ at 0410H, which is read off sector 2 of BOOT/SYS: TRSDOS62Level-AH, TRSDOS62Level-AN, TRSDOS62Level-AR. That change of practice is worth noticing, because it is how a 6.2 diskette can be identified exactly without running it. LSI's own source code of the system names level AD, with a beta level AC commented out above it, so at least five levels of 6.2 existed. The three on this site are AH and AN, both of them 6.02.00, and AR, which is 6.02.01.
Versions
The level is the two letters after Level- in PAKNAM$ at 0410H. The three levels in the archive were compared instruction by instruction for these pages, and the measurements below come from that comparison rather than from the documentation.
| Version | Notes |
|---|---|
| TRSDOS 6.0, 6.1 | April 1983 to 1984, written by LSI for Tandy. See the TRSDOS page. Their BOOT/SYS differs from 6.2.1's in more than 3000 of its 4096 bytes, so 6.2 is not a patch of 6.1 but a rewrite of much of the system. |
| 6.2.0 levels AC, AD | Not in the archive as diskettes. AC is a beta level named in a commented-out line of LSI's source; AD is the level LSI's published source code builds. |
| 6.2.0 level AH | 26-316, late 1984. The earliest 6.2 diskette on the site. |
| 6.2.0 level AN | AH with a byte or two changed in most files, but with a new BASIC/CMD (relocated 4 bytes through 7033 instructions) and a rewritten HELP/CMD, which grows from 3032 to 3064 bytes with only 403 of its 1800 instructions still in place. |
| 6.2.1 level AR | 1985, with the Model 4D. The level these disassembly pages are built from. Of the 33 files AN and AR have in common, 24 are byte for byte identical; the nine that changed are BOOT/SYS, SYS0/SYS, SYS6/SYS, BASIC/CMD, BASIC/OV1, BACKUP/CMD, FORMAT/CMD, FLOPPY/DCT and MEMDISK/DCT, and 99.6 per cent of all instructions are unmoved. Four bytes of the 6845 video controller table change here too, at 02F0H-02F3H: the horizontal sync position, the horizontal sync width, the vertical total and the vertical total adjust go from 86, 8, 24 and 0 to 85, 10, 25 and 4, which is the setting LS-DOS 6.3.1 keeps. |
| LS-DOS 6.3, 6.3.1 | January 1987 onward, sold by LSI and then MISOSYS under their own names. See the LS-DOS page. |
Downloads
Disk images of the TRSDOS 6.2 system diskettes, for real hardware or an emulator.
Manuals
TRSDOS 6.2 was documented by the Model 4 owner's manual, by the Model 4 Technical Reference Manual and its 6.2 update volume, and by a set of upgrade leaflets, one for each step of the release. Each title below is a download link.
Source Code
In 1984 Logical Systems published the complete commented source code of TRSDOS 6.2 as The Source, in three volumes of assembled listings: the system and its overlays in volume 1, the library commands in volume 2, and the utilities, drivers and filters in volume 3. That makes 6.2 the best documented of the Model 4 systems, and it is why the labels on these disassembly pages are LSI's own rather than invented.
The source does not call the system TRSDOS anywhere. Fifty of the 152 assembler files in LSI's own tree name LDOS 6.2 in their first line, among them the low memory, the resident system, the loader, the task processor and the file positioning code; the build file is LDOS60/JCL, the equate file LDOS60/EQU, and the resident system begins by reading that equate file in. TRSDOS 6 is the name Tandy sold LDOS 6 under, which the magazines said at the time and which the LDOS page sets out; the bytes on these pages are the bytes of LDOS 6.2.
One tree built two machines. The same files carry a Model 4 switch and a Model II switch, used nineteen and thirty times, with a second version of each part that differs between them: the low memory, the start-up, the task processor, the clock, the disk driver, the video driver and the printer driver all have a Model II twin sitting beside the Model 4 one. So the Model 4 system Tandy sold as TRSDOS 6.2 and the Model II and 12 system that followed in 1984 were assembled from one set of sources. Three more switches choose between the United States build and an international one, with German, French and 50 Hz variants under it: this diskette is the United States build, which is why the international flag at 0072H is zero and why the position on the sign-on line where the German and French builds put their language letter is a space.
Disassembly
The TRSDOS 6.2 Model 4 disassembly pages take the level AR system diskette apart file by file, 32 files in all: BOOT/SYS, SYS0/SYS to SYS13/SYS, Disk BASIC and its overlay, then the utilities, drivers, filters and drive tables. DIR/SYS, the directory itself, has no page, and neither do the help text DOS/HLP or the Model III ROM image MODELA/III. Every row is written from the bytes of the release file and checked back against them.
Three things the bytes settle that the documentation does not:
- The diskette holds 35 files. The directory cylinder is 20, named by the operand byte of the
CP 14Hthat is the second instruction of the boot sector, and GAT byte CBH reads 62H, which is how a formatter records the version that made the disk. GAT byte CDH is 42H, with bit 3 clear: a 6.2 diskette does not use the directory dating that LS-DOS 6.3 brought in. - TRSDOS 6.2 answers 99 supervisor calls, not the 107 of LS-DOS 6.3.1. The two LS-DOS adds are @HEXD (95) and @VDPRT (107), and @DATE (18) sits at 07A8H here, in the clock module beside @TIME, where LS-DOS moved it into the file and disk block and left 07A8H as data. All fifteen file services, 61 to 75, are at different addresses in the two systems.
- Disk BASIC is one module in 6.2, loading 3000H-82FFH in a single unbroken range with its transfer address at 8048H. The LS-DOS 6.3.1 BASIC/CMD is this same program with the NEWB enhancement package linked after it and nine patch blocks written over it, so 8048H, which in 6.2 is where BASIC starts, is exactly what MISOSYS replaced.
TRSDOS 6.2 Bugs Found in the Disassembly
These are the bugs found while disassembling the files of the TRSDOS 6.2.1 level AR system diskette, 36 so far. Each comes from the bytes themselves, and the address links to the row of the disassembly where it happens; the page of each file explains it in full. So far the list covers 8 of the 32 files that are paged (BOOT/SYS, SYS0/SYS, SYS1/SYS, SYS4/SYS, SYS5/SYS, SYS10/SYS, SYS13/SYS and BASIC/OV1); it grows as each file is disassembled, and it is not the whole of what the release holds. Under each one, How it happens says what a user would do to set it off and what he would see. Where the same instructions stand in LS-DOS 6.3.1, the entry says so, because the bug is then one generation older than the LS-DOS list rather than a separate one. They have not been tried on an emulator.
Bugs Found in the Code
Each of these 27 gives a wrong result in a case that can happen.
| File | Where | Bug |
|---|---|---|
| BOOT/SYS T1 | 076AH | After midnight those bytes keep the values of the day the system was started: anything that reads the day of the week or the day of the year gets the boot day's. How it happens: Nothing a user does shows it directly. A program that reads DATE$+3 or DATE$+4 for the day of the week, rather than working it out from the date, gets the day the machine was booted on for as long as it stays up: leave a machine running across midnight and the day of the week it reports is yesterday's. In the code: The clock task's midnight roll-over steps the day, the month and the year in DATE$ (0033H-0035H) but not DATE$+3 and DATE$+4 (0036H-0037H: the day of the year, the day of the week and the leap year flag), which only the start-up of SYS0/SYS sets. The same instructions stand in LS-DOS 6.3.1H, so this is Part 13's B2 one generation earlier and not a new bug. |
| BOOT/SYS T2 | 076FH | With DATE$ at 00/00/00 the day becomes 01H at the first midnight, the length of the month is read from ZERO$ at 0401H, the day is found past it and the month is stepped to 01H as well, so the system gives itself a date of 01/01/00 and every file closed after that carries it. How it happens: Boot the machine and press ENTER past the date prompt, so that no date is set, then leave it running until after midnight. The date is no longer unset: DATE shows 01/01/00, and every file closed from then on is dated 01/01/00 in the directory rather than left undated. The same sequence on LS-DOS 6.3.1 leaves the date unset, which is what it should do. In the code: The roll-over loads Register L with 34H, the day, points Register Pair DE at 0402H, increments the day, and only then reads the month to index the month length table as 0402H plus the month less one, so nothing tests whether a date has been set before the day is stepped. LS-DOS 6.3.1H loads Register L with 35H, the month, tests it for zero and returns (its 076DH and 076EH), finding the two bytes for the test by indexing the table from 0401H plus the month instead. New in this release and fixed in LS-DOS 6.3.1H; reachable, not latent. |
| BOOT/SYS T3 | 0785H | A system left running from New Year's Eve of a leap year into the new year keeps February's 29 days, so a 29 February that does not exist is accepted and the roll-over carries a day late; one started in a common year and left running into a leap year skips 29 February instead. How it happens: Set the date to the end of December of a leap year and leave the machine running across midnight into the 1st of January. February of the new year keeps the leap year's 29 days, so a 29 February that does not exist is accepted and the roll-over will carry a day late. In the code: The roll-over into a new year increments the year but leaves February's length at 0403H (MAXDAY$+2), which the start-up of SYS0/SYS set for the year the system was started. The same instructions stand in LS-DOS 6.3.1H, so this is Part 13's B3. |
| BOOT/SYS T5 | 0AA2H | CTRL held with the comma, slash, period or semicolon key gives 1BH, 1CH, 1DH or 1EH on the first press, from the four-entry search at SPECL 0AABH, and the plain character on every repeat, so a held CTRL and comma sends one escape and then a stream of commas. With any other key the character is right and only the Carry flag that marks it a control key is clear, which is also why KIBGN's screen print test at 092EH cannot fire a second time on a held CTRL and colon. How it happens: Set a key repeat with SYSTEM (KI) and hold CTRL and the comma key down at DOS Ready or in any program that reads the keyboard. The first press sends 1BH, an escape, and every repeat after it sends a comma; the same holds for CTRL and slash, period or semicolon. On LS-DOS 6.3.1 the key goes on repeating the control code, which is what a held key should do. In the code: On the repeat path, which reaches 0AA2H from 0A1EH, Register E holds keyboard row 7 as 099EH masked it with 78H, and 78H clears bit 2, the CTRL key, so 0AA2H always reads a repeated key as one pressed without CTRL. Nothing between 099EH and 0AA2H writes Register E: 09BFH and 09ECH are on the path where a key has changed, and the release path through 0A88H stores a key of 00H and leaves at 0A9FH. LS-DOS 6.3.1H spends the two bytes this release gives to the `JR Z` at 09AEH on `LD A,(BC)` and `LD E,A` at its 09B1H and 09B2H, reloading the unmasked row 7 into Register E with the Carry flag of 09B0H left standing for the jump below it, and so has the CTRL key here. New in this release and fixed in LS-DOS 6.3.1H; reachable from the keyboard, and question 4 of section 9 as pass 1 left it. |
| SYS0/SYS T7 | 1C8EH | The BREAK handler runs with the all RAM map of bank 0 and LBANK$ at 0 even when the program that was interrupted had another bank switched in, and @VDCTL behaves as though it had been called from a task until the next clock interrupt clears the bit. How it happens: Press BREAK while a program that has switched in bank 1 or bank 2 is running, with the BREAK vector set. The handler runs with bank 0 mapped and LBANK$ at 0, so a program that kept its own data in the other bank cannot find it, and anything the handler does through @VDCTL behaves as though a task had called it until the next clock tick. In the code: EXITBRK goes to the debugger or to the BREAK vector by popping the saved Operation Register value and logical bank off the stack without sending either back, and it leaves NFLAG$ bit 6, the in the task processor flag, set. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B5. |
| SYS0/SYS T9 | 1ED4H | After a reset that leaves memory standing, a bit set for the old date stays set for the new one: a leap year flag on a common year, so that a 29 February is accepted, or a day of the year 256 too high. How it happens: Boot with a date in a leap year, then press the reset button rather than turning the machine off, so that memory survives, and give a date in a common year. February still has 29 days, so a 29 February is accepted and the midnight roll-over carries a day late. The same reset with a date late in a long year leaves bit 8 of the day of the year set, so anything that reads the day of the year gets one 256 too high. In the code: SYS0/SYS does not load DATE$+4 (0037H), and the start-up only ever sets its bit 7, the leap year flag (1ED7H), and ORs in its bit 0, bit 8 of the day of the year (1F22H). The day of the week in bits 3-1 is masked out and rewritten at 1F45H, but neither of the other two bits is ever cleared. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B7. |
| SYS0/SYS T10 | 1FDAH | Holding the down arrow at boot, which is bit 4 of row 6, starts the debugger exactly as holding D does; holding the at sign, which is bit 0 of row 0, skips the AUTO command exactly as holding ENTER does. How it happens: Hold the down arrow down while the machine boots: the debugger comes up, exactly as it does for D. Hold the at sign down instead and the AUTO command of the diskette is skipped, exactly as ENTER does it. In the code: GETKB17 reads the keyboard at 0F441H, and 41H has bits 0 and 6 set, so one read returns keyboard rows 0 and 6 ORed together. 1FE1H then tests bit 4 of the result as the D key of row 0 and 1FEDH tests bit 0 as the ENTER key of row 6. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B8. |
| SYS0/SYS T11 | 204CH | Holding the space bar, which is bit 7 of row 6, the 9 key, which is bit 1 of row 5, or the oblique stroke, which is bit 7 of row 5, skips the SYSGEN configuration at boot exactly as holding CLEAR does. How it happens: Hold the space bar down while a SYSGENed diskette boots: the configuration is not loaded, exactly as holding CLEAR does it. The 9 key and the oblique stroke do the same. In the code: GETKB67 reads the keyboard at 0F460H, and 60H has bits 5 and 6 set, so one read returns rows 5 and 6 ORed together; 2028H masks the result with 82H, whose bit 7 is the CLEAR key of row 6. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B9. |
| SYS0/SYS T12 | 20F6H | A time reply of only the hours is completed from the rest of the date reply still in the buffer: after the date 01/23/85, the time 10 and ENTER is taken as 10:23:85. Only the range tests at 1FB2H to 1FBDH catch it, and they catch it only when a leftover field is too large. How it happens: At the Time prompt, answer with the hours alone and press ENTER, having just answered the Date prompt. The time is taken from what is left of the date reply in the buffer: the date 01/23/85 followed by a time of 10 gives 10:23:85, and 85 is above 59 so the prompt comes back. A date whose second and third fields are both below 60 is accepted outright with the wrong minutes and seconds. In the code: The reply parser takes every character below the digit 0 as a separator between fields, and a carriage return is 0DH, so a reply of fewer than three fields does not end the parse: the next field is read from the bytes after the carriage return in the reply buffer at 1E00H, which nothing clears. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B10. |
| SYS4/SYS T13 | 1F61H | The long display of an extended error is the same single line as the short one, Extended error, HL = X'xxxx': the error number and the return address of the program's call never show. Leaving the file and Last SVC lines out is the source's own design. How it happens: Only a program can meet it: call @ERROR with Register C = 3FH (63) and bit 6 clear, or with SFLAG$ bit 6 set. The screen shows the line Extended error, HL = X'xxxx' and nothing else, without the Error code = 63, Returns to X'dddd' line every other error gets. In the code: For error 63 in the long form the header (Error code = 63, Returns to X'dddd' and the two asterisk signs of the next line) is built in SBUFF$ and the extended line copied after it, but @LOGOT is called with Register Pair HL at 20A3H, the line in SYS4 itself, not the copy. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B25. |
| SYS4/SYS T17 | 1FCBH | The long display of error 41 or 42 always reads Unknown FCB/DCB instead of naming the file, which is open and could be named by its drive and DEC. How it happens: Only a program that asks for the long display can meet it: open a file that is already open with the open bit written to the disk (NFLAG$ bit 0), or with the wrong logical record length, and call @ERROR for error 41 or 42 with bit 6 clear. The third line reads Unknown FCB/DCB. The library commands show only the short message, so none of them meets it. In the code: The sentences of error 41 (File already open) and error 42 (Logical record length open fault) have bit 6 of the last byte set, so DSPSPEC reads the FCB as the text of a specification; SYS2 returns both errors with the FCB built and open (FCB+0 80H or A0H), which CHKASC refuses. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B29. |
| SYS4/SYS T18 | 1FDBH | The long display of an error flagged 80H whose FCB is a closed one, or a specification never opened such as an @INIT that failed with error 15, reads Open DCB, Device= and the seventh and eighth characters of the text: PAYROLLS/DAT:1 gives LS and PROGRAM:1 gives M:. How it happens: Only a program that asks for the long display can meet it: create a file with @INIT as PAYROLLS/DAT:1 on a write protected diskette and call @ERROR for error 15 with bit 6 clear. The third line reads Open DCB, Device=*LS. The same happens for an error such as 43 when the program's last file SVC was the @CLOSE of a file with an eight letter name. In the code: On the 80H path DSPSPEC takes every FCB whose FCB+0 bit 7 is clear as a device FCB (10H) without testing for 10H, and shows FCB+6 and FCB+7 as the device name when the first is A to Z and the second 30H to 5AH. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B30. |
| SYS5/SYS T19 | 210EH | Single stepping a JP (IX) with I or C puts the target breakpoint at the address in the program's Index Register IY instead of IX: the program jumps to IX's address and runs on without stopping, and an F7H is left over the byte at IY's address, often a system table such as the flag table @FLAGS points IY at, until the next entry to the debugger, which may never come. How it happens: Only someone single stepping a program meets it: in the debugger, with the pc line on a JP (IX) and Index Registers IX and IY holding different addresses, press I or C. The program does not stop after the jump, and the byte at the address in IY has become F7H. In the code: CMD_CI tells JP (IX) from JP (IY) with BIT 5,C, but Register C holds the instruction's second byte (E9H, bit 5 set) and not the DDH or FDH prefix, so 2112H always takes IYREG. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B31. |
| SYS5/SYS T20 | 1E32H | After G with no breakpoint the next entry takes the modification address, or the address made of the A or H letter and the display mode, as a breakpoint, and an F7H there is replaced by a stale byte. An RST 30H planted by hand with H is removed this way when the program reaches it, and the instruction there becomes whatever NXTBYT held. How it happens: In the debugger type H, an address in the program and a space, then F7 and ENTER to plant an RST 30H by hand, then G and ENTER. When the program reaches it the debugger comes up at that address, but the byte there is neither F7H nor what it was before, and G runs that stale byte as an instruction. In the code: The two breakpoint save areas (00A0H-00A2H and 00A3H-00A5H) are the same bytes as SAVONE, SAVTWO, SAVTWO+1, NXTADR and NXTBYT; G, I and C fill only the areas they use, and every entry puts the saved byte back at the address of each area that is not zero and holds F7H. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B32. |
| SYS5/SYS T21 | 1E2BH | When BREAK stops a program just after an instruction whose last byte is F7H (AND 0F7H, OR 0F7H, LD A,0F7H, SET 6,A), or @RUN starts one whose transfer address follows an F7H byte, the pc line shows one byte less, inside that instruction; G then runs the F7H as RST 30H and the debugger comes back at once, every time, until J moves the Program Counter on. How it happens: Turn DEBUG on and press BREAK while a program runs a loop in which an instruction such as AND 0F7H stands just before the place BREAK stops it. The pc line points into the AND, and every G enters the debugger again at once; J and then G go on. In the code: The entry takes every F7H in the byte before the return address as a breakpoint and moves the Program Counter back by one, whatever the way in. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B33. |
| SYS5/SYS T22 | 22A3H | F first,last,byte fills first to last as the manual says when first is below last, but nothing at all when the two are the same address, and with a last address of FFFFH it never stops: the address wraps to 0000H and the fill runs over the whole of memory, the system and SYS5 with it. How it happens: In the debugger type F7000,7000,FF and ENTER: the byte at 7000H is not changed. Type F8000,FFFF,0 and ENTER: the machine stops responding and must be reset. In the code: FILL clears the Carry flag only before the first SBC HL,BC; every later compare also subtracts the borrow of the one before, so the first compare stops when the address is not below the last and the later ones only when it is above it. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B34. |
| SYS5/SYS T23 | 1ED5H | After a program has sent 15H each tab code of the display shows as one special character instead of 6 or 61 spaces: the rows no longer fill 80 characters and run into each other, so the register display and the memory lines are scrambled until 15H is sent again. How it happens: In BASIC type PRINT CHR$(21); and ENTER to turn the special characters on, then, with DEBUG on, press BREAK: the register display is jumbled. PRINT CHR$(21); again after leaving puts the tabs back. In the code: WRREGS lays the display out with the video driver's tab codes (C6H, FDH) and resets 80 characters a line and normal video with 1CH, but not DFLAG$ bit 3 of DODATA$, which 15H toggles to show C0H-FFH as special characters. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B35. |
| SYS5/SYS T24 | 21B8H | When the modification address is the last byte of a memory line, an address ending in FH in the full screen display, its closing bar is missing, and a lone bar shows in front of the first byte of any line that starts at the next address. How it happens: In the debugger type D7000 and ENTER, S and ENTER, then H700F and a space. The byte at 700FH has a bar on its left only, and the line of 7010H starts with a bar. In the code: GRPHIC writes the bar after the framed byte as the separator in front of the next byte, and the separator of a line's first byte at the start of that line. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B36. |
| SYS5/SYS T25 | 2335H | A read, a write or a directory write with the address left out uses that number as its buffer: the sector or cylinder number typed (0,0,0,R, reads into 0000H, over the restart vectors, the SVC table and DBGSV$), or 124CH on a drive of 18 sectors a track when neither was typed, where a read fills memory over the resident file routines from 1300H on and a whole cylinder reaches @RDSEC and SYS5 itself, and the system stops. A write copies that memory onto the sectors, the whole directory cylinder when the cylinder and sector are both left out. How it happens: In the debugger type 0,,,R, and ENTER, with a comma after the R and no address. The read runs over the resident system and over SYS5 itself and the machine stops responding. With W in place of R the whole directory cylinder of drive 0 is written over with that memory. In the code: DISKIO reads the buffer address with HEXIN@, which leaves Register Pair HL unchanged when no address is typed; Register Pair HL then holds the last number HEXIN@ read, the sector, else the cylinder, else the sectors of a track times 256 plus 4CH, built at 22F9H from the 1E4CH of the command loop. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B37. |
| SYS5/SYS T26 | 20F6H | While a single stepped instruction runs (a CALL or RST run in full by C, an RST 28H to 38H by I, or any step whose breakpoints are never reached, as with T19), BREAK does not enter the debugger: a routine that loops or never returns can be stopped only by the program itself or by a reset. How it happens: In the debugger, with the pc line on a CALL of a routine that loops for ever, press C. The screen stays as the routine leaves it and BREAK does nothing; only the reset button gets out. In the code: I and C go on through JP 1F9FH, past the XOR A and LD (199FH),A at 1F9BH-1F9CH by which G turns DEBUG on, so @DBGHK keeps the C9H that RST28 stored when it loaded SYS5. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B38. |
| SYS5/SYS T27 | 211AH | G's RET runs the F7H at once, the entry puts the byte back and the Program Counter has not moved: DJNZ $ never counts down and I or C stays on the same instruction for ever; only G with a breakpoint after it gets past. How it happens: Stop a program in the debugger on a DJNZ $ delay loop (the bytes 10H FEH) and press I. The debugger comes back with the pc line on the same DJNZ and Register B unchanged, every time. In the code: For a branch whose target is the instruction itself (DJNZ $, JR $, JR cc,$, JP cc,$) the second breakpoint goes over the instruction's own first byte. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B39. |
| SYS10/SYS T28 | 1E27H, 1E52H, 1E5FH | An error once the first directory write has reached the disk (its verify, the HIT read or write, an FXDE read, the GAT write) leaves the file half removed: its entries spare with one perhaps still in the HIT, an FXDE not yet reached in use with no FPDE, and all its granules allocated in the GAT on the disk, so the file can no longer be opened and its space is lost. A second @REMOVE with the same open FCB finishes the work, but REMOVE and PURGE stop at the first error. How it happens: Only after a disk error: REMOVE a file while a directory or GAT write fails, on a diskette that is going bad. The file is gone from DIR but its space is not given back, and FREE shows less space than before. In the code: @REMOVE writes each directory entry and the HIT as it frees them and the GAT only at the end, and returns at the first disk error. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B208. |
| SYS10/SYS T29 | 1E1BH | Removing through an FCB whose file was already removed through another FCB, or whose diskette was changed, deletes whatever file now holds that DEC and returns no error. How it happens: Only a program meets it: open one file with two FCBs, remove it through the first, create another file, then remove through the second FCB. The new file is deleted. In the code: The drive and DEC are taken from the FCB and that entry is freed with no test of its in use bit, its FXDE bit or its name. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B209. |
| SYS13/SYS T30 | 1E3FH, 1E37H | In a DO job a line starting with an asterisk shows No command <*> present, as SYS13, then Job aborted, and the rest of the job is not run, as for a command that is not found; a program running such a line with @CMNDR gets Register Pair HL = 1E74H with Register A = 00H and Z; typed at TRSDOS Ready nothing follows from it, because CLEANUP ignores Register Pair HL. How it happens: Make a JCL file with the lines DATE, *X and TIME and DO it. After No command <*> present, as SYS13 the job is aborted and TIME never runs. In the code: SYS13 returns with Register Pair HL = the address of its message (1E74H, 1E40H), which @LOGOT keeps; RST28 returns it to @EXIT or to the @CMNDR caller as the return code. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B239. |
| SYS1/SYS T32 | 21B3H | A command name that begins with a library command and fills the field runs that command: APPENDIX runs APPEND, SETCOMM runs SETCOM, and the extra letters are ignored rather than giving a File not found for a program of that name. How it happens: Type APPENDIX and ENTER at TRSDOS Ready with no program of that name on the diskette: the APPEND command runs and asks for its parameters, instead of Program not found. SETCOMM does the same for SETCOM. In the code: @FNDPRM compares only as many characters of the word as the name in the table holds and never tests that the word ends where the name does; a name that fills its field to six characters has nothing after it to compare. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B11. |
| SYS1/SYS T33 | 208CH | A specification that ends with an exclamation mark at the end of the command line leaves Register Pair HL one byte past the 0DH, so the caller reads the line past its end; one followed by an opening parenthesis loses the parenthesis, so a parameter list after such a specification is not seen. How it happens: Only a program is likely to meet it. Give @FSPEC a line ending FILE/DAT:0! with the exclamation mark as the last character before ENTER, then read on from Register Pair HL: it is past the 0DH. Type a command with such a specification followed by a parameter list in parentheses and the list is not seen. In the code: After the exclamation mark that asks for the end of file to be written on every write, the INC HL steps over whatever character follows it without testing what it is. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B12. |
| SYS1/SYS T36 | 22D1H | In an X'nnnn' value the signs colon, semicolon, <, =, >, question mark, at sign and opening square bracket, and the letters W, X, Y and Z, are all taken as hexadecimal digits and give a value rather than a Parameter error. How it happens: Type any command that takes a hexadecimal parameter and give it a value with one of those characters, such as a SET or a PATCH with X'W0' in it: the value is accepted instead of Parameter error. In the code: HEXVAL subtracts 30H from the character and jumps on Carry; the test that follows accepts every value from 0AH to 16H as a letter A to F without an upper limit on the letters, so bytes from 3AH to 46H all pass. The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B15. |
Latent Bugs, Limits and Code With No Effect
These nine do no harm in the files as shipped (latent), or are limits built into the code.
| File | Where | Bug |
|---|---|---|
| BOOT/SYS T4 | 0805H | With four or more switch-in levels open when the clock interrupt comes (differences 4 to 7 have bit 2 set), KCK@ reports a BREAK that nobody pressed: KFLAG$ bit 0 is set and the task processor treats it as BREAK. How it happens: Hard to meet on purpose. It wants four or more routines to have the keyboard and video memory switched in at once, nested, and a program then calling KCK@; the program is told BREAK is down when it is not. No DOS command nests that deep, which is why it is recorded as latent. In the code: KCK@ reaches 0805H from 07FAH when another routine already has the keyboard and video memory switched in, and on that path Register A holds the low byte of OPREG_SV_PTR less 6FH, which counts the open ENADIS_DO_RAM levels, not a keyboard row, where 0805H tests bit 2 of it as the BREAK key. (Latent, needing four nested levels.) The same instructions stand in LS-DOS 6.3.1H, so this is Part 13's B1. |
| SYS0/SYS T6 | 1756H | On a drive of more than 203 cylinders the GAT bytes from CBH up, which are the version, the cylinder count, the format byte, the password hash, the disk name and the date, would be read as cylinder maps and their zero bits allocated as free granules. How it happens: Not reachable on any drive the system supports through its own FORMAT, which goes to 96 cylinders. It wants a hard drive or an added floppy table of more than 203 cylinders, and then a file that grows while the drive is nearly full. In the code: CG14 to CG16 look for a cylinder with a free granule from AFLAG$ up to the number of cylinders the drive has (DCT+6 plus one) with no limit at CBH, where the GAT's cylinder map ends; the extension test at 1734H does have that limit. (Latent, needing a drive of more than 203 cylinders.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B4. |
| SYS0/SYS T8 | 1ECAH | No TRSDOS 6 machine will take a date after 31 December 1987. From 1 January 1988 the Date prompt refuses every year a user can type and comes back, and the only way past it is SYSTEM (DATE=OFF), which leaves the date unset and so walks into T2. Every file closed on such a machine is dated by whatever the unset date rolls over to. How it happens: Set the machine's clock, or simply use it, in any year from 1988 on. Type the date at the boot prompt and it is refused, whatever is typed, and the prompt comes back: 1988 is the first year the test will not take. There is no patch in the release for it, and it is the reason Logical Systems was able to sell LS-DOS 6.3 as an upgrade to half a million machines. In the code: The start-up subtracts 50H (80) from the year the reply gave and compares it with 08H, so a year is accepted only when it is 1980 to 1987; the date that survived a reset is put through the same test at the same place. (Limit, and the most consequential one in the system.) LS-DOS 6.3.1H has CP 20H here, which takes the range to 2011; Part 13 numbers its narrower version B6. |
| SYS4/SYS T14 | 1F31H | The two asterisk signs are always written. Nothing visible changes, because for error 63, the only case the comment can mean, the header is never shown at all (T13). How it happens: Nothing anyone can see. In the code: The long header tests bit 6 of Register C, which the source comments as Extended error?, before writing the two asterisk signs of the message line; Register C was masked to bits 5-0 at 1EDBH, so the bit is always 0, and what the test was meant to catch cannot be told from the code. (No effect.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B26. |
| SYS4/SYS T15 | 200BH | After a long display of an error of a specification never opened, a later long display of an open device FCB in the same load of SYS4 puts the device's name into the line Device = and shows Open DCB, Device= with the name of an earlier call, or xx the first time. How it happens: Only a program can meet it: with SYS4 still in the overlay area, call @ERROR in the long form for an error such as 24 on an unopened file, then for an error such as 15 with JDCB$ at an FCB opened to a device such as *PR. The line reads Open DCB, Device= with xx, or an earlier name, instead of PR. In the code: DSPC2 stores 20EBH (DEV$NAM) into the operand of the device name store at 1FF0H, which is 213AH in the file, and nothing sets it back while SYS4 stays in the overlay area. (Latent.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B27. |
| SYS4/SYS T16 | 2031H | A long display of a file whose FCB text runs 24 characters with no 03H, 0DH or 00H shows them, and every later Open FCB line in the same load of SYS4 is an empty line. No text @FSPEC builds is longer than 23 characters, so only a program that fills an FCB itself reaches it. How it happens: Only a program that builds its own FCB text of 24 characters with no end byte and then calls @ERROR in the long form for an error of the file name kind can meet it. In the code: DSPC3 copies up to 24 characters of the FCB's text to 20F5H and RSPC5 puts 0DH after them; the line FILE$EQ has 23 places before its 0DH at 210CH, so 24 characters end with the 0DH at 210DH, the first byte of OPN$FCB. (Latent.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B28. |
| SYS13/SYS T31 | 1E24H, 1E3FH | The message No command <*> present, as SYS13 repeats without end, SYS1 and SYS13 are read from drive 0 on every pass, no TRSDOS Ready comes, and only a reset ends it. How it happens: Only a program or a patch meets it: set EFLAG$ (006EH) to 70H. At the next TRSDOS Ready the No command message scrolls for ever and only a reset stops it. In the code: CMDCONT (SYS1 1E8EH) sends EFLAG$ OR 8FH, and with bits 6-4 of EFLAG$ 111 that is FFH, the asterisk function 7, whose NOCMD shows its message and returns without clearing EFLAG$: only 1E2CH clears it. (Latent.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B240. |
| SYS1/SYS T34 | 21DBH | A program that calls @PARAM with no parameter list on the line gets its response bytes back exactly as they were, so a byte left set by an earlier call is read as a parameter that was given this time. How it happens: Only a program meets it, and only one that calls @PARAM twice with the same table: give a parameter on the first call and none on the second, and the second call reports the first call's parameter as given again. In the code: @PARAM returns at once when the line has no opening parenthesis, before the loop at 21EBH that clears the response byte of every entry of the table. (Latent.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B13. |
| SYS1/SYS T35 | 209DH | A file whose name is TO, ON, OVER or USING cannot be given to @FSPEC at all: the name is thrown away and the word after it is taken as the specification. COPY TO:0 TO:1 and the like cannot be typed. How it happens: Try to copy a file called TO: type COPY TO:0 TO:1 and ENTER. The name is passed over as a preposition and the command works on the wrong specification. In the code: After a specification is parsed, @FSPEC looks the text up in PREPTBL at 20B0H, the table of the prepositions TO, ON, OVER and USING, and parses the next word into the same FCB when it matches. (Limit.) The same instructions stand in LS-DOS 6.3.1H, where Part 13 numbers it B14. |