TRS-80 DOS - LDOS 5.3.1 for the Model I - SYS7/SYS Disassembled

Page Customization

Summary:

LDOS 5.3.1 SYS7/SYS Disassembly - Library B Command Set (Model I)

SYS7/SYS holds the second half of the LDOS 5.3.1 command library. Like SYS6/SYS (Library A), it is not a single overlay but a partitioned file of independent command overlays, each assembled with .ORG 5200H. Every overlay loads at 5200H and runs one at a time. The resident RST 28H dispatcher at 4BCDH recognizes request code 89H as "Library B", and the resident overlay loader at 4BF5H brings the requested command overlay into 5200H (in register B) and enters it at its first byte. The command name a user types is mapped to a (library, command-number) pair by the resident command interpreter (SYS1) through its command-name table at 4EBDH; SYS7 itself never sees the typed name, only the loaded overlay and the command number.

SYS7/SYS contains 13 overlays that together serve 15 command codes. Two overlays each serve a related pair of commands: the DATE/TIME overlay and the DEBUG/VERIFY overlay each expose two entry points at the top of the overlay, one per command number. The file is framed as an LDOS load module: a type 05 header (module name "sys7 "), a type 1F comment ("(C) 1982-4,6,90 MISOSYS"), then fifteen 6-byte type 08 directory entries (one per command code, giving the command code and the file offset of its overlay), then the 13 overlays as runs of type 01 load records, and a closing type 02 transfer record. The entire memory image of all 13 overlays was rebuilt from the binary through these load records and compared byte-for-byte against the disassembly listing: 0 mismatches.

Every overlay follows the common LDOS command shape: it saves the caller's stack pointer with a self-modifying LD (nnnnH),SP at entry (patching the operand of the exit's LD SP,nnnn), skips leading blanks on the command line, parses its keyword parameters, performs its work through the resident SYS0 supervisor services, and exits by returning to the RST 28H dispatcher (or aborting to @ABORT at 4030H when it is invoked from something other than the LDOS command level). The resident system flag SFLAG$ at 430FH bit 5 ("not at LDOS command level") gates the commands that are only valid at command level.

Command / Overlay Directory (verified against the SYS7.SYS load module)

Cmd CodeLoad RangeBytesCommand / Function
11H5200-5351H338AUTO
Set, display, or clear the diskette's auto-execute command line (stored in the GAT sector at offset E0H). Documented below.
15H / 16H5200-548DH654DATE / TIME
Display or set the system date (15H) and time/clock (16H); shares one overlay with two entry points (5200H JP for DATE, 5203H JP for TIME). Carries the 3-letter day and month name tables.
13H5200-53D2H467CREATE
Pre-allocate a file to a fixed size and set its record attributes (SIZE/HRS/HRREC/ARR/ARLRL/WRL/WRFILL/RF/RSHRINK); message "Creating: ".
14H / 1BH5200-5349H330DEBUG / VERIFY
Arm/disarm the DEBUG breakpoint re-entry (writes "JP 400FH" at 4315-4317, issues RST 28H code 8BH) and patch the @WRITE vector for write-verification; two entry points (5200H / 5203H). Command-code binding to be confirmed against the SYS1 4EBDH table.
1CH5200-552FH816SYSGEN
Build or delete the stored system configuration file CONFIG/SYS.CCC:0; messages "User configuration built/deleted", "*** CONFIGURING ***".
22H5200-55A3H932FREE
Display drive free-space and diskette information ("Drive :d packname packdate cyldh Free=sssss.s/sssss.s Fi=nnn/nnn").
A1H5200-5EE6H3303SYSTEM
System configuration command (SYSGEN/SYSRES/DRIVE/TYPE-ahead and more); "Can't SYSGEN with active SPOOLER!", "New SYSTEM drive installed", "Insert SYSTEM diskette in drive". Largest overlay in the file.
33H5200-5402H515BUILD
Build or append a keystroke/JCL file ("Building: ", "Appending: *KI to "), with HEX and APPEND options; "Odd # of hex digits!".
51H5200-56D5H1238ATTRIB
Set file/diskette attributes and passwords (PW/LOCK/UNLOCK/NAME/MPW); "New Master password ?", "Invalid master password!", "ATTRIB aborted!".
71H5200-5405H518DUMP
Dump memory to a file in CIM/TXT format with START/END/TRA/RELO/ASCII/ETX options; "Dumping: ", "START or END error!", "Start less than X'5500'!".
72H5200-577CH1405PURGE
Selectively delete files with INV/SYS/MPW/QUERY options and date filtering; "Purge file: ", "Purging: ", "Master password ?".
B1H5200-5525H806FORMS
Set the Forms printer-filter parameters (LINES/PAGE/CHARS/INDENT/ADDLF/FFHARD/TAB/XLATE/MARGIN); "Forms Filter not Resident".
B2H5200-569CH1181SETCOM
Set the RS-232 driver parameters (BAUD/WORD/STOP/PARITY/BREAK/DTR/RTS/DSR/CTS); "RS232/DVR not installed".

