LDOS 5.3.1 for the Model III - HITAPE/CMD Disassembled
Page Customization
Page Index
HITAPE/CMD
Other Navigation
Introduction/Summary
LDOS 5.3.1 HITAPE/CMD Disassembly - The 1500 Baud Cassette Interrupts (Model III)
HITAPE/CMD gives the 1500 baud cassette back to the ROM under LDOS. The ROM of the Model III reads a 1500 baud tape with the cassette's edge interrupts (bits 0 and 1 of the interrupt latch, port E0H), whose service routines are in the ROM (3365H and 3369H); LDOS 5.3.1 takes the RST 38H vector at 4012H for its own interrupt service (44A5H), which has no place for them. The manual (M-40-060) says so: the 1500 baud cassette loading was left out of the resident system for space, and HITAPE adds a routine to the DOS so that BASIC and CMDFILE can use 1500 baud tapes; without it a 1500 baud load does not load. The command is HITAPE; the parameter table also knows HITAPE (OFF), which the manual does not name.
The file is a load module of 456 bytes: a record of type 1FH with the text Copyright 1991 MISOSYS, Inc., All rights reserved, two load blocks for 5200H-5388H (393 bytes) and the transfer address record for 5200H. HITAPE copies a module of 28 bytes (536DH-5388H) to the top of the free memory, lowers HIGH$ below it, and points the RST 38H vector at it. The module sends the two cassette interrupts to the ROM and every other interrupt on to SYS0/SYS's service, entering it after its first three instructions with the stack as they would have left it. The manual adds that a SYSTEM (SYSGEN) done while HITAPE is in saves it with the configuration; the list of SYSGEN in SYS7/SYS holds both HIGH$ (4411H) and the vector at 4013H.
What HITAPE Does
| Step | What Happens |
|---|---|
| The banner and the parameter | The Stack Pointer is kept for the end, the banner is displayed and @PARAM reads OFF (5200H); a bad parameter gives error 2CH. |
| HITAPE | The module $HT is looked for above HIGH$ through SYS10/SYS (request BCH, 5296H). Found: the vector is pointed at it again. Not found: at LDOS command level only (@EXIT not taken over, the command not from a program; else Can't -- Valid only at LDOS Command level!), the module gets the HIGH$ and the vector of the moment and is copied below HIGH$, HIGH$ goes down by 28, and 4013H points at it (523CH). |
| HITAPE (OFF) | The module is looked for (Module is not resident! when it is not in memory); when it is the newest, HIGH$ goes back to its link word. The vector is then stored from the wrong word (5215H). |
| The end | Register Pair HL = 0000H after success, FFFFH after an error; an error during a JCL job ends at @ABORT (527BH). |
About This Page
The Model I diskette of LDOS 5.3.1 has no HITAPE/CMD (the Model I has no 1500 baud cassette), so this page is written from the bytes of the Model III file alone. Every byte of the file is shown at its address; the module is shown where it is in the file, 536DH-5388H, and runs at HIGH$ + 1 after the copy. Found in the code: HITAPE (OFF) computes the address of the saved vector from Register Pair HL after the SBC at 522AH has turned it into the module less HIGH$ less 1, so it reads 0008H-0009H of the ROM for the newest module and stores 00C3H as the RST 38H vector (5232H-5239H, 5278H); running HITAPE a second time points the vector at the module again (5242H), past any interrupt routine installed after it.
Memory Map
Load Blocks in File Order
The two load blocks of the file, after the copyright record: 393 bytes, 5200H-5388H. The transfer address is 5200H.
| Address | Contents |
|---|---|
| 5200H-52FFH | 256 bytes |
| 5300H-5388H | 137 bytes |
Sections of the Disassembly
| Address | Contents |
|---|---|
| 5200H | Entry: the Banner and the Parameter |
| 5215H | HITAPE (OFF): Take the Module Out |
| 523CH | Install the Module |
| 527BH | The End |
| 528DH | The Error Exits and the Module Search |
| 52B6H | The Texts and the Parameter Table |
| 536DH | The Module: the Cassette Interrupts First (Copied below HIGH$) |
Memory HITAPE/CMD Uses
| Address | Contents |
|---|---|
| 3365H, 3369H | ROM: the routines of the cassette's rising and falling edge interrupts of the 1500 baud read (537BH, 537FH). |
| 402DH, 4065H | The first byte of @EXIT, and during a JCL job the copy of it that SYS11/SYS keeps: C3H when a program has taken @EXIT over (5249H, 524EH). |
| 4012H-4014H | The RST 38H vector, JP 44A5H: 4013H-4014H is read (5265H) and pointed at the module (5278H). |
| 4030H, 4409H, 428AH, 4454H, 4467H | @ABORT, @ERROR, @LOGOT, @PARAM and @DSPLY. |
| 4411H-4412H | HIGH$: lowered by 28 for the module (5274H), given back by HITAPE (OFF) (522EH). |
| 442BH | SFLAG$: bit 5 a JCL job runs (5244H, 5284H). |
| 44A9H | SYS0/SYS's interrupt service after its PUSH HL, PUSH AF and IN A,(E0H): the module goes on there (5386H). |
| 4758H | The command interpreter's status byte: bit 1, the command came from a program (5256H). |
| RST 28H, BCH | SYS10/SYS: look for a module above HIGH$ by name (52A3H). |
Variables
The entry points of HITAPE/CMD, then the data of the file, the operands it changes, and the cells outside the file that it uses, by address.
Entry Points
| Address | Contents |
|---|---|
| 5200H | The start of HITAPE/CMD, the transfer address of the file. |
| 5296H | Look for the module $HT: the Z FLAG, Register Pair HL = the module, Register Pair DE = its link word. |
| 5377H | The code of the module (its +0AH), entered through the RST 38H vector after the copy. |
Data in the File
| Address Size | Contents |
|---|---|
| 52B6H 1 byte | DEFB 0AH 52B6H: 0AH, a new line: the start of the banner displayed by 5208H. |
| 52B7H-52E8H 50 bytes | DEFM "HITAPE - 1500 baud cassette driver - Version 5.3.1" 52B7H-52E8H: the name of the program, what it is and its version. |
| 52E9H 1 byte | DEFB 0AH 52E9H: 0AH, a new line: the copyright goes on the next line. |
| 52EAH-531AH 49 bytes | DEFM "Copyright 1991 MISOSYS, Inc., All rights reserved" 52EAH-531AH: the copyright line, the same text as the copyright record of the file. |
| 531BH-531CH 2 bytes | DEFB 0AH, 0DH 531BH-531CH: 0AH, a new line, and 0DH, the end of the banner. |
| 531DH-5346H 42 bytes | DEFM "Can't -- Valid only at LDOS Command level!" 531DH-5346H: the text of 52AAH, displayed by @LOGOT when HITAPE is run from a program or while @EXIT is taken over. |
| 5347H 1 byte | DEFB 0DH 5347H: 0DH, the end of the line and of the text. |
| 5348H-535EH 23 bytes | DEFM "Module is not resident!" 5348H-535EH: the text of 52A6H, for HITAPE (OFF) when no module $HT is in memory. |
| 535FH 1 byte | DEFB 0DH 535FH: 0DH, the end of the line and of the text. |
| 5360H-5362H 3 bytes | DEFM "$HT" 5360H-5362H: $HT, the name of the module that 521CH and 523CH give to the search; the same as in the module's header (5372H). |
| 5363H 1 byte | DEFB 00H 5363H: 00H, a character below 21H: the end of the name for SYS10/SYS's search. |
| 5364H-536BH 8 bytes | DEFM "OFF " / DEFW 5216H 5364H-536BH: OFF, padded with spaces to 6 characters, and 5216H, the operand of LD HL,0000H at 5215H, where @PARAM stores its value. |
| 536CH 1 byte | DEFB 00H 536CH: 00H, the end of the table: @PARAM stops here. |
| 536FH-5370H 2 bytes | DEFW 0000H 536FH-5370H, the module +02H-+03H: the link word, 0000H in the file; 5261H stores HIGH$ before the copy: SYS10/SYS's search goes on from it, and HITAPE (OFF) gives it back to HIGH$. |
| 5371H 1 byte | DEFB 03H 5371H, the module +04H: 03H, the length of the name in bits 3-0. |
| 5372H-5374H 3 bytes | DEFM "$HT" 5372H-5374H, the module +05H-+07H: the name of the module, $HT, which 5360H looks for. |
| 5375H-5376H 2 bytes | DEFW 0000H 5375H-5376H, the module +08H-+09H: the vector found at 4013H-4014H, 0000H in the file; 5268H stores it before the copy. The code jumps to 44A9H itself and does not use it. |
Operands Changed While It Runs
| Address Size | Contents |
|---|---|
| 5216H-5217H 2 bytes | The operand of LD HL,0000H at 5215H: OFF, FFFFH when @PARAM found it. |
| 527FH-5280H 2 bytes | The operand of LD SP,0000H at 527EH: the Stack Pointer as LDOS left it (5200H). |
| 536FH-5370H, 5375H-5376H 2 bytes each | The module's link word (5261H) and saved vector (5268H), stored before the copy. |
Cells Outside the File That HITAPE/CMD Uses
| Address Size | Contents |
|---|---|
| HIGH$ - 27 to HIGH$ 28 bytes | The copy of the module at the top of the free memory, HIGH$ as it was before HITAPE; HIGH$ is then 28 lower. |
Disassembly
5200H - Entry: the Banner and the Parameter
LDOS Ready loads HITAPE/CMD at 5200H-5388H and jumps to 5200H, the transfer address, with Register Pair HL at the rest of the command line after the word HITAPE. The command is HITAPE, or HITAPE (OFF) to take the module out again (the parameter table at 5364H; the manual, M-40-060, names only HITAPE). The Stack Pointer is kept in the operand of LD SP at 527EH, so every exit can leave from a clean stack; the banner is displayed and @PARAM reads the parameter.
5215H - HITAPE (OFF): Take the Module Out
With OFF the module $HT is looked for above HIGH$ (5296H). Not found: Module is not resident!. Found: when it is the newest module (it starts at HIGH$ + 1), HIGH$ goes back to the link word of its header, the HIGH$ before it was installed. Then the RST 38H vector at 4013H should get back the address the module saved at its +08H-+09H; but the code reads that word from Register Pair HL + 8 after the SBC at 522AH has changed Register Pair HL to the module less HIGH$ less 1: for the newest module from 0008H-0009H in the ROM (C3H 00H), so the vector becomes JP 00C3H and the next interrupt does not reach SYS0/SYS's service routine.
523CH - Install the Module
The module is looked for first: when $HT is already in memory, the RST 38H vector is simply pointed at it again. Else HITAPE must run at LDOS command level: @EXIT (402DH, or during a JCL job the copy SYS11/SYS keeps at 4065H) must not be taken over by a running program (a JP, C3H, there), and the command must not come from a program (bit 1 of 4758H); otherwise Can't -- Valid only at LDOS Command level!. Then the 28 byte module 536DH-5388H gets the HIGH$ (its link word) and the RST 38H vector (its +08H-+09H) of the moment and is copied to the top of the free memory, just below the old HIGH$; HIGH$ goes down by 28 and the vector at 4013H points at the module.
527BH - The End
Every exit comes through 527EH with Register Pair HL as the return code: 0000H for success, FFFFH after an error. The Stack Pointer is put back as LDOS left it (5200H); then success returns to LDOS, and an error does too unless a JCL job runs, which is ended at @ABORT.
528DH - The Error Exits and the Module Search
528DH gives error 2CH through @ERROR, which returns (bit 7 set); 52A6H displays Module is not resident! and 52AAH (inside the LD IX at 52A9H) Can't -- Valid only at LDOS Command level!, both through @LOGOT; all three end at 527EH with Register Pair HL = FFFFH. 5296H looks for the module through SYS10/SYS (request BCH) and returns its link word in Register Pair DE.
52B6H - The Texts and the Parameter Table
The banner, the two messages, the name of the module for the search, and the table @PARAM reads.
536DH - The Module: the Cassette Interrupts First (Copied below HIGH$)
536DH-5388H are 28 bytes copied to the top of the free memory (5271H) and entered from there through the RST 38H vector at 4012H for every maskable interrupt. The header: a JR over it, the link word (the HIGH$ before the module), 03H the length of the name, the name $HT, and the vector the module found at 4013H. The code reads the interrupt latch, port E0H (a bit is 0 while its interrupt is pending): bit 0, the cassette's rising edge, goes to the ROM's routine at 3365H and bit 1, the falling edge, to 3369H, the routines of the ROM's 1500 baud cassette read; any other interrupt goes on into SYS0/SYS's interrupt service at 44A9H with the stack as its own start (44A5H-44A8H) would have left it. The rows show the module at its address in the file; the JR and the jumps out of it work at any address.