LDOS 5.3.1 for the Model III - BASIC/OV3 Disassembled
Page Customization
Page Index
BASIC/OV3
Other Navigation
Introduction/Summary
LDOS 5.3.1 BASIC/OV3 Disassembly - the Error Messages, CMD"O", RUN With V and the M and C Commands (Model III)
BASIC/OV3 is the overlay BASIC/CMD calls back into while BASIC runs: it holds the texts of the BASIC errors, turns LDOS errors into BASIC errors, sorts a string array for CMD"O", parks the variables for a RUN with V, and moves or copies a program line for the M and C commands at READY. BASIC/CMD's 54DEH loads it at 4E00H, the overlay area of LDOS, and calls it with the number of a function in Register A'; once loaded it stays until a system file is loaded there, and 4414H (OVRLY$) holds 01H while it is there (4E00H).
The file is a load module of 1229 bytes: a copyright record, the code and data 4E00H-5281H in five load blocks, and the transfer address 4E00H. The last 130 bytes, 5200H-5281H, load over the start of BASIC/CMD's image, its banner and the messages of its start, which BASIC/CMD uses only when it starts.
The Functions
| A' | Called from | What it does |
|---|---|---|
| 01H | 5A76H | Register L = the E value of a BASIC error: the text of its message is built at 543CH and Register Pair HL points to it (4E1BH). |
| 02H | 6467H | Register L = an LDOS error code: it is kept at 660BH for CMD"E" and the ROM's error handler is entered with the E value of the BASIC error it stands for (4E6BH). |
| 03H | 585BH | CMD"O",count,array$(first): a Shell sort of count elements from the one named, in ascending order (4E80H). |
| 04H | 5EC4H | RUN"file",V: the strings of the program are copied into string space, DEF FN functions are undefined, and the variables and arrays are moved up below the stack, for BASIC/CMD's 5F70H to bring back after the load (4F19H). |
| 05H | 6578H | M old,new at READY: the old line is copied to the new number, then deleted (4FD6H, 501AH). |
| 06H | 6578H | C old,new at READY: the old line is copied to the new number (4FD6H). Any number other than 01H-05H does the same. |
The Messages
The texts are kept as words: a dictionary of 78 words (50D6H), each ended by bit 7 on its last character, and 49 messages (5057H), each a list of word numbers ended by bit 7. The E values of the ROM's errors, 00H-2EH, give messages 2-25; the E values of the disk errors, 64H-90H, give messages 26-48; every other even E value gives message 21, Unprintable error. The words are copied with a space after each, 00H after the last space, and the first letter made upper case. The LDOS error codes 01H-29H have a table of their own (502EH): most of them give Disk I/O error, and every code from 29H up gives Internal error.
About This Page
The Model III file is the Model I file of the same release with the same code at the same addresses; its 13 different bytes are operands: OVRLY$ 4414H (4E02H; Model I 430EH) and the cells of BASIC/CMD it changes, which are at other addresses in the Model III BASIC/CMD: 543CH (4E3EH; Model I 5414H), 660BH (4E6CH; 65F7H), the operands 5F72H, 5F85H, 5F79H, 5F92H, 5F98H (4F9CH-4FC9H; Model I 5F5EH, 5F71H, 5F65H, 5F7EH, 5F84H), the run state 6608H (4FD2H; 65F4H) and the line input 5BDFH (501AH; 5BD1H).
\n\t\t\t\t\t\t\t\tEvery byte of the file is shown at its address. The ROM routines named are those of the Model III ROM, version 3.1, at the same addresses as in the Level II ROM of the Model I, version 1.3; jumps into the ROM link to its page, except the jump into DELETE at 2BCAH, which has no id there. Found in the code: after M, the line input vector 41AFH points at 501AH until the ROM next asks for a line, so when the new line cannot be stored (Out of memory, say) the next line input still deletes the old line (4FD6H); the sort tests neither that the variable is a string array nor that the elements stay inside it, and it exchanges two elements that are the same (4E80H); messages 0 and 1 and word 0 are never used, and the first LD HL,5057H at 4E1CH is loaded again before it is read; the entry for LDOS code 00H is the last byte of the JP at 502BH.
Memory Map
Load Blocks
The file starts with a copyright record (type 1FH), then 5 load blocks with 1154 bytes, 4E00H-5281H, and the transfer address 4E00H.
| Address | Contents |
|---|---|
| 4E00H-4EFFH | 256 bytes |
| 4F00H-4FFFH | 256 bytes |
| 5000H-50FFH | 256 bytes |
| 5100H-51FFH | 256 bytes |
| 5200H-5281H | 130 bytes |
The Parts of the File
| Address | Contents |
|---|---|
| 4E00H-4E7FH | The entry, the text of a BASIC error (01H) and an LDOS error as a BASIC error (02H). |
| 4E80H-4F18H | CMD"O", the sort (03H). |
| 4F19H-4FD5H | RUN with V: the variables parked (04H). |
| 4FD6H-502DH | M and C, a line moved or copied (05H, 06H). |
| 502EH-5056H | The BASIC errors of the LDOS error codes 01H-29H. |
| 5057H-50D5H | The 49 messages. |
| 50D6H-5281H | The dictionary of 78 words; from 5200H over the start of BASIC/CMD. |
| 543CH-545AH | In BASIC/CMD's image: the text of a message (4E3EH), at most 30 characters and its 00H. |
Sections of the Disassembly
| Address | Contents |
|---|---|
| 4E00H | The Entry: the Function in Register A' |
| 4E1BH | Function 01H: the Text of a BASIC Error |
| 4E6BH | Function 02H: an LDOS Error Becomes a BASIC Error |
| 4E80H | Function 03H: CMD"O", Sort a String Array |
| 4E95H | The Next Round: Halve the Gap |
| 4EADH | The Next Position: Compare Two Elements |
| 4EE9H | Exchange the Two Descriptors |
| 4F04H | In Order: the Next Position |
| 4F19H | Function 04H: Park the Variables for a RUN With V |
| 4F23H | The Simple Variables |
| 4F3FH | The Arrays |
| 4F6AH | Move a String Out of the Program |
| 4F99H | Park the Block |
| 4FD6H | Functions 05H and 06H: M and C, Move or Copy a Line |
| 501AH | M: Delete the Old Line |
| 502EH | The LDOS Errors as BASIC Errors |
| 5057H | The Messages |
| 50D6H | The Dictionary |
Memory BASIC/OV3 Uses
| Address | Contents |
|---|---|
| 1997H, 197AH, 19A2H, 1E4AH, 1ED9H | The ROM: Syntax error, Out of memory, the error handler (Register E = the E value), Illegal function call, Undefined line number. |
| 1B2CH, 1E46H, 1E4FH, 260DH, 28BFH | The ROM: FNDLIN (the line whose number is in Register Pair DE), an integer, a line number, PTRGET (a variable), GETSPA (string space). |
| 2B7EH, 2BCAH, 2FEBH | The ROM: BUFLIN (a line back to text in the input buffer), DELETE after its line numbers, the EDIT exit (the buffer stored as a line). |
| 40A0H-40A1H | The start of string space: set below the parked variables (4FCCH), kept in 5F98H. |
| 40A4H-40A5H | The start of the program text (4F79H). |
| 40A7H-40A8H | The input buffer of the ROM, where BUFLIN puts the old line (5008H). |
| 40D6H-40D7H | The next free byte of string space, kept in 5F92H. |
| 40F9H-40FAH, 40FBH-40FCH, 40FDH-40FEH | The start of the simple variables, of the arrays, and the end of the arrays. |
| 41AFH-41B1H | The line input vector, JP 5BDFH (BASIC/CMD): its operand is 501AH after M until 501AH puts 5BDFH back. |
| 4414H | OVRLY$: 01H while BASIC/OV3 is at 4E00H (4E02H). |
| 5F72H, 5F79H, 5F85H, 5F92H, 5F98H | Operands in BASIC/CMD for 5F70H: the old 40F9H, the old 40FBH, the length of the parked block, the old 40D6H, the old 40A0H (4F99H). |
| 6608H, 660BH | In BASIC/CMD: the run state (D6H for a RUN with V, 4FD2H) and the last LDOS error (4E6CH). |
Variables
The tables of the file, then the operands BASIC/OV3 changes while it runs.
Data in the File
| Address Size | Contents |
|---|---|
| 502EH 1 byte | DEFB 72H 502EH: LDOS error 01H (parity error during header read): the E value 72H, Disk I/O error. |
| 502FH 1 byte | DEFB 72H 502FH: LDOS error 02H (seek error during read): the E value 72H, Disk I/O error. |
| 5030H 1 byte | DEFB 72H 5030H: LDOS error 03H (lost data during read): the E value 72H, Disk I/O error. |
| 5031H 1 byte | DEFB 72H 5031H: LDOS error 04H (parity error during read): the E value 72H, Disk I/O error. |
| 5032H 1 byte | DEFB 72H 5032H: LDOS error 05H (data record not found during read): the E value 72H, Disk I/O error. |
| 5033H 1 byte | DEFB 72H 5033H: LDOS error 06H (attempted to read system data record): the E value 72H, Disk I/O error. |
| 5034H 1 byte | DEFB 72H 5034H: LDOS error 07H (attempted to read locked/deleted data record): the E value 72H, Disk I/O error. |
| 5035H 1 byte | DEFB 80H 5035H: LDOS error 08H (device not available): the E value 80H, Bad file name. |
| 5036H 1 byte | DEFB 72H 5036H: LDOS error 09H (parity error during header write): the E value 72H, Disk I/O error. |
| 5037H 1 byte | DEFB 72H 5037H: LDOS error 0AH (seek error during write): the E value 72H, Disk I/O error. |
| 5038H 1 byte | DEFB 72H 5038H: LDOS error 0BH (lost data during write): the E value 72H, Disk I/O error. |
| 5039H 1 byte | DEFB 72H 5039H: LDOS error 0CH (parity error during write): the E value 72H, Disk I/O error. |
| 503AH 1 byte | DEFB 72H 503AH: LDOS error 0DH (data record not found during write): the E value 72H, Disk I/O error. |
| 503BH 1 byte | DEFB 72H 503BH: LDOS error 0EH (write fault on disk drive): the E value 72H, Disk I/O error. |
| 503CH 1 byte | DEFB 88H 503CH: LDOS error 0FH (write protected disk): the E value 88H, Disk write protection. |
| 503DH 1 byte | DEFB 66H 503DH: LDOS error 10H (illegal logical file number): the E value 66H, Internal error. |
| 503EH 1 byte | DEFB 72H 503EH: LDOS error 11H (directory read error): the E value 72H, Disk I/O error. |
| 503FH 1 byte | DEFB 72H 503FH: LDOS error 12H (directory write error): the E value 72H, Disk I/O error. |
| 5040H 1 byte | DEFB 80H 5040H: LDOS error 13H (illegal file name): the E value 80H, Bad file name. |
| 5041H 1 byte | DEFB 72H 5041H: LDOS error 14H (GAT read error): the E value 72H, Disk I/O error. |
| 5042H 1 byte | DEFB 72H 5042H: LDOS error 15H (GAT write error): the E value 72H, Disk I/O error. |
| 5043H 1 byte | DEFB 72H 5043H: LDOS error 16H (HIT read error): the E value 72H, Disk I/O error. |
| 5044H 1 byte | DEFB 72H 5044H: LDOS error 17H (HIT write error): the E value 72H, Disk I/O error. |
| 5045H 1 byte | DEFB 6AH 5045H: LDOS error 18H (file not in directory): the E value 6AH, File not found. |
| 5046H 1 byte | DEFB 8AH 5046H: LDOS error 19H (file access denied): the E value 8AH, File access denied. |
| 5047H 1 byte | DEFB 88H 5047H: LDOS error 1AH (full or write protected disk): the E value 88H, Disk write protection. |
| 5048H 1 byte | DEFB 7AH 5048H: LDOS error 1BH (disk space full): the E value 7AH, Disk full. |
| 5049H 1 byte | DEFB 66H 5049H: LDOS error 1CH (end of file encountered): the E value 66H, Internal error. |
| 504AH 1 byte | DEFB 66H 504AH: LDOS error 1DH (record number out of range): the E value 66H, Internal error. |
| 504BH 1 byte | DEFB 7AH 504BH: LDOS error 1EH (directory full, can't extend file): the E value 7AH, Disk full. |
| 504CH 1 byte | DEFB 6AH 504CH: LDOS error 1FH (program not found): the E value 6AH, File not found. |
| 504DH 1 byte | DEFB 80H 504DH: LDOS error 20H (illegal drive number): the E value 80H, Bad file name. |
| 504EH 1 byte | DEFB 66H 504EH: LDOS error 21H (no device space available): the E value 66H, Internal error. |
| 504FH 1 byte | DEFB 66H 504FH: LDOS error 22H (load file format error): the E value 66H, Internal error. |
| 5050H 1 byte | DEFB 66H 5050H: LDOS error 23H (memory fault): the E value 66H, Internal error. |
| 5051H 1 byte | DEFB 66H 5051H: LDOS error 24H (attempted to load read only memory): the E value 66H, Internal error. |
| 5052H 1 byte | DEFB 8AH 5052H: LDOS error 25H (illegal access attempted to protected file): the E value 8AH, File access denied. |
| 5053H 1 byte | DEFB 66H 5053H: LDOS error 26H (file not open): the E value 66H, Internal error. |
| 5054H 1 byte | DEFB 8AH 5054H: LDOS error 27H (device in use): the E value 8AH, File access denied. |
| 5055H 1 byte | DEFB 8AH 5055H: LDOS error 28H (protected system device): the E value 8AH, File access denied. |
| 5056H 1 byte | DEFB 66H 5056H: LDOS error 29H (unknown error code and every code above it): the E value 66H, Internal error. |
| 5057H 1 byte | DEFB D2H 5057H: message 0, the byte D2H: bit 7 makes it a message of one word, number 52H, past the dictionary; it marks the start of the table and is never chosen. |
| 5058H-5059H 2 bytes | DEFB 25H,85H 5058H-5059H: message 1, never chosen: words 37 no, 5 error, bit 7 on the last byte: No error. |
| 505AH-505CH 3 bytes | DEFB 01H,02H,83H 505AH-505CH: message 2, for the E value 00H: words 1 next, 2 without, 3 for, bit 7 on the last byte: Next without for. |
| 505DH-505EH 2 bytes | DEFB 04H,85H 505DH-505EH: message 3, for the E value 02H: words 4 syntax, 5 error, bit 7 on the last byte: Syntax error. |
| 505FH-5061H 3 bytes | DEFB 06H,02H,87H 505FH-5061H: message 4, for the E value 04H: words 6 return, 2 without, 7 GOSUB, bit 7 on the last byte: Return without GOSUB. |
| 5062H-5064H 3 bytes | DEFB 08H,09H,8AH 5062H-5064H: message 5, for the E value 06H: words 8 out, 9 of, 10 data, bit 7 on the last byte: Out of data. |
| 5065H-5067H 3 bytes | DEFB 0BH,0CH,8DH 5065H-5067H: message 6, for the E value 08H: words 11 illegal, 12 function, 13 call, bit 7 on the last byte: Illegal function call. |
| 5068H 1 byte | DEFB 8EH 5068H: message 7, for the E value 0AH: word 14 overflow, bit 7 on the last byte: Overflow. |
| 5069H-506BH 3 bytes | DEFB 08H,09H,8FH 5069H-506BH: message 8, for the E value 0CH: words 8 out, 9 of, 15 memory, bit 7 on the last byte: Out of memory. |
| 506CH-506EH 3 bytes | DEFB 10H,11H,92H 506CH-506EH: message 9, for the E value 0EH: words 16 undefined, 17 line, 18 number, bit 7 on the last byte: Undefined line number. |
| 506FH-5072H 4 bytes | DEFB 13H,08H,09H,94H 506FH-5072H: message 10, for the E value 10H: words 19 subscript, 8 out, 9 of, 20 range, bit 7 on the last byte: Subscript out of range. |
| 5073H-5074H 2 bytes | DEFB 15H,96H 5073H-5074H: message 11, for the E value 12H: words 21 redimensioned, 22 array, bit 7 on the last byte: Redimensioned array. |
| 5075H-5077H 3 bytes | DEFB 17H,18H,99H 5075H-5077H: message 12, for the E value 14H: words 23 division, 24 by, 25 zero, bit 7 on the last byte: Division by zero. |
| 5078H-5079H 2 bytes | DEFB 0BH,9AH 5078H-5079H: message 13, for the E value 16H: words 11 illegal, 26 direct, bit 7 on the last byte: Illegal direct. |
| 507AH-507BH 2 bytes | DEFB 1BH,9CH 507AH-507BH: message 14, for the E value 18H: words 27 type, 28 mismatch, bit 7 on the last byte: Type mismatch. |
| 507CH-507FH 4 bytes | DEFB 08H,09H,1DH,9EH 507CH-507FH: message 15, for the E value 1AH: words 8 out, 9 of, 29 string, 30 space, bit 7 on the last byte: Out of string space. |
| 5080H-5082H 3 bytes | DEFB 1DH,1FH,A0H 5080H-5082H: message 16, for the E value 1CH: words 29 string, 31 too, 32 long, bit 7 on the last byte: String too long. |
| 5083H-5086H 4 bytes | DEFB 1DH,21H,1FH,A2H 5083H-5086H: message 17, for the E value 1EH: words 29 string, 33 formula, 31 too, 34 complex, bit 7 on the last byte: String formula too complex. |
| 5087H-5088H 2 bytes | DEFB 23H,A4H 5087H-5088H: message 18, for the E value 20H: words 35 can't, 36 continue, bit 7 on the last byte: Can't continue. |
| 5089H-508AH 2 bytes | DEFB 25H,A6H 5089H-508AH: message 19, for the E value 22H: words 37 no, 38 RESUME, bit 7 on the last byte: No RESUME. |
| 508BH-508DH 3 bytes | DEFB 26H,02H,85H 508BH-508DH: message 20, for the E value 24H: words 38 RESUME, 2 without, 5 error, bit 7 on the last byte: RESUME without error. |
| 508EH-508FH 2 bytes | DEFB 27H,85H 508EH-508FH: message 21, for the E value 26H and every E value from 2FH to 62H and from 91H up (4E2BH): words 39 unprintable, 5 error, bit 7 on the last byte: Unprintable error. |
| 5090H-5091H 2 bytes | DEFB 28H,A9H 5090H-5091H: message 22, for the E value 28H: words 40 missing, 41 operand, bit 7 on the last byte: Missing operand. |
| 5092H-5094H 3 bytes | DEFB 2AH,2BH,8AH 5092H-5094H: message 23, for the E value 2AH: words 42 bad, 43 cassette, 10 data, bit 7 on the last byte: Bad cassette data. |
| 5095H 1 byte | DEFB ACH 5095H: message 24, for the E value 2CH: word 44 ?, bit 7 on the last byte: ?. |
| 5096H-5098H 3 bytes | DEFB 2DH,2EH,8CH 5096H-5098H: message 25, for the E value 2EH: words 45 undefined, 46 user, 12 function, bit 7 on the last byte: Undefined user function. |
| 5099H-509AH 2 bytes | DEFB 2FH,8EH 5099H-509AH: message 26, for the E value 64H: words 47 FIELD, 14 overflow, bit 7 on the last byte: FIELD overflow. |
| 509BH-509CH 2 bytes | DEFB 30H,85H 509BH-509CH: message 27, for the E value 66H: words 48 internal, 5 error, bit 7 on the last byte: Internal error. |
| 509DH-509FH 3 bytes | DEFB 2AH,31H,92H 509DH-509FH: message 28, for the E value 68H: words 42 bad, 49 file, 18 number, bit 7 on the last byte: Bad file number. |
| 50A0H-50A2H 3 bytes | DEFB 31H,32H,B3H 50A0H-50A2H: message 29, for the E value 6AH: words 49 file, 50 not, 51 found, bit 7 on the last byte: File not found. |
| 50A3H-50A5H 3 bytes | DEFB 2AH,31H,B4H 50A3H-50A5H: message 30, for the E value 6CH: words 42 bad, 49 file, 52 mode, bit 7 on the last byte: Bad file mode. |
| 50A6H-50A8H 3 bytes | DEFB 31H,35H,B6H 50A6H-50A8H: message 31, for the E value 6EH: words 49 file, 53 already, 54 open, bit 7 on the last byte: File already open. |
| 50A9H 1 byte | DEFB ACH 50A9H: message 32, for the E value 70H: word 44 ?, bit 7 on the last byte: ?. |
| 50AAH-50ACH 3 bytes | DEFB 37H,38H,85H 50AAH-50ACH: message 33, for the E value 72H: words 55 disk, 56 I/O, 5 error, bit 7 on the last byte: Disk I/O error. |
| 50ADH-50AFH 3 bytes | DEFB 31H,35H,B9H 50ADH-50AFH: message 34, for the E value 74H: words 49 file, 53 already, 57 exists, bit 7 on the last byte: File already exists. |
| 50B0H 1 byte | DEFB ACH 50B0H: message 35, for the E value 76H: word 44 ?, bit 7 on the last byte: ?. |
| 50B1H 1 byte | DEFB ACH 50B1H: message 36, for the E value 78H: word 44 ?, bit 7 on the last byte: ?. |
| 50B2H-50B3H 2 bytes | DEFB 37H,BAH 50B2H-50B3H: message 37, for the E value 7AH: words 55 disk, 58 full, bit 7 on the last byte: Disk full. |
| 50B4H-50B6H 3 bytes | DEFB 3BH,3CH,BDH 50B4H-50B6H: message 38, for the E value 7CH: words 59 input, 60 past, 61 end, bit 7 on the last byte: Input past end. |
| 50B7H-50B9H 3 bytes | DEFB 2AH,3EH,92H 50B7H-50B9H: message 39, for the E value 7EH: words 42 bad, 62 record, 18 number, bit 7 on the last byte: Bad record number. |
| 50BAH-50BCH 3 bytes | DEFB 2AH,31H,BFH 50BAH-50BCH: message 40, for the E value 80H: words 42 bad, 49 file, 63 name, bit 7 on the last byte: Bad file name. |
| 50BDH-50BEH 2 bytes | DEFB 34H,9CH 50BDH-50BEH: message 41, for the E value 82H: words 52 mode, 28 mismatch, bit 7 on the last byte: Mode mismatch. |
| 50BFH-50C2H 4 bytes | DEFB 1AH,40H,41H,B1H 50BFH-50C2H: message 42, for the E value 84H: words 26 direct, 64 statement, 65 in, 49 file, bit 7 on the last byte: Direct statement in file. |
| 50C3H-50C5H 3 bytes | DEFB 1FH,42H,C3H 50C3H-50C5H: message 43, for the E value 86H: words 31 too, 66 many, 67 files, bit 7 on the last byte: Too many files. |
| 50C6H-50C8H 3 bytes | DEFB 37H,44H,C5H 50C6H-50C8H: message 44, for the E value 88H: words 55 disk, 68 write, 69 protection, bit 7 on the last byte: Disk write protection. |
| 50C9H-50CBH 3 bytes | DEFB 31H,46H,C7H 50C9H-50CBH: message 45, for the E value 8AH: words 49 file, 70 access, 71 denied, bit 7 on the last byte: File access denied. |
| 50CCH-50CEH 3 bytes | DEFB 48H,31H,85H 50CCH-50CEH: message 46, for the E value 8CH: words 72 blocked, 49 file, 5 error, bit 7 on the last byte: Blocked file error. |
| 50CFH-50D1H 3 bytes | DEFB 49H,4AH,CBH 50CFH-50D1H: message 47, for the E value 8EH: words 73 system, 74 command, 75 aborted, bit 7 on the last byte: System command aborted. |
| 50D2H-50D5H 4 bytes | DEFB 45H,4CH,4DH,8FH 50D2H-50D5H: message 48, for the E value 90H: words 69 protection, 76 has, 77 cleared, 15 memory, bit 7 on the last byte: Protection has cleared memory. |
| 50D6H 1 byte | DEFB D2H 50D6H: word 0, D2H (R with bit 7 set): the start mark of the dictionary, used by no message. |
| 50D7H-50DAH 4 bytes | DEFM "nex" / DEFB F4H 50D7H-50DAH: word 1, next (the last character t with bit 7 set, F4H): used by message 2. |
| 50DBH-50E1H 7 bytes | DEFM "withou" / DEFB F4H 50DBH-50E1H: word 2, without (the last character t with bit 7 set, F4H): used by messages 2, 4, 20. |
| 50E2H-50E4H 3 bytes | DEFM "fo" / DEFB F2H 50E2H-50E4H: word 3, for (the last character r with bit 7 set, F2H): used by message 2. |
| 50E5H-50EAH 6 bytes | DEFM "synta" / DEFB F8H 50E5H-50EAH: word 4, syntax (the last character x with bit 7 set, F8H): used by message 3. |
| 50EBH-50EFH 5 bytes | DEFM "erro" / DEFB F2H 50EBH-50EFH: word 5, error (the last character r with bit 7 set, F2H): used by messages 1, 3, 20, 21, 27, 33, 46. |
| 50F0H-50F5H 6 bytes | DEFM "retur" / DEFB EEH 50F0H-50F5H: word 6, return (the last character n with bit 7 set, EEH): used by message 4. |
| 50F6H-50FAH 5 bytes | DEFM "GOSU" / DEFB C2H 50F6H-50FAH: word 7, GOSUB (the last character B with bit 7 set, C2H): used by message 4. |
| 50FBH-50FDH 3 bytes | DEFM "ou" / DEFB F4H 50FBH-50FDH: word 8, out (the last character t with bit 7 set, F4H): used by messages 5, 8, 10, 15. |
| 50FEH-50FFH 2 bytes | DEFM "o" / DEFB E6H 50FEH-50FFH: word 9, of (the last character f with bit 7 set, E6H): used by messages 5, 8, 10, 15. |
| 5100H-5103H 4 bytes | DEFM "dat" / DEFB E1H 5100H-5103H: word 10, data (the last character a with bit 7 set, E1H): used by messages 5, 23. |
| 5104H-510AH 7 bytes | DEFM "illega" / DEFB ECH 5104H-510AH: word 11, illegal (the last character l with bit 7 set, ECH): used by messages 6, 13. |
| 510BH-5112H 8 bytes | DEFM "functio" / DEFB EEH 510BH-5112H: word 12, function (the last character n with bit 7 set, EEH): used by messages 6, 25. |
| 5113H-5116H 4 bytes | DEFM "cal" / DEFB ECH 5113H-5116H: word 13, call (the last character l with bit 7 set, ECH): used by message 6. |
| 5117H-511EH 8 bytes | DEFM "overflo" / DEFB F7H 5117H-511EH: word 14, overflow (the last character w with bit 7 set, F7H): used by messages 7, 26. |
| 511FH-5124H 6 bytes | DEFM "memor" / DEFB F9H 511FH-5124H: word 15, memory (the last character y with bit 7 set, F9H): used by messages 8, 48. |
| 5125H-512DH 9 bytes | DEFM "undefine" / DEFB E4H 5125H-512DH: word 16, undefined (the last character d with bit 7 set, E4H): used by message 9. |
| 512EH-5131H 4 bytes | DEFM "lin" / DEFB E5H 512EH-5131H: word 17, line (the last character e with bit 7 set, E5H): used by message 9. |
| 5132H-5137H 6 bytes | DEFM "numbe" / DEFB F2H 5132H-5137H: word 18, number (the last character r with bit 7 set, F2H): used by messages 9, 28, 39. |
| 5138H-5140H 9 bytes | DEFM "subscrip" / DEFB F4H 5138H-5140H: word 19, subscript (the last character t with bit 7 set, F4H): used by message 10. |
| 5141H-5145H 5 bytes | DEFM "rang" / DEFB E5H 5141H-5145H: word 20, range (the last character e with bit 7 set, E5H): used by message 10. |
| 5146H-5152H 13 bytes | DEFM "redimensione" / DEFB E4H 5146H-5152H: word 21, redimensioned (the last character d with bit 7 set, E4H): used by message 11. |
| 5153H-5157H 5 bytes | DEFM "arra" / DEFB F9H 5153H-5157H: word 22, array (the last character y with bit 7 set, F9H): used by message 11. |
| 5158H-515FH 8 bytes | DEFM "divisio" / DEFB EEH 5158H-515FH: word 23, division (the last character n with bit 7 set, EEH): used by message 12. |
| 5160H-5161H 2 bytes | DEFM "b" / DEFB F9H 5160H-5161H: word 24, by (the last character y with bit 7 set, F9H): used by message 12. |
| 5162H-5165H 4 bytes | DEFM "zer" / DEFB EFH 5162H-5165H: word 25, zero (the last character o with bit 7 set, EFH): used by message 12. |
| 5166H-516BH 6 bytes | DEFM "direc" / DEFB F4H 5166H-516BH: word 26, direct (the last character t with bit 7 set, F4H): used by messages 13, 42. |
| 516CH-516FH 4 bytes | DEFM "typ" / DEFB E5H 516CH-516FH: word 27, type (the last character e with bit 7 set, E5H): used by message 14. |
| 5170H-5177H 8 bytes | DEFM "mismatc" / DEFB E8H 5170H-5177H: word 28, mismatch (the last character h with bit 7 set, E8H): used by messages 14, 41. |
| 5178H-517DH 6 bytes | DEFM "strin" / DEFB E7H 5178H-517DH: word 29, string (the last character g with bit 7 set, E7H): used by messages 15, 16, 17. |
| 517EH-5182H 5 bytes | DEFM "spac" / DEFB E5H 517EH-5182H: word 30, space (the last character e with bit 7 set, E5H): used by message 15. |
| 5183H-5185H 3 bytes | DEFM "to" / DEFB EFH 5183H-5185H: word 31, too (the last character o with bit 7 set, EFH): used by messages 16, 17, 43. |
| 5186H-5189H 4 bytes | DEFM "lon" / DEFB E7H 5186H-5189H: word 32, long (the last character g with bit 7 set, E7H): used by message 16. |
| 518AH-5190H 7 bytes | DEFM "formul" / DEFB E1H 518AH-5190H: word 33, formula (the last character a with bit 7 set, E1H): used by message 17. |
| 5191H-5197H 7 bytes | DEFM "comple" / DEFB F8H 5191H-5197H: word 34, complex (the last character x with bit 7 set, F8H): used by message 17. |
| 5198H-519CH 5 bytes | DEFM "can'" / DEFB F4H 5198H-519CH: word 35, can't (the last character t with bit 7 set, F4H): used by message 18. |
| 519DH-51A4H 8 bytes | DEFM "continu" / DEFB E5H 519DH-51A4H: word 36, continue (the last character e with bit 7 set, E5H): used by message 18. |
| 51A5H-51A6H 2 bytes | DEFM "n" / DEFB EFH 51A5H-51A6H: word 37, no (the last character o with bit 7 set, EFH): used by messages 1, 19. |
| 51A7H-51ACH 6 bytes | DEFM "RESUM" / DEFB C5H 51A7H-51ACH: word 38, RESUME (the last character E with bit 7 set, C5H): used by messages 19, 20. |
| 51ADH-51B7H 11 bytes | DEFM "unprintabl" / DEFB E5H 51ADH-51B7H: word 39, unprintable (the last character e with bit 7 set, E5H): used by message 21. |
| 51B8H-51BEH 7 bytes | DEFM "missin" / DEFB E7H 51B8H-51BEH: word 40, missing (the last character g with bit 7 set, E7H): used by message 22. |
| 51BFH-51C5H 7 bytes | DEFM "operan" / DEFB E4H 51BFH-51C5H: word 41, operand (the last character d with bit 7 set, E4H): used by message 22. |
| 51C6H-51C8H 3 bytes | DEFM "ba" / DEFB E4H 51C6H-51C8H: word 42, bad (the last character d with bit 7 set, E4H): used by messages 23, 28, 30, 39, 40. |
| 51C9H-51D0H 8 bytes | DEFM "cassett" / DEFB E5H 51C9H-51D0H: word 43, cassette (the last character e with bit 7 set, E5H): used by message 23. |
| 51D1H 1 byte | DEFB BFH 51D1H: word 44, ? (the last character ? with bit 7 set, BFH): used by messages 24, 32, 35, 36. |
| 51D2H-51DAH 9 bytes | DEFM "undefine" / DEFB E4H 51D2H-51DAH: word 45, undefined (the last character d with bit 7 set, E4H): used by message 25. |
| 51DBH-51DEH 4 bytes | DEFM "use" / DEFB F2H 51DBH-51DEH: word 46, user (the last character r with bit 7 set, F2H): used by message 25. |
| 51DFH-51E3H 5 bytes | DEFM "FIEL" / DEFB C4H 51DFH-51E3H: word 47, FIELD (the last character D with bit 7 set, C4H): used by message 26. |
| 51E4H-51EBH 8 bytes | DEFM "interna" / DEFB ECH 51E4H-51EBH: word 48, internal (the last character l with bit 7 set, ECH): used by message 27. |
| 51ECH-51EFH 4 bytes | DEFM "fil" / DEFB E5H 51ECH-51EFH: word 49, file (the last character e with bit 7 set, E5H): used by messages 28, 29, 30, 31, 34, 40, 42, 45, 46. |
| 51F0H-51F2H 3 bytes | DEFM "no" / DEFB F4H 51F0H-51F2H: word 50, not (the last character t with bit 7 set, F4H): used by message 29. |
| 51F3H-51F7H 5 bytes | DEFM "foun" / DEFB E4H 51F3H-51F7H: word 51, found (the last character d with bit 7 set, E4H): used by message 29. |
| 51F8H-51FBH 4 bytes | DEFM "mod" / DEFB E5H 51F8H-51FBH: word 52, mode (the last character e with bit 7 set, E5H): used by messages 30, 41. |
| 51FCH-5202H 7 bytes | DEFM "alread" / DEFB F9H 51FCH-5202H: word 53, already (the last character y with bit 7 set, F9H): used by messages 31, 34. |
| 5203H-5206H 4 bytes | DEFM "ope" / DEFB EEH 5203H-5206H: word 54, open (the last character n with bit 7 set, EEH): used by message 31. |
| 5207H-520AH 4 bytes | DEFM "dis" / DEFB EBH 5207H-520AH: word 55, disk (the last character k with bit 7 set, EBH): used by messages 33, 37, 44. |
| 520BH-520DH 3 bytes | DEFM "I/" / DEFB CFH 520BH-520DH: word 56, I/O (the last character O with bit 7 set, CFH): used by message 33. |
| 520EH-5213H 6 bytes | DEFM "exist" / DEFB F3H 520EH-5213H: word 57, exists (the last character s with bit 7 set, F3H): used by message 34. |
| 5214H-5217H 4 bytes | DEFM "ful" / DEFB ECH 5214H-5217H: word 58, full (the last character l with bit 7 set, ECH): used by message 37. |
| 5218H-521CH 5 bytes | DEFM "inpu" / DEFB F4H 5218H-521CH: word 59, input (the last character t with bit 7 set, F4H): used by message 38. |
| 521DH-5220H 4 bytes | DEFM "pas" / DEFB F4H 521DH-5220H: word 60, past (the last character t with bit 7 set, F4H): used by message 38. |
| 5221H-5223H 3 bytes | DEFM "en" / DEFB E4H 5221H-5223H: word 61, end (the last character d with bit 7 set, E4H): used by message 38. |
| 5224H-5229H 6 bytes | DEFM "recor" / DEFB E4H 5224H-5229H: word 62, record (the last character d with bit 7 set, E4H): used by message 39. |
| 522AH-522DH 4 bytes | DEFM "nam" / DEFB E5H 522AH-522DH: word 63, name (the last character e with bit 7 set, E5H): used by message 40. |
| 522EH-5236H 9 bytes | DEFM "statemen" / DEFB F4H 522EH-5236H: word 64, statement (the last character t with bit 7 set, F4H): used by message 42. |
| 5237H-5238H 2 bytes | DEFM "i" / DEFB EEH 5237H-5238H: word 65, in (the last character n with bit 7 set, EEH): used by message 42. |
| 5239H-523CH 4 bytes | DEFM "man" / DEFB F9H 5239H-523CH: word 66, many (the last character y with bit 7 set, F9H): used by message 43. |
| 523DH-5241H 5 bytes | DEFM "file" / DEFB F3H 523DH-5241H: word 67, files (the last character s with bit 7 set, F3H): used by message 43. |
| 5242H-5246H 5 bytes | DEFM "writ" / DEFB E5H 5242H-5246H: word 68, write (the last character e with bit 7 set, E5H): used by message 44. |
| 5247H-5250H 10 bytes | DEFM "protectio" / DEFB EEH 5247H-5250H: word 69, protection (the last character n with bit 7 set, EEH): used by messages 44, 48. |
| 5251H-5256H 6 bytes | DEFM "acces" / DEFB F3H 5251H-5256H: word 70, access (the last character s with bit 7 set, F3H): used by message 45. |
| 5257H-525CH 6 bytes | DEFM "denie" / DEFB E4H 5257H-525CH: word 71, denied (the last character d with bit 7 set, E4H): used by message 45. |
| 525DH-5263H 7 bytes | DEFM "blocke" / DEFB E4H 525DH-5263H: word 72, blocked (the last character d with bit 7 set, E4H): used by message 46. |
| 5264H-5269H 6 bytes | DEFM "syste" / DEFB EDH 5264H-5269H: word 73, system (the last character m with bit 7 set, EDH): used by message 47. |
| 526AH-5270H 7 bytes | DEFM "comman" / DEFB E4H 526AH-5270H: word 74, command (the last character d with bit 7 set, E4H): used by message 47. |
| 5271H-5277H 7 bytes | DEFM "aborte" / DEFB E4H 5271H-5277H: word 75, aborted (the last character d with bit 7 set, E4H): used by message 47. |
| 5278H-527AH 3 bytes | DEFM "ha" / DEFB F3H 5278H-527AH: word 76, has (the last character s with bit 7 set, F3H): used by message 48. |
| 527BH-5281H 7 bytes | DEFM "cleare" / DEFB E4H 527BH-5281H: word 77, cleared (the last character d with bit 7 set, E4H): used by message 48. |
Operands Changed While It Runs
| Address Size | Contents |
|---|---|
| 4EA0H-4EA1H 2 bytes | The count of elements of CMD"O" (4E85H). 0000H in the file. |
| 4EAEH-4EAFH 2 bytes | The position of the round of the sort (4EAAH, 4F0BH). 0000H in the file. |
| 4EB4H-4EB5H 2 bytes | The working position of the sort, stepped back by the gap after an exchange (4EB0H, 4EFDH). 0000H in the file. |
| 4EBBH-4EBCH 2 bytes | The descriptor of the first element to sort (4E8FH). 0000H in the file. |
| 4F0FH-4F10H 2 bytes | The count less the gap: the positions of a round (4EA4H). 0000H in the file. |
| 5023H-5024H 2 bytes | The number of the old line of M or C (4FE3H), deleted by 501AH for M. 0000H in the file. |
Disassembly
4E00H - The Entry: the Function in Register A'
The transfer address and the only entry. BASIC/CMD calls BASIC/OV3 through its 54DEH with the number of a function in Register A' (put there by EX AF,AF'): it JUMPs to 4E00H when the file is already in the overlay area, or loads it with @LOAD and RETurns to 4E00H. 4414H, OVRLY$, gets 01H first, the mark BASIC/CMD's 54DEH tests to know the file is still at 4E00H. Function 01H gives the text of a BASIC error, 02H turns an LDOS error into a BASIC error, 03H sorts a string array (CMD"O"), 04H parks the variables for a RUN with V, 05H moves a line (M at READY) and 06H copies one (C); any other number runs the copy too.
4E1BH - Function 01H: the Text of a BASIC Error
BASIC/CMD's 5A72H (the error vector 41A6H) calls it with Register L = the error's E value from the ROM's error handler. The E value picks one of the messages of the table at 5057H: E values 00H-2EH give messages 2-25 (E / 2 + 2), 64H-90H give messages 26-48 (the disk errors), any other even value message 21, Unprintable error; an odd value (only the 19H of LDOS code 00H) has bit 7 set by the RRCA and sends the search past the end of the table. Each message is a list of word numbers from the dictionary at 50D6H, bit 7 set on the last; the words are copied to 543CH (in BASIC/CMD's image) with a space after each and 00H at the end, and the first letter is made upper case. It RETurns with Register Pair HL = 543CH.
4E6BH - Function 02H: an LDOS Error Becomes a BASIC Error
BASIC/CMD's 6463H calls it with Register L = the error code an LDOS service returned. The code is kept at 660BH for CMD"E"; codes from 29H up are taken as 29H; the table at 502DH gives the E value of the BASIC error, and the ROM's error handler is entered with it. It does not RETurn.
4E80H - Function 03H: CMD"O", Sort a String Array
BASIC/CMD's 5858H calls it for CMD"O",count,array$(first) with Register Pair HL at the text after "O". The count goes into the operand at 4EA0H, the address of the first element (from the ROM's PTRGET) into the operand at 4EBBH. The elements are sorted in ascending order by a Shell sort: the gap starts at half the count and is halved after each round until it is 0. Only the 3 byte string descriptors (length, address) are exchanged, never the text. Nothing tests that the variable is a string array or that the elements stay inside the array. It RETurns to BASIC/CMD with Register Pair HL after the array name.
4E95H - The Next Round: Halve the Gap
Register Pair BC = the gap of the round before (the count at the start). It is halved; at 0 the sort is done. 4F0FH gets the count less the gap, the number of comparisons of the round, and the position at 4EAEH starts again at 0.
4EADH - The Next Position: Compare Two Elements
The element at the position (4EAEH, copied to 4EB4H as the working position) is compared with the element one gap after it. Each element is 3 bytes from the first one (4EBBH). The shorter length is compared character by character; when the shorter string is the same as the start of the longer one, the shorter goes first. An element above its partner (or the same) is exchanged with it, and the working position steps back by the gap to compare again.
4EE9H - Exchange the Two Descriptors
The 3 bytes of the two descriptors are exchanged, so the lower element moves one gap down; the working position (4EB4H) steps back by the gap and the compare is made again while it is 0 or more.
4F04H - In Order: the Next Position
The two elements are in order: the three words saved at 4EC3H-4EC5H are taken back, and the position of the round (4EAEH) goes up by one. While it is below the count less the gap (4F0FH) the next position is compared, else the next round begins with half the gap.
4F19H - Function 04H: Park the Variables for a RUN With V
BASIC/CMD's 5EC1H calls it for RUN"file",V before the ROM's NEW. The simple variables (40F9H-40FAH up to 40FBH) are walked first: each entry is a type byte (the size of the value: 02H, 03H, 04H, 08H), two name bytes and the value. A DEF FN entry (bit 7 of its second name byte) gets its pointer into the program set to 0000H, since the program goes away. A string's text that lies in the program (a constant) is copied into string space (4F6AH). The arrays (40FBH up to 40FDH) come next, every element of a string array the same way. Then 4F99H moves the whole block up below the stack and keeps the pointers for BASIC/CMD's 5F70H.
4F23H - The Simple Variables
Register Pair HL steps over each entry by Register C, the size of its value; DE = the end of the simple variables.
4F3FH - The Arrays
Each array is a type byte, two name bytes, the length of the rest (2 bytes, from the count of dimensions to the end), the count of dimensions and 2 bytes for each dimension, then the elements. A number array is passed over in one step; in a string array every 3 byte descriptor goes to 4F6AH.
4F6AH - Move a String Out of the Program
Register Pair HL = a string descriptor (length, address of the text), Register Pair DE = the end of the area being walked (the start of the arrays, or the end of the array). A text at or above Register Pair DE (in string space) or below 40A4H is left alone; a text between them is in the program, and goes to new string space from the ROM's GETSPA (28BFH), the descriptor then pointing at the copy. It RETurns with Register Pair HL 3 bytes on and Register Pair DE as it was.
4F99H - Park the Block
The variables and arrays (40F9H up to 40FDH) are moved up to end 128 bytes below the Stack Pointer, with LDDR; when the block already reaches that place it is Out of memory. The start of string space (40A0H) is set just below the parked block, so the ROM's NEW puts the stack under it. The old values go into BASIC/CMD's operands for 5F70H: 5F72H the old 40F9H, 5F85H the length, 5F79H the old 40FBH, 5F92H the old 40D6H, 5F98H the old 40A0H; 6608H gets D6H.
4FD6H - Functions 05H and 06H: M and C, Move or Copy a Line
BASIC/CMD's 6578H calls it for a line typed at READY that is M or C with two line numbers, M old,new or C old,new; Register Pair HL = the line, its letter replaced by the function number and 00H after it. 4FD6H (M) is OR AFH, which leaves the NZ FLAG; 4FD7H (C) is the AFH alone, XOR A, which leaves the Z FLAG. The old line must exist (Undefined line number) and the new one must not (Illegal function call); a missing line number, a line number of 0 (either one) or more text after the second number is a Syntax error. The old line's text is turned back into characters in the input buffer, and the ROM's EDIT exit (2FEBH) takes it in as the new line, as if typed; for C no READY is shown. For M the line input vector (41AFH) is pointed at 501AH, so that when the ROM next asks for a line the old line is deleted.
501AH - M: Delete the Old Line
Reached through the line input vector (41AFH) from the ROM's 0368H, when the ROM asks for a line after the new one went in. The vector gets back BASIC/CMD's 5BDFH, the two return addresses (from 0368H and from 1A7BH) are dropped, and the old line (its number at 5023H) is deleted by the ROM's DELETE from 2BCAH, which shows READY and goes back to the command loop.
502EH - The LDOS Errors as BASIC Errors
One byte for each LDOS error code from 01H to 29H (4E6BH): the E value of the BASIC error it becomes. The entry for code 00H is 19H, the last byte of the JP at 502BH; codes from 29H up use the entry of 29H. Each row names the LDOS error and the BASIC message its E value gives (4E1BH).
5057H - The Messages
49 messages, each a list of word numbers of the dictionary at 50D6H, bit 7 set on the last; function 01H passes over E / 2 + 2 messages (4E35H). Messages 0 and 1 are never chosen: no E value gives a number below 2. Messages 24, 32, 35 and 36 (the E values 2CH, 70H, 76H and 78H) are the word ? alone.
50D6H - The Dictionary
78 words in lower case unless shown in capitals, each ended by bit 7 set on its last character; word n is reached by passing over n words from 50D6H (4E47H). Word 0 is the byte D2H alone, which only marks the start, so word 1 begins at 50D7H. The first letter of a message is made upper case at 4E68H.