AUTO (Command 11H) - Variables and Self-Modifying Cells

Address RangePurpose
5220H
2 bytes
Saved stack pointer. Written by the entry LD (5220H),SP at 5200H and consumed both as the operand of LD SP,nnnn at 521FH and by LD SP,(5220H) at 525AH to restore the caller's stack. Self-Modifying Code.
5268H
1 byte
Drive-valid flag. The operand of LD A,00H at 5267H, patched by the drive-check routine at 52A1H to 00H when the target drive is valid or FFH when it is not. Self-Modifying Code.
52A2H
1 byte
Parsed drive number. The operand of LD C,00H at 52A1H, patched by the ":d" drive parser at 52B4H (default 0). Read back at 528DH to select which drive's GAT to write. Self-Modifying Code.
42E0H
32 bytes
The auto-execute command field inside the shared directory/sector buffer SBUFF$ (4200H). LDOS stores the AUTO command string at offset E0H of the diskette's GAT sector; AUTO reads that sector into 4200H so 42E0H holds the current auto command, terminated by 0DH.

AUTO (Command 11H) - Major Routines

AddressName / Purpose
5200HAUTO Entry
Save SP, skip blanks, and branch on the first command-line character: "?" displays the current auto command, "=" re-executes the stored auto command, anything else stores a new auto command.
52A1HValidate Drive and Read GAT
Load C with the parsed drive number, call @CKDRV (44B8H), record the valid/invalid result, and (when valid) read the GAT sector into 4200H via 52D0H.
52B4HParse Optional Drive Spec
If the next command-line character is ":", read the following digit as the drive number and store it in the 52A2H cell; validate it is 0-7.
52D0HRead GAT Sector
Seek the directory cylinder (DIRCYL 4B65H) and read sector 0 (the GAT, which holds the auto command at offset E0H) into 4200H via RDSSEC (4B45H). Returns error code 14H on failure.
52E3HWrite GAT Sector
Write the 4200H buffer back to the directory cylinder's sector 0 with a deleted-data address mark (WRPROT 4768H) and verify it (VERSEC 4772H). Returns error code 15H on failure.

Cross-Reference Notes

SYS7/SYS is loaded and dispatched by the resident RST 28H supervisor in SYS0/SYS (dispatcher 4BCDH, overlay loader 4BF5H) in response to request code 89H. The command name to command-number mapping is performed by the SYS1/SYS command interpreter through its command-name table at 4EBDH. The AUTO overlay calls the following resident SYS0 services: @LOGOT (447BH, display a carriage-return-terminated string), @CKDRV (44B8H, validate a drive number), @ERROR (4409H, report an error code), @ABORT (4030H, return to DOS), DIRCYL (4B65H, seek the directory cylinder), RDSSEC (4B45H, read a directory-track sector), WRPROT (4768H, write a directory sector with a deleted-data address mark), and VERSEC (4772H, verify a sector). The "=" path additionally jumps to the resident entry at 4451H to re-execute the stored auto command line.

Disassembly:

5200H - AUTO Command (RST 28H Code 89H, Command 11H)

Set, display, or re-execute the diskette's auto-execute command line. On entry from the resident overlay loader HL points to the command line just past the command name, and register B held the command number (11H) used by the loader to select this overlay. The auto command is stored in the diskette's GAT sector at offset E0H, which AUTO reads into the shared buffer at 42E0H.

