LDOS 5.3.1 for the Model III - LOG/CMD Disassembled
Page Customization
Page Index
LOG/CMD
Other Navigation
Introduction/Summary
LDOS 5.3.1 LOG/CMD Disassembly - Log In One Drive's Diskette (Model III)
LOG/CMD logs in the diskette of one drive: it puts the directory cylinder of the diskette and its number of sides into the drive's code table, as the DEVICE command does for every drive. The command is LOG :d; for drive 0, given or by default, the program first asks for the diskette to be exchanged, so that a system diskette with another directory cylinder or a double sided diskette can go into drive 0. The manual (M-40-060) gives that use: LOG :0 must be used when switching between double and single sided diskettes in drive 0.
The file is a load module of 194 bytes: a record of type 1FH with the text Copyright 1991 MISOSYS, Inc., All rights reserved, one load block for 5200H-5286H (135 bytes) and the transfer address record for 5200H. LOG issues no supervisor request of its own: it calls the resident vectors and disk primitives of SYS0/SYS (and @CKDRV, which loads SYS2/SYS) and two ROM routines.
What LOG Does
| Step | What Happens |
|---|---|
| The drive | Spaces are passed over; a colon and the character after it give the drive (bits 2-0 of the character, not checked). Without a colon the drive is 0 (5200H). |
| Drive 0 | Exchange disks and hit <ENTER> is shown with the cursor on and the ROM waits for any key; @CKDRV is not called (5210H). |
| Drives 1-7 | @CKDRV must find the drive ready, else error 20H, Illegal drive number, as a short message, and the program ends at @ABORT (5224H). |
| The directory cylinder | Cylinder 0, sector 0, the copy of the boot sector, is read into 5287H; its byte 02H goes to +09H of the drive code table (522CH). |
| The sides | Sector 0 of that cylinder, the allocation table, must read with the deleted data mark; bit 5 of its configuration byte (CDH) is copied into bit 5 of +04H of the drive code table. Then @EXIT (5246H). |
About This Page
The Model I diskette of LDOS 5.3.1 has no LOG/CMD, so this page is written from the bytes of the Model III file alone. Every byte of the file is shown at its address, with a DEFS row for 5287H-5386H, the buffer beyond the file. Found in the code: the character after the colon is not checked, so LOG :X works on drive 0 (58H AND 07H); a diskette whose allocation table carries the normal data mark ends with the short message of error 0 (40H, 5250H); for drive 0 nothing tests that the drive is ready before the read, which then gives the error of RDSECT.
Memory Map
Load Blocks in File Order
The one load block of the file, after the copyright record: 135 bytes, 5200H-5286H. The transfer address is 5200H.
| Address | Contents |
|---|---|
| 5200H-5286H | 135 bytes |
Sections of the Disassembly
| Address | Contents |
|---|---|
| 5200H | The Drive from the Command Line |
| 5210H | Drive 0: Exchange the Diskettes |
| 522CH | Read the Boot Sector: the Directory Cylinder |
| 5246H | Read the Allocation Table: the Number of Sides |
| 5267H | The Prompt and the Buffer |
Memory LOG/CMD Uses
| Address | Contents |
|---|---|
| 0033H | ROM: display the character in Register A (5221H). |
| 0049H | ROM: wait for a key, returned in Register A (521AH). |
| 402DH | @EXIT: the end of the program (5264H). |
| 4409H | @ERROR: the short message of an error, then @ABORT (5229H, 5237H, 5250H). |
| 4467H | @DSPLY: the prompt for drive 0 (5217H). |
| 4209H | @CKDRV: the check of drives 1-7 (5224H). |
| 4700H-474FH | DCT$, the drive code tables: GETDCT (478FH) points Index Register IY at the drive's table; LOG sets its +09H and bit 5 of +04H. |
| 4777H | RDSECT: the reads of the boot sector copy and the allocation table (5232H, 5249H). |
| 5287H-5386H | The buffer of both reads. |
Variables
The entry point of LOG/CMD, then the data of the file and the buffer beyond it, and the cells outside the file that it uses, by address. LOG changes no operand of its own code.
Entry Points
| Address | Contents |
|---|---|
| 5200H | The start of LOG/CMD, the transfer address of the file. |
Data in the File and Beyond It
| Address Size | Contents |
|---|---|
| 5267H-5284H 30 bytes | DEFM "Exchange disks and hit <ENTER>" The prompt for drive 0, displayed by @DSPLY from 5217H. |
| 5285H-5286H 2 bytes | DEFB 0EH, 03H Cursor on, then the end of the text. |
| 5287H-5386H 256 bytes | DEFS 256 Not in the file: the buffer of the boot sector copy (its directory cylinder at 5289H) and of the allocation table (its configuration byte at 5354H). |
Cells Outside the File That LOG/CMD Uses
| Address Size | Contents |
|---|---|
| IY +09H 1 byte | The directory cylinder in the drive code table of the drive given, stored by 5240H from byte 02H of the boot sector. |
| IY +04H 1 byte | The drive's flags: bit 5, two sides, set or cleared by 5261H from the allocation table. |
| Boot sector +02H 1 byte | Cylinder 0, sector 0, byte 02H: the directory cylinder (5289H in the buffer). |
| Allocation table +CDH 1 byte | The configuration byte of the diskette (5354H in the buffer): bit 5 set for a double sided diskette. |
Disassembly
5200H - The Drive from the Command Line
LDOS Ready loads LOG/CMD at 5200H-5286H and jumps to 5200H, the transfer address, with Register Pair HL at the rest of the command line after the word LOG. The command is LOG :d. Spaces are passed over; when a colon follows, the character after it gives the drive in its bits 2-0. Without a colon the drive is 0. Nothing else on the line is read.
5210H - Drive 0: Exchange the Diskettes
For drive 0, given or by default, LOG lets the diskette be changed: it shows Exchange disks and hit <ENTER> with the cursor on and waits for a key through the ROM; @CKDRV is not called, since a diskette just put in may not be in the drive code table yet. For any other drive @CKDRV must find the drive ready, or LOG ends with error 20H.
522CH - Read the Boot Sector: the Directory Cylinder
Cylinder 0, sector 0 holds a copy of the boot sector, whose byte 02H is the directory cylinder of the diskette. LOG reads it into the buffer at 5287H, beyond the file, and stores that byte at +09H of the drive's code table.
5246H - Read the Allocation Table: the Number of Sides
The allocation table is read into the buffer; it must come back with the deleted data mark every sector of the directory cylinder carries (RDSECT's error 06H). Bit 5 of its byte CDH, the configuration byte, says that the diskette is double sided; it is copied into bit 5 of +04H of the drive code table, and LOG ends at @EXIT.
5267H - The Prompt and the Buffer
The text displayed for drive 0, then the buffer beyond the file that both sectors are read into.