Percom DoubleDOS 4.24 for the Model I - SYS7/SYS Disassembled
Page Customization
Page Index
SYS7/SYS
Other Navigation
Introduction/Summary
Percom DoubleDOS 4.24 SYS7/SYS Disassembly (Model I)
SYS7/SYS is the overlay of DoubleDOS (DBLDOS in Percom's manual) that gives Disk BASIC its error messages in words. Where Level II BASIC shows ?SN ERROR, DoubleDOS's BASIC shows Syntax error. It is overlay 9 (directory record 21H), the only overlay that runs at 4D00H; the others run at 4E00H (SYS1/SYS to SYS5/SYS) or 5200H (SYS6/SYS).
The file is 777 bytes: six load blocks of 128 bytes and one of 109 bytes, 4D00H-4FECH (749 bytes), then the transfer address 4D00H. Unlike every other SYS file of DoubleDOS it has no name record and no copyright record. Every loaded byte is on exactly one row below: 33 bytes of code and 716 bytes of messages. SYS7/SYS is the same in DoubleDOS 4.20, 4.23 (all three sets) and 4.24.
Load Map
| Addresses | Contents |
|---|---|
| 4D00H-4D20H | Turn the error code into a message number, find the message, hand it to the ROM (4D00H) |
| 4D21H-4FECH | A 00H, then the 44 messages, each ended by 00H, and a last 00H (4D21H) |
How SYS7/SYS Is Reached
| Step | What happens |
|---|---|
| 1 | When BASIC/CMD starts, it copies its table of vectors at 4D00H-4D92H to the Disk BASIC vectors at 4152H-41E4H (BASIC/CMD 5C44H). The bytes at 4D54H, LD A,89H and RST 28H, land at 41A6H, the vector the ROM calls when it reports an error; JP 5679H after them lands at 41A9H. That table was loaded at 4D00H with BASIC/CMD, and the place is free once it has been copied. |
| 2 | The ROM's error routine (19A2H) resets the stack, starts a new line and calls 41A6H at 19ECH with Register E the error code and Register Pair HL 18C9H, the table of two letter codes. |
| 3 | RST 28H takes request code 89H to the overlay dispatcher of SYS0/SYS (4BA2H). When the code last used is not 89H, it reads directory record 21H and loads SYS7/SYS; Register Pair DE is saved around the load (4BB6H, 4BECH). Then it calls 4D00H. |
| 4 | SYS7/SYS counts the 00H bytes of its table to the message and jumps to 1A01H in the ROM, which shows the message and the line number. The question mark, the two letter code and the word ERROR (19F0H-19FEH, after the call at 19ECH) are passed over. The program ends at BASIC's READY as with any error. |
SYS7/SYS never returns. The dispatcher's return address 4BFEH and the ROM's 19EFH are left on the stack until the next error, RUN or CLEAR resets the Stack Pointer (1B9AH). The dispatcher's restore of the BREAK flag 4315H after the overlay (4BFEH-4C01H) is passed over too, but nothing is lost: the dispatcher had set it to 00H, and BASIC/CMD keeps it at 00H while it runs (5C32H). It sets 4315H to C3H only when it returns to DOS (5B59H).
Error Numbers and Messages
| Error number Register E | Message |
|---|---|
| 1-23 00H-2CH | Messages 1-23, those of the ROM's two letter codes NF, SN, RG, OD, FC, OV, OM, UL, BS, DD, /0, ID, TM, OS, LS, ST, CN, NR, RW, UE, MO, FD, L3 (4D22H to 4E95H) |
| 24 2EH | Message 24, Undefined USER function (4EA8H) |
| 25-50 30H-62H | Message 20, Unprintable error (4D0DH) |
| 51-70 64H-8AH | Messages 25-44: FIELD overflow, Internal error, Bad file #, File not found, Bad file mode, File already open, ? (57), Disk I/O error. Use E-CMD for specific, File already exists, ? (60), ? (61), Disk full, Input past end, Bad record #, Bad file name, Mode mismatch, Direct statement in file, Too many files, Disk write protected, File access denied (4EC0H to 4FD9H) |
| 71-128 8CH-FEH | Message 20, Unprintable error (4D0DH) |
The messages are in capitals and small letters, as Level II BASIC's are not. Two begin with a small letter: string Formula too complex and can't continue. The message of error 58 tells the user to type CMD"E", which shows the DOS's own message for the last disk error. Error numbers 57, 60 and 61 have only a question mark, and the last 00H at 4FECH, an empty 45th message, is never reached.
SYS0/SYS's Test for an Overlay at 4D00H
SYS7/SYS runs at 4D00H, where SYS0/SYS also reads the GAT of a drive (4AF0H). One case matters: SYS0/SYS reads the GAT there by itself, with no overlay loaded, when it gives a file more granules as it grows (4A07H). The GAT then covers 4D00H-4DFFH, the code and the first messages of SYS7/SYS, while the request code 89H stays at 430EH. A second BASIC error then finds code 89H there, takes SYS7/SYS as still in memory, and calls 4D00H, which now holds the GAT. This can happen when a file opened for output is written further after an error in the immediate mode, with no OPEN or CLOSE in between (those load SYS2/SYS or SYS3/SYS and change 430EH).
SYS0/SYS has code for this case in the path of every sector transfer, at 45E3H-45EDH. When the overlay last called runs at 4Dxx (the high byte of its transfer address at 4BFDH is 4DH), it would store 00H at 430EH, so that the next RST 28H reads the overlay again. But the store is made only when 4DH minus Register B is 00H. Register B holds the tries left there (0AH or 05H at the most), while Register H holds the page of the buffer (pushed at 468EH), which is 4DH for the GAT. So the store never runs, and the case is not caught. This is bug B2 of SYS0/SYS; its effect is the one described above.
Bugs
No bug was found in SYS7/SYS itself. The bug that concerns it is B2 of SYS0/SYS (45E3H), described above.
Every bug found in DoubleDOS is listed, with what a user would do to set it off, on the DoubleDOS reference page.
Differences From the Manual
Percom's manual says nothing of SYS7/SYS or of the error messages of BASIC; for BASIC it refers to the Radio Shack TRSDOS and Disk BASIC Reference Manual. The DOS's directory gives SYS7/SYS the place of overlay 9, which only BASIC/CMD calls (request code 89H, from its vector table at 4D54H).
Variables
Places in SYS7/SYS
SYS7/SYS has no variables of its own: no byte of it is written while it runs.
Places Outside SYS7/SYS
| Address Size | Contents |
|---|---|
| 41A6H-41A8H 3 bytes | The Error Vector of Disk BASIC LD A,89H and RST 28H, copied from BASIC/CMD's 4D54H when BASIC starts; the ROM calls it at 19ECH. |
| 430EH 1 byte | The Request Code of the Overlay in Memory 89H while SYS7/SYS is the overlay last loaded; SYS0/SYS's dispatcher compares the low four bits. |
| 4BFCH-4BFDH 2 bytes | The Transfer Address of the Last Overlay 4D00H after SYS7/SYS; 45E3H tests its high byte, 4DH. |
Outside Routines
| Address | Use |
|---|---|
| 1A01H | ROM: The End of the Error Routine Shows the text at Register Pair HL through 28A7H and then the line number, and goes on to READY. |
Disassembly
4D00H - Choose the Long Error Message
The transfer address of SYS7/SYS, overlay 9 (directory record 21H), loaded at 4D00H by the overlay dispatcher of SYS0/SYS for request code 89H. BASIC/CMD copies LD A,89H and RST 28H into the Disk BASIC vector at 41A6H (from its table at 4D54H), and the ROM's error routine calls 41A6H at 19ECH with Register E the error code (two times the error number less one) and Register Pair HL 18C9H, its table of two letter codes. The dispatcher keeps Register Pair DE while it loads the overlay, so Register E comes here as the ROM left it. Error numbers 1-24 pick messages 1-24, 51-70 pick messages 25-44, and every other number picks message 20, Unprintable error.
4D21H - The Long Error Messages
Forty-four messages, each ended by a 00H byte, after a 00H at 4D21H that the search counts first. Messages 1-24 belong to the error numbers 1-24 (the ROM's two letter codes NF to L3, and error number 24, Undefined USER function, of Disk BASIC); messages 25-44 belong to the Disk BASIC error numbers 51-70. The texts are in capitals and small letters. Messages 31, 34 and 35 are a question mark: error numbers 57, 60 and 61 have no message. A last 00H at 4FECH is never reached.