5200
LD (5220H),SP ED 73 20 52
Self-Modifying Code
Save the caller's stack pointer into 5220H, which is simultaneously the operand of the LD SP,nnnn instruction at 521FH and the source read by LD SP,(5220H) at 525AH. This lets AUTO restore the caller's stack on the way out.
5204
DEC HL 2B
Back HL (the command-line pointer, pointing just past the command name) up by one byte so that the first INC HL of the blank-skip loop at 5205H lands on the original first character.
5205
INC HL 23
Loop Start
Advance HL to the next command-line character. HL is the running command-line pointer.
5206
LD A,(HL) 7E
Fetch the current command-line character (addressed by HL) into Register A.
5207
CP 20H FE 20
Compare Register A (the current command-line character) against 20H (ASCII space). If Register A equals 20H the Z FLAG is set; otherwise the NZ FLAG is set.
5209
If the Z FLAG is set (the character was a blank), LOOP BACK to 5205H to skip it. Loop End
520B
CP 3FH FE 3F
Compare Register A (the first non-blank command-line character) against 3FH (ASCII ?). If Register A equals 3FH the Z FLAG is set; otherwise the NZ FLAG is set.
520D
If the NZ FLAG is set (the character is not ?), JUMP to 522EH to test for the "=" form. Otherwise fall through to display the current auto command.
520F
INC HL 23
Consume the ? character by advancing the command-line pointer HL past it.
5210
GOSUB to 52B4H to parse an optional ":d" drive specifier from the command line (HL) into the drive-number cell 52A2H.
5213
GOSUB to 52A1H to validate the selected drive and read that drive's GAT sector (which contains the auto command at offset E0H) into the buffer at 4200H.
5216
LD HL,42E0H 21 E0 42
Point HL to 42E0H, the auto-execute command field within the GAT sector buffer that 52A1H just filled. This is a carriage-return-terminated string holding the current auto command.
5219
GOSUB to the resident SYS0 service @LOGOT (447BH) to display the carriage-return-terminated string at HL (42E0H), showing the current auto command to the user.
521C
LD HL,0000H 21 00 00
Set HL to 0000H, the success return/error code (0 means no error). This point is reached both after displaying the auto command and after a successful write.
521F
LD SP,0000H 31 00 00
Self-Modifying Code
Restore the caller's stack pointer. The operand at 5220H was overwritten at 5200H with the caller's SP, so this loads SP with the caller's stack pointer.
5222
LD A,H 7C
Copy the high byte of HL (the error code) into Register A to begin testing whether the code is zero.
5223
OR L B5
OR Register A (error code high byte) with L (error code low byte). If HL was 0000H the Z FLAG is set; any non-zero error code leaves the NZ FLAG set.
5224
RET Z C8
If the Z FLAG is set (error code 0, success), RETurn to the RST 28H dispatcher.
5225
LD A,(430FH) 3A 0F 43
Fetch the resident system flag byte SFLAG$ from 430FH into Register A to test the command-level flag.
5228
BIT 5,A CB 6F
Test bit 5 of Register A (SFLAG$ from 430FH). Bit 5 set means the system is NOT at the LDOS command level (for example, running under a program or JCL). If bit 5 is 0 the Z FLAG is set.
522A
RET Z C8
If the Z FLAG is set (bit 5 of SFLAG$ clear, meaning AUTO was run at the LDOS command level), RETurn to the dispatcher, letting the non-zero error code propagate normally.
522B
Otherwise (bit 5 of SFLAG$ set, meaning AUTO was invoked from something other than the command level and an error occurred), JUMP to the resident SYS0 service @ABORT (4030H) to abort back to DOS.
522E
CP 3DH FE 3D
Compare Register A (the first non-blank command-line character) against 3DH (ASCII =). If Register A equals 3DH the Z FLAG is set; otherwise the NZ FLAG is set.
5230
If the NZ FLAG is set (the character is not =), JUMP to 5261H to store a new auto command. Otherwise fall through to re-execute the stored auto command.
5232
INC HL 23
Consume the = character by advancing the command-line pointer HL past it.
5233
GOSUB to 52B4H to parse an optional ":d" drive specifier from the command line (HL) into the drive-number cell 52A2H.
5236
GOSUB to 52A1H to validate the selected drive and read its GAT sector (containing the stored auto command at offset E0H) into the buffer at 4200H.
5239
LD HL,42E0H 21 E0 42
Point HL to 42E0H, the stored auto command inside the GAT buffer, to prepare to re-execute it.
523C
LD A,(HL) 7E
Fetch the first character of the stored auto command (addressed by HL at 42E0H) into Register A.
523D
CP 2AH FE 2A
Compare Register A (the first stored-command character) against 2AH (ASCII *). A leading * is the LDOS marker that flags a special auto command. If equal the Z FLAG is set.
523F
If the NZ FLAG is set (no leading *), JUMP to 524AH. Otherwise fall through to set the SFLAG$ marker bit.
5241
INC HL 23
Consume the * marker by advancing HL past it, so the command that follows can be executed.
5242
LD IY,430FH FD 21 0F 43
Point IY to the resident system flag byte SFLAG$ at 430FH so its marker bit can be set.
5246
SET 4,(IY+00H) FD CB 00 E6
Set bit 4 of SFLAG$ (430FH, addressed by IY+0) to record that the auto command was flagged with a leading *.
524A
LD A,(HL) 7E
Fetch the next character of the stored auto command (addressed by HL) into Register A to check for an empty command.
524B
CP 0EH FE 0E
Compare Register A (the stored-command character) against 0EH. LDOS treats any byte below 0EH as an end-of-string terminator. If Register A is below 0EH the CARRY FLAG is set.
524D
If the CARRY FLAG is set (the stored command is empty), JUMP to 5285H to report "No AUTO command installed!".
5250
LD DE,5261H 11 61 52
Load Register Pair DE with 5261H, which is pushed next as the return address so control comes back into this overlay's store path after the stored command has been copied.
5253
PUSH DE D5
Save 5261H (Register Pair DE) onto the stack as the return address for the block copy that follows.
5254
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H (64), the byte count for the block copy of the stored auto command.
5257
LDIR ED B0
Block-copy 64 bytes: Source is HL (the stored auto command at 42E0H), Destination is DE (5261H), count is BC (64), incrementing. This moves the stored command out of the GAT buffer into a scratch area so the command interpreter can run it after the overlay releases the buffer.
5259
POP HL E1
Restore HL from the stack (5261H, the start of the copied command string) so it can be handed to the command executor.
525A
LD SP,(5220H) ED 7B 20 52
Self-Modifying Code
Restore the caller's stack pointer from 5220H, where it was saved at 5200H, before transferring to the resident command executor.
525E
JUMP to the resident SYS0 entry at 4451H to execute the copied auto command string (HL points to it at 5261H). This is the re-execute path for the "AUTO=" form.
5261
Store path. GOSUB to 52B4H to parse an optional ":d" drive specifier from the command line (HL) into the drive-number cell 52A2H.
5264
GOSUB to 52A1H to validate the selected drive and read its GAT sector into the buffer at 4200H so the auto command field at 42E0H can be rewritten.
5267
LD A,00H 3E 00
Self-Modifying Code
Load Register A with the drive-valid flag. The operand at 5268H was patched by 52A1H to 00H (drive valid) or FFH (drive invalid).
5269
OR A B7
Test Register A (the drive-valid flag). If it is 00H (drive valid) the Z FLAG is set; if FFH the NZ FLAG is set.
526A
If the NZ FLAG is set (the target drive is write protected or otherwise not writable), JUMP to 5281H to report "Destination disk is write protected!".
526C
LD DE,42E0H 11 E0 42
Point Register Pair DE to 42E0H, the auto command field in the GAT buffer, as the destination for the new command string being stored.
526F
LD A,(HL) 7E
Loop Start
Fetch the next source character of the new command from the command line (addressed by HL) into Register A.
5270
LD (DE),A 12
Store the command character (Register A) into the auto command field (addressed by DE within the GAT buffer).
5271
CP 0DH FE 0D
Compare Register A (the just-stored character) against 0DH (carriage return, the end-of-line marker). If equal the Z FLAG is set.
5273
If the Z FLAG is set (end of the command line), JUMP to 528DH to write the updated GAT sector back to disk.
5275
CP 03H FE 03
Compare Register A (the just-stored character) against 03H (ETX, the alternate end-of-string marker). If equal the Z FLAG is set.
5277
If the Z FLAG is set (end of the command string), JUMP to 528DH to write the updated GAT sector back to disk.
5279
INC HL 23
Advance the command-line source pointer HL to the next character.
527A
INC E 1C
Advance only the low byte of the destination pointer DE (E) to the next byte of the auto command field. E started at E0H, so it wraps to 00H after 32 characters.
527B
If the NZ FLAG is set (E has not yet wrapped past the 32-byte field), LOOP BACK to 526FH for the next character. If E has wrapped to 00H the command was too long and execution falls through. Loop End
527D
LD HL,5320H 21 20 53
The command line overflowed the 32-byte auto command field. Point HL to the message text "Command line too long!" at 5320H for display.
5280
LD IX,52FBH DD 21 FB 52
Overlapping Code
On straight fall-through from 527DH this loads IX with 52FBH and has no effect on the message (HL already points to "Command line too long!"). Entered at 5281H (skipping the DD prefix) the bytes 21 FB 52 decode instead as LD HL,52FBH, pointing HL at the message "Destination disk is write protected!". 5281H is the write-protect error entry reached from 526AH.
5284
LD IX,5337H DD 21 37 53
Overlapping Code
On fall-through this loads IX with 5337H with no effect. Entered at 5285H (skipping the DD prefix) the bytes 21 37 53 decode as LD HL,5337H, pointing HL at the message "No AUTO command installed!". 5285H is the empty-command entry reached from 524DH.
5288
GOSUB to the resident SYS0 service @LOGOT (447BH) to display the carriage-return-terminated error message pointed to by HL (5320H, 52FBH, or 5337H depending on the entry point above).
528B
JUMP to 529BH to set the failure return code and exit.
528D
LD A,(52A2H) 3A A2 52
Fetch the parsed drive number from the 52A2H cell into Register A, to tell the GAT-write routine which drive to update.
5290
LD C,A 4F
Copy the drive number (Register A) into Register C, the drive argument expected by the GAT-write routine.
5291
GOSUB to 52E3H to write the updated GAT sector (buffer at 4200H, now holding the new auto command at 42E0H) back to the directory cylinder of drive C. On success it returns with the Z FLAG set; on failure Register A holds an error code.
5294
If the Z FLAG is set (the GAT sector was written successfully), JUMP to 521CH to set the success code and exit.
5296
OR 0C0H F6 C0
Set bits 7 and 6 of the error code in Register A. These bits tell the @ERROR service to display the message and return to the caller rather than abort. This point is also the shared error tail reached from the drive parser and drive check.
5298
GOSUB to the resident SYS0 service @ERROR (4409H) to display the system error message for the code in Register A.
529B
LD HL,0FFFFH 21 FF FF
Set HL to FFFFH, the non-zero failure return/error code checked at the exit tail.
529E
JUMP to the exit tail at 521FH to restore the caller's stack and return (or abort) with the failure code in HL.

52A1H - Validate Drive and Read GAT Sector

Load Register C with the parsed drive number, validate it with the resident @CKDRV service, record whether the drive is usable in the self-modifying flag at 5268H, and (when the drive is valid) read the drive's GAT sector into the buffer at 4200H.

52A1
LD C,00H 0E 00
Self-Modifying Code
Load Register C with the drive number. The operand at 52A2H is patched by the drive parser at 52B4H, so C receives the parsed drive number (default 0).
52A3
GOSUB to the resident SYS0 service @CKDRV (44B8H) to validate the drive number in Register C and confirm the drive is enabled. It reports validity through the Z and CARRY flags.
52A6
PUSH AF F5
Save Register A and the flags returned by @CKDRV onto the stack so the validity result can be recorded without losing the flags.
52A7
SBC A,A 9F
Subtract-with-carry Register A from itself, producing 00H when @CKDRV left the CARRY FLAG clear (drive valid) or FFH when CARRY was set (drive invalid).
52A8
LD (5268H),A 32 68 52
Self-Modifying Code
Store the 00H/FFH drive-valid flag (Register A) into 5268H, the operand of the LD A,00H at 5267H, so the store path can later branch on drive validity.
52AB
POP AF F1
Restore Register A and the @CKDRV flags from the stack so the Z FLAG can gate the GAT read below.
52AC
LD A,20H 3E 20
Load Register A with 20H, the pre-set error code used if the drive check indicated an illegal drive number (error 20H = illegal drive number).
52AE
If the Z FLAG is set (the drive is valid), GOSUB to 52D0H to read the drive's GAT sector into the buffer at 4200H. On return the Z FLAG reflects whether the read succeeded.
52B1
RET Z C8
If the Z FLAG is set (the GAT sector was read successfully), RETurn to the caller with the buffer at 4200H filled.
52B2
Otherwise (illegal drive or a read error, error code in Register A), JUMP to the shared error tail at 5296H to report the error.

52B4H - Parse Optional Drive Specifier

If the command line at HL continues with a ":d" drive specifier, read the drive digit, store it in the drive-number cell 52A2H, and validate the range 0-7. If there is no drive specifier the routine returns leaving the default in place.

52B4
LD A,(HL) 7E
Fetch the next command-line character (addressed by HL) into Register A to test for a drive specifier.
52B5
CP 0EH FE 0E
Compare Register A (the command-line character) against 0EH. Any byte below 0EH is an end-of-line terminator. If below 0EH the CARRY FLAG is set.
52B7
RET C D8
If the CARRY FLAG is set (end of the command line, no drive specifier), RETurn leaving the default drive in the 52A2H cell.
52B8
CP 3AH FE 3A
Compare Register A (the command-line character) against 3AH (ASCII :), the drive-specifier introducer. If equal the Z FLAG is set.
52BA
RET NZ C0
If the NZ FLAG is set (the character is not :, so there is no drive specifier), RETurn leaving the default drive in place.
52BB
INC HL 23
Consume the : by advancing the command-line pointer HL past it.
52BC
LD B,(HL) 46
Load Register B with the drive digit character that follows the : (addressed by HL).
52BD
INC HL 23
Loop Start
Advance the command-line pointer HL past the drive digit (and past any trailing blanks on subsequent iterations).
52BE
LD A,(HL) 7E
Fetch the next command-line character (addressed by HL) into Register A to skip trailing blanks after the drive digit.
52BF
CP 20H FE 20
Compare Register A against 20H (ASCII space). If equal the Z FLAG is set.
52C1
If the Z FLAG is set (a trailing blank), LOOP BACK to 52BDH to skip it. Loop End
52C3
LD A,B 78
Copy the drive digit character (Register B) into Register A to convert it to a numeric drive number.
52C4
SUB 30H D6 30
Subtract 30H (ASCII 0) from Register A to convert the ASCII drive digit into its binary value 0-9.
52C6
LD (52A2H),A 32 A2 52
Self-Modifying Code
Store the binary drive number (Register A) into 52A2H, the operand of the LD C,00H at 52A1H, so the drive-check routine uses this drive.
52C9
CP 08H FE 08
Compare the drive number (Register A) against 08H. Valid Model I drives are 0-7, so a value below 08H is in range and sets the CARRY FLAG.
52CB
RET C D8
If the CARRY FLAG is set (drive number 0-7, in range), RETurn to the caller.
52CC
LD A,20H 3E 20
The drive number was 8 or greater. Load Register A with error code 20H (illegal drive number).
52CE
JUMP to the shared error tail at 5296H to report the illegal drive number.

52D0H - Read GAT Sector

Seek the directory cylinder of the current drive and read its sector 0 (the Granule Allocation Table, which carries the auto command at offset E0H) into the shared buffer at 4200H. Returns error code 14H (GAT read error) on failure.

52D0
PUSH DE D5
Save Register Pair DE (the caller's destination pointer into the auto command field) onto the stack across the disk read.
52D1
PUSH HL E5
Save Register Pair HL (the caller's command-line pointer) onto the stack across the disk read.
52D2
GOSUB to the resident SYS0 service DIRCYL (4B65H) to seek the directory cylinder of the current drive and prepare its geometry for a sector read.
52D5
LD E,00H 1E 00
Load Register E with 00H, selecting sector 0 of the directory cylinder (the GAT sector) for the read.
52D7
LD HL,4200H 21 00 42
Point HL to the shared directory/sector buffer SBUFF$ at 4200H, the destination for the GAT sector.
52DA
GOSUB to the resident SYS0 service RDSSEC (4B45H) to read sector E (0, the GAT) of the directory cylinder into the buffer at HL (4200H). The Z FLAG is set on a successful read.
52DD
POP HL E1
Restore the caller's command-line pointer (Register Pair HL) from the stack.
52DE
POP DE D1
Restore the caller's destination pointer (Register Pair DE) from the stack.
52DF
RET Z C8
If the Z FLAG is set (the GAT sector was read successfully), RETurn to the caller.
52E0
LD A,14H 3E 14
The read failed. Load Register A with error code 14H (GAT read error).
52E2
RET C9
RETurn to the caller with the error code in Register A and the NZ FLAG indicating the failure.

52E3H - Write GAT Sector

Write the updated buffer at 4200H (now holding the new auto command at 42E0H) back to sector 0 of the directory cylinder, using a deleted-data address mark as all directory sectors require, and verify the write. Returns error code 15H (GAT write error) on failure.

52E3
PUSH DE D5
Save Register Pair DE onto the stack across the disk write.
52E4
PUSH HL E5
Save Register Pair HL onto the stack across the disk write.
52E5
GOSUB to the resident SYS0 service DIRCYL (4B65H) to seek the directory cylinder of the current drive and prepare its geometry for the sector write.
52E8
LD HL,4200H 21 00 42
Point HL to the shared buffer SBUFF$ at 4200H, the source of the GAT sector data to be written.
52EB
LD E,L 5D
Copy the low byte of HL (00H) into Register E, selecting sector 0 (the GAT sector) for the write.
52EC
GOSUB to the resident SYS0 service WRPROT (4768H) to write the buffer at HL to sector E (0) of the directory cylinder with a deleted-data address mark, as all LDOS directory sectors require. The Z FLAG is set on a successful write.
52EF
If the NZ FLAG is set (the write failed), JUMP to 52F6H to load the GAT write-error code.
52F1
GOSUB to the resident SYS0 service VERSEC (4772H) to verify the sector just written by reading its ID field.
52F4
CP 06H FE 06
Compare the verify status (Register A) against 06H. This sets the flags the caller inspects to decide whether the verify succeeded.
52F6
LD A,15H 3E 15
Load Register A with error code 15H (GAT write error), used when the write or verify above failed.
52F8
POP HL E1
Restore Register Pair HL from the stack.
52F9
POP DE D1
Restore Register Pair DE from the stack.
52FA
RET C9
RETurn to the caller. The Z FLAG (set by the successful write/verify path) indicates success; otherwise Register A holds error code 15H.

52FBH - AUTO Message Text

The three carriage-return-terminated message strings displayed by @LOGOT (447BH). These are data, not code; the disassembler renders the bytes as spurious instructions. The strings are reached through the overlapping LD IX / LD HL entry points at 5280H, 5284H, and the direct load at 527DH.

52FB-531F
DEFM 'Destination disk is write protected!' 44 65 73 74 ...
Error message shown when the target diskette cannot be written (reached via 5281H). The final byte at 531FH is 0DH (carriage return) terminating the string for @LOGOT.
5320-5336
DEFM 'Command line too long!' 43 6F 6D 6D ...
Error message shown when the new auto command exceeds the 32-byte field (reached via 527DH). Terminated by 0DH at 5336H.
5337-5351
DEFM 'No AUTO command installed!' 4E 6F 20 41 ...
Message shown for the "AUTO=" re-execute form when no auto command is stored (reached via 5285H). Terminated by 0DH at 5350H; the byte at 5351H is the 00H module pad ending the overlay image.