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

Page Customization

Introduction/Summary

LDOS 5.3.1 SYS6/SYS Disassembly: Library A (Model I)

SYS6/SYS is Library A of LDOS 5.3.1: fifteen members, each a separate program that carries out one or more of the commands typed at LDOS Ready (or passed by a program through 4451H). Twenty commands are served: MEMORY, DIR, KILL, LIB, CLS, TOF, DO, SPOOL, APPEND, COPY, LIST, RENAME, DEVICE, LINK, RESET, ROUTE, SET, FILTER, LOAD and RUN. Fourteen members load at 5200H, directly above the overlay area 4E00H-51FFH; the member of FILTER and SET loads at 5A00H. Only one member is in memory at a time, and the next library command loads its own member over it.

The file is 15387 bytes: a header record (05H) with the name sys6, a copyright record (1FH) with the text (C) 1982-4,6,90 MISOSYS, twenty member headers (08H), a record 0AH that ends the headers, then the fifteen members, each ended by a record 04H, and a transfer record (02H) for 0000H. Each member header holds six bytes: the member byte, the entry address, and the record and byte of the file where the member's load blocks begin. Members that serve two or three commands have one header for each command, all pointing at the same place in the file with different entry addresses. The members hold 14851 loaded bytes.

How a Member Is Run

SYS1/SYS looks the command word up in its command table (4EBDH) and issues request 88H (Library A) through RST 28H with Register B = the member byte of the table entry. The supervisor dispatcher of SYS0/SYS hands the request to the overlay loader (4BF5H), which finds the member header whose member byte equals Register B, reads the member's load blocks from the record and byte it names, and calls the entry address it names with Register Pair HL at the text after the command word. The member's RET goes to 4BE7H in the dispatcher and from there back to SYS1/SYS's caller: @EXIT for a typed command, the program for a command passed through 4451H.

CommandMember ByteMemberEntry
MEMORY1EH15200H
DIR21H25200H
KILL18H35200H
LIB19H45200H
CLS24H45203H
TOF25H45206H
DO91H55200H
SPOOLA2H65200H
APPEND31H75203H
COPY32H75200H
LIST41H85200H
RENAME53H95200H
DEVICE61H105200H
LINK62H115200H
RESET63H125200H
ROUTE64H135200H
SET65H145A01H
FILTER66H145A00H
LOAD81H155203H
RUN82H155200H

What the Members Have in Common

The members that can fail save the Stack Pointer into the operand of their own LD SP at the exit, so that an error anywhere can put the stack back and end the command. The parameters in brackets are read by @PARAM (4476H) against a table in the member, and each value goes straight into the operand of the instruction that uses it: a keyword alone stores FFFFH, KEY=N stores 0000H, KEY=value stores the value, and a quoted text stores the address of the text. The Variables section lists these cells for every member.

A member ends with Register Pair HL = 0000H when the command was carried out and FFFFH when it failed. With FFFFH during a JCL job (bit 5 of SFLAG$, 430FH) the member jumps to @ABORT (4030H) instead, so that the job stops. Errors go through @ERROR (4409H) with bits 7 and 6 of the error number set: the short message, then a return to the member. The commands that change memory or the devices' drivers refuse to run unless they came from LDOS command level (MEMORY for CLEAR and HIGH, SPOOL for an install, LINK, RESET of the whole system, ROUTE to a file, FILTER and SET): @EXIT (402DH, or its saved copy at 4065H during a JCL job) must not be a JP, and bit 1 of 4758H (a command line from a program) must be clear.

Several members choose one of their messages with a chain of LD IX instructions: each entry of the chain is the LD HL hidden after the DDH prefix of an LD IX, so the code that jumps into the chain loads Register Pair HL with one message and the LD IX instructions after it load Index Register IX to no purpose.

The Members

Member 1, MEMORY (5200H-5603H): shows HIGH$ and the modules above it in a directory of the high memory, reserves memory below HIGH$ with HIGH (a header of ten bytes is written for the block), shows and changes memory with ADD, WORD and BYTE, fills 5200H up to HIGH$ with 00H with CLEAR, and jumps to an address with GO.

Member 2, DIR (5200H-5BE0H): lists the directory of one drive or every drive: a drive line with the diskette's name and date, the cylinders, density and sides, the free and total space and the free and total directory records, then the files that match the partspec, with their attributes and, in the full display, their access, record length, records, end of file, extents, size, date and time. SORT (on unless SORT=N) sorts the files by name with a Shell sort in the memory above 5E00H; DATE limits the files to a range of dates; I, S and MOD choose which files are shown.

Member 3, KILL (5200H-5370H): deletes each file named with @KILL (after checking that its access allows it) or takes a device (*XX) out of its device control block, showing Deleting: and the name for each.

Member 4, LIB, CLS and TOF (5200H-52D2H): LIB lists the commands of Library A and Library B from SYS1/SYS's command table; CLS clears the screen; TOF sends the printer to the top of the next form.

Member 5, DO (5200H-5D00H): the JCL compiler. It reads a /JCL file, keeps or drops its lines by the //IF, //ELSE and //END directives, puts the values of the parameters given after DO into them, follows //INCLUDE, //SET, //RESET, //ASSIGN and //QUIT, writes the result to SYSTEM/JCL on the first writable drive and starts it through request 9DH, which SYS11/SYS carries out. DO * runs the SYSTEM/JCL already there, DO = runs a file without compiling it and DO $ compiles without running.

Member 6, SPOOL (5200H-59DAH): puts a printer spooler into high memory: a module of 016BH bytes that becomes the device's driver, a queue block, a table of slots for the memory pages (MEM) and the sectors of a spool file (DISK), and the pages. The despool task in task slot 9 sends up to two characters on each tick, and the keyboard task hook @KITSK moves pages between memory and the spool file. PAUSE, RESUME, CLEAR and OFF work on a spooler already installed.

Member 7, COPY and APPEND (5200H-5A6DH): copies a file whole sectors at a time through the memory from 5B00H up, or byte by byte when a device is at either end, with CLONE (the source's attributes, date and password kept, on unless CLONE=N), LRL, ECHO and X (a copy between two diskettes on one drive, with prompts for the source, the destination and the system diskette). APPEND adds the source to the end of an existing file, with STRIP and ECHO.

Member 8, LIST (5200H-563BH): lists a file as text (with line numbers for NUM, from LINE on, tabs expanded to TAB, bit 7 kept with ASCII8) or with HEX as records in hexadecimal and characters (from REC on, in the record length of LRL), on the screen with a pause at each page or with P on the printer.

Member 9, RENAME (5200H-53A4H): gives a file a new name and extension in its directory record and puts the new name's hash into the hash index table; the new name must not exist and stays on the old file's drive.

Member 10, DEVICE (5200H-56DFH): shows the drives (their code tables, diskettes and timing), the device control blocks with what each is assigned, linked or routed to, and the options that are on with the system files kept in memory.

Member 11, LINK (5200H-53A1H): puts a module of 41 bytes in high memory that makes the first device's output go to the second device too, and lets the first device take input from the second.

Member 12, RESET (5200H-54D5H): resets one device to the driver the system started with, resets the whole system (devices, options, hooks, task slots and the memory above HIGH$ when no task runs there), or changes the record length or date of a file's directory record (LRL, DATE).

Member 13, ROUTE (5200H-53F3H): routes a device to another device, to a file (through a module $R and the device's letters in high memory, the file opened at its end unless REWIND is given), or to nothing (NIL).

Member 14, FILTER and SET (5A00H-5B43H): loads a filter (/FLT) or a driver (/DVR) file for a device with @LOAD and jumps to it with Register Pair DE at the device's control block, so that the loaded code installs itself.

Member 15, RUN and LOAD (5200H-536FH): runs or loads a program; with X the program is loaded from a diskette put in for it, with prompts for that diskette and then the system diskette around the load.

About This Page

Every loaded byte of the file is shown, 14851 bytes, member by member in the order of the file. Since fourteen members share the addresses from 5200H up, the row ids carry the member number (ov1-5200H is 5200H of member 1), and every jump and address in a member's comments refers to that member. The bytes a member uses as work areas above its loaded bytes (such as DIR's sort buffer from 5E00H) are described in the comments, not shown as rows. Many instructions have operands that the member itself stores into while it runs, for parameter values, counters and saved values; the comment of such an instruction gives the value in the file and what changes it.

Instructions entered in their middle: 5495H of MEMORY, 5A2DH of DIR, 5595H and 579CH-57B0H of DO, 561BH-562FH, 5654H and 5658H of SPOOL, 5816H and 5823H-582FH of COPY, 533CH and 54E7H of LIST, 5358H and 535CH of RENAME, 5331H and 5335H of LINK, 5351H and 535EH of ROUTE, 5A01H (the entry of SET), 5AD3H and 5AD7H of FILTER and SET, and 52E1H of RUN and LOAD. In ROUTE the code at 5264H-526DH is never reached (5261H). The texts Start = (55ABH of MEMORY) and ms (565DH of DEVICE) are in the file but no code uses them.

Memory Map

The Records of the File

The file is 15387 bytes. The overlay loader reads the member headers to find a member, then reads the member's load blocks from the record and byte its header names, up to its record 04H.

File OffsetContents
0000HRecord 05H, 6 bytes: the file name sys6 and two spaces.
0008HRecord 1FH, 23 bytes: the text (C) 1982-4,6,90 MISOSYS.
0021H-00C0HTwenty member headers, record 08H of 6 bytes each: the member byte, the entry address, and the record and byte where the member begins.
00C1HRecord 0AH, 1 byte (00H): the end of the member headers.
00C4HRecord 04H, 1 byte (00H): the end of member 0, which has no load blocks.
00C7H-04E1HMember 1 (MEMORY): 5 load blocks, then record 04H.
04E2H-0EEDHMember 2 (DIR): 10 load blocks, then record 04H.
0EEEH-1069HMember 3 (KILL): 2 load blocks, then record 04H.
106AH-1143HMember 4 (LIB, CLS, TOF): 1 load block, then record 04H.
1144H-1837HMember 5 (DO): 10 load blocks, then record 04H.
1838H-1FE7HMember 6 (SPOOL): 10 load blocks, then record 04H.
1FE8H-27E5HMember 7 (COPY, APPEND): 10 load blocks, then record 04H.
27E6H-2C38HMember 8 (LIST): 5 load blocks, then record 04H.
2C39H-2DE8HMember 9 (RENAME): 2 load blocks, then record 04H.
2DE9H-32BBHMember 10 (DEVICE): 6 load blocks, then record 04H.
32BCH-3468HMember 11 (LINK): 2 load blocks, then record 04H.
3469H-374DHMember 12 (RESET): 3 load blocks, then record 04H.
374EH-394CHMember 13 (ROUTE): 2 load blocks, then record 04H.
394DH-3A9BHMember 14 (FILTER, SET): 2 load blocks, then record 04H.
3A9CH-3C16HMember 15 (RUN, LOAD): 2 load blocks, then record 04H.
3C17HRecord 02H, 2 bytes: the transfer address 0000H, not used, since every member is run through its header.

The Members

The loaded addresses of each member, its load blocks joined where they follow each other. Members 5, 6, 7 and 10 leave gaps between their blocks: work areas whose bytes the file does not load.

MemberFile OffsetLoadedSizeCommands
100C7H5200H-5603H1028 bytesMEMORY
204E2H5200H-5BE0H2529 bytesDIR
30EEEH5200H-5370H369 bytesKILL
4106AH5200H-52D2H211 bytesLIB, CLS, TOF
51144H5200H-57BBH
580DH-5907H
59A8H-59AAH
59CAH-59D7H
5D00H-5D00H
1737 bytesDO
61838H5200H-57B7H
57D8H-584DH
5858H-58F5H
58F8H-59AEH
59D9H-59DAH
1925 bytesSPOOL
71FE8H5200H-5985H
59C6H-59C9H
5A25H-5A6DH
2003 bytesCOPY, APPEND
827E6H5200H-563BH1084 bytesLIST
92C39H5200H-53A4H421 bytesRENAME
102DE9H5200H-566DH
5696H-56DFH
1208 bytesDEVICE
1132BCH5200H-53A1H418 bytesLINK
123469H5200H-54D5H726 bytesRESET
13374EH5200H-53F3H500 bytesROUTE
14394DH5A00H-5B43H324 bytesFILTER, SET
153A9CH5200H-536FH368 bytesRUN, LOAD

Sections of the Disassembly

MemberAddressContents
15200HMember 1 (MEMORY): Entry, Parameters and CLEAR
15224HThe CLEAR Routine, Copied to 4200H and Run There
1523BHADD, WORD and BYTE: Show and Change Memory
15294HHIGH: Reserve Memory below HIGH$
152CFHNo HIGH: Show HIGH$, or Start the Directory
15308HThe Module Loop: One Line for Each Module above HIGH$
15357HBuild the Summary Line and the Column Headings
153A4HBytes without a Header: Find the Next Module
153FFHHelper: Write X'nnnn' into the Line
15411HHelper: Write a Number in Decimal
1542AHHelper: Send the Line, Blank It and Count It against the Page
1545FHGO and the Exit
1547AHCheck for LDOS Command Level
154A0HParameter Error
154A9HMEMORY Data: the Header of a Reserved Block
154B3HMEMORY Data: Messages
154E9HMEMORY Data: the Parameter Table
1555AHMEMORY Data: the High Line and the ADD Line
1558FHMEMORY Data: the Directory Texts
25200HMember 2 (DIR): Entry, the File Specification and the Drive
25252HSet Up: SORT, the Sort Buffer, P and DATE
252B4HOne Drive: Check It, Read the Allocation Table, Count the Free Granules
25308HThe Drive Line: Cylinders, Density, Sides, Total Space and Directory Size
253DEHThe Next Directory Record and the End of the Drive
2541BHA Drive That Is Not Ready
2542DHRead a Directory Record and Decide Whether It Is Shown
25509HShow One File: Name, Extension and Attributes
255C5HThe Detail of a File: Access, LRL, Records, EOF, Extents, Size, Date and Time
25709HThe Size of a File: the Sorted Key or the Extents
2577CHOutput Helpers: a Text, a Character, a Space
25796HGranules to Kilobytes
257C2HCopy a Name Field into a Mask
257DDHA Directory Date as One Word
25806HRead a Date Argument MM/DD/YY
25856HRead Three Two Digit Fields
25888HDecimal Output: Three, Five or Two Digits
258C7HBREAK and the Pause Key
258F2HCount a Line against the Page
25944HSORT: Sort the Collected Records by Name and Show Them
25997HThe Shell Sort of the Pointer Table
25A29HErrors and the Common Exit
25A42HDIR Data: the Parameter Table
25AABHDIR Data: the Headings, the Access Codes and the Drive Line
25B3CHDIR Data: the Detail Template, the Masks and the Days of the Months
25B82HDIR Data: Messages, Month Names and the Date Mode
35200HMember 3 (KILL): Entry and the Loop over the File Specifications
3522EHOne File Specification: Open the File, Check the Access, Delete It
3527DHHelper: Display the Deleting Line
35286HRemove a Device
35302HHelpers: Clear Eight Bytes, Copy a Specification without Its Password
3531FHHelper: BREAK
35341HErrors
35354HKILL Data: Messages
45200HMember 4 (LIB, CLS, TOF): the Three Entries
45222HLIB: List the Library Commands
452BFHHelper: Display Spaces
452C7HLIB Data: the Heading
55200HMember 5 (DO): Entry, Open the JCL File and Create SYSTEM/JCL
55260HThe Command Tail: Parameters and the Keyin Prompt
5528BHPop an Included File off the Include Stack
552A5HRead the Next Source Line
55314HDO = : Run a Named File without Compiling
5532BHDO * : Run the Current SYSTEM/JCL File
55330HHelper: Copy the SYSTEM/JCL Specification
5533CHThe Parameter List: Tokens and Their Values
55384HRead Lines, Finding the Named Label
553B7HThe Compile Loop: Read a Line and Compile It
5540AHHelper: A Hexadecimal Digit to Its Value
5541BHSubstitute a Parameter Value
5544EHDirectives: the Nesting Check and the Error Line
5546FHA Directive Line: // Dispatch
5549DHRead One Source Line into 59D8H
554CEHWrite the Compiled Line to SYSTEM/JCL
554FAHDO Data: the Conditional Directive Table
55510HDO Data: the Other Directive Table
55543HIF: Evaluate the Condition and Push the Block State
5556BHELSE: Flip the Block State
55576HEND: Pop the Block
5557FHEvaluate a Term of the Condition
55589HEvaluate One Token
555A5HSET: Give a Token the Value True
555B4HRESET: Give a Token the Value False
555C6HASSIGN: Give a Token a Character String Value
555DFHINCLUDE: Compile Another File in Place
55614HQUIT: End the Compile
55620HRead a Token or a Value String
55667HThe Character Reader of a Token or Value
556CDHStore a Token in the Token Table
556DFHStore a Value String against a Token
556EAHLook for a Token in the Token Table
556FBHSearch a Directive Table
55716HThe Name Table Search
55766HHelper: Write a Number in Decimal
5577FHHelper: Test for a Space or a Comma
55785HHelper: Fold a Small Letter to a Capital
5578FHParameter Error and the Message Selector
5580DHDO Data: Launch Stubs and the SYSTEM/JCL Name
55825HDO Data: the Messages
55906HDO Data: Stacks and the Error Line
55D00HDO Data: the Token Table
65200HMember 6 (SPOOL): Entry and an Installed Spooler
6523FHCheck for LDOS Command Level
65259HRead the Device and the Spool File
652C6HRead the Parameters
652EBHInstall: Find the Device
6533AHInstall: Make the Spool File
6538DHInstall: Lay Out the Spooler's Memory
65488HInstall: Move the Module and Start It
6550FHPAUSE and RESUME
65539HOFF: Turn the Spooler Off
655A7HCLEAR: Empty the Queue
655F1HFind a Device Control Block by Name
65617HThe Messages and the Exit
65664HSPOOL Data: the Messages
657B2HSPOOL Data: the RESET Line and the Device
657D8HSPOOL Data: Default Names and the Parameter Table
65844HThe Spooler Module: Header and Driver Entry
65863HThe Spooler Module: Queue a Character
658F6HThe Spooler Module: the Despool Task
6593CHThe Spooler Module: the Keyboard Task Part
65942HThe Spooler Module: Change the Page Being Sent
659AFHThe Spooler Module: the Queue Block
75200HMember 7 (COPY, APPEND): the Two Entries and APPEND
752B1HCOPY: Read the Specifications and Parameters
7533DHCOPY: Open the Source and the Destination
753DCHCopy Whole Sectors through Memory
75498HWrite the Last Pages
754B8HSet the Highest Page and Clear the Keys
754D4HGive the Destination Its Space
754F4HCOPY with a Device: Open Both Ends
75519HCopy Byte by Byte
75564HKeep a Destination as It Was Typed
7558EHComplete the Destination from the Source
755FEHOpen a File or Device and Check Its Access
756A1HDisplay the Banner
756BDHThe Record Length of a File
756CCHKeep the Source's Directory Bytes
756E9HBREAK and the Pause
7570CHThe Diskette Prompts of X
7576BHFlash a Prompt until ENTER
757C5HThree Overlay Loads, a Device Test, the Date Layout Test and the GAT Read
757FFHOpen the Source or the Destination
75810HErrors and the Message Selector
7583BHCOPY Data: the Messages
75986HCOPY Data: the Control Blocks and the Names
75A25HCOPY Data: the Parameter Table
85200HMember 8 (LIST): Entry, Parameters and the File
8527EHRecord Length, TAB, Device and Mode
85309HList the Text
85399HList in Hexadecimal
854A8HSend a Character and Count the Page
85525HBREAK and the Pause
85559HThe Line Number
85583HErrors and the Exit
85598HLIST Data: Texts and the Parameter Table
8563CHLIST Data: the Work Areas
95200HMember 9 (RENAME): Read the Two Names
952D3HKeep the New Name as It Was Typed
952F0HComplete the New Name from the Old
9534BHErrors and the Messages
95368HRENAME Data
105200HMember 10 (DEVICE): Parameters and the Drives
105365HDEVICE: the Device Control Blocks
10541BHNumbers and Names for the Lines
10545AHDEVICE: the Options and the System Modules
105528HShow and Print
1055AAHDEVICE Data: Texts and the Parameter Table
115200HMember 11 (LINK): Link Two Devices
1152C7HThe Link Module
1152F0HFind a Device Control Block by Name
115326HErrors and the Messages
115341HLINK Data
125200HMember 12 (RESET): Read What to Reset
125240HReset One Device
125290HReset the Whole System
125374HChange a File's Directory Record
1253C1HClose a Routed File
125416HDFLAG$ and the Templates
12545DHRESET Data: the Parameter Table, Messages and Control Blocks
135200HMember 13 (ROUTE): Read the Two Specifications
135255HPoint the Device at Its Destination
13528CHRoute a Device to a File
135303HThe Device's Control Block
135390HROUTE Data
145A00HMember 14 (FILTER, SET): Load a Filter or a Driver
145AA2HFind a Device Control Block by Name
155200HMember 15 (RUN, LOAD): Load a Program from Another Diskette
155222HFlash a Prompt until ENTER
15527CHRUN
155293HRead X and the File
1552CCHLoad the Program
155302HRUN and LOAD Data

Routines Outside the File That SYS6/SYS Calls

The routines of the ROM, SYS0/SYS and SYS2/SYS the members call or jump to, and which members use each. Requests through RST 28H: 84H, 85H and 8AH (SYS2/SYS, SYS3/SYS and SYS8/SYS loaded into the overlay area, function 00H doing nothing) in COPY, 84H in RUN and LOAD, D4H (the name hash of SYS2/SYS) in RENAME, BCH (the module search of SYS10/SYS) in LINK and ROUTE, 9DH (SYS11/SYS runs SYSTEM/JCL) in DO.

AddressRoutineMembers
0013HROM: @GET, a byte from the device or file at Register Pair DE.5, 7, 8, 11
001BHROM: @PUT, a byte to the device or file at Register Pair DE.5, 7, 8, 11
0023HROM: a control request to the device at Register Pair DE (the printer's status for TOF).4, 6
002BHROM: look at the keyboard once, Register A = the key or 00H.2, 3, 7, 8, 10, 15
0033HROM: display the character in Register A.2, 4, 5, 7, 8, 10, 15
003BHROM: print the character in Register A.2, 4, 10
0040HROM: @KEYIN, read a line from the keyboard.5
0049HROM: wait for a key.1, 2, 6, 8, 10
0060HROM: a delay of Register Pair BC counts.3, 7, 15
01C9HROM: clear the screen.1, 2, 8, 10
4030H@ABORT: end the command and a JCL job.1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
4408HThe RET Z at the end of @CMNDI, before @ERROR.15
4409H@ERROR: report the error in Register A.1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
4410H@ADTSK: put a task into a task slot.6
4413H@RMTSK: empty a task slot.6, 12
441CH@FSPEC: a file or device specification into a control block.3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15
4420H@INIT: open a file, making it when it is not there.5, 6, 13
4424H@OPEN: open a file or device.3, 5, 7, 8, 9, 12
4428H@CLOSE: close a file.5, 7, 12, 13
442CH@KILL: delete a file.3
4430H@LOAD: load a program file.14, 15
4433H@RUN: load and run a program file.15
4436H@READ: read a record.6, 7
4439H@WRITE: write a record.6, 7
443FH@REW: back to the first record.6, 7
4442H@POSN: position to a record.6, 7, 8
4445H@BKSP: back one record.7
4448H@PEOF: position to the end of the file.7, 13
444EH@WEOF: set the end of the file.6
4451HRun a command line through SYS1/SYS.6
4454H@RREAD: read the current sector again.5
4467H@DSPLY: display a line.1, 2, 3, 4, 5, 7, 10, 12, 15
446AH@PRINT: print a line.1, 2, 10
4473H@FEXT: give a specification a default extension.5, 6, 8, 14, 15
4476H@PARAM: read the parameters in brackets.1, 2, 6, 7, 8, 10, 12, 13, 15
4479H@MSG: send a line to a device.8
447BH@LOGOT: display a line and send it to the job log.1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15
447EH@LOGER: send a line to the job log.5
44B8H@CKDRV: check that a drive is ready.2, 5, 7, 10
44BBH@FNAME: the name of a file from its directory entry.10
44C1H@MULT: multiply Register Pair HL by Register A.2
44C4H@DIV: divide Register Pair HL by Register A.1, 2, 5, 8
4777HRDSECT: read a sector.12
478FHGETDCT: Index Register IY at a drive code table.2, 10
4B10HDIRRD: read the directory sector of a record.2, 6, 7, 9, 12
4B1FHDIRWR: write the directory sector back.6, 7, 9, 12
4B45HRDSSEC: read a directory sector.2, 7, 10
4B65HDIRCYL: the directory cylinder of a drive.2, 7
4D76HWrite Register Pair DE as four hexadecimal digits.1, 8, 10
4D7BHWrite Register A as two hexadecimal digits.8
51BDHSYS2/SYS: read the hash index table.9
51BEHSYS2/SYS: write the hash index table back.9

Variables

Parameter Cells

The operands that @PARAM fills from each member's parameter table. KILL, LIB, DO, RENAME, LINK, FILTER and SET have no parameter table; DO reads its own parameters into the token table at 5D00H.

Address
Size
MemberKeywordContents
5295H-5296H
2 bytes
1HIGH or HThe operand of the LD BC at 5294H.
523CH-523DH
2 bytes
1ADD or AThe operand of the LD HL at 523BH.
525FH-5260H
2 bytes
1WORD or WThe operand of the LD DE at 525EH.
5266H-5267H
2 bytes
1BYTE or BThe operand of the LD DE at 5265H (00FFH in the file).
5460H-5461H
2 bytes
1GO or GThe operand of the LD HL at 545FH (FFFFH in the file).
520EH-520FH
2 bytes
1CLEAR or CThe operand of the LD DE at 520DH.
542EH-542FH
2 bytes
1PRINT or PThe operand of the LD DE at 542DH, which sends every line to the printer too.
559AH-559BH
2 bytes
2AThe operand of the LD DE at 5599H (FFFFH in the file, the full display; A=N gives the short display).
5464H-5465H
2 bytes
2I or INVThe operand of the LD DE at 5463H: invisible files are shown.
578FH-5790H
2 bytes
2PThe operand of the LD DE at 578EH: every line is printed too, without pauses.
5456H-5457H
2 bytes
2S or SYSThe operand of the LD DE at 5455H: system files are shown.
58FFH-5900H
2 bytes
2NThe operand of the LD DE at 58FEH: the display does not pause after each page.
5274H-5275H
2 bytes
2DATE or DThe operand of the LD HL at 5273H. DATE stores the address of the text inside its quotes.
546CH-546DH
2 bytes
2MOD or MThe operand of the LD DE at 546BH: only files with the mod flag are shown.
54CFH-54D0H
2 bytes
2SORT or OThe operand of the LD DE at 54CEH (FFFFH in the file: sorted; SORT=N shows the files in directory order).
538EH-538FH
2 bytes
6MEM or MThe operand of the LD BC at 538DH (0001H in the file).
5356H-5357H
2 bytes
6DISK or DThe operand of the LD BC at 5355H (0004H in the file).
52D0H-52D1H
2 bytes
6OFF or NThe operand of the LD DE at 52CFH.
52DEH-52DFH
2 bytes
6PAUSE or PThe operand of the LD DE at 52DDH.
52D7H-52D8H
2 bytes
6RESUME or RThe operand of the LD DE at 52D6H.
52E5H-52E6H
2 bytes
6CLEAR or CThe operand of the LD DE at 52E4H.
5359H-535AH
2 bytes
7LRL or LThe operand of the LD BC at 5358H (FF00H in the file).
544BH-544CH
2 bytes
7CLONE or CThe operand of the LD DE at 544AH (FFFFH in the file: on).
52D4H-52D5H
2 bytes
7XThe operand of the LD DE at 52D3H.
5269H-526AH
2 bytes
7STRIP or SThe operand of the LD DE at 5268H.
5545H-5546H
2 bytes
7ECHO or EThe operand of the LD DE at 5544H.
5333H-5334H
2 bytes
8ASCII8 or A8The operand of the LD DE at 5332H.
521EH-521FH
2 bytes
8CThe operand of the LD HL at 521DH (FFFFH in the file).
52D5H-52D6H
2 bytes
8HEX or HThe operand of the LD BC at 52D4H.
53B9H-53BAH
2 bytes
8LRL or LThe operand of the LD BC at 53B8H (FF00H in the file).
52F0H-52F1H
2 bytes
8LINEThe operand of the LD BC at 52EFH (0001H in the file).
531EH-531FH
2 bytes
8NUMThe operand of the LD BC at 531DH.
54F6H-54F7H
2 bytes
8NThe operand of the LD DE at 54F5H: the listing does not stop at each page.
539AH-539BH
2 bytes
8REC or RThe operand of the LD BC at 5399H.
52B7H-52B8H
2 bytes
8PThe operand of the LD BC at 52B6H.
5343H-5344H
2 bytes
8TAB or TThe operand of the LD DE at 5342H (0008H in the file).
5366H-5367H
2 bytes
10BYTEIO or BThe operand of the LD HL at 5365H (FFFFH in the file).
5218H-5219H
2 bytes
10DRIVES or DThe operand of the LD HL at 5217H (FFFFH in the file).
554CH-554DH
2 bytes
10NThe operand of the LD DE at 554BH, which 5210H overwrites with P.
553BH-553CH
2 bytes
10PThe operand of the LD DE at 553AH.
545BH-545CH
2 bytes
10STATUS or SThe operand of the LD HL at 545AH (FFFFH in the file).
5394H-5395H
2 bytes
12LRL or LThe operand of the LD DE at 5393H (FF00H in the file).
539DH-539EH
2 bytes
12DATE or DThe operand of the LD DE at 539CH (FF00H in the file).
5223H-5224H
2 bytes
13NILThe operand of the LD BC at 5222H.
52CDH-52CEH
2 bytes
13REWIND or RThe operand of the LD BC at 52CCH.
52BDH-52BEH
2 bytes
15XThe operand of the LD DE at 52BCH.

Cells Outside the File

Address
Size
Contents
4015H-402CH
24 bytes
KIDCB$, DODCB$ and PRDCB$, the device control blocks of KI, DO and PR (8 bytes each, the name at +06H-+07H), searched by name in members 3, 6, 10, 11, 12, 13, 14.
402DH-4032H
6 bytes
@EXIT and @ABORT: their first byte is a JP while a program has taken them over, the test for LDOS command level (members 1, 5, 6, 11, 12, 13, 14); DO puts its own requests over them for a JCL job.
4049H-404AH
2 bytes
HIGH$, the highest address free for programs (members 1, 2, 6, 7, 11, 12, 13).
4065H-406AH
6 bytes
The bytes of 402DH-4032H that SYS11/SYS keeps during a JCL job (members 1, 5, 6, 11, 12, 13, 14); DO stores them there.
4200H-42FFH
256 bytes
The system buffer: directory sectors, the allocation table (42CDH-42DFH: the configuration byte, the diskette's password hash, name and date) and routines copied there to run (members 1, 2, 5, 6, 7, 10, 12).
4300H-4302H
3 bytes
@KITSK, the keyboard task hook: SPOOL makes it a jump into its module.
4303H
1 byte
@ICNFG: RESET stores C9H, a RET.
430FH
1 byte
SFLAG$: bit 5 a JCL job (every member that can fail), bit 2 a program load (FILTER and SET, RUN and LOAD), bit 3 FAST, bit 4 BREAK disabled (DEVICE), bit 0 cleared by RESET.
4310H-4311H
2 bytes
The hook of DEBUG for a key it does not know: RESET puts back 4876H.
4315H
1 byte
The BREAK trap switch: DO stores C9H, the trap off.
4318H-4357H
64 bytes
INBUF$, the command line buffer: DO reads a line of up to 63 characters into it for a semicolon in the command line of DO, which asks for more of the line with a question mark.
4358H-4377H
32 bytes
JFCB$, the control block of SYSTEM/JCL (DO).
43B8H-43BDH
6 bytes
KISV$, DOSV$ and PRSV$, the drivers of KI, DO and PR that the boot found (RESET).
43BEH-43BFH
2 bytes
KIJCL$, the keyboard driver while a JCL job feeds the keyboard (members 11, 12, 13).
43C0H-43FFH
64 bytes
The second table of device control blocks: JL, SI, SO and five spare blocks from 43D8H (members 3, 6, 10, 11, 12, 13, 14).
4403H-4404H
2 bytes
The top of memory (MEMORY, RESET).
441FH
1 byte
DFLAG$, the device flags: bit 0 the spooler, 1 TYPE, 2 JKL, 3 PR/FLT, 4 KI/DVR, 5 MiniDOS, 6 KSM, 7 Graphic (members 6, 10, 12).
4423H
1 byte
KFLAG$: bit 0 BREAK, bit 1 the pause, bit 2 ENTER, bit 4 despooling on (members 2, 3, 6, 7, 8, 10, 15).
442FH
1 byte
MFLAG$, the machine flags: RESET tests bit 0 to choose which drive tables of the system information sector it copies to DCT$.
443AH-443BH
2 bytes
The address of the @WRITE vector: 48E6H when writes are verified (DEVICE).
4480H-449FH
32 bytes
CFCB$, the control block of a program (RUN and LOAD).
44FDH
1 byte
The end of @LOGER: RESET stores C9H, a RET.
4500H-4517H
24 bytes
The task table, the address of each slot's task block: SPOOL uses slot 9 (4512H), RESET looks at every slot.
45DAH
1 byte
The clock task after midnight: RESET stores C9H, a RET.
46FDH
1 byte
The patch byte of the disk driver, not 00H when SMOOTH is on (DEVICE).
4700H-474FH
80 bytes
DCT$, the eight drive code tables of 10 bytes: DIR and DEVICE read them through GETDCT, RESET copies them from the system information sector of drive 0.
4758H
1 byte
The command interpreter's status: bit 1 a command line from a program (members 1, 2, 6, 7, 11, 12, 13, 14), bit 3 set by FILTER and SET.
475DH
1 byte
The date stamping flags, bit n for drive n (DIR, COPY).
4BCFH-4BD0H
2 bytes
The operand of the JP P in the supervisor dispatcher: RESET puts back 4BEFH.
4BDFH-4BE0H
2 bytes
The operand of the overlay loader's CALL in the supervisor dispatcher: 4BF5H while no system files are kept in memory (DEVICE, RESET).
4DF0H-4DF1H
2 bytes
The address of an installed spooler's parameter block (SPOOL, RESET).
4DF6H-4DF7H
2 bytes
The module address of PR/FLT (SPOOL).
4EBDH
8 bytes an entry
SYS1/SYS's command table, read by LIB.
51E1H, 51EAH-51F4H
12 bytes
Cells of SYS2/SYS: the old name's hash and the new name packed (RENAME).

Disassembly

5200H - Member 1 (MEMORY): Entry, Parameters and CLEAR

The MEMORY command (library member 1EH). SYS1/SYS's command loop issues request 88H with Register B = 1EH; the overlay loader of SYS0/SYS (4BF5H) loads this member at 5200H-5603H and the supervisor dispatcher calls 5200H with Register Pair HL at the command's parameters. The parameters are read by @PARAM (4476H) straight into the operands of the instructions that use them (table at 54E9H). CLEAR (5214H) fills 5200H up to HIGH$ with 00H; ADD, WORD and BYTE (523BH) show and change memory; HIGH (5294H) reserves memory below HIGH$; with neither, MEMORY shows HIGH$ or lists the modules above it (52CFH); GO (545FH) jumps to an address last.

5200
LD (546CH),SP ED 73 6C 54
Store the Stack Pointer at 546CH, the operand of the LD SP at 546BH: the exit puts the stack back to this depth whatever the member has pushed, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,54E9H 11 E9 54
Point Register Pair DE to 54E9H, the parameter table of MEMORY (HIGH, H, ADD, A, WORD, W, BYTE, B, GO, G, CLEAR, C, PRINT, P).
5207
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL (the text after MEMORY) against the table at Register Pair DE. Each value is stored at the address the table names: here the operands of the LD instructions below. A keyword given without a value stores FFFFH.
520A
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 54A0H to report error 2CH (parameter error) and end the command.
520D
LD DE,0000H 11 00 00
Load Register Pair DE with the CLEAR parameter, the operand at 520EH-520FH: 0000H in the file, FFFFH when CLEAR (or C) was given.
5210
LD A,D 7A
Copy Register D (the high byte of the CLEAR parameter) into Register A.
5211
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when the CLEAR parameter is 0000H, not given.
5212
If the Z FLAG is set (no CLEAR), JUMP to 523BH for ADD, WORD and BYTE.
5214
GOSUB to 547AH, which returns only when the command was typed at LDOS command level; otherwise it reports Can't -- Only valid at LDOS command level and ends the command.
5217
LD HL,5224H 21 24 52
Point Register Pair HL to 5224H, the 23 byte routine that clears memory. It must run outside 5200H-HIGH$, since it clears this member too.
521A
LD DE,4200H 11 00 42
Point Register Pair DE to 4200H, the system buffer, where the routine is copied and run.
521D
PUSH DE D5
Save Register Pair DE (4200H) to the stack: the RET below goes there.
521E
LD BC,0017H 01 17 00
Load Register Pair BC with 0017H, the 23 bytes of the routine (5224H-523AH).
5221
LDIR ED B0
Copy the routine: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 5224H-523AH go to 4200H-4216H.
5223
RET C9
RETurn into the copy at 4200H (the address pushed above). The routine ends with JP 402DH, so CLEAR does no more than clear memory.

5224H - The CLEAR Routine, Copied to 4200H and Run There

These 23 bytes are copied to 4200H-4216H by 5221H and run there: the addresses in the comments are those of the copy. It fills every byte from 5200H up to HIGH$ (4049H-404AH) with 00H, this member included, and leaves through @EXIT (402DH). The routine has no relative jump, so it runs the same at either address.

5224
LD HL,(4049H) 2A 49 40
At 4200H: fetch HIGH$, the highest address free for programs, from 4049H-404AH into Register Pair HL.
5227
LD DE,5200H 11 00 52
At 4203H: load Register Pair DE with 5200H, the first address cleared.
522A
PUSH DE D5
At 4206H: save Register Pair DE (5200H) to the stack, to be taken back as the start address.
522B
XOR A AF
At 4207H: clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
522C
SBC HL,DE ED 52
At 4208H: subtract Register Pair DE (5200H) from Register Pair HL (HIGH$): Register Pair HL = HIGH$ - 5200H, the bytes after 5200H up to HIGH$.
522E
LD B,H 44
At 420AH: copy Register H (the high byte of the count) into Register B.
522F
LD C,L 4D
At 420BH: copy Register L (the low byte of the count) into Register C: Register Pair BC = HIGH$ - 5200H.
5230
POP HL E1
At 420CH: restore Register Pair HL from the stack: 5200H, the first byte to clear.
5231
LD DE,5201H 11 01 52
At 420DH: load Register Pair DE with 5201H, one byte above Register Pair HL, so the LDIR spreads one byte upwards.
5234
LD (HL),00H 36 00
At 4210H: store 00H at Register Pair HL (5200H).
5236
LDIR ED B0
At 4212H: copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: each byte copies the 00H before it, so 5200H-HIGH$ all become 00H.
5238
At 4214H: JUMP to 402DH (@EXIT): the command is over and LDOS Ready follows (a program that ran MEMORY through 4451H is not returned to, since CLEAR has filled its memory with 00H).

523BH - ADD, WORD and BYTE: Show and Change Memory

With ADD=address the member shows the address in hexadecimal and decimal and the two bytes there in the order they lie in memory; WORD= stores a word at the address (low byte first) and BYTE= one byte, and the bytes are then shown again after =>. The line is built in the template at 556BH: X'aaaa' = ddddd ('bbbb' => X'bbbb'). WORD=0 and BYTE=X'FF' cannot be given: those are the values that mean not given.

523B
LD HL,0000H 21 00 00
Load Register Pair HL with the ADD parameter, the operand at 523CH-523DH: 0000H when ADD (or A) was not given, else the address.
523E
LD A,H 7C
Copy Register H (the high byte of the ADD address) into Register A.
523F
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when the address is 0000H, not given.
5240
If the Z FLAG is set (no ADD), JUMP to 5294H for HIGH.
5242
PUSH HL E5
Save Register Pair HL (the ADD address) to the stack.
5243
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the ADD address, for the hexadecimal digits.
5244
LD HL,556DH 21 6D 55
Point Register Pair HL to 556DH, the dddd after X' in the template at 556BH.
5247
GOSUB to 4D76H (SYS0/SYS) to write Register Pair DE (the address) as four hexadecimal digits at Register Pair HL (556DH-5570H).
524A
POP HL E1
Restore Register Pair HL (the ADD address) from the stack.
524B
PUSH HL E5
Save Register Pair HL (the ADD address) to the stack again.
524C
LD DE,5575H 11 75 55
Point Register Pair DE to 5575H, the five ddddd after = in the template.
524F
GOSUB to 5411H to write Register Pair HL (the address) in decimal, right justified, at 5575H-5579H.
5252
POP HL E1
Restore Register Pair HL (the ADD address) from the stack.
5253
PUSH HL E5
Save Register Pair HL (the ADD address) to the stack again.
5254
LD D,(HL) 56
Fetch the byte at the ADD address (Register Pair HL) into Register D, the first byte shown.
5255
INC HL 23
INCrement Register Pair HL to the next address.
5256
LD E,(HL) 5E
Fetch the byte at Register Pair HL (the ADD address + 1) into Register E: Register Pair DE = the two bytes in memory order.
5257
LD HL,557EH 21 7E 55
Point Register Pair HL to 557EH, the dddd after (' in the template.
525A
GOSUB to 4D76H to write Register Pair DE (the two bytes, first byte first) as four hexadecimal digits at 557EH-5581H.
525D
POP HL E1
Restore Register Pair HL (the ADD address) from the stack.
525E
LD DE,0000H 11 00 00
Load Register Pair DE with the WORD parameter, the operand at 525FH-5260H: 0000H when WORD (or W) was not given.
5261
LD A,D 7A
Copy Register D (the high byte of the WORD value) into Register A.
5262
OR E B3
OR Register E (the low byte) into Register A: the NZ FLAG is set when a WORD value was given.
5263
If the NZ FLAG is set (a WORD value), JUMP to 5273H to store it at the ADD address.
5265
LD DE,00FFH 11 FF 00
Load Register Pair DE with the BYTE parameter, the operand at 5266H-5267H: 00FFH when BYTE (or B) was not given.
5268
LD A,D 7A
Copy Register D (the high byte of the BYTE value) into Register A.
5269
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when the value does not fit in one byte.
526A
If the NZ FLAG is set (BYTE above 255), JUMP to 54A0H to report the parameter error.
526D
INC E 1C
INCrement Register E (the BYTE value): the Z FLAG is set when it was FFH, not given.
526E
If the Z FLAG is set (no BYTE), JUMP to 5286H to end the line after the bytes shown.
5270
DEC E 1D
DECrement Register E back to the BYTE value (it was raised by one for the test above).
5271
JUMP to 5276H to store the byte in Register E at the ADD address.
5273
INC HL 23
WORD: INCrement Register Pair HL to the ADD address + 1.
5274
LD (HL),D 72
Store Register D (the high byte of the WORD value) at Register Pair HL (address + 1).
5275
DEC HL 2B
DECrement Register Pair HL back to the ADD address.
5276
LD (HL),E 73
Store Register E (the low byte of WORD, or the BYTE value) at Register Pair HL, the ADD address.
5277
LD A,E 7B
Copy Register E (the byte just stored) into Register A.
5278
INC HL 23
INCrement Register Pair HL to the ADD address + 1.
5279
LD E,(HL) 5E
Fetch the byte at Register Pair HL (the ADD address + 1) into Register E, the second byte now in memory.
527A
LD D,A 57
Copy Register A (the first byte now in memory) into Register D: Register Pair DE = the two bytes in memory order.
527B
LD HL,5589H 21 89 55
Point Register Pair HL to 5589H, the dddd after => X' in the template.
527E
GOSUB to 4D76H to write Register Pair DE (the new bytes) as four hexadecimal digits at 5589H-558CH.
5281
LD HL,558EH 21 8E 55
Point Register Pair HL to 558EH, the ) that ends the long form of the line.
5284
JUMP to 5289H to end the text after the bracket at Register Pair HL (558EH).
5286
LD HL,5583H 21 83 55
No WORD and no BYTE: point Register Pair HL to 5583H, the space after the quote that closes the bytes shown, where the short form of the line ends.
5289
LD (HL),29H 36 29
Store 29H, a closing bracket, at Register Pair HL (5583H or 558EH).
528B
INC HL 23
INCrement Register Pair HL to the byte after the closing bracket.
528C
LD (HL),03H 36 03
Store 03H, the end of text mark, at Register Pair HL (5584H or 558FH): the line ends after the bracket. 558FH is the first letter of the text High Memory Directory, so after WORD or BYTE the summary line that 5357H builds from it starts with this 03H, and a directory shown in the same command leaves that line out (@DSPLY stops at once).
528E
LD HL,556BH 21 6B 55
Point Register Pair HL to 556BH, the start of the line X'aaaa' = ddddd ('bbbb' ...
5291
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to the 03H.

5294H - HIGH: Reserve Memory below HIGH$

HIGH=address makes the memory from address + 1 up to the current HIGH$ a reserved block: a ten byte module header (the template at 54A9H) is written at address - 9 to address, HIGH$ becomes address - 10, and the header names the block &aaaa after its first address. The address must be below the current HIGH$ (or equal to it) and above the word 5200H holds at this point (73EDH, the first two bytes of this member), else Range error.

5294
LD BC,0000H 01 00 00
Load Register Pair BC with the HIGH parameter, the operand at 5295H-5296H: 0000H when HIGH (or H) was not given, else the address asked for.
5297
LD A,B 78
Copy Register B (the high byte of the HIGH address) into Register A.
5298
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when the address is 0000H, not given.
5299
If the Z FLAG is set (no HIGH), JUMP to 52CFH to show HIGH$ or the modules above it.
529B
GOSUB to 547AH, which returns only at LDOS command level.
529E
LD HL,(5200H) 2A 00 52
Fetch the word at 5200H-5201H into Register Pair HL: EDH 73H, the first two bytes of this member's LD (546CH),SP, so Register Pair HL = 73EDH, the lower limit the HIGH address is checked against.
52A1
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52A2
SBC HL,BC ED 42
Subtract Register Pair BC (the HIGH address) from Register Pair HL (73EDH): the CARRY FLAG is set when the HIGH address is above 73EDH.
52A4
If the NO CARRY FLAG is set (the HIGH address is 73EDH or below), JUMP to 5495H to display Range error and end the command.
52A7
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
52AA
LD (54ABH),HL 22 AB 54
Store Register Pair HL (HIGH$) at 54ABH-54ACH, the link word of the header template: the reserved block ends at the old HIGH$.
52AD
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52AE
SBC HL,BC ED 42
Subtract Register Pair BC (the HIGH address) from Register Pair HL (HIGH$): the CARRY FLAG is set when the address is above HIGH$.
52B0
If the CARRY FLAG is set (the address is above HIGH$), JUMP to 5495H for Range error.
52B3
LD D,B 50
Copy Register B (the high byte of the HIGH address) into Register D.
52B4
LD E,C 59
Copy Register C (the low byte) into Register E: Register Pair DE = the HIGH address.
52B5
INC DE 13
INCrement Register Pair DE to the first address of the reserved block (HIGH address + 1).
52B6
LD HL,54AFH 21 AF 54
Point Register Pair HL to 54AFH, the four characters of the name after the & in the header template.
52B9
GOSUB to 4D76H to write Register Pair DE (the block's first address) as four hexadecimal digits at 54AFH-54B2H: the module is named &aaaa.
52BC
LD HL,FFF6H 21 F6 FF
Load Register Pair HL with FFF6H, minus 10, to take the header's ten bytes off the HIGH address.
52BF
ADD HL,BC 09
ADD Register Pair BC (the HIGH address) to Register Pair HL: Register Pair HL = the HIGH address - 10 (the CARRY FLAG is set, the sum passes FFFFH).
52C0
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is now ten bytes below the HIGH address, below the header.
52C3
INC HL 23
INCrement Register Pair HL to the HIGH address - 9, where the header goes.
52C4
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the header's address.
52C5
LD HL,54A9H 21 A9 54
Point Register Pair HL to 54A9H, the header template.
52C8
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of the header.
52CB
LDIR ED B0
Copy the header: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 54A9H-54B2H go to HIGH address - 9 up to the HIGH address.
52CD
JUMP to 52E7H to list the modules above the new HIGH$. The CARRY FLAG is still set from 52BFH.

52CFH - No HIGH: Show HIGH$, or Start the Directory

When HIGH$ is the top of memory (nothing is above it) the line High = X'nnnn' is all MEMORY shows. Otherwise the High Memory Directory follows: a blank line, the summary line with HIGH$ and the bytes above it, the column headings, and one line for each module or block above HIGH$.

52CF
LD DE,(4049H) ED 5B 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair DE.
52D3
LD HL,(4403H) 2A 03 44
Fetch the top of memory from 4403H-4404H into Register Pair HL (the address SYS0/SYS's reset found).
52D6
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
52D7
SBC HL,DE ED 52
Subtract Register Pair DE (HIGH$) from Register Pair HL (the top of memory): the Z FLAG is set when they are equal.
52D9
If the NZ FLAG is set (something is above HIGH$), JUMP to 52E7H for the directory.
52DB
LD HL,5565H 21 65 55
Point Register Pair HL to 5565H, the xxxx of the line High = X'xxxx'.
52DE
GOSUB to 4D76H to write Register Pair DE (HIGH$) as four hexadecimal digits at 5565H-5568H.
52E1
LD HL,555AH 21 5A 55
Point Register Pair HL to 555AH, the line High = X'nnnn'.
52E4
GOSUB to 447BH (@LOGOT) to display the line at Register Pair HL and send it to the job log. It returns with the CARRY FLAG clear.
52E7
GOSUB to 543FH to count one line against the page (the counter in 5440H; the first call only counts).
52EA
LD DE,(4403H) ED 5B 03 44
Fetch the top of memory from 4403H-4404H into Register Pair DE.
52EE
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
52F1
SBC HL,DE ED 52
Subtract Register Pair DE (the top of memory) and the CARRY FLAG from Register Pair HL (HIGH$): the Z FLAG is set only when HIGH$ is the top of memory and the CARRY FLAG was clear (the path from 52E4H). After HIGH the CARRY FLAG is set, so the directory always follows.
52F3
If the Z FLAG is set (nothing above HIGH$), JUMP to 545FH for GO and the exit.
52F6
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, for an empty first line of the directory.
52F8
LD (5200H),A 32 00 52
Store Register A (0DH) at 5200H: the line buffer 5200H-5239H, over this member's first bytes, now holds an empty line.
52FB
GOSUB to 542AH to display (and with PRINT print) the empty line and fill the buffer with spaces.
52FE
GOSUB to 5357H to build and send the summary line High Memory Directory HIGH$ = X'nnnn' Length = ddddd, then copy the column headings into the buffer.
5301
GOSUB to 542AH to send the column headings now in the line buffer at 5200H.
5304
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5307
INC HL 23
INCrement Register Pair HL to HIGH$ + 1, the first byte above HIGH$, where the first module starts.

5308H - The Module Loop: One Line for Each Module above HIGH$

Register Pair HL = the address where the next module should start. A module in high memory begins with a header: 18H (a JR over the header), the jump's offset, the link word (the last address of the module), the length of the name and the name. For each module the line shows the name, its first and last address and its length in decimal; bytes that do not begin with a header are shown as <unknown> up to the next header (53A4H). The loop ends after the top of memory.

5308
LD (533CH),HL 22 3C 53
Store Register Pair HL (the first address of this module) at 533CH-533DH, the operand of the LD DE at 533BH, for the length.
530B
LD A,(HL) 7E
Fetch the first byte of the module at Register Pair HL into Register A.
530C
CP 18H FE 18
Compare Register A against 18H, the JR that every module header starts with.
530E
If the NZ FLAG is set (no header here), JUMP to 53A4H to look for the next header and show these bytes as <unknown>.
5311
INC HL 23
INCrement Register Pair HL past the 18H of the header to the jump's offset.
5312
INC HL 23
INCrement Register Pair HL past the jump's offset, to the link word.
5313
LD E,(HL) 5E
Fetch the low byte of the link word (the module's last address) at Register Pair HL into Register E.
5314
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
5315
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the module's last address.
5316
LD (5330H),DE ED 53 30 53
Store Register Pair DE (the module's last address) at 5330H-5331H, the operand of the LD HL at 532FH.
531A
INC HL 23
INCrement Register Pair HL to the length of the module's name.
531B
LD B,(HL) 46
Fetch the length of the name at Register Pair HL into Register B, the count for the copy.
531C
INC HL 23
INCrement Register Pair HL to the first character of the name.
531D
LD DE,5200H 11 00 52
Point Register Pair DE to 5200H, the start of the line buffer. 53EDH comes here with Register Pair HL = 55F4H (<unknown>) and Register B = 9.
5320
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
5321
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the line buffer.
5322
INC HL 23
INCrement Register Pair HL to the next character of the name.
5323
INC DE 13
INCrement Register Pair DE to the next position of the line.
5324
DECrement Register B (the characters left) and LOOP BACK to 5320H until the whole name is copied.
5326
LD HL,(533CH) 2A 3C 53
Fetch the module's first address from 533CH-533DH into Register Pair HL.
5329
LD DE,5212H 11 12 52
Point Register Pair DE to 5212H, the Start Address column of the line.
532C
GOSUB to 53FFH to write X'nnnn' (Register Pair HL, the first address) at 5212H-5218H.
532F
LD HL,0000H 21 00 00
Load Register Pair HL with the module's last address, the operand at 5330H-5331H (0000H in the file; stored by 5316H, 53BCH or 53FAH).
5332
LD DE,5224H 11 24 52
Point Register Pair DE to 5224H, the End Address column of the line.
5335
GOSUB to 53FFH to write X'nnnn' (Register Pair HL, the last address) at 5224H-522AH.
5338
LD HL,(5330H) 2A 30 53
Fetch the module's last address from 5330H-5331H into Register Pair HL.
533B
LD DE,0000H 11 00 00
Load Register Pair DE with the module's first address, the operand at 533CH-533DH (0000H in the file; stored by 5308H).
533E
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
533F
SBC HL,DE ED 52
Subtract Register Pair DE (the first address) from Register Pair HL (the last address).
5341
INC HL 23
INCrement Register Pair HL: Register Pair HL = the length of the module in bytes.
5342
LD DE,5233H 11 33 52
Point Register Pair DE to 5233H, the Length column of the line.
5345
GOSUB to 5411H to write Register Pair HL (the length) in decimal, right justified, at 5233H-5237H.
5348
GOSUB to 542AH to send the line, blank the buffer and count the line against the page.
534B
LD HL,(5330H) 2A 30 53
Fetch the module's last address from 5330H-5331H into Register Pair HL.
534E
INC HL 23
INCrement Register Pair HL to the address after the module, where the next one starts.
534F
LD A,H 7C
Copy Register H (the high byte of that address) into Register A.
5350
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when the address wrapped to 0000H (the module ended at FFFFH, the top of a 48K machine).
5351
If the Z FLAG is set (the top of memory is passed), JUMP to 545FH for GO and the exit.
5354
JUMP to 5308H for the next module, Register Pair HL at its first address.

5357H - Build the Summary Line and the Column Headings

Fills the line buffer at 5200H with High Memory Directory, HIGH$ = X'nnnn' and Length = ddddd (the bytes above HIGH$ up to the top of memory) and sends it; then copies the column headings line (55BAH) into the buffer for the caller to send.

5357
LD HL,558FH 21 8F 55
Point Register Pair HL to 558FH, the text High Memory Directory.
535A
LD DE,5200H 11 00 52
Point Register Pair DE to 5200H, the start of the line buffer.
535D
LD BC,0015H 01 15 00
Load Register Pair BC with 0015H, the 21 characters of the text.
5360
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the title goes to 5200H-5214H.
5362
LD HL,55A4H 21 A4 55
Point Register Pair HL to 55A4H, the text HIGH$ =.
5365
LD DE,5219H 11 19 52
Point Register Pair DE to 5219H, four spaces after the title.
5368
LD C,07H 0E 07
Load Register C with 07H, the seven characters of HIGH$ = (Register B is 00H after the LDIR).
536A
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: HIGH$ = goes to 5219H-521FH.
536C
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
536F
LD DE,5221H 11 21 52
Point Register Pair DE to 5221H, after HIGH$ = and a space.
5372
GOSUB to 53FFH to write X'nnnn' (Register Pair HL, HIGH$) at 5221H-5227H.
5375
LD HL,55B2H 21 B2 55
Point Register Pair HL to 55B2H, the text Length =.
5378
LD DE,522CH 11 2C 52
Point Register Pair DE to 522CH, four spaces further on.
537B
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of Length =.
537E
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: Length = goes to 522CH-5233H.
5380
LD HL,(4403H) 2A 03 44
Fetch the top of memory from 4403H-4404H into Register Pair HL.
5383
LD DE,(4049H) ED 5B 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair DE.
5387
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
5388
SBC HL,DE ED 52
Subtract Register Pair DE (HIGH$) from Register Pair HL (the top of memory): Register Pair HL = the bytes above HIGH$.
538A
LD DE,5234H 11 34 52
Point Register Pair DE to 5234H, after Length =.
538D
GOSUB to 5411H to write Register Pair HL (the bytes above HIGH$) in decimal, right justified, at 5234H-5238H.
5390
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line.
5392
LD (5239H),A 32 39 52
Store Register A (0DH) at 5239H, the last byte of the line buffer: 542AH never changes this byte, so every later line ends with it too.
5395
GOSUB to 542AH to send the summary line, blank the buffer and count the line.
5398
LD HL,55BAH 21 BA 55
Point Register Pair HL to 55BAH, the column headings Module Start Address End Address Length. 5456H calls here at the top of each new page.
539B
LD DE,5200H 11 00 52
Point Register Pair DE to 5200H, the start of the line buffer.
539E
LD BC,003AH 01 3A 00
Load Register Pair BC with 003AH, the 58 bytes of the headings line, its 0DH included.
53A1
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the headings fill the line buffer 5200H-5239H.
53A3
RET C9
RETurn to the caller, which sends the headings line now at 5200H.

53A4H - Bytes without a Header: Find the Next Module

Register Pair HL = the first byte above the last module, where no 18H header begins. The bytes from here are searched for an 18H that starts a believable header: its link word not below the byte before it, a name length below 16 and a name of printable characters 21H-7AH. The bytes up to that header (or up to the top of memory when none is found) get a line of their own named <unknown>.

53A4
PUSH HL E5
Save Register Pair HL (the first byte to search) to the stack.
53A5
DEC HL 2B
DECrement Register Pair HL to the byte before it.
53A6
LD DE,(4403H) ED 5B 03 44
Fetch the top of memory from 4403H-4404H into Register Pair DE.
53AA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the top of memory, Register Pair DE = the first byte to search - 1.
53AB
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
53AC
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: Register Pair HL = the bytes from the first byte to search up to the top of memory (0000H when the search starts past the top).
53AE
LD B,H 44
Copy Register H (the high byte of the count) into Register B.
53AF
LD C,L 4D
Copy Register L into Register C: Register Pair BC = the bytes to search.
53B0
POP HL E1
Restore Register Pair HL (the first byte to search) from the stack. POP does not change the flags.
53B1
If the Z FLAG is set (the search starts after the top of memory: everything is listed), JUMP to 545FH for GO and the exit.
53B4
LD A,18H 3E 18
Load Register A with 18H, the first byte of a module header.
53B6
CPIR ED B1
Compare Register A with (HL) for up to Register Pair BC bytes, Register Pair HL counting up (CPIR): stops after the first 18H with the Z FLAG set, or after Register Pair BC bytes with the NZ FLAG.
53B8
If the NZ FLAG is set (no 18H up to the top of memory), JUMP to 53F7H to show the rest as one <unknown> block.
53BA
DEC HL 2B
DECrement Register Pair HL back to the 18H found (CPIR stops one byte past it).
53BB
DEC HL 2B
DECrement Register Pair HL to the byte before it, the last byte of the block in front.
53BC
LD (5330H),HL 22 30 53
Store Register Pair HL (the last byte of the block in front) at 5330H-5331H, the operand of the LD HL at 532FH.
53BF
INC HL 23
INCrement Register Pair HL from the byte before the header to the 18H.
53C0
INC HL 23
INCrement Register Pair HL to the jump's offset.
53C1
INC HL 23
INCrement Register Pair HL from the jump's offset to the link word.
53C2
LD E,(HL) 5E
Fetch the low byte of the link word at Register Pair HL into Register E.
53C3
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
53C4
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the link word, the last address the header would claim.
53C5
LD HL,(5330H) 2A 30 53
Fetch the byte before the 18H from 5330H-5331H into Register Pair HL.
53C8
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the link word, Register Pair DE = the byte before the 18H.
53C9
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
53CA
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the CARRY FLAG is set when the link word lies below the header.
53CC
If the CARRY FLAG is set (not a header), JUMP to 53F0H to search on after this 18H.
53CE
LD HL,(5330H) 2A 30 53
Fetch the byte before the 18H from 5330H-5331H into Register Pair HL.
53D1
INC HL 23
INCrement Register Pair HL from the byte before the header to the 18H.
53D2
INC HL 23
INCrement Register Pair HL to the jump's offset.
53D3
INC HL 23
INCrement Register Pair HL to the low byte of the link word.
53D4
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
53D5
INC HL 23
INCrement Register Pair HL to the length of the name.
53D6
LD A,(HL) 7E
Fetch the length of the name at Register Pair HL into Register A.
53D7
CP 10H FE 10
Compare Register A (the length) against 10H: the NO CARRY FLAG is set for 16 or more.
53D9
If the NO CARRY FLAG is set (too long for a name), JUMP to 53F0H to search on.
53DB
LD B,A 47
Copy Register A (the length) into Register B, the characters to check.
53DC
INC HL 23
INCrement Register Pair HL to the next character of the name.
53DD
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
53DE
CP 21H FE 21
Compare Register A against 21H: the CARRY FLAG is set for a space or a control code.
53E0
If the CARRY FLAG is set (not printable), JUMP to 53F0H to search on.
53E2
CP 7BH FE 7B
Compare Register A against 7BH: the NO CARRY FLAG is set for 7BH and above.
53E4
If the NO CARRY FLAG is set (not a name character), JUMP to 53F0H to search on.
53E6
DECrement Register B (the characters left) and LOOP BACK to 53DCH until the whole name is checked.
53E8
LD HL,55F4H 21 F4 55
A header is believed (or 53FDH: none to the top). Point Register Pair HL to 55F4H, the name <unknown>.
53EB
LD B,09H 06 09
Load Register B with 09H, the nine characters of <unknown>.
53ED
JUMP to 531DH to build the line of the block from 533CH-533DH (its first address) to 5330H-5331H (its last), named <unknown>; the loop then goes on at the header.
53F0
LD HL,(5330H) 2A 30 53
Not a header: fetch the byte before the 18H from 5330H-5331H into Register Pair HL.
53F3
INC HL 23
INCrement Register Pair HL from the byte before the 18H to the 18H itself.
53F4
INC HL 23
INCrement Register Pair HL past the 18H, where the search goes on.
53F5
JUMP to 53A4H to search on from the byte after the 18H.
53F7
LD HL,(4403H) 2A 03 44
No header up to the top: fetch the top of memory from 4403H-4404H into Register Pair HL.
53FA
LD (5330H),HL 22 30 53
Store Register Pair HL (the top of memory) at 5330H-5331H: the <unknown> block ends there.
53FD
JUMP to 53E8H to show the bytes up to the top of memory as one <unknown> block.

53FFH - Helper: Write X'nnnn' into the Line

Register Pair HL = the value, Register Pair DE = where in the line buffer. The four hexadecimal digits go into the template X' ' at 55FDH-5603H and the seven characters are copied to Register Pair DE.

53FF
PUSH DE D5
Save Register Pair DE (the place in the line) to the stack.
5400
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the value.
5401
LD HL,55FFH 21 FF 55
Point Register Pair HL to 55FFH, the four spaces inside X' '.
5404
GOSUB to 4D76H to write Register Pair DE (the value) as four hexadecimal digits at 55FFH-5602H.
5407
POP DE D1
Restore Register Pair DE (the place in the line) from the stack.
5408
LD HL,55FDH 21 FD 55
Point Register Pair HL to 55FDH, the X'nnnn' just made.
540B
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, its seven characters.
540E
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: X'nnnn' goes into the line.
5410
RET C9
RETurn to the caller with Register Pair DE after the seven characters copied.

5411H - Helper: Write a Number in Decimal

Register Pair HL = the number (0-65535), Register Pair DE = the first of five places. The places are filled with spaces, then the digits are written from the right, dividing by ten (@DIV) until the number is 0. Returns Register Pair DE after the five places.

5411
LD B,05H 06 05
Load Register B with 05H, the five places of the number.
5413
LD A,20H 3E 20
Load Register A with 20H, a space, to fill the five places.
5415
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
5416
INC DE 13
INCrement Register Pair DE to the next place.
5417
DECrement Register B (the places left) and LOOP BACK to 5415H until all five are spaces.
5419
PUSH DE D5
Save Register Pair DE (the address after the five places) to the stack, the value returned.
541A
DEC DE 1B
DECrement Register Pair DE to the last place, where the units go.
541B
LD A,0AH 3E 0A
Load Register A with 0AH (10), the divisor for the next decimal digit.
541D
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A (10): Register Pair HL = the quotient, Register A = the remainder, the next digit from the right.
5420
ADD A,30H C6 30
ADD 30H to Register A (the digit 0-9): the character 0-9.
5422
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
5423
DEC DE 1B
DECrement Register Pair DE to the place on its left.
5424
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
5425
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when the quotient is 0, no digits left.
5426
If the NZ FLAG is set (digits left), LOOP BACK to 541BH for the next digit.
5428
POP DE D1
Restore Register Pair DE (the address after the five places) from the stack.
5429
RET C9
RETurn to the caller with Register Pair DE after the five places.

542AH - Helper: Send the Line, Blank It and Count It against the Page

Sends the line buffer at 5200H to the printer when PRINT was given and to the video, fills its first 57 bytes with spaces again (5239H keeps the 0DH) and counts the line. After 15 lines it waits for a key: BREAK ends the command, any other key clears the screen and starts a new page with the column headings.

542A
LD HL,5200H 21 00 52
Point Register Pair HL to 5200H, the line buffer.
542D
LD DE,0000H 11 00 00
Load Register Pair DE with the PRINT parameter, the operand at 542EH-542FH: 0000H in the file, FFFFH when PRINT (or P) was given.
5430
INC E 1C
INCrement Register E (the low byte of the PRINT parameter)...
5431
DEC E 1D
...and DECrement it back: Register E is unchanged and the NZ FLAG is set when it is not 0, PRINT given.
5432
If the NZ FLAG is set (PRINT), GOSUB to 446AH (@PRINT) to print the line at Register Pair HL; @PRINT returns Register Pair HL unchanged.
5435
GOSUB to 4467H (@DSPLY) to display the line at Register Pair HL (5200H). 545CH comes here for the headings of a new page, which are not printed.
5438
LD B,39H 06 39
Load Register B with 39H (57), the bytes of the line before its 0DH.
543A
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL in the line buffer.
543C
INC HL 23
INCrement Register Pair HL to the next byte of the line.
543D
DECrement Register B (the bytes left) and LOOP BACK to 543AH until 5200H-5238H are spaces.
543F
LD A,0FH 3E 0F
Load Register A with the lines left on this page, the operand at 5440H: 0FH (15) in the file, stored back by 5442H and 5453H.
5441
DEC A 3D
DECrement Register A (the lines left): the Z FLAG is set when the page is full.
5442
LD (5440H),A 32 40 54
Store Register A (the lines left) at 5440H, the operand of the LD A at 543FH.
5445
RET NZ C0
RETurn if the NZ FLAG is set (the page is not full yet).
5446
The page is full: GOSUB to the ROM at 0049H to wait for a key; Register A = the key.
5449
CP 01H FE 01
Compare Register A (the key) against 01H, BREAK.
544B
If the Z FLAG is set (BREAK), JUMP to 549BH to end the command with Register Pair HL = FFFFH.
544E
GOSUB to the ROM at 01C9H to clear the screen and put the cursor at the top left corner.
5451
LD A,0FH 3E 0F
Load Register A with 0FH (15), a new page of lines.
5453
LD (5440H),A 32 40 54
Store Register A (15) at 5440H, the lines left.
5456
GOSUB to 5398H to copy the column headings into the line buffer.
5459
LD HL,5200H 21 00 52
Point Register Pair HL to 5200H, the line buffer with the headings.
545C
JUMP to 5435H to display the headings at the top of the new page, blank the buffer and count the line.

545FH - GO and the Exit

GO=address is carried out last of all: the member jumps to the address with the stack as the command was entered, so the code there can return to LDOS with a RET. Without GO the member ends with Register Pair HL = 0000H (done). The error paths come in at 546BH with Register Pair HL = FFFFH: the stack is put back, and when a JCL job runs (bit 5 of 430FH) the job is ended through @ABORT.

545F
LD HL,FFFFH 21 FF FF
Load Register Pair HL with the GO parameter, the operand at 5460H-5461H: FFFFH when GO (or G) was not given, else the address.
5462
LD A,H 7C
Copy Register H (the high byte of the GO address) into Register A.
5463
AND L A5
AND Register L (the low byte) into Register A: FFH only when both bytes are FFH.
5464
INC A 3C
INCrement Register A: the Z FLAG is set when Register Pair HL = FFFFH, no GO.
5465
If the Z FLAG is set (no GO), JUMP to 5468H to end the command.
5467
JP (HL) E9
JUMP to the GO address in Register Pair HL. The stack is as it was when the command was entered, so a RET there returns through the supervisor dispatcher (4BE7H).
5468
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
546B
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 546CH-546DH (0000H in the file, stored by 5200H): anything pushed since is dropped. 549EH comes here with Register Pair HL = FFFFH.
546E
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
546F
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H, the command was carried out.
5470
RET Z C8
RETurn if the Z FLAG is set, with Register Pair HL = 0000H, through the supervisor dispatcher to the program that ran the command.
5471
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5474
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5476
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5477
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

547AH - Check for LDOS Command Level

Returns only when the command may change memory: @EXIT (402DH) is not taken over by a running program (a JP there) and the command did not come from a program through SYS1/SYS's function 20H (bit 1 of 4758H). Otherwise displays Can't -- Only valid at LDOS command level and ends the command. While a JCL job runs, SYS11/SYS keeps the original bytes of 402DH at 4065H, so those are tested instead.

547A
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
547D
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
547F
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
5482
If the Z FLAG is set (no JCL job), JUMP to 5487H to test that byte.
5484
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
5487
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with LD A (3EH) as LDOS loads it, and with a JP only while a program has taken it over.
5489
If the Z FLAG is set (a program owns @EXIT), JUMP to 5491H to refuse.
548B
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
548E
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
5490
RET Z C8
RETurn if the Z FLAG is set (bit 1 clear): the command was typed at LDOS command level.
5491
LD HL,54B3H 21 B3 54
Point Register Pair HL to 54B3H, the message Can't -- Only valid at LDOS command level.
5494
LD IX,54DDH DD 21 DD 54
Load Index Register IX with 54DDH. This instruction only covers the three bytes 21H DDH 54H: a JP to 5495H skips the DDH and runs them as LD HL,54DDH, which points Register Pair HL at the message Range error (from 52A4H and 52B0H). Index Register IX is not used afterwards.
5498
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
549B
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. 544BH (BREAK) and 54A7H come here.
549E
JUMP to 546BH to put the stack back and end the command.

54A0H - Parameter Error

@PARAM rejected the parameters, or BYTE was given a value above 255: error 2CH (parameter error) is reported through @ERROR, which returns, and the command ends with Register Pair HL = FFFFH.

54A0
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
54A2
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
54A4
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
54A7
JUMP to 549BH to end the command with Register Pair HL = FFFFH.

54A9H - MEMORY Data: the Header of a Reserved Block

The ten bytes HIGH writes below the memory it reserves (52CBH): the module header that MEMORY's own directory, and the other programs that walk the module chain from HIGH$, read. The link word and the four characters of the name are filled in before the copy.

54A9
DEFB 18H 18
18H, the opcode of JR: the first byte of every module header (tested at 530CH and 53B4H).
54AA
DEFB 08H 08
08H, the offset of the JR: from the header at HIGH address - 9 it lands at HIGH address + 1, the first byte of the reserved block, past the eight bytes that follow.
54AB-54AC
DEFW 0000H 00 00
The link word, the last address of the block: 0000H in the file; 52AAH stores the old HIGH$ here.
54AD
DEFB 05H 05
05H, the length of the name that follows: & and four hexadecimal digits.
54AE-54B2
DEFM "&nnnn" 26 6E 6E 6E 6E
The name of the block, & and four characters: 52B9H writes the block's first address in hexadecimal over nnnn.

54B3H - MEMORY Data: Messages

The two messages of the member, each ended by 0DH, displayed by 5498H.

54B3-54DB
DEFM "Can't -- Only valid at LDOS command level" 43 61 6E 27 74 20 2D 2D 20 4F 6E 6C 79 20 76 61 6C 69 64 20 61 74 20 4C 44 4F 53 20 63 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C
The message of 5491H: the command was not typed at LDOS command level (547AH).
54DC
DEFB 0DH 0D
0DH, the end of the message Can't -- Only valid at LDOS command level.
54DD-54E7
DEFM "Range error" 52 61 6E 67 65 20 65 72 72 6F 72
The message reached through 5495H: the HIGH address is not between 73EEH and HIGH$.
54E8
DEFB 0DH 0D
0DH, the end of the message Range error, displayed with it.

54E9H - MEMORY Data: the Parameter Table

The table @PARAM reads (5204H): fourteen entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H. Each address is the operand of an instruction that uses the value; the short form of each keyword names the same address.

54E9-54F0
DEFM "HIGH " / DEFW 5295H 48 49 47 48 20 20 95 52
HIGH: its value goes to 5295H-5296H, the operand of the LD BC at 5294H.
54F1-54F8
DEFM "H " / DEFW 5295H 48 20 20 20 20 20 95 52
H, the short form of HIGH: its value goes to 5295H-5296H too.
54F9-5500
DEFM "ADD " / DEFW 523CH 41 44 44 20 20 20 3C 52
ADD: its value goes to 523CH-523DH, the operand of the LD HL at 523BH.
5501-5508
DEFM "A " / DEFW 523CH 41 20 20 20 20 20 3C 52
A, the short form of ADD: its value goes to 523CH-523DH too.
5509-5510
DEFM "WORD " / DEFW 525FH 57 4F 52 44 20 20 5F 52
WORD: its value goes to 525FH-5260H, the operand of the LD DE at 525EH.
5511-5518
DEFM "W " / DEFW 525FH 57 20 20 20 20 20 5F 52
W, the short form of WORD: its value goes to 525FH-5260H too.
5519-5520
DEFM "BYTE " / DEFW 5266H 42 59 54 45 20 20 66 52
BYTE: its value goes to 5266H-5267H, the operand of the LD DE at 5265H (00FFH in the file).
5521-5528
DEFM "B " / DEFW 5266H 42 20 20 20 20 20 66 52
B, the short form of BYTE: its value goes to 5266H-5267H too.
5529-5530
DEFM "GO " / DEFW 5460H 47 4F 20 20 20 20 60 54
GO: its value goes to 5460H-5461H, the operand of the LD HL at 545FH (FFFFH in the file).
5531-5538
DEFM "G " / DEFW 5460H 47 20 20 20 20 20 60 54
G, the short form of GO: its value goes to 5460H-5461H too.
5539-5540
DEFM "CLEAR " / DEFW 520EH 43 4C 45 41 52 20 0E 52
CLEAR: its value goes to 520EH-520FH, the operand of the LD DE at 520DH.
5541-5548
DEFM "C " / DEFW 520EH 43 20 20 20 20 20 0E 52
C, the short form of CLEAR: its value goes to 520EH-520FH too.
5549-5550
DEFM "PRINT " / DEFW 542EH 50 52 49 4E 54 20 2E 54
PRINT: its value goes to 542EH-542FH, the operand of the LD DE at 542DH, which sends every line to the printer too.
5551-5558
DEFM "P " / DEFW 542EH 50 20 20 20 20 20 2E 54
P, the short form of PRINT: its value goes to 542EH-542FH too.
5559
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.

555AH - MEMORY Data: the High Line and the ADD Line

The line shown when nothing is above HIGH$ (52E1H), and the template of the ADD line, whose digits are filled in by 5244H-527EH and whose end (5583H or 558EH) is chosen by 5289H.

555A-5569
DEFM " High = X'xxxx'" 20 20 48 69 67 68 20 3D 20 58 27 78 78 78 78 27
The line of 52E1H: two spaces, High = X' and four characters that 52DEH replaces with HIGH$ in hexadecimal (5565H-5568H).
556A
DEFB 0DH 0D
0DH, the end of the High line, displayed with it.
556B-556C
DEFM "X'" 58 27
The ADD line starts here (528EH): X and a quote before the address.
556D-5570
DEFM "dddd" 64 64 64 64
The ADD address in hexadecimal, written by 5247H.
5571-5574
DEFM "' = " 27 20 3D 20
The quote after the address, an equals sign and spaces.
5575-5579
DEFM "ddddd" 64 64 64 64 64
The ADD address in decimal, five places written by 524FH.
557A-557D
DEFM " ('" 20 20 28 27
Two spaces, an opening bracket and a quote before the bytes at the address.
557E-5581
DEFM "dddd" 64 64 64 64
The two bytes at the ADD address in memory order, written by 525AH.
5582
DEFM "'" 27
The quote after the two bytes shown from the ADD address.
5583-5588
DEFM " => X'" 20 3D 3E 20 58 27
A space, =>, a space, X and a quote: the short line ends here with ) and 03H stored over 5583H-5584H (5289H).
5589-558C
DEFM "dddd" 64 64 64 64
The two bytes after WORD or BYTE, written by 527EH.
558D
DEFM "'" 27
The quote after the two bytes shown after WORD or BYTE.
558E
DEFM ")" 29
The closing bracket of the long line; 5289H stores it again and 03H after it at 558FH.

558FH - MEMORY Data: the Directory Texts

The texts of the High Memory Directory: the summary line's parts (5357H), the column headings (5398H), the name of a block with no header (53E8H) and the template of a hexadecimal address (53FFH).

558F-55A3
DEFM "High Memory Directory" 48 69 67 68 20 4D 65 6D 6F 72 79 20 44 69 72 65 63 74 6F 72 79
The title at the start of the summary line (5357H copies 21 bytes). After WORD or BYTE its first byte is 03H (528CH).
55A4-55AA
DEFM "HIGH$ =" 48 49 47 48 24 20 3D
Copied to 5219H by 5362H, before HIGH$ in hexadecimal.
55AB-55B1
DEFM "Start =" 53 74 61 72 74 20 3D
Seven characters Start = that no code of the member copies or displays.
55B2-55B9
DEFM "Length =" 4C 65 6E 67 74 68 20 3D
Copied to 522CH by 5375H, before the bytes above HIGH$ in decimal.
55BA-55F2
DEFM "Module Start Address End Address Length" 4D 6F 64 75 6C 65 20 20 20 20 20 20 20 20 20 53 74 61 72 74 20 41 64 64 72 65 73 73 20 20 20 20 20 20 45 6E 64 20 41 64 64 72 65 73 73 20 20 20 20 20 20 4C 65 6E 67 74 68
The column headings, copied to 5200H with the 0DH below by 5398H: the name at column 0, the first address at column 18 (5212H), the last at column 36 (5224H) and the length at column 51 (5233H).
55F3
DEFB 0DH 0D
0DH, the end of the headings line; the copy puts it at 5239H.
55F4-55FC
DEFM "<unknown>" 3C 75 6E 6B 6E 6F 77 6E 3E
The name shown for bytes above HIGH$ that do not begin with a module header (53E8H).
55FD-55FE
DEFM "X'" 58 27
The start of the address template that 53FFH copies into the line.
55FF-5602
DEFM " " 20 20 20 20
Four spaces that 5404H replaces with the hexadecimal digits of the address.
5603
DEFM "'" 27
The closing quote of the address template, the last byte of the member.

5200H - Member 2 (DIR): Entry, the File Specification and the Drive

The DIR command (library member 21H), loaded at 5200H-5BE0H. Register Pair HL points at the text after DIR: an optional partspec (name and extension with $ for any character, a leading - to show the files that do not match), an optional drive (:d, or the digit alone), then the parameters in brackets (table at 5A42H). The partspec goes into the masks at 5B6AH (8 bytes) and 5B72H (3 bytes), the drive into 52AEH (the first drive shown) and 53FEH (FFH: no drive given, show every drive).

5200
LD (540DH),SP ED 73 0D 54
Store the Stack Pointer at 540DH, the operand of the LD SP at 540CH: the exit puts the stack back to this depth.
5204
GOSUB to 58E8H to clear bits 2-0 of KFLAG$ (4423H), the BREAK, pause and ENTER bits left from before the command.
5207
LD A,(HL) 7E
Fetch the first character of the text at Register Pair HL into Register A.
5208
INC HL 23
INCrement Register Pair HL past the character.
5209
CP 30H FE 30
Compare Register A against 30H, the character 0: the CARRY FLAG is set below it.
520B
If the CARRY FLAG is set (not a digit: a space, a - or the end), JUMP to 5211H to read a partspec.
520D
CP 3AH FE 3A
Compare Register A against 3AH, one above the character 9: the CARRY FLAG is set for a digit 0-9.
520F
If the CARRY FLAG is set (DIR followed by a drive digit alone), JUMP to 5238H to take it as the drive.
5211
LD DE,5B6AH 11 6A 5B
Point Register Pair DE to 5B6AH, the eight byte name mask (spaces in the file: any name matches).
5214
LD B,08H 06 08
Load Register B with 08H, the most characters of a name.
5216
CP 2DH FE 2D
Compare Register A (the first character) against 2DH, a minus sign.
5218
If the NZ FLAG is set (no minus sign), JUMP to 521FH to copy the name.
521A
LD (549DH),A 32 9D 54
Store Register A (2DH) at 549DH, the operand of the LD A at 549CH: DIR shows the files whose name does not match.
521D
LD A,(HL) 7E
Fetch the character after the minus sign at Register Pair HL into Register A.
521E
INC HL 23
INCrement Register Pair HL past the first character of the name.
521F
GOSUB to 57C2H to copy up to Register B (8) name characters, the first in Register A, into the mask at Register Pair DE (capitals, $ kept). It returns Register A = the character that ended the name.
5222
CP 2FH FE 2F
Compare Register A against 2FH, the slash before an extension.
5224
If the NZ FLAG is set (no extension), JUMP to 5230H to look for a drive.
5226
LD DE,5B72H 11 72 5B
Point Register Pair DE to 5B72H, the three byte extension mask.
5229
LD B,03H 06 03
Load Register B with 03H, the most characters of an extension.
522B
LD A,(HL) 7E
Fetch the character after the slash at Register Pair HL into Register A.
522C
INC HL 23
INCrement Register Pair HL past the first character of the extension.
522D
GOSUB to 57C2H to copy up to Register B (3) extension characters into the mask at Register Pair DE; Register A = the character that ended it.
5230
CP 3AH FE 3A
Compare Register A against 3AH, the colon before a drive number.
5232
LD C,00H 0E 00
Load Register C with 00H, drive 0, the first drive when none is given. LD does not change the flags.
5234
If the NZ FLAG is set (no colon), JUMP to 5244H with Register C = 0.
5236
LD A,(HL) 7E
Fetch the drive digit after the colon at Register Pair HL into Register A.
5237
INC HL 23
INCrement Register Pair HL past the drive digit after the colon.
5238
INC HL 23
INCrement Register Pair HL once more: 5244H steps back one, so Register Pair HL ends at the character after the digit. 520FH joins here with the digit in Register A.
5239
SUB 30H D6 30
SUBtract 30H from Register A (the digit character): the drive number.
523B
CP 08H FE 08
Compare Register A (the drive number) against 08H: the NO CARRY FLAG is set for 8 or more.
523D
If the NO CARRY FLAG is set (not a drive 0-7), JUMP to 5A35H to report error 2CH (parameter error).
5240
LD C,A 4F
Copy Register A (the drive number) into Register C.
5241
LD (53FEH),A 32 FE 53
Store Register A (the drive number) at 53FEH, the operand of the LD A at 53FDH (FFH in the file): only this drive is shown.
5244
DEC HL 2B
DECrement Register Pair HL back to the character that ended the drive or the name, where the parameters begin.
5245
LD A,C 79
Copy Register C (the drive: 0, or the one given) into Register A.
5246
LD (52AEH),A 32 AE 52
Store Register A (the first drive) at 52AEH, the operand of the LD C at 52ADH.
5249
LD DE,5A42H 11 42 5A
Point Register Pair DE to 5A42H, the parameter table of DIR (A, I, INV, P, S, SYS, N, DATE, D, MOD, M, SORT, O).
524C
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value goes to the operand the table names (FFFFH for a keyword alone).
524F
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5A35H to report error 2CH.

5252H - Set Up: SORT, the Sort Buffer, P and DATE

A DIR issued by a program (bit 1 of 4758H) is never sorted, since the sort buffer at 5E00H-HIGH$ is memory that program can be using. The highest address a sorted record may end at is HIGH$ - 33 (5BE3H). P implies N. DATE="M1/D1/Y1-M2/D2/Y2" gives a start date (5BE5H, bit 7 of the mode byte 5BE0H) and an end date (5BE7H, bit 0); "M1/D1/Y1" gives the same date for both, "-M2/D2/Y2" only the end and "M1/D1/Y1-" only the start.

5252
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
5255
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
5257
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value that turns SORT off. LD does not change the flags.
525A
If the Z FLAG is set (typed at LDOS command level), JUMP to 525FH, keeping SORT as given.
525C
LD (54CFH),HL 22 CF 54
Store Register Pair HL (0000H) at 54CFH-54D0H, the operand of the LD DE at 54CEH (the SORT parameter): no sort for a program's DIR.
525F
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5262
LD DE,FFDFH 11 DF FF
Load Register Pair DE with FFDFH, minus 33, the room kept below HIGH$.
5265
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = HIGH$ - 33.
5266
LD (5BE3H),HL 22 E3 5B
Store Register Pair HL (HIGH$ - 33) at 5BE3H-5BE4H, the ceiling of the sort buffer that 54F8H and 5965H test against.
5269
LD HL,(578FH) 2A 8F 57
Fetch the P parameter from 578FH-5790H, the operand of the LD DE at 578EH, into Register Pair HL.
526C
LD A,H 7C
Copy Register H (the high byte of the P parameter) into Register A.
526D
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when P was not given.
526E
If the Z FLAG is set (no P), JUMP to 5273H, leaving the N parameter as given.
5270
LD (58FFH),HL 22 FF 58
Store Register Pair HL (the P value, not 0000H) at 58FFH-5900H, the operand of the LD DE at 58FEH (the N parameter): printing never pauses.
5273
LD HL,0000H 21 00 00
Load Register Pair HL with the DATE parameter, the operand at 5274H-5275H: 0000H when DATE (or D) was not given, else the address of the text inside the quotes in the command line.
5276
LD A,H 7C
Copy Register H (the high byte of the DATE address) into Register A.
5277
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when no DATE was given.
5278
If the Z FLAG is set (no DATE), JUMP to 52ADH.
527A
LD A,(HL) 7E
Fetch the first character of the date text at Register Pair HL into Register A.
527B
CP 2DH FE 2D
Compare Register A against 2DH, a minus sign: the text starts with the end date only.
527D
If the Z FLAG is set (-M2/D2/Y2), JUMP to 5294H to read the end date.
527F
LD A,80H 3E 80
Load Register A with 80H, bit 7: a start date is given.
5281
LD (5BE0H),A 32 E0 5B
Store Register A (80H) at 5BE0H, the date mode byte.
5284
GOSUB to 5806H to read the date MM/DD/YY at Register Pair HL into Register Pair BC in the form 57DDH makes of a directory date (an error goes to Bad date format).
5287
LD (5BE5H),BC ED 43 E5 5B
Store Register Pair BC (the start date) at 5BE5H-5BE6H.
528B
LD A,(HL) 7E
Fetch the character after the date at Register Pair HL into Register A.
528C
CP 22H FE 22
Compare Register A against 22H, the closing quote.
528E
If the Z FLAG is set (one date alone), JUMP to 52A1H to make it the end date too.
5290
CP 2DH FE 2D
Compare Register A against 2DH, the minus sign before an end date.
5292
If the NZ FLAG is set (something else), JUMP to 52ADH with only the start date.
5294
INC HL 23
INCrement Register Pair HL past the minus sign.
5295
LD A,(HL) 7E
Fetch the character after the minus sign at Register Pair HL into Register A.
5296
CP 22H FE 22
Compare Register A against 22H, the closing quote.
5298
If the Z FLAG is set (M1/D1/Y1-: no end date), JUMP to 52ADH.
529A
CP 0DH FE 0D
Compare Register A against 0DH, the end of the line (a missing closing quote).
529C
If the Z FLAG is set (no end date), JUMP to 52ADH.
529E
GOSUB to 5806H to read the end date at Register Pair HL into Register Pair BC.
52A1
LD A,(5BE0H) 3A E0 5B
Fetch the date mode byte from 5BE0H into Register A.
52A4
OR 01H F6 01
OR 01H into Register A: bit 0, an end date is given.
52A6
LD (5BE0H),A 32 E0 5B
Store Register A (the date mode, bit 0 now set) at 5BE0H.
52A9
LD (5BE7H),BC ED 43 E7 5B
Store Register Pair BC (the end date) at 5BE7H-5BE8H.
52AD
LD C,00H 0E 00
Load Register C with the first drive to show, the operand at 52AEH (00H in the file, stored by 5246H).
52AF
LD A,0FH 3E 0F
Load Register A with 0FH (15), the lines of a page.
52B1
LD (58F3H),A 32 F3 58
Store Register A (15) at 58F3H, the operand of the LD A at 58F2H: the lines left on the screen.

52B4H - One Drive: Check It, Read the Allocation Table, Count the Free Granules

The loop over the drives starts here with Register C = the drive. A drive that is not ready is passed over (541BH). The allocation table (sector 0 of the directory cylinder) is read into 4200H and its free granules counted: each cylinder's byte has a bit set for every granule in use, and the granules the cylinder lacks are set too.

52B4
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the stack for the whole drive.
52B5
LD A,03H 3E 03
Load Register A with 03H, the entries on a line in the short display.
52B7
LD (55A2H),A 32 A2 55
Store Register A (3) at 55A2H, the operand of the LD A at 55A1H that counts the entries of a line.
52BA
LD A,C 79
Copy Register C (the drive number) into Register A for its digit.
52BB
ADD A,30H C6 30
ADD 30H to Register A: the drive's digit character.
52BD
LD (5B02H),A 32 02 5B
Store Register A (the digit) at 5B02H, the d of Drive :d in the drive line, which 575BH also reads back as the drive.
52C0
GOSUB to 44B8H (@CKDRV) to check that drive Register C is ready and holds a formatted diskette.
52C3
If the NZ FLAG is set (the drive is not ready), JUMP to 541BH.
52C6
GOSUB to 478FH (GETDCT) to point Index Register IY at the drive code table of drive Register C.
52C9
LD B,C 41
Copy Register C (the drive) into Register B, to count the rotations below.
52CA
LD A,(475DH) 3A 5D 47
Fetch the date stamping flags from 475DH into Register A: bit n set for a drive n whose diskette has this release's directory dates with the time.
52CD
INC B 04
INCrement Register B: the bits are rotated drive + 1 times.
52CE
RRCA 0F
Rotate Register A right one bit (RRCA): bit 0 goes into the CARRY FLAG and into bit 7.
52CF
DECrement Register B and LOOP BACK to 52CEH: after drive + 1 rotations the CARRY FLAG holds the drive's bit. Register B ends at 00H.
52D1
SBC A,A 9F
SUBtract Register A and the CARRY FLAG from Register A (SBC A,A): Register A = FFH when the drive's bit was set, else 00H.
52D2
LD (56ACH),A 32 AC 56
Store Register A at 56ACH, the operand of the LD A at 56ABH (and read by 57EEH): FFH means the directory records of this diskette carry the time and a five bit year.
52D5
LD D,(IY+09H) FD 56 09
Fetch byte +09H of the drive code table at Index Register IY into Register D: the directory cylinder.
52D8
LD E,B 58
Copy Register B (00H) into Register E: sector 0, the allocation table.
52D9
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer.
52DC
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL, as a directory sector.
52DF
If the NZ FLAG is set (it could not be read as a directory sector), JUMP to 5A37H to report the error in Register A (the value RDSSEC returns) and end the command.
52E2
LD A,(IY+08H) FD 7E 08
Fetch byte +08H of the drive code table at Index Register IY into Register A: bits 4-0 the sectors in a granule less one.
52E5
AND 1FH E6 1F
Mask Register A with 1FH, keeping bits 4-0, the sectors in a granule less one.
52E7
INC A 3C
INCrement Register A: the sectors in a granule.
52E8
LD (579BH),A 32 9B 57
Store Register A (the sectors in a granule) at 579BH, the operand of the LD A at 579AH that turns granules into sectors.
52EB
LD D,L 55
Copy Register L (00H, Register Pair HL = 4200H) into Register D.
52EC
LD E,L 5D
Copy Register L (00H) into Register E: Register Pair DE = 0000H, the count of free granules.
52ED
LD B,(IY+06H) FD 46 06
Fetch byte +06H of the drive code table at Index Register IY into Register B: the highest cylinder.
52F0
INC B 04
INCrement Register B: the number of cylinders, one allocation byte each.
52F1
PUSH BC C5
Save Register Pair BC (Register B = the cylinders, Register C = the drive) to the stack.
52F2
LD A,(HL) 7E
Fetch the allocation byte of the next cylinder at Register Pair HL into Register A.
52F3
SCF 37
Set the CARRY FLAG (SCF), the bit that will come in at the top.
52F4
RRA 1F
Rotate Register A right through the CARRY FLAG (RRA): bit 0 of the byte goes into the CARRY FLAG and a 1 comes in at bit 7.
52F5
If the CARRY FLAG is set (that granule is in use), JUMP to 52F8H.
52F7
INC DE 13
INCrement Register Pair DE: one more free granule.
52F8
CP FFH FE FF
Compare Register A against FFH: once all the bits left are 1 (in use or not on the cylinder) the byte is done.
52FA
If the NZ FLAG is set (a 0 bit is left), LOOP BACK to 52F3H for the next bit.
52FC
INC L 2C
INCrement Register L to the allocation byte of the next cylinder.
52FD
DECrement Register B (the cylinders left) and LOOP BACK to 52F2H until every cylinder is counted.
52FF
LD HL,5B21H 21 21 5B
Point Register Pair HL to 5B21H, the Free=sssss.s field of the drive line.
5302
GOSUB to 5796H to write Register Pair DE (the free granules) as kilobytes at 5B21H-5B25H; Register A returns the tenths digit.
5305
LD (5B27H),A 32 27 5B
Store Register A (the tenths digit) at 5B27H, after the decimal point of the free space.

5308H - The Drive Line: Cylinders, Density, Sides, Total Space and Directory Size

Fills the drive line at 5AFBH: Drive :d, the diskette's name and date from the allocation table (42D0H, 42D8H), the cylinders and the density letter (S single, D double, H a rigid drive) with the sides or heads, Free=free/total in kilobytes and Fi=free/total directory records, and displays it.

5308
POP AF F1
Restore Register Pair AF from the stack: Register A = Register B pushed at 52F1H, the number of cylinders (Register F takes the drive, not used).
5309
LD L,A 6F
Copy Register A (the cylinders) into Register L.
530A
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the number of cylinders.
530C
PUSH HL E5
Save Register Pair HL (the cylinders) to the stack for the total space.
530D
LD DE,5B16H 11 16 5B
Point Register Pair DE to 5B16H, the cyl field of the drive line.
5310
GOSUB to 5888H to write Register Pair HL (the cylinders) as three decimal digits at Register Pair DE (5B16H-5B18H), spaces for leading zeros.
5313
LD HL,3148H 21 48 31
Load Register Pair HL with 3148H: Register L = 48H (H, a rigid drive) and Register H = 31H (1, one side or one head).
5316
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of byte +03H of the drive code table at Index Register IY: set for a rigid drive.
531A
If the Z FLAG is set (a floppy drive), JUMP to 5329H.
531C
LD A,(IY+07H) FD 7E 07
Fetch byte +07H of the drive code table at Index Register IY into Register A: bits 7-5 the heads less one.
531F
RLCA 07
Rotate Register A left one bit (RLCA): first of three rotations that bring bits 7-5 down to bits 2-0.
5320
RLCA 07
Rotate Register A left one bit again (RLCA): second rotation.
5321
RLCA 07
Rotate Register A left one bit again (RLCA): bits 7-5 are now bits 2-0.
5322
AND 07H E6 07
Mask Register A with 07H: the heads less one, 0-7.
5324
ADD A,31H C6 31
ADD 31H to Register A: the character 1-8, the number of heads.
5326
LD H,A 67
Copy Register A (the heads character) into Register H for the drive line.
5327
JUMP to 533AH to store the letter H and the heads in the drive line.
5329
LD L,44H 2E 44
A floppy drive: load Register L with 44H, D for double density.
532B
BIT 6,(IY+03H) FD CB 03 76
Test bit 6 of byte +03H of the drive code table at Index Register IY: set for double density.
532F
If the NZ FLAG is set (double density), JUMP to 5333H keeping D.
5331
LD L,53H 2E 53
Load Register L with 53H, S for single density.
5333
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of byte +04H of the drive code table at Index Register IY: set for a drive with two sides.
5337
If the Z FLAG is set (one side), JUMP to 533AH keeping 1 in Register H.
5339
INC H 24
INCrement Register H: the character 2, two sides.
533A
LD (5B19H),HL 22 19 5B
Store Register Pair HL at 5B19H-5B1AH: the density letter (Register L) and the sides or heads (Register H) after the cylinders.
533D
POP HL E1
Restore Register Pair HL (the number of cylinders) from the stack.
533E
LD A,(IY+08H) FD 7E 08
Fetch byte +08H of the drive code table at Index Register IY into Register A: bits 7-5 the granules on a track less one.
5341
AND E0H E6 E0
Mask Register A with E0H, keeping bits 7-5, the granules on a track less one.
5343
RLCA 07
Rotate Register A left one bit (RLCA): first of three rotations.
5344
RLCA 07
Rotate Register A left one bit again (RLCA): second rotation.
5345
RLCA 07
Rotate Register A left one bit again (RLCA): the granules on a track less one, 0-7.
5346
INC A 3C
INCrement Register A: the granules on a track.
5347
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of byte +04H of the drive code table at Index Register IY: two sides.
534B
If the Z FLAG is set (one side), JUMP to 534EH.
534D
ADD A,A 87
ADD Register A to itself: two sides double the granules on a cylinder.
534E
PUSH AF F5
Save Register Pair AF (Register A = the granules on a cylinder) to the stack.
534F
GOSUB to 44C1H (@MULT) to multiply Register Pair HL (the cylinders) by Register A (the granules on a cylinder): the 24 bit product in Register Pair HL (high 16 bits) and Register A (low 8 bits).
5352
LD D,L 55
Copy Register L (the middle byte of the product) into Register D.
5353
LD E,A 5F
Copy Register A (the low byte) into Register E: Register Pair DE = the granules on the diskette (Register H, the top byte, is 00H).
5354
LD HL,5B29H 21 29 5B
Point Register Pair HL to 5B29H, the total space after the slash.
5357
GOSUB to 5796H to write Register Pair DE (the total granules) as kilobytes at 5B29H-5B2DH; Register A returns the tenths digit.
535A
LD (5B2FH),A 32 2F 5B
Store Register A (the tenths digit) at 5B2FH, after the decimal point of the total.
535D
POP BC C1
Restore Register Pair BC from the stack: Register B = the granules on a cylinder (Register A pushed at 534EH).
535E
LD A,(579BH) 3A 9B 57
Fetch the sectors in a granule from 579BH into Register A.
5361
LD C,A 4F
Copy Register A (the sectors in a granule) into Register C.
5362
XOR A AF
Clear Register A (XOR A) to add up the sectors of a cylinder.
5363
ADD A,C 81
ADD Register C (the sectors in a granule) to Register A.
5364
DECrement Register B and LOOP BACK to 5363H: Register A = the sectors on a cylinder, which the directory cylinder fills.
5366
LD HL,0100H 21 00 01
Load Register Pair HL with 0100H, the 256 records of the largest directory. LD does not change the flags.
5369
SUB 02H D6 02
SUBtract 02H from Register A: the allocation table and the hash index table take two sectors; the rest hold directory records.
536B
CP 20H FE 20
Compare Register A (the directory sectors) against 20H: the NO CARRY FLAG is set for 32 or more.
536D
If the NO CARRY FLAG is set (32 sectors or more), JUMP to 5378H with Register Pair HL = 256 records.
536F
SLA A CB 27
Shift Register A left one bit (SLA A): first of three shifts, eight records to a sector.
5371
SLA A CB 27
Shift Register A left one bit again (SLA A): second shift.
5373
SLA A CB 27
Shift Register A left one bit again (SLA A): Register A = the directory sectors times eight.
5375
LD L,A 6F
Copy Register A (the directory records) into Register L.
5376
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the directory records.
5378
LD (53A4H),HL 22 A4 53
Store Register Pair HL (the directory records) at 53A4H-53A5H, the operand of the LD DE at 53A3H.
537B
LD DE,5B38H 11 38 5B
Point Register Pair DE to 5B38H, the total after Fi=nnn/.
537E
GOSUB to 5888H to write Register Pair HL (the directory records) as three decimal digits at Register Pair DE.
5381
LD HL,42D0H 21 D0 42
Point Register Pair HL to 42D0H, the diskette name in the allocation table read into 4200H.
5384
LD DE,5B04H 11 04 5B
Point Register Pair DE to 5B04H, the packname field of the drive line.
5387
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name.
538A
LDIR ED B0
Copy the name: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up (42D0H-42D7H to 5B04H-5B0BH).
538C
INC DE 13
INCrement Register Pair DE past the space at 5B0CH; Register Pair HL is at 42D8H, the diskette's date.
538D
LD C,08H 0E 08
Load Register C with 08H, the eight characters of the date (Register B is 00H after the LDIR).
538F
LDIR ED B0
Copy the date: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up (42D8H-42DFH to 5B0DH-5B14H).
5391
POP BC C1
Restore Register Pair BC (Register C = the drive) from the stack.
5392
PUSH BC C5
Save Register Pair BC to the stack again for the rest of the drive.
5393
GOSUB to 4B65H (DIRCYL) to load Register D with the directory cylinder of drive Register C.
5396
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder, the hash index table.
5398
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, the buffer for the hash index table.
539B
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL.
539E
LD A,16H 3E 16
Load Register A with 16H, error 22 (hash index table read error). LD does not change the flags.
53A0
If the NZ FLAG is set (the read failed), JUMP to 5A37H to report error 16H.
53A3
LD DE,0000H 11 00 00
Load Register Pair DE with the directory records, the operand at 53A4H-53A5H (0000H in the file, stored by 5378H): the count of free records starts at the total.
53A6
DEC DE 1B
DECrement Register Pair DE for this slot of the hash index table at Register Pair HL; a free slot gives it back below.
53A7
LD A,(42CDH) 3A CD 42
Fetch the configuration byte of the diskette from 42CDH (byte CDH of the allocation table) into Register A.
53AA
RLCA 07
Rotate Register A left one bit (RLCA): bit 7 of the configuration byte goes into the CARRY FLAG.
53AB
If the CARRY FLAG is set (bit 7 set), JUMP to 53B2H: every slot is counted.
53AD
LD A,L 7D
Copy Register L (the slot number) into Register A.
53AE
AND D8H E6 D8
Mask Register A with D8H: the Z FLAG is set for the slots 00H-07H and 20H-27H, the records of the system files.
53B0
If the Z FLAG is set (a system file's slot), JUMP to 53B7H: it is not counted as free.
53B2
LD A,(HL) 7E
Fetch the slot's hash byte at Register Pair HL into Register A.
53B3
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, a free slot.
53B4
If the NZ FLAG is set (the slot is in use), JUMP to 53B7H.
53B6
INC DE 13
INCrement Register Pair DE: the slot is free.
53B7
INC L 2C
INCrement Register L to the next slot of the hash index table.
53B8
If the NZ FLAG is set (Register L did not wrap to 00H), LOOP BACK to 53A6H: all 256 slots are counted.
53BA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the free directory records.
53BB
LD DE,5B34H 11 34 5B
Point Register Pair DE to 5B34H, the free count after Fi=.
53BE
GOSUB to 5888H to write Register Pair HL (the free records) as three decimal digits at Register Pair DE.
53C1
LD HL,5AFBH 21 FB 5A
Point Register Pair HL to 5AFBH, the drive line (64 characters, ended by 03H).
53C4
GOSUB to 577CH to display the drive line, and print it when P was given.
53C7
GOSUB to 58F2H to count the line against the page.
53CA
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER: the drive line fills the 64 columns of the screen, so only the printer needs it.
53CC
GOSUB to 578EH to send Register A (0DH) to the printer when P was given.
53CF
GOSUB to 5921H to display the column headings and a line of dashes when the full display is on.
53D2
POP BC C1
Restore Register Pair BC (Register C = the drive) from the stack.
53D3
LD HL,5E00H 21 00 5E
Point Register Pair HL to 5E00H, the start of the sort buffer.
53D6
LD (5BE1H),HL 22 E1 5B
Store Register Pair HL (5E00H) at 5BE1H-5BE2H, the address where the next sorted record goes.
53D9
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, the first slot of the hash index table.
53DC
JUMP to 542DH to read the directory records slot by slot from the hash index table.

53DEH - The Next Directory Record and the End of the Drive

The slots of the hash index table are taken in the order 00H, 20H, 40H ... E0H, 01H, 21H ...: slot n is record (n AND E0H)/32 of directory sector (n AND 1FH) + 2, so the eight records of one sector are done before the next sector is read. After the last slot the sorted records are shown, the line is ended, and the next drive follows unless a drive was given.

53DE
POP HL E1
Restore Register Pair HL (the directory record) from the stack. The record tests come here when the file is not shown.
53DF
POP BC C1
Restore Register Pair BC from the stack: Register B = the slot number, Register C = the drive.
53E0
LD H,5CH 26 5C
Load Register H with 5CH, the page of the hash index table.
53E2
LD L,B 68
Copy Register B (the slot number) into Register L: Register Pair HL = the slot's hash byte.
53E3
LD A,L 7D
Copy Register L (the slot number) into Register A. 542FH comes here for a free slot.
53E4
ADD A,20H C6 20
ADD 20H to Register A: the next record in the same directory sector.
53E6
LD L,A 6F
Copy Register A (the next slot number) into Register L.
53E7
If the NO CARRY FLAG is set (still in this sector), JUMP to 542DH for that slot.
53E9
INC L 2C
INCrement Register L: the first record of the next sector.
53EA
BIT 5,L CB 6D
Test bit 5 of Register L: set once the slot number reaches 20H, past the last sector.
53EC
If the Z FLAG is set (sectors left), JUMP to 542DH.
53EE
LD A,(54CFH) 3A CF 54
Fetch the low byte of the SORT parameter from 54CFH into Register A (FFH in the file, 00H after SORT=N or for a program's DIR).
53F1
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when the records were collected for sorting.
53F2
If the NZ FLAG is set, GOSUB to 5944H to sort the collected records by name and show them.
53F5
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the last line of the drive.
53F7
GOSUB to 5789H to display Register A (0DH) and print it when P was given.
53FA
GOSUB to 58F2H to count the line against the page.
53FD
LD A,FFH 3E FF
Load Register A with the drive given, the operand at 53FEH: FFH in the file (no drive given), else the drive number (5241H).
53FF
INC A 3C
INCrement Register A: the Z FLAG is set for FFH, no drive given.
5400
If the NZ FLAG is set (one drive was asked for), JUMP to 5409H to end the command.
5402
INC C 0C
INCrement Register C to the next drive, every drive being shown.
5403
LD A,C 79
Copy Register C (the next drive) into Register A.
5404
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for drives 0-7.
5406
If the CARRY FLAG is set (drives left), JUMP to 52B4H for the next drive.
5409
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
540C
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 540DH-540EH (0000H in the file, stored by 5200H). 5A3FH comes here with Register Pair HL = FFFFH.
540F
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5410
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5411
RET Z C8
RETurn if the Z FLAG is set, with Register Pair HL = 0000H, through the supervisor dispatcher to the program that ran the command.
5412
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5415
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5417
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH.
5418
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

541BH - A Drive That Is Not Ready

@CKDRV found no diskette. When the drive was asked for, error 20H (illegal drive number) is reported; when every drive is being shown it is passed over. When the last drive (7) is not ready, the RET at 542CH ends the command at once: the stack is back at its entry depth, and Register Pair HL is what @CKDRV left, not 0000H.

541B
POP BC C1
Restore Register Pair BC (Register C = the drive) from the stack.
541C
LD A,(53FEH) 3A FE 53
Fetch the drive given from 53FEH into Register A (FFH: none).
541F
INC A 3C
INCrement Register A: the NZ FLAG is set when a drive was given.
5420
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number). LD does not change the flags.
5422
If the NZ FLAG is set (the drive was asked for), JUMP to 5A37H to report error 20H.
5425
INC C 0C
INCrement Register C to the next drive, every drive being shown.
5426
LD A,C 79
Copy Register C (the next drive) into Register A.
5427
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for drives 0-7.
5429
If the CARRY FLAG is set (drives left), JUMP to 52B4H for the next drive.
542C
RET C9
RETurn to the supervisor dispatcher (4BE7H): the last drive was not ready. Register Pair HL is not set to 0000H on this path.

542DH - Read a Directory Record and Decide Whether It Is Shown

Register Pair HL = the slot's hash byte at 5C00H-5CFFH. A slot with a hash is read with DIRRD (the sector is read only when it is not the one already at 4200H, 5439H). A record is passed over when it is not in use or is an extension record; a system file needs S, an invisible file I; MOD shows only files whose mod flag is set; the name must match the partspec (or must not, after a minus sign); DATE keeps the files whose date lies in the range. A file that passes is shown at once (5509H) or, with SORT, copied to the sort buffer with its size.

542D
LD A,(HL) 7E
Fetch the slot's hash byte at Register Pair HL into Register A.
542E
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, a free slot.
542F
If the Z FLAG is set (no file in this slot), JUMP to 53E3H for the next slot.
5431
LD B,L 45
Copy Register L (the slot number) into Register B: the directory record number for DIRRD.
5432
PUSH BC C5
Save Register Pair BC (Register B = the record, Register C = the drive) to the stack.
5433
LD A,L 7D
Copy Register L (the record number) into Register A.
5434
AND E0H E6 E0
Mask Register A with E0H: the record's place in its sector times 32, its offset in the buffer.
5436
LD L,A 6F
Copy Register A (the offset) into Register L.
5437
XOR B A8
Exclusive OR Register B (the record number) into Register A: the offset cancels, leaving bits 4-0, the sector of the record less 2.
5438
CP FFH FE FF
Compare Register A against the sector now in the buffer at 4200H, the operand at 5439H (FFH in the file, so the first record is always read).
543A
If the Z FLAG is set (the record's sector is already at 4200H), JUMP to 5445H.
543C
LD (5439H),A 32 39 54
Store Register A (the record's sector) at 5439H, the operand of the CP at 5438H.
543F
GOSUB to 4B10H (DIRRD) to read the directory sector of record Register B on drive Register C into 4200H; Register Pair HL comes back pointing at the record.
5442
If the NZ FLAG is set (the sector could not be read), JUMP to 5A37H to report the error in Register A (11H).
5445
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = 4200H + the offset in Register L, the record in the buffer.
5447
BIT 4,(HL) CB 66
Test bit 4 of the record's attribute byte at Register Pair HL: set when the record is in use.
5449
If the Z FLAG is set (not in use), JUMP to 53DFH for the next slot.
544C
BIT 7,(HL) CB 7E
Test bit 7 of the attribute byte at Register Pair HL: set for an extension record, which holds more extents of a file.
544E
If the NZ FLAG is set (an extension record), JUMP to 53DFH for the next slot.
5451
BIT 6,(HL) CB 76
Test bit 6 of the attribute byte at Register Pair HL: set for a system file.
5453
If the Z FLAG is set (not a system file), JUMP to 545FH.
5455
LD DE,0000H 11 00 00
Load Register Pair DE with the S parameter, the operand at 5456H-5457H: 0000H unless S or SYS was given.
5458
LD A,D 7A
Copy Register D (the high byte of the S parameter) into Register A.
5459
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when S was not given.
545A
If the Z FLAG is set (no S), JUMP to 53DFH: system files are not shown.
545D
JUMP to 546BH to go on with the MOD test: a system file needs no I.
545F
BIT 3,(HL) CB 5E
Test bit 3 of the attribute byte at Register Pair HL: set for an invisible file.
5461
If the Z FLAG is set (a visible file), JUMP to 546BH.
5463
LD DE,0000H 11 00 00
Load Register Pair DE with the I parameter, the operand at 5464H-5465H: 0000H unless I or INV was given.
5466
LD A,D 7A
Copy Register D (the high byte of the I parameter) into Register A.
5467
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when I was not given.
5468
If the Z FLAG is set (no I), JUMP to 53DFH: invisible files are not shown.
546B
LD DE,0000H 11 00 00
Load Register Pair DE with the MOD parameter, the operand at 546CH-546DH: 0000H unless MOD or M was given.
546E
LD A,D 7A
Copy Register D (the high byte of the MOD parameter) into Register A.
546F
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when MOD was not given.
5470
If the Z FLAG is set (no MOD), JUMP to 5479H for the name test.
5472
INC L 2C
INCrement Register L to byte +01H of the record, the flags and the month.
5473
BIT 6,(HL) CB 76
Test bit 6 of byte +01H at Register Pair HL: the mod flag, set when the file was written since it was last backed up.
5475
If the Z FLAG is set (not modified), JUMP to 53DFH: MOD shows only modified files.
5478
DEC L 2D
DECrement Register L back to the record's attribute byte.
5479
PUSH HL E5
Save Register Pair HL (the record) to the stack.
547A
LD A,L 7D
Copy Register L (the record's offset) into Register A.
547B
ADD A,05H C6 05
ADD 05H to Register A: byte +05H, the first of the eight characters of the name.
547D
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record's name.
547E
LD DE,5B6AH 11 6A 5B
Point Register Pair DE to 5B6AH, the name mask, followed at 5B72H by the extension mask.
5481
LD B,0BH 06 0B
Load Register B with 0BH, the eleven characters of a name and an extension.
5483
LD A,(DE) 1A
Fetch the mask's next character at Register Pair DE into Register A.
5484
CP 24H FE 24
Compare Register A against 24H, the $ that stands for any character.
5486
If the Z FLAG is set ($), JUMP to 548FH: this character matches.
5488
CP (HL) BE
Compare Register A (the mask's character) against the record's character at Register Pair HL.
5489
If the Z FLAG is set (the same character), JUMP to 548FH.
548B
CP 20H FE 20
Compare Register A against 20H, a space: a mask shorter than the name ends in spaces, which match anything.
548D
If the NZ FLAG is set (a different character), JUMP to 549CH: the name does not match.
548F
INC HL 23
INCrement Register Pair HL to the record's next character.
5490
INC DE 13
INCrement Register Pair DE to the mask's next character.
5491
DECrement Register B (the characters left) and LOOP BACK to 5483H.
5493
LD A,(549DH) 3A 9D 54
The name matches: fetch the minus sign switch from 549DH into Register A (00H, or 2DH after a leading minus sign).
5496
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set after a minus sign.
5497
If the NZ FLAG is set (only files that do not match are shown), JUMP to 53DEH for the next slot.
549A
JUMP to 54A2H: the file is shown, subject to the date range.
549C
LD A,00H 3E 00
The name does not match: load Register A with the minus sign switch, the operand at 549DH (00H in the file, 2DH after a leading minus sign).
549E
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set without a minus sign.
549F
If the Z FLAG is set (only files that match are shown), JUMP to 53DEH for the next slot.
54A2
POP HL E1
Restore Register Pair HL (the record) from the stack.
54A3
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
54A4
INC HL 23
INCrement Register Pair HL to byte +01H, the month of the record's date.
54A5
GOSUB to 57DDH to turn the record's date into one comparable word in Register Pair DE (year, month and day from the top bits down; 0000H for a file with no date).
54A8
LD A,(5BE0H) 3A E0 5B
Fetch the date mode byte from 5BE0H into Register A.
54AB
RLCA 07
Rotate Register A left one bit (RLCA): bit 7, a start date given, goes into the CARRY FLAG.
54AC
If the NO CARRY FLAG is set (no start date), JUMP to 54BCH.
54AE
LD A,D 7A
Copy Register D (the high byte of the file's date) into Register A.
54AF
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set for a file with no date.
54B0
If the Z FLAG is set (no date), JUMP to 53DEH: such a file is never in a range.
54B3
LD HL,(5BE5H) 2A E5 5B
Fetch the start date from 5BE5H-5BE6H into Register Pair HL.
54B6
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the file's date, Register Pair DE = the start date.
54B7
RST 18H DF
RST 18H: the ROM's compare (4006H, 1C90H) of Register Pair HL with Register Pair DE: the CARRY FLAG is set when the file's date is before the start date.
54B8
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair DE = the file's date. EX does not change the flags.
54B9
If the CARRY FLAG is set (before the start date), JUMP to 53DEH: the file is not shown.
54BC
LD A,(5BE0H) 3A E0 5B
Fetch the date mode byte from 5BE0H into Register A.
54BF
RRCA 0F
Rotate Register A right one bit (RRCA): bit 0, an end date given, goes into the CARRY FLAG.
54C0
If the NO CARRY FLAG is set (no end date), JUMP to 54CEH.
54C2
LD A,D 7A
Copy Register D (the high byte of the file's date) into Register A.
54C3
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set for a file with no date.
54C4
If the Z FLAG is set (no date), JUMP to 53DEH.
54C7
LD HL,(5BE7H) 2A E7 5B
Fetch the end date from 5BE7H-5BE8H into Register Pair HL.
54CA
RST 18H DF
RST 18H: compare Register Pair HL (the end date) with Register Pair DE (the file's date): the CARRY FLAG is set when the end date is before the file's date.
54CB
If the CARRY FLAG is set (after the end date), JUMP to 53DEH: the file is not shown.
54CE
LD DE,FFFFH 11 FF FF
Load Register Pair DE with the SORT parameter, the operand at 54CFH-54D0H: FFFFH in the file (sort on), 0000H after SORT=N or for a program's DIR.
54D1
LD A,D 7A
Copy Register D (the high byte of the SORT parameter) into Register A.
54D2
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when the files are not sorted.
54D3
POP HL E1
Restore Register Pair HL (the record) from the stack. POP does not change the flags.
54D4
If the Z FLAG is set (no sort), JUMP to 5503H to show the file now.
54D6
PUSH HL E5
Save Register Pair HL (the record) to the stack.
54D7
GOSUB to 571FH to add up the file's extents: Register Pair DE = its granules, Register Pair BC = its extents.
54DA
POP HL E1
Restore Register Pair HL (the record) from the stack.
54DB
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
54DC
POP IX DD E1
Restore it into Index Register IX: Index Register IX = the record in the buffer.
54DE
LD (IX+16H),E DD 73 16
Store Register E (the low byte of the granules) at byte +16H of the record at Index Register IX, over the first extent, which the sorted display does not need.
54E1
LD (IX+17H),D DD 72 17
Store Register D (the high byte of the granules) at byte +17H of the record at Index Register IX.
54E4
LD (IX+18H),C DD 71 18
Store Register C (the low byte of the extents) at byte +18H of the record at Index Register IX.
54E7
LD (IX+19H),B DD 70 19
Store Register B (the high byte of the extents) at byte +19H of the record at Index Register IX.
54EA
LD DE,(5BE1H) ED 5B E1 5B
Fetch the address for the next sorted record from 5BE1H-5BE2H into Register Pair DE.
54EE
PUSH HL E5
Save Register Pair HL (the record) to the stack: 53DEH takes it back.
54EF
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a directory record.
54F2
LDIR ED B0
Copy the record: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up, into the sort buffer.
54F4
LD (5BE1H),DE ED 53 E1 5B
Store Register Pair DE (the address after the copy) at 5BE1H-5BE2H.
54F8
LD HL,(5BE3H) 2A E3 5B
Fetch the sort buffer's ceiling (HIGH$ - 33) from 5BE3H-5BE4H into Register Pair HL.
54FB
SBC HL,DE ED 52
Subtract Register Pair DE (the next free address) and the CARRY FLAG (clear) from Register Pair HL: the CARRY FLAG is set when the buffer has passed the ceiling.
54FD
If the NO CARRY FLAG is set (room left), JUMP to 53DEH for the next slot.
5500
JUMP to 5A29H to display Insufficient memory for SORT buffer! and end the command.
5503
GOSUB to 5509H to show the file whose record is at Register Pair HL.
5506
JUMP to 53DFH for the next slot (the record was taken from the stack at 54D3H).

5509H - Show One File: Name, Extension and Attributes

Register Pair HL = any byte of the file's directory record. The name and /extension take 13 columns, then five attribute characters: S (system), I (invisible), P (a password with an access level below full), * (bit 5 of the attribute byte: a partitioned data set) and + (the mod flag), each - when off, and a space. With the full display (A, the default) the detail follows (55C5H) and the line ends; in the short display (A=N) three files share a line.

5509
LD A,L 7D
Copy Register L (an offset inside the record) into Register A.
550A
AND E0H E6 E0
Mask Register A with E0H: the offset of the record's first byte in its sector.
550C
ADD A,05H C6 05
ADD 05H to Register A: the offset of byte +05H, the first character of the name.
550E
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record's name.
550F
LD C,0DH 0E 0D
Load Register C with 0DH (13), the columns of the name field, counted down as characters go out.
5511
LD B,08H 06 08
Load Register B with 08H, the eight characters of the name.
5513
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
5514
INC HL 23
INCrement Register Pair HL to the character after it.
5515
CP 20H FE 20
Compare Register A against 20H: a space ends a name shorter than eight characters.
5517
If the Z FLAG is set (the name has ended), JUMP to 5521H.
5519
GOSUB to 5789H to display the character in Register A (and print it when P was given).
551C
DEC C 0D
DECrement Register C, the columns left in the name field.
551D
DECrement Register B (the name characters left) and LOOP BACK to 5513H.
551F
JUMP to 5525H: all eight characters were shown and Register Pair HL is at the extension.
5521
LD A,L 7D
Copy Register L (one past the space) into Register A.
5522
ADD A,B 80
ADD Register B (the name characters left, the space included) to Register A.
5523
DEC A 3D
DECrement Register A: Register A = the low byte of the extension's address, byte +0DH.
5524
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the extension.
5525
LD A,(HL) 7E
Fetch the first character of the extension at Register Pair HL into Register A.
5526
CP 20H FE 20
Compare Register A against 20H, a space: the file has no extension.
5528
If the Z FLAG is set (no extension), JUMP to 553EH to pad the field.
552A
LD A,2FH 3E 2F
Load Register A with 2FH, the slash before the extension.
552C
GOSUB to 5789H to display the slash in Register A.
552F
DEC C 0D
DECrement Register C, the columns left in the name field.
5530
LD B,03H 06 03
Load Register B with 03H, the three characters of the extension.
5532
LD A,(HL) 7E
Fetch the next character of the extension at Register Pair HL into Register A.
5533
INC HL 23
INCrement Register Pair HL to the character after it.
5534
CP 20H FE 20
Compare Register A against 20H, a space that ends a short extension.
5536
If the Z FLAG is set (the extension has ended), JUMP to 553EH.
5538
GOSUB to 5789H to display the character in Register A.
553B
DEC C 0D
DECrement Register C, the columns left in the name field.
553C
DECrement Register B (the extension characters left) and LOOP BACK to 5532H.
553E
GOSUB to 5787H to display a space (and print it when P was given).
5541
DEC C 0D
DECrement Register C, the columns left in the name field.
5542
If the NZ FLAG is set (columns left), LOOP BACK to 553EH: the field is always 13 columns wide.
5544
LD A,L 7D
Copy Register L (inside the record) into Register A.
5545
AND E0H E6 E0
Mask Register A with E0H: the offset of the record's first byte.
5547
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record's attribute byte.
5548
LD B,(HL) 46
Fetch the attribute byte at Register Pair HL into Register B.
5549
BIT 6,B CB 70
Test bit 6 of Register B (the attribute byte): a system file.
554B
LD A,53H 3E 53
Load Register A with 53H, S. LD does not change the flags.
554D
If the NZ FLAG is set (a system file), JUMP to 5551H to show S.
554F
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign, for the attribute that is off.
5551
GOSUB to 5789H to display Register A (S or -).
5554
BIT 3,B CB 58
Test bit 3 of Register B (the attribute byte): an invisible file.
5556
LD A,49H 3E 49
Load Register A with 49H, I. LD does not change the flags.
5558
If the NZ FLAG is set (invisible), JUMP to 555CH to show I.
555A
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign: the file is visible.
555C
GOSUB to 5789H to display Register A (I or -).
555F
PUSH HL E5
Save Register Pair HL (the record) to the stack.
5560
LD A,L 7D
Copy Register L (the record's offset) into Register A.
5561
ADD A,10H C6 10
ADD 10H to Register A: byte +10H, the password hash of the record.
5563
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the password hash.
5564
LD E,(HL) 5E
Fetch the low byte of the password hash at Register Pair HL into Register E.
5565
INC L 2C
INCrement Register L to the high byte of the password hash.
5566
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the file's password hash.
5567
LD HL,4296H 21 96 42
Load Register Pair HL with 4296H, the hash of a blank password (no password).
556A
SBC HL,DE ED 52
Subtract Register Pair DE (the file's hash) from Register Pair HL (the CARRY FLAG is clear after the ADD at 5561H): the Z FLAG is set when the file has no password.
556C
If the Z FLAG is set (no password), JUMP to 5575H to show a minus sign.
556E
LD A,B 78
Copy Register B (the attribute byte) into Register A.
556F
AND 07H E6 07
Mask Register A with 07H, the access level: the Z FLAG is set for level 0, full access, which the password does not limit.
5571
LD A,50H 3E 50
Load Register A with 50H, P. LD does not change the flags.
5573
If the NZ FLAG is set (the password protects the file), JUMP to 5577H to show P.
5575
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign: no protecting password.
5577
LD (55C7H),A 32 C7 55
Store Register A (P or -) at 55C7H, the operand of the LD A at 55C6H, which chooses the access code shown in the detail.
557A
GOSUB to 5789H to display Register A (P or -).
557D
POP HL E1
Restore Register Pair HL (the record's attribute byte) from the stack.
557E
LD A,2AH 3E 2A
Load Register A with 2AH, an asterisk, for bit 5 of the attribute byte.
5580
BIT 5,B CB 68
Test bit 5 of Register B (the attribute byte): a partitioned data set.
5582
If the NZ FLAG is set, JUMP to 5586H to show the asterisk.
5584
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign: bit 5 of the attribute byte is clear.
5586
GOSUB to 5789H to display Register A (the asterisk or -).
5589
INC HL 23
INCrement Register Pair HL to byte +01H of the record, the flags and the month.
558A
BIT 6,(HL) CB 76
Test bit 6 of byte +01H at Register Pair HL: the mod flag.
558C
LD A,2BH 3E 2B
Load Register A with 2BH, a plus sign. LD does not change the flags.
558E
If the NZ FLAG is set (modified), JUMP to 5592H to show the plus sign.
5590
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign: the file is not modified.
5592
GOSUB to 5789H to display Register A (+ or -).
5595
DEC HL 2B
DECrement Register Pair HL back to the attribute byte.
5596
GOSUB to 5787H to display a space after the attributes: 19 columns so far.
5599
LD DE,FFFFH 11 FF FF
Load Register Pair DE with the A parameter, the operand at 559AH-559BH: FFFFH in the file (the full display), 0000H after A=N.
559C
LD A,D 7A
Copy Register D (the high byte of the A parameter) into Register A.
559D
OR E B3
OR Register E (the low byte) into Register A: the NZ FLAG is set for the full display.
559E
If the NZ FLAG is set, GOSUB to 55C5H to show the detail of the file; it sets 55A2H to 01H so that the line ends.
55A1
LD A,00H 3E 00
Load Register A with the files still to go on this line, the operand at 55A2H (3 at the start of a line; 1 after the detail).
55A3
DEC A 3D
DECrement Register A: the Z FLAG is set when the line is full.
55A4
LD (55A2H),A 32 A2 55
Store Register A at 55A2H, the operand of the LD A at 55A1H.
55A7
RET NZ C0
RETurn if the NZ FLAG is set (more files fit on this line).
55A8
LD A,03H 3E 03
Load Register A with 03H, the files of the next line.
55AA
LD (55A2H),A 32 A2 55
Store Register A (3) at 55A2H, the files left on the new line.
55AD
LD A,(559AH) 3A 9A 55
Fetch the low byte of the A parameter from 559AH into Register A.
55B0
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the short display.
55B1
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER. LD does not change the flags.
55B3
PUSH AF F5
Save Register Pair AF (0DH and the flags) to the stack.
55B4
If the Z FLAG is set (the short display, 57 columns), GOSUB to 5789H to display and print the 0DH.
55B7
POP AF F1
Restore Register Pair AF (0DH and the flags) from the stack.
55B8
If the NZ FLAG is set (the full display, 64 columns, which wraps on the screen by itself), GOSUB to 578EH to send the 0DH to the printer only.
55BB
GOSUB to 58F2H to count the line against the page.
55BE
GOSUB to 58C7H to look at the BREAK and pause keys: it returns the Z FLAG to go on.
55C1
RET Z C8
RETurn if the Z FLAG is set (no BREAK): the next file follows.
55C2
BREAK was pressed: JUMP to 5A3CH to end the command with Register Pair HL = FFFFH.

55C5H - The Detail of a File: Access, LRL, Records, EOF, Extents, Size, Date and Time

Fills the detail template at 5B3CH (pr lrl #recs eof de s=sssss.s dd-mmm-yy hh:mm, 45 characters) from the record at Register Pair HL and displays it. pr is the access code (5AEBH; AL when no password protects the file), the records are worked out from the ending record number, the end of file byte and the record length, the size in kilobytes from the granules; s: instead of s= marks a file made by CREATE. The time is shown only for a diskette that carries it (56ACH).

55C5
PUSH HL E5
Save Register Pair HL (the record) to the stack.
55C6
LD A,00H 3E 00
Load Register A with the attribute character P or -, the operand at 55C7H stored by 5577H.
55C8
SUB 2DH D6 2D
SUBtract 2DH from Register A: the Z FLAG is set for a minus sign, a file no password protects.
55CA
If the Z FLAG is set (Register A = 00H), JUMP to 55CFH to show entry 0, AL.
55CC
LD A,(HL) 7E
Fetch the attribute byte at Register Pair HL into Register A.
55CD
AND 07H E6 07
Mask Register A with 07H: the access level 0-7.
55CF
ADD A,A 87
ADD Register A to itself: two characters for each entry of the access table.
55D0
LD C,A 4F
Copy Register A (the offset) into Register C.
55D1
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the offset in the table.
55D3
LD HL,5AEBH 21 EB 5A
Point Register Pair HL to 5AEBH, the access codes AL KI NM (blank) WR RD EX NO for levels 0-7.
55D6
ADD HL,BC 09
ADD Register Pair BC (the offset) to Register Pair HL: the file's access code.
55D7
LD DE,5B3CH 11 3C 5B
Point Register Pair DE to 5B3CH, the pr field at the start of the detail template.
55DA
LD BC,0002H 01 02 00
Load Register Pair BC with 0002H, the two characters of the code.
55DD
LDIR ED B0
Copy the code: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up.
55DF
POP HL E1
Restore Register Pair HL (the record) from the stack.
55E0
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
55E1
INC L 2C
INCrement Register L to byte +01H of the record.
55E2
INC L 2C
INCrement Register L to byte +02H of the record, the day and year byte.
55E3
INC L 2C
INCrement Register L to byte +03H, the end of file byte.
55E4
LD A,(HL) 7E
Fetch the end of file byte at Register Pair HL into Register A: the position after the last byte in the last sector.
55E5
PUSH AF F5
Save Register Pair AF (the end of file byte) to the stack.
55E6
INC L 2C
INCrement Register L to byte +04H, the record length.
55E7
LD A,(HL) 7E
Fetch the record length at Register Pair HL into Register A (00H means 256).
55E8
LD (5603H),A 32 03 56
Store Register A (the record length) at 5603H, the operand of the LD A at 5602H.
55EB
PUSH HL E5
Save Register Pair HL (the record + 04H) to the stack.
55EC
LD L,A 6F
Copy Register A (the record length) into Register L.
55ED
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the record length.
55EF
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, a length of 256.
55F0
If the NZ FLAG is set (1-255), JUMP to 55F3H.
55F2
INC H 24
INCrement Register H: Register Pair HL = 0100H, 256.
55F3
INC DE 13
INCrement Register Pair DE past the space at 5B3EH to the lrl field.
55F4
GOSUB to 5888H to write Register Pair HL (the record length) as three decimal digits at Register Pair DE (5B3FH-5B41H).
55F7
POP HL E1
Restore Register Pair HL (the record + 04H) from the stack.
55F8
LD A,L 7D
Copy Register L (the offset of byte +04H) into Register A.
55F9
ADD A,10H C6 10
ADD 10H to Register A: byte +14H, the ending record number.
55FB
LD L,A 6F
Copy Register A into Register L: Register Pair HL = byte +14H of the record.
55FC
LD E,(HL) 5E
Fetch the low byte of the ending record number at Register Pair HL into Register E.
55FD
INC L 2C
INCrement Register L to the high byte of the ending record number.
55FE
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the ending record number, the sectors the file takes, a last part sector included.
55FF
POP BC C1
Restore Register Pair BC from the stack: Register B = the end of file byte (Register A pushed at 55E5H).
5600
PUSH BC C5
Save Register Pair BC (the end of file byte) to the stack again for the eof column.
5601
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the ending record number.
5602
LD A,00H 3E 00
Load Register A with the record length, the operand at 5603H (00H in the file, stored by 55E8H).
5604
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 256 byte records.
5605
If the Z FLAG is set (256 byte records: the records are the sectors), JUMP to 561FH with Register Pair HL = the ending record number.
5607
LD E,A 5F
Copy Register A (the record length) into Register E.
5608
INC B 04
INCrement Register B (the end of file byte)...
5609
DEC B 05
...and DECrement Register B back: the Z FLAG is set when the end of file byte is 00H, the last sector full.
560A
If the Z FLAG is set (no part sector), JUMP to 560DH.
560C
DEC HL 2B
DECrement Register Pair HL: the full sectors, the last part sector left out.
560D
GOSUB to 44C4H (@DIV) to divide Register Pair HL (the full sectors) by Register A (the record length): Register Pair HL = the quotient q, Register A = the remainder r. The file's bytes are q x length x 256 + r x 256 + the end of file byte.
5610
LD C,L 4D
Copy Register L (the low byte of q) into Register C.
5611
LD D,H 54
Copy Register H (the high byte of q) into Register D.
5612
LD H,A 67
Copy Register A (the remainder r) into Register H.
5613
LD L,B 68
Copy Register B (the end of file byte) into Register L: Register Pair HL = r x 256 + the end of file byte.
5614
LD A,E 7B
Copy Register E (the record length) into Register A.
5615
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A (the record length): Register Pair HL = the records in the rest (below 256), Register A = the bytes left over.
5618
LD H,C 61
Copy Register C (the low byte of q) into Register H: Register Pair HL = q x 256 + the records in the rest, the whole records.
5619
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no bytes are left over.
561A
If the Z FLAG is set (no part record), JUMP to 561DH.
561C
INC HL 23
INCrement Register Pair HL: a part record counts as one.
561D
LD A,D 7A
Copy Register D (the high byte of q) into Register A.
561E
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when q is 256 or more, so the records are above 65535 and do not fit in Register Pair HL.
561F
LD DE,5B43H 11 43 5B
Point Register Pair DE to 5B43H, the #recs field. LD does not change the flags. 5605H comes here with the Z FLAG set.
5622
If the Z FLAG is set (the count fits), JUMP to 562EH to write it.
5624
LD HL,5BDBH 21 DB 5B
Point Register Pair HL to 5BDBH, the five asterisks shown when the count does not fit.
5627
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters.
562A
LDIR ED B0
Copy the asterisks: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up, into the #recs field.
562C
JUMP to 5631H for the end of file column, the asterisks in place.
562E
GOSUB to 588CH to write Register Pair HL (the records) as five decimal digits at Register Pair DE (5B43H-5B47H).
5631
POP HL E1
Restore Register Pair HL from the stack: Register H = the end of file byte (Register B pushed at 5600H).
5632
DEC H 25
DECrement Register H: the position of the last byte, 255 for a full last sector.
5633
LD L,H 6C
Copy Register H (the last byte's position) into Register L.
5634
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the position, 0-255.
5636
LD DE,5B49H 11 49 5B
Point Register Pair DE to 5B49H, the eof field.
5639
GOSUB to 5888H to write Register Pair HL as three decimal digits at Register Pair DE (5B49H-5B4BH).
563C
POP HL E1
Restore Register Pair HL (the record) from the stack.
563D
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
563E
GOSUB to 5709H for the file's size: Register Pair DE = the granules, Register Pair BC = the extents (from the sorted record, or added up from the extents).
5641
PUSH DE D5
Save Register Pair DE (the granules) to the stack.
5642
LD L,C 69
Copy Register C (the low byte of the extents) into Register L.
5643
LD H,B 60
Copy Register B (the high byte) into Register H: Register Pair HL = the extents.
5644
LD DE,5B4DH 11 4D 5B
Point Register Pair DE to 5B4DH, the de field.
5647
LD A,20H 3E 20
Load Register A with 20H, a space, to show for a leading zero.
5649
GOSUB to 58A0H to write Register Pair HL (the extents) as two decimal digits at Register Pair DE (5B4DH-5B4EH).
564C
POP DE D1
Restore Register Pair DE (the granules) from the stack.
564D
LD HL,5B52H 21 52 5B
Point Register Pair HL to 5B52H, the sssss.s field.
5650
GOSUB to 5796H to write Register Pair DE (the granules) as kilobytes at 5B52H-5B56H; Register A returns the tenths digit.
5653
LD (5B58H),A 32 58 5B
Store Register A (the tenths digit) at 5B58H, after the decimal point.
5656
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the space after the size.
5659
LD DE,5B5AH 11 5A 5B
Point Register Pair DE to 5B5AH, the first byte of the date field.
565C
LD BC,000FH 01 0F 00
Load Register Pair BC with 000FH, the 15 bytes of the date and time fields.
565F
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: each byte takes the space before it, so 5B5AH-5B68H are blanked from the last file.
5661
POP HL E1
Restore Register Pair HL (the record) from the stack.
5662
LD DE,5B5AH 11 5A 5B
Point Register Pair DE to 5B5AH, where the day goes.
5665
INC HL 23
INCrement Register Pair HL to byte +01H of the record.
5666
BIT 7,(HL) CB 7E
Test bit 7 of byte +01H at Register Pair HL: set for a file made by CREATE, whose unused space is kept.
5668
LD A,3AH 3E 3A
Load Register A with 3AH, a colon. LD does not change the flags.
566A
If the NZ FLAG is set (made by CREATE), JUMP to 566EH to show the colon.
566C
LD A,3DH 3E 3D
Load Register A with 3DH, an equals sign, for a file made otherwise.
566E
LD (5B51H),A 32 51 5B
Store Register A (: or =) at 5B51H, after the s before the size.
5671
INC HL 23
INCrement Register Pair HL to byte +02H of the record: bits 7-3 the day, bits 2-0 the year in the older form.
5672
LD A,(HL) 7E
Fetch byte +02H at Register Pair HL into Register A.
5673
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, a file with no date.
5674
If the Z FLAG is set (no date), JUMP to 56FDH: the date and time fields stay blank.
5677
RRCA 0F
Rotate Register A right one bit (RRCA): first of three rotations that bring the day down.
5678
RRCA 0F
Rotate Register A right one bit again (RRCA): second rotation.
5679
RRCA 0F
Rotate Register A right one bit again (RRCA): the day is in bits 4-0.
567A
AND 1FH E6 1F
Mask Register A with 1FH: the day of the month, 1-31.
567C
LD B,2FH 06 2F
Load Register B with 2FH, one below the character 0, to count the tens.
567E
INC B 04
INCrement Register B: the next tens digit character of the day.
567F
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A (what is left of the day).
5681
If the NO CARRY FLAG is set (10 more taken off), LOOP BACK to 567EH: Register B = the tens digit character.
5683
ADD A,3AH C6 3A
ADD 3AH to Register A (the units less 10): the units digit character.
5685
PUSH AF F5
Save Register Pair AF (the units digit) to the stack.
5686
LD A,B 78
Copy Register B (the tens digit) into Register A.
5687
LD (DE),A 12
Store Register A (the tens digit) at Register Pair DE (5B5AH).
5688
INC DE 13
INCrement Register Pair DE to 5B5BH, the units of the day.
5689
POP AF F1
Restore Register Pair AF (the units digit) from the stack.
568A
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE (5B5BH).
568B
INC DE 13
INCrement Register Pair DE to 5B5CH, after the day.
568C
LD A,2DH 3E 2D
Load Register A with 2DH, the minus sign between the day and the month.
568E
LD (DE),A 12
Store Register A (-) at Register Pair DE (5B5CH).
568F
INC DE 13
INCrement Register Pair DE to 5B5DH, the month's name.
5690
PUSH HL E5
Save Register Pair HL (the record + 02H) to the stack.
5691
DEC HL 2B
DECrement Register Pair HL to byte +01H, whose bits 3-0 are the month.
5692
LD A,(HL) 7E
Fetch byte +01H at Register Pair HL into Register A.
5693
AND 0FH E6 0F
Mask Register A with 0FH: the month of the file's date, 1-12.
5695
DEC A 3D
DECrement Register A: the month less one, 0-11.
5696
LD C,A 4F
Copy Register A (the month less one) into Register C.
5697
RLCA 07
Rotate Register A left one bit (RLCA): the month less one times two.
5698
ADD A,C 81
ADD Register C to Register A: the month less one times three, the offset of its name.
5699
LD C,A 4F
Copy Register A (the offset) into Register C.
569A
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the offset.
569C
LD HL,5BB7H 21 B7 5B
Point Register Pair HL to 5BB7H, the month names JanFebMar...Dec.
569F
ADD HL,BC 09
ADD Register Pair BC (the offset) to Register Pair HL: the month's name.
56A0
LD C,03H 0E 03
Load Register C with 03H, the three letters of the name (Register B is 00H).
56A2
LDIR ED B0
Copy the name: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up, to 5B5DH-5B5FH.
56A4
LD A,2DH 3E 2D
Load Register A with 2DH, the minus sign between the month and the year.
56A6
LD (DE),A 12
Store Register A (-) at Register Pair DE (5B60H).
56A7
INC DE 13
INCrement Register Pair DE to 5B61H, the year.
56A8
POP HL E1
Restore Register Pair HL (the record + 02H) from the stack.
56A9
LD C,38H 0E 38
Load Register C with 38H, the character 8, the tens of the years 1980-1989.
56AB
LD A,00H 3E 00
Load Register A with the dating switch, the operand at 56ACH (stored by 52D2H): FFH when the diskette's records carry the time and a five bit year.
56AD
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for such a diskette.
56AE
PUSH AF F5
Save Register Pair AF (the flags) to the stack for the time below.
56AF
If the NZ FLAG is set (five bit year), JUMP to 56B6H.
56B1
LD A,(HL) 7E
Fetch byte +02H at Register Pair HL into Register A: bits 2-0 the year less 1980 in the older form.
56B2
AND 07H E6 07
Mask Register A with 07H: the year 0-7, 1980-1987.
56B4
JUMP to 56CCH to write 8 and the year's digit.
56B6
LD A,L 7D
Copy Register L (the record + 02H) into Register A.
56B7
ADD A,11H C6 11
ADD 11H to Register A: byte +13H of the record, whose bits 4-0 are the year less 1980.
56B9
LD L,A 6F
Copy Register A into Register L: Register Pair HL = byte +13H of the record.
56BA
LD A,(HL) 7E
Fetch byte +13H at Register Pair HL into Register A.
56BB
AND 1FH E6 1F
Mask Register A with 1FH: the year less 1980, 0-31.
56BD
CP 14H FE 14
Compare Register A against 14H (20): the NO CARRY FLAG is set for 2000 and later.
56BF
If the CARRY FLAG is set (1980-1999), JUMP to 56C5H.
56C1
SUB 14H D6 14
SUBtract 14H (20) from Register A: the year less 2000.
56C3
LD C,30H 0E 30
Load Register C with 30H, the character 0, the tens of 2000-2009.
56C5
CP 0AH FE 0A
Compare Register A against 0AH (10): the NO CARRY FLAG is set for 10 years or more into the decade.
56C7
If the CARRY FLAG is set (0-9), JUMP to 56CCH.
56C9
INC C 0C
INCrement Register C: the next tens digit (9 for 1990-1999, 1 for 2010-2011).
56CA
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A: the units of the year.
56CC
LD B,A 47
Copy Register A (the units of the year) into Register B.
56CD
LD A,C 79
Copy Register C (the tens digit character) into Register A.
56CE
LD (DE),A 12
Store Register A (the tens digit) at Register Pair DE (5B61H).
56CF
INC DE 13
INCrement Register Pair DE to 5B62H, the units of the year.
56D0
LD A,B 78
Copy Register B (the units of the year) into Register A.
56D1
ADD A,30H C6 30
ADD 30H to Register A: the units digit character.
56D3
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE (5B62H).
56D4
POP AF F1
Restore Register Pair AF (the flags of the dating switch) from the stack.
56D5
If the Z FLAG is set (the older form, no time), JUMP to 56FDH.
56D7
LD A,(HL) 7E
Fetch byte +13H at Register Pair HL into Register A: bits 7-5 the low three bits of the minutes.
56D8
DEC HL 2B
DECrement Register Pair HL to byte +12H: bits 7-3 the hours, bits 2-0 the high three bits of the minutes.
56D9
LD L,(HL) 6E
Fetch byte +12H at Register Pair HL into Register L.
56DA
LD B,03H 06 03
Load Register B with 03H, the three bits of the minutes held in Register L.
56DC
SRL L CB 3D
Shift Register L right one bit (SRL L): its bit 0 goes into the CARRY FLAG.
56DE
RRA 1F
Rotate Register A right through the CARRY FLAG (RRA): the bit from Register L comes in at bit 7.
56DF
DECrement Register B and LOOP BACK to 56DCH: Register L = the hours, and bits 7-2 of Register A = the minutes.
56E1
RRA 1F
Rotate Register A right through the CARRY FLAG (RRA): first of two rotations.
56E2
RRA 1F
Rotate Register A right through the CARRY FLAG again (RRA): the minutes are in bits 5-0.
56E3
AND 3FH E6 3F
Mask Register A with 3FH: the minutes of the file's time, 0-59.
56E5
PUSH AF F5
Save Register Pair AF (the minutes) to the stack.
56E6
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the hours.
56E8
LD DE,5B64H 11 64 5B
Point Register Pair DE to 5B64H, the hh field.
56EB
LD A,30H 3E 30
Load Register A with 30H, the character 0, shown for a leading zero.
56ED
GOSUB to 58A0H to write Register Pair HL (the hours) as two decimal digits at Register Pair DE.
56F0
LD A,3AH 3E 3A
Load Register A with 3AH, the colon between the hours and the minutes.
56F2
LD (DE),A 12
Store Register A (:) at Register Pair DE (5B66H).
56F3
INC DE 13
INCrement Register Pair DE to 5B67H, the minutes.
56F4
POP AF F1
Restore Register Pair AF (the minutes) from the stack.
56F5
LD L,A 6F
Copy Register A (the minutes) into Register L.
56F6
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the minutes.
56F8
LD A,30H 3E 30
Load Register A with 30H, the character 0, for a leading zero.
56FA
GOSUB to 58A0H to write Register Pair HL (the minutes) as two decimal digits at Register Pair DE (5B67H-5B68H).
56FD
LD HL,5B3CH 21 3C 5B
Point Register Pair HL to 5B3CH, the detail just filled in (ended by 03H at 5B69H).
5700
GOSUB to 577CH to display the detail, and print it when P was given.
5703
LD A,01H 3E 01
Load Register A with 01H: the line is full after this file.
5705
LD (55A2H),A 32 A2 55
Store Register A (1) at 55A2H, the files left on the line, so that 55A1H ends the line.
5708
RET C9
RETurn to 559EH, where the line is ended after the detail.

5709H - The Size of a File: the Sorted Key or the Extents

5709H returns Register Pair DE = the file's granules and Register Pair BC = its extents. With SORT the two words stored at +16H-+19H of the copied record (54DEH) are taken; otherwise 571FH adds up the extents of the record at Register Pair HL and of its extension records: each extent is two bytes (the cylinder, then bits 7-5 the first granule and bits 4-0 the granules less one), FEH as a cylinder links to an extension record whose number follows, FFH ends the list. An extension record not in the buffer at 4200H is read into 5D00H.

5709
LD A,(54CFH) 3A CF 54
Fetch the low byte of the SORT parameter from 54CFH into Register A.
570C
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when the files are not sorted.
570D
If the Z FLAG is set (no sort), JUMP to 571FH to add up the extents.
570F
PUSH HL E5
Save Register Pair HL (the record in the sort buffer) to the stack.
5710
POP IX DD E1
Restore it into Index Register IX: Index Register IX = the record.
5712
LD E,(IX+16H) DD 5E 16
Fetch the low byte of the granules from byte +16H of the record at Index Register IX into Register E.
5715
LD D,(IX+17H) DD 56 17
Fetch the high byte of the granules from byte +17H of the record at Index Register IX into Register D.
5718
LD C,(IX+18H) DD 4E 18
Fetch the low byte of the extents from byte +18H of the record at Index Register IX into Register C.
571B
LD B,(IX+19H) DD 46 19
Fetch the high byte of the extents from byte +19H of the record at Index Register IX into Register B.
571E
RET C9
RETurn with Register Pair DE = the granules and Register Pair BC = the extents.
571F
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the granules counted so far.
5722
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the extents counted so far.
5725
LD A,L 7D
Copy Register L (the record's offset in its buffer) into Register A. 574CH and 5752H come here with an extension record.
5726
ADD A,16H C6 16
ADD 16H to Register A: byte +16H, the first extent. 577AH comes here with Register A = the offset of a record just read.
5728
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the first extent of the record.
5729
LD A,(HL) 7E
Fetch the extent's cylinder byte at Register Pair HL into Register A.
572A
INC L 2C
INCrement Register L to the extent's granule byte.
572B
CP FEH FE FE
Compare Register A against FEH: the NO CARRY FLAG is set for FEH (a link) or FFH (the end).
572D
If the NO CARRY FLAG is set (FEH or FFH, not a cylinder), JUMP to 573CH.
572F
INC BC 03
INCrement Register Pair BC: one more extent of the file.
5730
LD A,(HL) 7E
Fetch the extent's granule byte at Register Pair HL into Register A.
5731
INC L 2C
INCrement Register L to the next extent of the record.
5732
AND 1FH E6 1F
Mask Register A with 1FH: the granules of the extent less one.
5734
INC A 3C
INCrement Register A: the granules of the extent.
5735
ADD A,E 83
ADD Register E (the low byte of the granules so far) to Register A.
5736
LD E,A 5F
Copy Register A into Register E, the low byte of the granules so far.
5737
If the NO CARRY FLAG is set (no carry into the high byte), LOOP BACK to 5729H for the next extent.
5739
INC D 14
INCrement Register D: the carry into the high byte of the granules.
573A
LOOP BACK to 5729H for the next extent of the record.
573C
RET NZ C0
RETurn if the NZ FLAG is set (FFH: the last extent was read): Register Pair DE = the granules, Register Pair BC = the extents.
573D
LD A,(HL) 7E
FEH, a link: fetch the byte after it at Register Pair HL into Register A, the number of the extension record (byte +1FH).
573E
AND 1FH E6 1F
Mask Register A with 1FH: the record's sector less 2.
5740
PUSH AF F5
Save Register Pair AF (the sector) to the stack.
5741
XOR (HL) AE
Exclusive OR the record number at Register Pair HL into Register A: Register A = the record number AND E0H, the record's offset in its sector.
5742
LD L,A 6F
Copy Register A (the offset) into Register L.
5743
POP AF F1
Restore Register Pair AF (the sector) from the stack.
5744
PUSH HL E5
Save Register Pair HL (the offset in Register L) to the stack.
5745
LD HL,5439H 21 39 54
Point Register Pair HL to 5439H, the sector now in the buffer at 4200H.
5748
CP (HL) BE
Compare Register A (the extension record's sector) against the byte at Register Pair HL.
5749
POP HL E1
Restore Register Pair HL (the offset) from the stack. POP does not change the flags.
574A
LD H,42H 26 42
Load Register H with 42H, the page of the buffer at 4200H. LD does not change the flags.
574C
If the Z FLAG is set (the extension record is at 4200H), JUMP to 5725H to add up its extents.
574E
CP FFH FE FF
Compare Register A against the sector now in the buffer at 5D00H, the operand at 574FH (FFH in the file).
5750
LD H,5DH 26 5D
Load Register H with 5DH, the page of the buffer at 5D00H. LD does not change the flags.
5752
If the Z FLAG is set (the extension record is at 5D00H), JUMP to 5725H.
5754
LD (574FH),A 32 4F 57
Store Register A (the sector) at 574FH, the operand of the CP at 574EH: it will be at 5D00H.
5757
PUSH BC C5
Save Register Pair BC (the extents so far) to the stack.
5758
PUSH DE D5
Save Register Pair DE (the granules so far) to the stack.
5759
OR L B5
OR Register L (the offset) into Register A: Register A = the extension record's number again.
575A
LD B,A 47
Copy Register A (the record number) into Register B.
575B
LD A,(5B02H) 3A 02 5B
Fetch the drive's digit from 5B02H into Register A.
575E
SUB 30H D6 30
SUBtract 30H from Register A: the drive number.
5760
LD C,A 4F
Copy Register A (the drive number) into Register C for the read.
5761
GOSUB to 4B65H (DIRCYL) to load Register D with the directory cylinder of drive Register C.
5764
LD A,B 78
Copy Register B (the record number) into Register A.
5765
AND 1FH E6 1F
Mask Register A with 1FH: the record's sector less 2.
5767
ADD A,02H C6 02
ADD 02H to Register A: the sector of the directory cylinder that holds the record.
5769
LD E,A 5F
Copy Register A (the sector) into Register E.
576A
LD HL,5D00H 21 00 5D
Point Register Pair HL to 5D00H, the second directory buffer.
576D
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL.
5770
LD A,11H 3E 11
Load Register A with 11H, error 17 (directory read error). LD does not change the flags.
5772
If the NZ FLAG is set (the read failed), JUMP to 5A37H to report error 11H.
5775
LD A,B 78
Copy Register B (the record number) into Register A.
5776
AND E0H E6 E0
Mask Register A with E0H: the record's offset in the sector.
5778
POP DE D1
Restore Register Pair DE (the granules so far) from the stack.
5779
POP BC C1
Restore Register Pair BC (the extents so far) from the stack.
577A
JUMP to 5726H to add up the extents of the record at 5D00H + Register A (Register H is 5DH).

577CH - Output Helpers: a Text, a Character, a Space

577CH displays the text at Register Pair HL and prints it when P was given (the P parameter at 578FH). 5787H shows a space, 5789H the character in Register A, both also sent to the printer with P; 578EH sends Register A to the printer only.

577C
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL (ended by 03H or 0DH).
577F
LD A,(578FH) 3A 8F 57
Fetch the low byte of the P parameter from 578FH into Register A.
5782
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when P was given.
5783
If the NZ FLAG is set (P), JUMP to 446AH (@PRINT) to print the text at Register Pair HL too; it returns to the caller.
5786
RET C9
RETurn to the caller: the text was only displayed.
5787
LD A,20H 3E 20
Load Register A with 20H, a space, and go on into 5789H.
5789
PUSH AF F5
Save Register Pair AF (the character) to the stack.
578A
GOSUB to the ROM at 0033H to display the character in Register A (the ROM leaves Register Pair DE = 401DH).
578D
POP AF F1
Restore Register Pair AF (the character) from the stack.
578E
LD DE,0000H 11 00 00
Load Register Pair DE with the P parameter, the operand at 578FH-5790H: 0000H in the file, FFFFH when P was given.
5791
INC E 1C
INCrement Register E: the Z FLAG is set when it was FFH, P given.
5792
If the Z FLAG is set (P), JUMP to the ROM at 003BH to print the character in Register A; it returns to the caller.
5795
RET C9
RETurn to the caller without printing: P was not given.

5796H - Granules to Kilobytes

Register Pair DE = granules, Register Pair HL = the place of five digits. The granules times the sectors in a granule (579BH) give the sectors; four sectors of 256 bytes make one kilobyte. The kilobytes go out as five decimal digits (588CH) and the quarter left over returns in Register A as the tenths digit 0, 2, 5 or 8.

5796
LD (57ABH),HL 22 AB 57
Store Register Pair HL (the place for the digits) at 57ABH-57ACH, the operand of the LD DE at 57AAH.
5799
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the granules.
579A
LD A,00H 3E 00
Load Register A with the sectors in a granule, the operand at 579BH (stored by 52E8H).
579C
GOSUB to 44C1H (@MULT) to multiply Register Pair HL (the granules) by Register A: the 24 bit sector count in Register Pair HL (high 16 bits) and Register A (low 8 bits).
579F
PUSH AF F5
Save Register Pair AF (the low byte of the sectors) to the stack.
57A0
LD H,L 65
Copy Register L (the middle byte of the sectors) into Register H.
57A1
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the sectors (the top byte, 00H for any diskette here, is dropped).
57A2
SRL H CB 3C
Shift Register H right one bit (SRL H): first of two shifts of Register Pair HL.
57A4
RR L CB 1D
Rotate Register L right through the CARRY FLAG (RR L): Register Pair HL = the sectors / 2.
57A6
SRL H CB 3C
Shift Register H right one bit again (SRL H).
57A8
RR L CB 1D
Rotate Register L right through the CARRY FLAG (RR L): Register Pair HL = the sectors / 4, the kilobytes.
57AA
LD DE,0000H 11 00 00
Load Register Pair DE with the place for the digits, the operand at 57ABH-57ACH (0000H in the file).
57AD
GOSUB to 588CH to write Register Pair HL (the kilobytes) as five decimal digits at Register Pair DE.
57B0
POP AF F1
Restore Register Pair AF (the low byte of the sectors) from the stack.
57B1
AND 03H E6 03
Mask Register A with 03H: the sectors left over, 0-3 quarters of a kilobyte.
57B3
LD B,A 47
Copy Register A (the quarters) into Register B.
57B4
LD A,30H 3E 30
Load Register A with 30H, the character 0. LD does not change the flags.
57B6
RET Z C8
RETurn if the Z FLAG is set (no quarter) with Register A = 0.
57B7
DEC B 05
DECrement Register B: the Z FLAG is set for one quarter.
57B8
LD A,32H 3E 32
Load Register A with 32H, the character 2, for a quarter.
57BA
RET Z C8
RETurn if the Z FLAG is set (0.25) with Register A = 2.
57BB
DEC B 05
DECrement Register B: the Z FLAG is set for two quarters.
57BC
LD A,35H 3E 35
Load Register A with 35H, the character 5, for a half.
57BE
RET Z C8
RETurn if the Z FLAG is set (0.5) with Register A = 5.
57BF
LD A,38H 3E 38
Load Register A with 38H, the character 8, for three quarters.
57C1
RET C9
RETurn with Register A = 8, for three quarters of a kilobyte.

57C2H - Copy a Name Field into a Mask

Register A = the first character, Register Pair HL = the text after it, Register Pair DE = the mask, Register B = the most characters. A $ and the letters and digits are stored, small letters as capitals; any other character ends the field. Returns Register A = the character after the field and Register Pair HL past it.

57C2
CP 24H FE 24
Compare Register A against 24H, the $ that stands for any character.
57C4
If the Z FLAG is set ($), JUMP to 57D6H to store it.
57C6
CP 41H FE 41
Compare Register A against 41H, the letter A: the NO CARRY FLAG is set for A and above.
57C8
If the NO CARRY FLAG is set (a letter), JUMP to 57D0H.
57CA
CP 3AH FE 3A
Compare Register A against 3AH, one above the character 9.
57CC
RET NC D0
RETurn if the NO CARRY FLAG is set (3AH-40H, such as the colon): the field has ended.
57CD
CP 30H FE 30
Compare Register A against 30H, the character 0.
57CF
RET C D8
RETurn if the CARRY FLAG is set (below 0, such as a space or a bracket): the field has ended.
57D0
CP 61H FE 61
Compare Register A against 61H, the small letter a.
57D2
If the CARRY FLAG is set (a capital or a digit), JUMP to 57D6H.
57D4
XOR 20H EE 20
Exclusive OR 20H into Register A: a small letter becomes a capital.
57D6
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the mask.
57D7
INC DE 13
INCrement Register Pair DE to the next place of the mask.
57D8
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A.
57D9
INC HL 23
INCrement Register Pair HL past the character just fetched.
57DA
DECrement Register B (the places left) and LOOP BACK to 57C2H.
57DC
RET C9
RETurn with the field full: Register A = the character after it.

57DDH - A Directory Date as One Word

Register Pair HL = byte +01H of a directory record. Returns Register Pair DE = the year in bits 15-11, the month in bits 10-7 and the day in bits 6-2, so that dates compare as numbers. The year is the five bit year at +13H on a diskette with this release's dates (56ACH), else the three bits of +02H.

57DD
LD A,(HL) 7E
Fetch byte +01H at Register Pair HL into Register A.
57DE
AND 0FH E6 0F
Mask Register A with 0FH: the month of the record's date, 1-12.
57E0
LD E,00H 1E 00
Load Register E with 00H for the low byte of the word.
57E2
SRL A CB 3F
Shift Register A right one bit (SRL A): bit 0 of the month goes into the CARRY FLAG.
57E4
RR E CB 1B
Rotate Register E right through the CARRY FLAG (RR E): bit 0 of the month becomes bit 7 of Register E.
57E6
LD D,A 57
Copy Register A (the month's bits 3-1) into Register D.
57E7
INC HL 23
INCrement Register Pair HL to byte +02H, the day in bits 7-3.
57E8
LD A,(HL) 7E
Fetch byte +02H at Register Pair HL into Register A.
57E9
AND F8H E6 F8
Mask Register A with F8H: the day of the record's date in bits 7-3.
57EB
RRCA 0F
Rotate Register A right one bit (RRCA): the day in bits 6-2.
57EC
OR E B3
OR Register E into Register A: bit 7 the month's bit 0, bits 6-2 the day.
57ED
LD E,A 5F
Copy Register A into Register E, the low byte of the word.
57EE
LD A,(56ACH) 3A AC 56
Fetch the dating switch from 56ACH into Register A (FFH for the five bit year).
57F1
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for the five bit year.
57F2
If the NZ FLAG is set, JUMP to 57FDH to take the year from +13H.
57F4
LD A,(HL) 7E
Fetch byte +02H at Register Pair HL into Register A.
57F5
AND 07H E6 07
Mask Register A with 07H: the three bit year less 1980.
57F7
RLCA 07
Rotate Register A left one bit (RLCA): first of three rotations. 5804H joins here with the five bit year.
57F8
RLCA 07
Rotate Register A left one bit again (RLCA): second rotation.
57F9
RLCA 07
Rotate Register A left one bit again (RLCA): the year is in bits 7-3.
57FA
OR D B2
OR Register D (the month's bits 3-1) into Register A.
57FB
LD D,A 57
Copy Register A into Register D, the high byte of the word.
57FC
RET C9
RETurn with Register Pair DE = the date as one word.
57FD
LD A,L 7D
Copy Register L (the record + 02H) into Register A.
57FE
ADD A,11H C6 11
ADD 11H to Register A: byte +13H of the record.
5800
LD L,A 6F
Copy Register A into Register L: Register Pair HL = byte +13H.
5801
LD A,(HL) 7E
Fetch byte +13H at Register Pair HL into Register A.
5802
AND 1FH E6 1F
Mask Register A with 1FH: the year less 1980, 0-31.
5804
JUMP to 57F7H to move the year to the top of the word.

5806H - Read a Date Argument MM/DD/YY

Register Pair HL = the first digit. Three fields of two digits separated by slashes are read into 5BEBH (the month), 5BEAH (the day) and 5BE9H (the year); years 00-11 mean 2000-2011. The day is checked against the days of the month at 5B76H (February gets one more day in a leap year: 581FH adds it to the table itself, so a second leap year date in the same command allows one more). Returns Register Pair BC = the date as one word in the form of 57DDH, Register Pair HL after the date. A bad date goes to Bad date format.

5806
LD A,(HL) 7E
Fetch the first character of the date at Register Pair HL into Register A (5856H fetches it again).
5807
LD C,2FH 0E 2F
Load Register C with 2FH, the slash that separates the fields.
5809
GOSUB to 5856H to read three two digit fields separated by Register C into 5BEBH, 5BEAH and 5BE9H.
580C
If the NZ FLAG is set (a field was not two digits, or a slash is missing), JUMP to 5A2DH to display Bad date format.
580F
LD A,(DE) 1A
Fetch the year from 5BE9H (Register Pair DE points at it) into Register A.
5810
CP 0CH FE 0C
Compare Register A (the year) against 0CH (12): the CARRY FLAG is set for 00-11.
5812
If the NO CARRY FLAG is set (12-99), JUMP to 5817H.
5814
ADD A,64H C6 64
ADD 64H (100) to Register A: 00-11 become 100-111, the years 2000-2011.
5816
LD (DE),A 12
Store Register A (the year) at Register Pair DE (5BE9H).
5817
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 5BE9H, Register Pair DE = the text after the date.
5818
AND 03H E6 03
Mask Register A (the year) with 03H: the Z FLAG is set for a leap year.
581A
LD HL,5B77H 21 77 5B
Point Register Pair HL to 5B77H, the days in February. LD does not change the flags.
581D
If the NZ FLAG is set (not a leap year), JUMP to 5820H.
581F
INC (HL) 34
INCrement the days in February at Register Pair HL: 29 in a leap year.
5820
LD A,(5BEBH) 3A EB 5B
Fetch the month of the date being read from 5BEBH into Register A.
5823
DEC A 3D
DECrement Register A: the month less one, 0-11 for a good month.
5824
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for a month of 0 or above 12.
5826
If the NO CARRY FLAG is set (a bad month), JUMP to 5833H, where the JP NC reports it.
5828
DEC HL 2B
DECrement Register Pair HL to 5B76H, the days in January.
5829
ADD A,L 85
ADD Register L to Register A (the month less one).
582A
LD L,A 6F
Copy Register A into Register L: the low byte of the month's entry.
582B
If the NO CARRY FLAG is set (no carry into Register H), JUMP to 582EH.
582D
INC H 24
INCrement Register H: Register Pair HL = the days in the month.
582E
LD A,(5BEAH) 3A EA 5B
Fetch the day of the date being read from 5BEAH into Register A.
5831
DEC A 3D
DECrement Register A: the day less one, so that day 0 fails too.
5832
CP (HL) BE
Compare Register A against the days in the month at Register Pair HL: the CARRY FLAG is set for a day 1 up to the last day.
5833
If the NO CARRY FLAG is set (day 0, or past the end of the month, or a bad month), JUMP to 5A2DH: Bad date format.
5836
LD HL,5BEBH 21 EB 5B
Point Register Pair HL to 5BEBH, the month of the date read.
5839
LD B,(HL) 46
Fetch the month at Register Pair HL into Register B.
583A
LD C,00H 0E 00
Load Register C with 00H for the low byte of the word.
583C
SRL B CB 38
Shift Register B right one bit (SRL B): bit 0 of the month goes into the CARRY FLAG.
583E
RR C CB 19
Rotate Register C right through the CARRY FLAG (RR C): bit 0 of the month becomes bit 7.
5840
DEC HL 2B
DECrement Register Pair HL to 5BEAH, the day.
5841
LD A,(HL) 7E
Fetch the day at Register Pair HL into Register A.
5842
DEC HL 2B
DECrement Register Pair HL to 5BE9H, the year.
5843
RLCA 07
Rotate Register A left one bit (RLCA): first of two rotations.
5844
RLCA 07
Rotate Register A left one bit again (RLCA): the day in bits 6-2.
5845
OR C B1
OR Register C (the month's bit 0) into Register A.
5846
LD C,A 4F
Copy Register A into Register C, the low byte of the word.
5847
LD A,(HL) 7E
Fetch the year at Register Pair HL into Register A: 80-99 for 1980-1999, 100-111 for 2000-2011, and 12-79 as typed.
5848
SUB 50H D6 50
SUBtract 50H (80) from Register A: the year less 1980.
584A
CP 70H FE 70
Compare Register A against 70H: the NO CARRY FLAG is set when the subtraction went below 0 (a year 12-79).
584C
If the CARRY FLAG is set (1980-2011), JUMP to 584FH.
584E
XOR A AF
Clear Register A (XOR A): a year 12-79 counts as 1980.
584F
RLCA 07
Rotate Register A left one bit (RLCA): first of three rotations.
5850
RLCA 07
Rotate Register A left one bit again (RLCA): second rotation.
5851
RLCA 07
Rotate Register A left one bit again (RLCA): the year in bits 7-3.
5852
OR B B0
OR Register B (the month's bits 3-1) into Register A.
5853
LD B,A 47
Copy Register A into Register B: Register Pair BC = the date as one word.
5854
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the text after the date.
5855
RET C9
RETurn with Register Pair BC = the date as one word and Register Pair HL after it; the callers do not test the flags.

5856H - Read Three Two Digit Fields

Register Pair HL = the text, Register C = the separator. The fields go to 5BEBH, 5BEAH and 5BE9H. Returns the Z FLAG with Register Pair DE = 5BE9H, or the NZ FLAG when a field is not two digits or a separator is not Register C. 586BH reads two digits into Register A (the Z FLAG when both are digits); 5881H takes one character and returns the CARRY FLAG for a digit.

5856
LD DE,5BEBH 11 EB 5B
Point Register Pair DE to 5BEBH, where the first field goes.
5859
LD B,03H 06 03
Load Register B with 03H, the three fields month, day and year.
585B
PUSH DE D5
Save Register Pair DE (the place of this field) to the stack.
585C
GOSUB to 586BH to read two digits at Register Pair HL into Register A as a number 0-99.
585F
POP DE D1
Restore Register Pair DE (the place of this field) from the stack.
5860
RET NZ C0
RETurn if the NZ FLAG is set (not two digits).
5861
LD (DE),A 12
Store Register A (the field) at Register Pair DE.
5862
DEC B 05
DECrement Register B, the fields still to be read.
5863
RET Z C8
RETurn if the Z FLAG is set (three fields read), with Register Pair DE = 5BE9H.
5864
DEC DE 1B
DECrement Register Pair DE to the place of the next field.
5865
LD A,(HL) 7E
Fetch the separator at Register Pair HL into Register A.
5866
INC HL 23
INCrement Register Pair HL past the separator just fetched.
5867
CP C B9
Compare Register A against Register C (the slash).
5868
If the Z FLAG is set (a slash), LOOP BACK to 585BH for the next field.
586A
RET C9
RETurn with the NZ FLAG set: a separator is missing.
586B
GOSUB to 5881H to take the first digit at Register Pair HL: Register A = its value, the CARRY FLAG set for a digit.
586E
If the NO CARRY FLAG is set (not a digit), JUMP to 587FH to return NZ.
5870
LD E,A 5F
Copy Register A (the tens digit) into Register E.
5871
RLCA 07
Rotate Register A left one bit (RLCA): the digit times 2.
5872
RLCA 07
Rotate Register A left one bit again (RLCA): times 4.
5873
ADD A,E 83
ADD Register E (the digit) to Register A: the digit times 5.
5874
RLCA 07
Rotate Register A left one bit (RLCA): times 10.
5875
LD E,A 5F
Copy Register A (the tens digit times ten) into Register E.
5876
GOSUB to 5881H to take the second digit at Register Pair HL.
5879
If the NO CARRY FLAG is set (not a digit), JUMP to 587FH to return NZ.
587B
ADD A,E 83
ADD Register E (the tens) to Register A: the two digit number.
587C
LD E,A 5F
Copy Register A (the number) into Register E.
587D
CP A BF
Compare Register A with itself (CP A): the Z FLAG is set for success.
587E
RET C9
RETurn with the Z FLAG set and Register A = the number.
587F
OR A B7
Set the flags from Register A (OR A): Register A holds the character less 30H, which is not 00H, so the NZ FLAG is set.
5880
RET C9
RETurn with the NZ FLAG set: the character was not a digit.
5881
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5882
INC HL 23
INCrement Register Pair HL past the character just fetched.
5883
SUB 30H D6 30
SUBtract 30H from Register A: a digit becomes its value 0-9.
5885
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG is set for a digit.
5887
RET C9
RETurn with the CARRY FLAG set for a digit and Register A its value.

5888H - Decimal Output: Three, Five or Two Digits

Register Pair HL = the number, Register Pair DE = the place for the digits. 5888H writes three digits and 588CH five, with spaces for leading zeros; 58A0H writes two digits with Register A = the character for a leading zero (a space or 0). Each digit is found by 58ACH, which subtracts the power of ten in Register Pair BC as often as it can. Register Pair DE returns after the digits.

5888
LD A,20H 3E 20
Load Register A with 20H, a space for leading zeros.
588A
JUMP to 589AH to write the hundreds, tens and units.
588C
LD A,20H 3E 20
Load Register A with 20H, a space for leading zeros.
588E
LD BC,2710H 01 10 27
Load Register Pair BC with 2710H (10000), the ten thousands.
5891
GOSUB to 58ACH to write the ten thousands digit at Register Pair DE.
5894
LD BC,03E8H 01 E8 03
Load Register Pair BC with 03E8H (1000), the thousands.
5897
GOSUB to 58ACH to write the thousands digit at Register Pair DE.
589A
LD BC,0064H 01 64 00
Load Register Pair BC with 0064H (100), the hundreds.
589D
GOSUB to 58ACH to write the hundreds digit at Register Pair DE.
58A0
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH (10), the tens.
58A3
GOSUB to 58ACH to write the tens digit at Register Pair DE.
58A6
LD A,L 7D
Copy Register L (the units left, 0-9) into Register A.
58A7
ADD A,30H C6 30
ADD 30H to Register A: the units digit character, always shown.
58A9
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE.
58AA
INC DE 13
INCrement Register Pair DE past the digits, to the next place.
58AB
RET C9
RETurn with Register Pair DE after the number.
58AC
PUSH DE D5
Save Register Pair DE (the place of the digit) to the stack.
58AD
LD E,A 5F
Copy Register A (the character for a zero) into Register E.
58AE
LD D,FFH 16 FF
Load Register D with FFH: the count of subtractions starts one low.
58B0
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtractions.
58B1
INC D 14
INCrement Register D: one more subtraction of the power of ten.
58B2
SBC HL,BC ED 42
Subtract Register Pair BC (the power of ten) and the CARRY FLAG from Register Pair HL.
58B4
If the NO CARRY FLAG is set (it went), LOOP BACK to 58B1H.
58B6
ADD HL,BC 09
ADD Register Pair BC back to Register Pair HL: the subtraction that went below 0 is undone.
58B7
LD A,E 7B
Copy Register E (the character for a zero) into Register A.
58B8
LD B,D 42
Copy Register D (the digit, the count of subtractions) into Register B.
58B9
POP DE D1
Restore Register Pair DE (the place of the digit) from the stack.
58BA
LD (DE),A 12
Store Register A (the character for a zero) at Register Pair DE.
58BB
INC B 04
INCrement Register B (the digit) to test it...
58BC
DEC B 05
...and DECrement Register B back: the Z FLAG is set when the digit is 0.
58BD
If the Z FLAG is set (0), JUMP to 58C5H, keeping the character for a zero.
58BF
LD A,B 78
Copy Register B (the digit, 1-9) into Register A.
58C0
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit.
58C2
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
58C3
LD A,30H 3E 30
Load Register A with 30H, the character 0: after the first digit that is not 0, zeros are shown.
58C5
INC DE 13
INCrement Register Pair DE to the next place.
58C6
RET C9
RETurn with Register A = the character for a zero from now on.

58C7H - BREAK and the Pause Key

58C7H returns the Z FLAG to go on and the NZ FLAG for BREAK. During a JCL job (bit 5 of 430FH) nothing is checked. With SHIFT @ held (bit 1 of KFLAG$, 4423H) it waits for a key other than SHIFT @. 58E8H clears the BREAK, pause and ENTER bits of KFLAG$.

58C7
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
58CA
AND 20H E6 20
Mask Register A with 20H, bit 5: a JCL job runs.
58CC
XOR 20H EE 20
Exclusive OR 20H into Register A: the Z FLAG is set during a JCL job.
58CE
RET Z C8
RETurn if the Z FLAG is set (a JCL job): go on.
58CF
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
58D2
BIT 0,A CB 47
Test bit 0 of Register A: set by the interrupt's keyboard scan when BREAK was pressed.
58D4
RET NZ C0
RETurn if the NZ FLAG is set (BREAK was pressed): the caller stops.
58D5
BIT 1,A CB 4F
Test bit 1 of Register A: set when SHIFT and @ were held, the pause.
58D7
RET Z C8
RETurn if the Z FLAG is set (no pause): go on.
58D8
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
58DB
BIT 0,A CB 47
Test bit 0 of Register A: BREAK pressed during the pause.
58DD
RET NZ C0
RETurn if the NZ FLAG is set (BREAK during the pause): the caller stops.
58DE
GOSUB to the ROM at 002BH to look at the keyboard once: Register A = the key or 00H.
58E1
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is pressed.
58E2
If the Z FLAG is set (no key), LOOP BACK to 58D8H.
58E4
CP 60H FE 60
Compare Register A against 60H, the code of SHIFT @ itself.
58E6
If the Z FLAG is set (the pause key again), LOOP BACK to 58D8H.
58E8
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A. The entry calls 58E8H directly (5204H).
58EB
AND F8H E6 F8
Mask Register A with F8H: bits 2-0 (BREAK, pause, ENTER) are cleared.
58ED
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, the three bits cleared.
58F0
XOR A AF
Clear Register A (XOR A): the Z FLAG is set, go on.
58F1
RET C9
RETurn with the Z FLAG set: the caller goes on.

58F2H - Count a Line against the Page

Counts down the lines left on the screen (58F3H, 15 a page). At the end of a page, unless N or P was given or a JCL job runs, it waits for a key: BREAK ends the command, C (or c) makes the rest of the display continuous, any key clears the screen; then the column headings are shown again (5921H).

58F2
LD A,00H 3E 00
Load Register A with the lines left on the page, the operand at 58F3H (00H in the file; 52B1H and 58FBH store 0FH).
58F4
DEC A 3D
DECrement Register A: the Z FLAG is set when the page is full.
58F5
LD (58F3H),A 32 F3 58
Store Register A at 58F3H, the operand of the LD A at 58F2H.
58F8
RET NZ C0
RETurn if the NZ FLAG is set (lines left on the page).
58F9
LD A,0FH 3E 0F
Load Register A with 0FH (15), the lines of a new page.
58FB
LD (58F3H),A 32 F3 58
Store Register A (15) at 58F3H, the lines left.
58FE
LD DE,0000H 11 00 00
Load Register Pair DE with the N parameter, the operand at 58FFH-5900H: 0000H in the file, not 0000H after N, P (5270H) or C (591AH).
5901
LD A,E 7B
Copy Register E (the low byte of the N parameter) into Register A.
5902
OR D B2
OR Register D (the high byte) into Register A: the NZ FLAG is set for the continuous display.
5903
RET NZ C0
RETurn if the NZ FLAG is set: the display does not pause.
5904
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5907
AND 20H E6 20
Mask Register A with 20H, bit 5: a JCL job runs.
5909
RET NZ C0
RETurn if the NZ FLAG is set (a JCL job): no pause.
590A
GOSUB to the ROM at 0049H to wait for a key: Register A = the key (the ROM leaves Register Pair DE = 4015H).
590D
CP 01H FE 01
Compare Register A (the key) against 01H, BREAK.
590F
If the Z FLAG is set (BREAK), JUMP to 5A3CH to end the command with Register Pair HL = FFFFH.
5912
SUB 43H D6 43
SUBtract 43H, the letter C, from Register A: the Z FLAG is set for C.
5914
If the Z FLAG is set (C was pressed), JUMP to 591AH.
5916
SUB 20H D6 20
SUBtract 20H from Register A: the Z FLAG is set for the small letter c (63H).
5918
If the NZ FLAG is set (another key), JUMP to 591EH.
591A
LD (58FFH),DE ED 53 FF 58
Store Register Pair DE (4015H, left by the ROM's keyboard call) at 58FFH-5900H, the N parameter: not 0000H, so the rest of the display does not pause.
591E
GOSUB to the ROM at 01C9H to clear the screen and put the cursor at the top left corner.
5921
LD A,(559AH) 3A 9A 55
Fetch the low byte of the A parameter from 559AH into Register A (FFH for the full display).
5924
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the short display.
5925
RET Z C8
RETurn if the Z FLAG is set (the short display has no headings).
5926
LD HL,5AABH 21 AB 5A
Point Register Pair HL to 5AABH, the column headings (63 characters, ended by 03H).
5929
GOSUB to 577CH to display the headings, and print them when P was given.
592C
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the headings line.
592E
GOSUB to 5789H to display and print Register A (0DH).
5931
GOSUB to 58F2H to count the headings line against the page.
5934
LD B,40H 06 40
Load Register B with 40H (64), a line of dashes.
5936
LD A,2DH 3E 2D
Load Register A with 2DH, a minus sign, for the line of dashes.
5938
GOSUB to 5789H to display and print Register A (-).
593B
DECrement Register B and LOOP BACK to 5936H for 64 dashes.
593D
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER: the dashes fill the screen line, so only the printer needs it.
593F
GOSUB to 578EH to send Register A (0DH) to the printer when P was given.
5942
JUMP to 58F2H to count the line of dashes; it returns to the caller.

5944H - SORT: Sort the Collected Records by Name and Show Them

The records copied to 5E00H up to the address in 5BE1H are sorted through a table of pointers built right after them, one word for each record: a Shell sort (5997H) compares the eleven characters of name and extension and swaps the pointers, then each record is shown through 5509H in the new order. The room test before the table compares twice the count with the ceiling address itself, not with the room left above the records.

5944
LD HL,(5BE1H) 2A E1 5B
Fetch the address after the last copied record from 5BE1H-5BE2H into Register Pair HL.
5947
LD DE,5E00H 11 00 5E
Point Register Pair DE to 5E00H, the first record.
594A
LD (HL),E 73
Store Register E (00H) at Register Pair HL, the first byte of the pointer table.
594B
INC HL 23
INCrement Register Pair HL to the high byte of the first table entry.
594C
LD (HL),D 72
Store Register D (5EH) at Register Pair HL: the first entry of the table is 5E00H.
594D
DEC HL 2B
DECrement Register Pair HL back to the start of the table.
594E
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
594F
SBC HL,DE ED 52
Subtract Register Pair DE (5E00H) from Register Pair HL: Register Pair HL = the bytes of records collected.
5951
RET Z C8
RETurn if the Z FLAG is set (no records on this drive).
5952
LD B,05H 06 05
Load Register B with 05H, five shifts: 32 bytes a record.
5954
SRL H CB 3C
Shift Register H right one bit (SRL H): the bytes divided by two.
5956
RR L CB 1D
Rotate Register L right through the CARRY FLAG (RR L).
5958
DECrement Register B and LOOP BACK to 5954H: Register Pair HL = the number of records.
595A
LD B,L 45
Copy Register L (the number of records, 00H for 256) into Register B, the count for the loops.
595B
PUSH BC C5
Save Register Pair BC (the count) to the stack.
595C
LD (5998H),HL 22 98 59
Store Register Pair HL (the number of records) at 5998H-5999H, the operand of the LD HL at 5997H.
595F
LD A,L 7D
Copy Register L (the low byte of the count) into Register A.
5960
OR H B4
OR Register H into Register A: the Z FLAG is set for no records.
5961
If the Z FLAG is set (no records), JUMP to 5984H, where nothing is shown.
5963
ADD HL,HL 29
ADD Register Pair HL to itself: twice the number of records, the bytes of the pointer table.
5964
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the size of the table.
5965
LD HL,(5BE3H) 2A E3 5B
Fetch the ceiling of the sort buffer (HIGH$ - 33) from 5BE3H-5BE4H into Register Pair HL.
5968
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5969
SBC HL,DE ED 52
Subtract Register Pair DE (the table's size) from Register Pair HL (the ceiling): the CARRY FLAG is set only when the size is above the ceiling address.
596B
If the CARRY FLAG is set, JUMP to 5A29H for Insufficient memory for SORT buffer!.
596E
LD HL,(5BE1H) 2A E1 5B
Fetch the address after the last record from 5BE1H-5BE2H into Register Pair HL: the pointer table goes there.
5971
LD DE,5E00H 11 00 5E
Point Register Pair DE to 5E00H, the first record.
5974
LD (HL),E 73
Store Register E (the low byte of the record's address) at Register Pair HL.
5975
INC HL 23
INCrement Register Pair HL to the high byte of the table entry.
5976
LD (HL),D 72
Store Register D (the high byte of the record's address) at Register Pair HL.
5977
INC HL 23
INCrement Register Pair HL to the next entry of the table.
5978
LD A,E 7B
Copy Register E (the low byte of the record's address) into Register A.
5979
ADD A,20H C6 20
ADD 20H to Register A: the next record, 32 bytes on.
597B
LD E,A 5F
Copy Register A into Register E, the low byte of the next record's address.
597C
If the NO CARRY FLAG is set (no carry into Register D), JUMP to 597FH.
597E
INC D 14
INCrement Register D: Register Pair DE = the next record.
597F
DECrement Register B (the records left) and LOOP BACK to 5974H until every record has its pointer.
5981
GOSUB to 5997H to sort the pointer table by the names of the records.
5984
POP BC C1
Restore Register Pair BC (Register B = the number of records) from the stack.
5985
LD HL,(5BE1H) 2A E1 5B
Fetch the address of the pointer table from 5BE1H-5BE2H into Register Pair HL.
5988
LD E,(HL) 5E
Fetch the low byte of the next pointer at Register Pair HL into Register E.
5989
INC HL 23
INCrement Register Pair HL to the high byte of the pointer.
598A
LD D,(HL) 56
Fetch the high byte of the pointer at Register Pair HL into Register D: Register Pair DE = the next record in name order.
598B
INC HL 23
INCrement Register Pair HL to the next pointer.
598C
PUSH HL E5
Save Register Pair HL (the next pointer) to the stack.
598D
PUSH BC C5
Save Register Pair BC (the count) to the stack.
598E
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the record.
598F
GOSUB to 5509H to show the file whose record is at Register Pair HL.
5992
POP BC C1
Restore Register Pair BC (the count) from the stack.
5993
POP HL E1
Restore Register Pair HL (the next pointer) from the stack.
5994
DECrement Register B (the records left) and LOOP BACK to 5988H.
5996
RET C9
RETurn to 53F5H: every record of the drive has been shown in name order.

5997H - The Shell Sort of the Pointer Table

N = the number of records (5998H). The gap starts at N/2 and halves until it is 0 (599EH). For each i from 0 below N - gap (59BAH, the limit at 5A1FH), j starts at i (59C0H): when the name of record j + gap is below the name of record j, the two pointers swap and j steps back by the gap while it stays 0 or more. Every count lives in the operand of the instruction that loads it.

5997
LD HL,0000H 21 00 00
Load Register Pair HL with the number of records, the operand at 5998H-5999H (0000H in the file, stored by 595CH).
599A
LD (599EH),HL 22 9E 59
Store Register Pair HL at 599EH-599FH, the operand of the LD DE at 599DH: the gap starts at N, halved below before it is used.
599D
LD DE,0000H 11 00 00
Load Register Pair DE with the gap, the operand at 599EH-599FH (0000H in the file).
59A0
SRL D CB 3A
Shift Register D right one bit (SRL D): the gap divided by two.
59A2
RR E CB 1B
Rotate Register E right through the CARRY FLAG (RR E): Register Pair DE = the new gap.
59A4
LD A,D 7A
Copy Register D (the high byte of the new gap) into Register A.
59A5
OR E B3
OR Register E into Register A: the Z FLAG is set when the gap is 0 (and the CARRY FLAG is clear).
59A6
RET Z C8
RETurn if the Z FLAG is set: the table is sorted.
59A7
LD (599EH),DE ED 53 9E 59
Store Register Pair DE (the gap) at 599EH-599FH.
59AB
LD HL,(5998H) 2A 98 59
Fetch the number of records from 5998H-5999H into Register Pair HL.
59AE
SBC HL,DE ED 52
Subtract Register Pair DE (the gap) from Register Pair HL (the CARRY FLAG is clear from the OR): N - gap.
59B0
LD (5A1FH),HL 22 1F 5A
Store Register Pair HL (N - gap) at 5A1FH-5A20H, the operand of the LD DE at 5A1EH: the limit of i.
59B3
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the first i.
59B6
LD (59BAH),HL 22 BA 59
Store Register Pair HL (0) at 59BAH-59BBH, the operand of the LD HL at 59B9H: i.
59B9
LD HL,0000H 21 00 00
Load Register Pair HL with i, the operand at 59BAH-59BBH (0000H in the file).
59BC
LD (59C0H),HL 22 C0 59
Store Register Pair HL (i) at 59C0H-59C1H, the operand of the LD HL at 59BFH: j starts at i.
59BF
LD HL,0000H 21 00 00
Load Register Pair HL with j, the operand at 59C0H-59C1H (0000H in the file).
59C2
LD DE,(599EH) ED 5B 9E 59
Fetch the gap from 599EH-599FH into Register Pair DE.
59C6
ADD HL,DE 19
ADD Register Pair DE (the gap) to Register Pair HL: j + gap.
59C7
ADD HL,HL 29
ADD Register Pair HL to itself: the offset of pointer j + gap in the table.
59C8
PUSH HL E5
Save Register Pair HL (that offset) to the stack.
59C9
LD HL,(59C0H) 2A C0 59
Fetch j from 59C0H-59C1H into Register Pair HL.
59CC
ADD HL,HL 29
ADD Register Pair HL to itself: the offset of pointer j.
59CD
LD BC,(5BE1H) ED 4B E1 5B
Fetch the address of the pointer table from 5BE1H-5BE2H into Register Pair BC.
59D1
ADD HL,BC 09
ADD Register Pair BC (the table) to Register Pair HL: the address of pointer j.
59D2
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the address of pointer j.
59D3
POP HL E1
Restore Register Pair HL (the offset of pointer j + gap) from the stack.
59D4
ADD HL,BC 09
ADD Register Pair BC (the table) to Register Pair HL: the address of pointer j + gap.
59D5
PUSH HL E5
Save Register Pair HL (the address of pointer j + gap) to the stack for a swap.
59D6
PUSH DE D5
Save Register Pair DE (the address of pointer j) to the stack for a swap.
59D7
LD B,0BH 06 0B
Load Register B with 0BH, the eleven characters of name and extension.
59D9
PUSH BC C5
Save Register Pair BC (the count) to the stack.
59DA
LD A,(HL) 7E
Fetch the low byte of pointer j + gap at Register Pair HL into Register A.
59DB
INC HL 23
INCrement Register Pair HL to the high byte of pointer j + gap.
59DC
LD H,(HL) 66
Fetch the high byte at Register Pair HL into Register H.
59DD
LD L,A 6F
Copy Register A into Register L: Register Pair HL = record j + gap.
59DE
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the offset of the name in a record.
59E1
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the name of record j + gap.
59E2
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = that name, Register Pair HL = the address of pointer j.
59E3
LD A,(HL) 7E
Fetch the low byte of pointer j at Register Pair HL into Register A.
59E4
INC HL 23
INCrement Register Pair HL to the high byte of pointer j.
59E5
LD H,(HL) 66
Fetch the high byte at Register Pair HL into Register H.
59E6
LD L,A 6F
Copy Register A into Register L: Register Pair HL = record j.
59E7
ADD HL,BC 09
ADD Register Pair BC (5) to Register Pair HL: the name of record j.
59E8
POP BC C1
Restore Register Pair BC (Register B = 11) from the stack.
59E9
LD A,(DE) 1A
Fetch the next character of the name of record j + gap at Register Pair DE into Register A.
59EA
SUB (HL) 96
SUBtract the character of record j at Register Pair HL from Register A.
59EB
If the CARRY FLAG is set (record j + gap comes first), JUMP to 59F5H to swap.
59ED
If the NZ FLAG is set (record j comes first), JUMP to 5A14H: the pair is in order.
59EF
INC DE 13
INCrement Register Pair DE to the next character of record j + gap.
59F0
INC HL 23
INCrement Register Pair HL to the next character of record j.
59F1
DECrement Register B (the characters left) and LOOP BACK to 59E9H.
59F3
JUMP to 5A14H: the names are the same, no swap.
59F5
POP DE D1
Restore Register Pair DE (the address of pointer j) from the stack.
59F6
POP HL E1
Restore Register Pair HL (the address of pointer j + gap) from the stack.
59F7
LD B,02H 06 02
Load Register B with 02H, the two bytes of a pointer.
59F9
LD C,(HL) 4E
Fetch the byte of pointer j + gap at Register Pair HL into Register C.
59FA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the byte of pointer j.
59FB
LD A,(HL) 7E
Fetch the byte of pointer j at Register Pair HL into Register A.
59FC
LD (HL),C 71
Store Register C (the byte of pointer j + gap) at Register Pair HL, in pointer j.
59FD
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair HL = the byte of pointer j + gap.
59FE
LD (HL),A 77
Store Register A (the byte of pointer j) at Register Pair HL, in pointer j + gap.
59FF
INC HL 23
INCrement Register Pair HL to the next byte of pointer j + gap.
5A00
INC DE 13
INCrement Register Pair DE to the next byte of pointer j.
5A01
DECrement Register B and LOOP BACK to 59F9H for the high byte.
5A03
LD HL,(599EH) 2A 9E 59
Fetch the gap from 599EH-599FH into Register Pair HL.
5A06
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the gap.
5A07
LD HL,(59C0H) 2A C0 59
Fetch j from 59C0H-59C1H into Register Pair HL.
5A0A
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5A0B
SBC HL,DE ED 52
Subtract Register Pair DE (the gap) from Register Pair HL: j - gap; the CARRY FLAG is set below 0.
5A0D
LD (59C0H),HL 22 C0 59
Store Register Pair HL (j - gap) at 59C0H-59C1H, the new j.
5A10
If the NO CARRY FLAG is set (j is still 0 or more), LOOP BACK to 59BFH to compare the pair below.
5A12
JUMP to 5A16H for the next i: j went below 0.
5A14
POP DE D1
Restore Register Pair DE from the stack (the address of pointer j, not needed).
5A15
POP HL E1
Restore Register Pair HL from the stack (the address of pointer j + gap, not needed).
5A16
LD HL,(59BAH) 2A BA 59
Fetch i from 59BAH-59BBH into Register Pair HL.
5A19
INC HL 23
INCrement Register Pair HL: the next i of the pass.
5A1A
LD (59BAH),HL 22 BA 59
Store Register Pair HL (i) at 59BAH-59BBH, the operand of the LD HL at 59B9H.
5A1D
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5A1E
LD DE,0000H 11 00 00
Load Register Pair DE with the limit N - gap, the operand at 5A1FH-5A20H (0000H in the file, stored by 59B0H).
5A21
SBC HL,DE ED 52
Subtract Register Pair DE (the limit) from Register Pair HL (i): the NO CARRY FLAG is set once i reaches the limit.
5A23
If the NO CARRY FLAG is set (this gap is done), JUMP to 599DH to halve the gap.
5A26
JUMP to 59B9H for the next i: j starts at the new i.

5A29H - Errors and the Common Exit

5A29H displays Insufficient memory for SORT buffer!; 5A2DH (inside the LD IX at 5A2CH) displays Bad date format; 5A35H reports error 2CH (parameter error) and 5A37H the error in Register A through @ERROR, which returns. All end the command with Register Pair HL = FFFFH.

5A29
LD HL,5B82H 21 82 5B
Point Register Pair HL to 5B82H, the message Insufficient memory for SORT buffer!.
5A2C
LD IX,5BA7H DD 21 A7 5B
Load Index Register IX with 5BA7H. This instruction only covers the three bytes 21H A7H 5BH: a JP to 5A2DH (from 580CH and 5833H, the date checks) skips the DDH and runs them as LD HL,5BA7H, which points Register Pair HL at the message Bad date format. Index Register IX is not used afterwards.
5A30
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5A33
JUMP to 5A3CH to end the command with Register Pair HL = FFFFH.
5A35
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
5A37
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return and bit 6 for the short form of the message.
5A39
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5A3C
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. BREAK (55C2H, 590FH) comes here too.
5A3F
JUMP to 540CH to put the stack back and end the command.

5A42H - DIR Data: the Parameter Table

The table @PARAM reads (5249H): thirteen entries of eight bytes, a keyword of six characters padded with spaces and the address its value goes to, then 00H. Every address is the operand of the instruction that uses the value.

5A42-5A49
DEFM "A " / DEFW 559AH 41 20 20 20 20 20 9A 55
A: its value goes to 559AH-559BH, the operand of the LD DE at 5599H (FFFFH in the file, the full display; A=N gives the short display).
5A4A-5A51
DEFM "I " / DEFW 5464H 49 20 20 20 20 20 64 54
I: its value goes to 5464H-5465H, the operand of the LD DE at 5463H: invisible files are shown.
5A52-5A59
DEFM "INV " / DEFW 5464H 49 4E 56 20 20 20 64 54
INV, the long form of I: its value goes to 5464H-5465H too.
5A5A-5A61
DEFM "P " / DEFW 578FH 50 20 20 20 20 20 8F 57
P: its value goes to 578FH-5790H, the operand of the LD DE at 578EH: every line is printed too, without pauses.
5A62-5A69
DEFM "S " / DEFW 5456H 53 20 20 20 20 20 56 54
S: its value goes to 5456H-5457H, the operand of the LD DE at 5455H: system files are shown.
5A6A-5A71
DEFM "SYS " / DEFW 5456H 53 59 53 20 20 20 56 54
SYS, the long form of S: its value goes to 5456H-5457H too.
5A72-5A79
DEFM "N " / DEFW 58FFH 4E 20 20 20 20 20 FF 58
N: its value goes to 58FFH-5900H, the operand of the LD DE at 58FEH: the display does not pause after each page.
5A7A-5A81
DEFM "DATE " / DEFW 5274H 44 41 54 45 20 20 74 52
DATE: the address of its quoted text goes to 5274H-5275H, the operand of the LD HL at 5273H.
5A82-5A89
DEFM "D " / DEFW 5274H 44 20 20 20 20 20 74 52
D, the short form of DATE: its value goes to 5274H-5275H too.
5A8A-5A91
DEFM "MOD " / DEFW 546CH 4D 4F 44 20 20 20 6C 54
MOD: its value goes to 546CH-546DH, the operand of the LD DE at 546BH: only files with the mod flag are shown.
5A92-5A99
DEFM "M " / DEFW 546CH 4D 20 20 20 20 20 6C 54
M, the short form of MOD: its value goes to 546CH-546DH too.
5A9A-5AA1
DEFM "SORT " / DEFW 54CFH 53 4F 52 54 20 20 CF 54
SORT: its value goes to 54CFH-54D0H, the operand of the LD DE at 54CEH (FFFFH in the file: sorted; SORT=N shows the files in directory order).
5AA2-5AA9
DEFM "O " / DEFW 54CFH 4F 20 20 20 20 20 CF 54
O, the short form of SORT: its value goes to 54CFH-54D0H too.
5AAA
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.

5AABH - DIR Data: the Headings, the Access Codes and the Drive Line

The column headings of the full display (5926H), the eight access codes of the detail (55D3H) and the template of the drive line (53C1H), whose fields 5302H-53BEH fill in for each drive.

5AAB-5AE9
DEFM "Filespec Attrib LRL #Recs EOF DE File Size MOD Date Time" 46 69 6C 65 73 70 65 63 20 20 20 20 20 20 41 74 74 72 69 62 20 20 4C 52 4C 20 23 52 65 63 73 20 45 4F 46 20 44 45 20 46 69 6C 65 20 53 69 7A 65 20 20 4D 4F 44 20 44 61 74 65 20 54 69 6D 65
The column headings of the full display, 63 characters, displayed by 5929H above a line of 64 dashes.
5AEA
DEFB 03H 03
03H, the end of the headings: not displayed, so 592EH ends the line with 0DH.
5AEB-5AFA
DEFM "ALKINM WRRDEXNO" 41 4C 4B 49 4E 4D 20 20 57 52 52 44 45 58 4E 4F
The access codes, two characters for each access level 0-7: AL (all), KI (kill), NM (rename), two spaces for level 3, WR (write), RD (read), EX (execute), NO (no access). 55D3H copies one into the detail.
5AFB-5B01
DEFM "Drive :" 44 72 69 76 65 20 3A
The drive line starts here (53C1H): Drive and a colon before the drive's digit.
5B02
DEFM "d" 64
The drive's digit, stored by 52BDH for each drive and read back as the drive by 575BH.
5B03
DEFM " " 20
A space in the drive line before the diskette's name.
5B04-5B0B
DEFM "packname" 70 61 63 6B 6E 61 6D 65
The diskette's name, eight characters copied from the allocation table (42D0H) by 538AH.
5B0C
DEFM " " 20
A space in the drive line before the diskette's date.
5B0D-5B14
DEFM "packdate" 70 61 63 6B 64 61 74 65
The diskette's date MM/DD/YY, eight characters copied from the allocation table (42D8H) by 538FH.
5B15
DEFM " " 20
A space in the drive line before the number of cylinders.
5B16-5B18
DEFM "cyl" 63 79 6C
The number of cylinders, three digits written by 5310H.
5B19-5B1A
DEFM "dh" 64 68
The density letter (S single, D double, H a rigid drive) and the sides or heads, stored by 533AH.
5B1B-5B20
DEFM " Free=" 20 46 72 65 65 3D
A space and Free= in the drive line, before the free space.
5B21-5B27
DEFM "sssss.s" 73 73 73 73 73 2E 73
The free space in kilobytes, five digits written by 5302H, a point and the tenths digit stored at 5B27H by 5305H.
5B28
DEFM "/" 2F
The slash between the free and the total space.
5B29-5B2F
DEFM "sssss.s" 73 73 73 73 73 2E 73
The total space in kilobytes, written by 5357H and 535AH.
5B30-5B33
DEFM " Fi=" 20 46 69 3D
A space and Fi= before the directory records.
5B34-5B36
DEFM "nnn" 6E 6E 6E
The free directory records, three digits written by 53BEH.
5B37
DEFM "/" 2F
The slash between the free and the total records.
5B38-5B3A
DEFM "nnn" 6E 6E 6E
The total directory records, three digits written by 537EH. The line is 64 characters, the width of the screen.
5B3B
DEFB 03H 03
03H, the end of the drive line: not displayed, so 53CCH sends 0DH to the printer only.

5B3CH - DIR Data: the Detail Template, the Masks and the Days of the Months

The 45 characters of the detail (filled by 55C5H), the name and extension masks of the partspec, and the days in each month for the date check.

5B3C-5B3D
DEFM "pr" 70 72
The access code, two characters copied by 55DDH.
5B3E
DEFM " " 20
A space in the detail template before the record length.
5B3F-5B41
DEFM "lrl" 6C 72 6C
The record length, three digits written by 55F4H.
5B42
DEFM " " 20
A space in the detail template before the number of records.
5B43-5B47
DEFM "#recs" 23 72 65 63 73
The number of records, five digits written by 562EH, or five asterisks (562AH).
5B48
DEFM " " 20
A space in the detail template before the end of file position.
5B49-5B4B
DEFM "eof" 65 6F 66
The position of the last byte in the last sector, three digits written by 5639H.
5B4C
DEFM " " 20
A space in the detail template before the number of extents.
5B4D-5B4E
DEFM "de" 64 65
The number of extents, two digits written by 5649H.
5B4F-5B50
DEFM " s" 20 73
A space and the small letter s before the size.
5B51
DEFM "?" 3F
An equals sign, or a colon for a file made by CREATE, stored by 566EH.
5B52-5B58
DEFM "xxxxx.x" 78 78 78 78 78 2E 78
The file's size in kilobytes, five digits written by 5650H, a point and the tenths digit stored at 5B58H by 5653H.
5B59
DEFM " " 20
The space before the date, which 565FH spreads over 5B5AH-5B68H to blank the date and the time.
5B5A-5B62
DEFM "dd-mmm-yy" 64 64 2D 6D 6D 6D 2D 79 79
The date of the file: the day (5687H-568AH), the month's name (56A2H) and the year (56CEH-56D3H).
5B63
DEFM " " 20
A space in the detail template between the date and the time.
5B64-5B68
DEFM " " 20 20 20 20 20
The time hh:mm, written by 56EDH-56FAH only for a diskette whose records carry it.
5B69
DEFB 03H 03
03H, the end of the detail: the 64 characters of the line wrap on the screen by themselves.
5B6A-5B71
DEFM " " 20 20 20 20 20 20 20 20
The name mask, eight characters from the partspec (521FH); spaces match any character, and so does $.
5B72-5B74
DEFM " " 20 20 20
The extension mask, three characters from the partspec (522DH).
5B75
DEFM " " 20
A space after the extension mask that no code of the member reads (the name test compares eleven bytes from 5B6AH).
5B76-5B81
DEFB 1FH, 1CH, 1FH, 1EH, 1FH, 1EH, 1FH, 1FH, 1EH, 1FH, 1EH, 1FH 1F 1C 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
The days in January to December: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. 581FH adds one to February (5B77H) for each leap year date read.

5B82H - DIR Data: Messages, Month Names and the Date Mode

The two messages (5A29H, 5A2DH), the month names of the detail (569CH), the five asterisks of a record count that does not fit (5624H) and the date mode byte, the last byte of the member.

5B82-5BA5
DEFM "Insufficient memory for SORT buffer!" 49 6E 73 75 66 66 69 63 69 65 6E 74 20 6D 65 6D 6F 72 79 20 66 6F 72 20 53 4F 52 54 20 62 75 66 66 65 72 21
The message of 5A29H: the sorted records reached HIGH$ - 33.
5BA6
DEFB 0DH 0D
0DH, the end of the message Insufficient memory for SORT buffer!.
5BA7-5BB5
DEFM "Bad date format" 42 61 64 20 64 61 74 65 20 66 6F 72 6D 61 74
The message reached through 5A2DH: a DATE argument that 5806H cannot read.
5BB6
DEFB 0DH 0D
0DH, the end of the message Bad date format, displayed with it.
5BB7-5BDA
DEFM "JanFebMarAprMayJunJulAugSepOctNovDec" 4A 61 6E 46 65 62 4D 61 72 41 70 72 4D 61 79 4A 75 6E 4A 75 6C 41 75 67 53 65 70 4F 63 74 4E 6F 76 44 65 63
The month names, three letters each, for the date column of the detail.
5BDB-5BDF
DEFM "*****" 2A 2A 2A 2A 2A
Five asterisks shown in the #recs column when the records are more than 65535.
5BE0
DEFB 00H 00
The date mode byte: 00H in the file; bit 7 set when DATE gives a start date (5281H), bit 0 when it gives an end date (52A6H).

5200H - Member 3 (KILL): Entry and the Loop over the File Specifications

The KILL command (library member 18H), loaded at 5200H-5370H. Register Pair HL points at the text after KILL: one or more file specifications, or device names (*XX). Each is taken in turn: a file is opened to check its access and deleted with @KILL (4424H, 442CH); a device is taken out of its device control block (5286H). Each deletion is shown as Deleting: name:d. BREAK between two specifications ends the command; an error ends it through @ERROR.

5200
LD (5220H),SP ED 73 20 52
Store the Stack Pointer at 5220H, the operand of the LD SP at 521FH: the exit puts the stack back to this depth.
5204
GOSUB to 531FH to clear a BREAK left from before the command (the result is not used here).
5207
PUSH HL E5
Save Register Pair HL (the text after KILL) to the stack, for the POP at 5209H.
5208
XOR A AF
Clear Register A (XOR A): the Z FLAG is set, no error. 52FFH comes back here after a device was removed.
5209
POP HL E1
Restore Register Pair HL (the text after the last specification) from the stack. 524CH and 527BH come here with the flags of @OPEN or @KILL.
520A
If the NZ FLAG is set (@OPEN or @KILL failed), JUMP to 5341H to report the error in Register A.
520D
GOSUB to 531FH to look at BREAK: the NZ FLAG is set when BREAK was pressed (after waiting for the key to be let go).
5210
If the NZ FLAG is set (BREAK), JUMP to 5346H to end the command with Register Pair HL = FFFFH.
5213
DEC HL 2B
DECrement Register Pair HL, so that the INC below starts at the current character.
5214
INC HL 23
INCrement Register Pair HL to the next character of the text.
5215
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5216
CP 20H FE 20
Compare Register A against 20H, a space between the specifications.
5218
If the Z FLAG is set (a space), LOOP BACK to 5214H to pass over it.
521A
If the NO CARRY FLAG is set (a character above the space), JUMP to 522EH to take the next specification.
521C
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out (the line has ended).
521F
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5220H-5221H (0000H in the file, stored by 5200H). 5349H comes here with Register Pair HL = FFFFH.
5222
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5223
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5224
RET Z C8
RETurn if the Z FLAG is set, with Register Pair HL = 0000H, through the supervisor dispatcher to the program that ran the command.
5225
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5228
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
522A
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
522B
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

522EH - One File Specification: Open the File, Check the Access, Delete It

The specification is read into the control block at 5380H (above the member, not in the file) and copied without its password into 5371H for the message. A device name (*) goes to 5286H. A file must open and its access must be KILL or better (level 0 or 1, else error 25H); the drive is added to the message when the specification has none.

522E
LD DE,5380H 11 80 53
Point Register Pair DE to 5380H, the file control block of KILL, just above the member.
5231
GOSUB to 441CH (@FSPEC) to take a file specification from the text at Register Pair HL into the control block at Register Pair DE; Register Pair HL comes back after it.
5234
If the NZ FLAG is set (no file specification), JUMP to 534CH to display File spec required.
5237
PUSH HL E5
Save Register Pair HL (the text after this specification) to the stack.
5238
PUSH DE D5
Save Register Pair DE (5380H, the control block) to the stack.
5239
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the control block with the specification.
523A
LD DE,5371H 11 71 53
Point Register Pair DE to 5371H, the name in the message, right after the text Deleting: at 5367H.
523D
GOSUB to 530AH to copy the specification at Register Pair HL to Register Pair DE without its password.
5240
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the message.
5242
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, after the name.
5243
POP DE D1
Restore Register Pair DE (5380H, the control block) from the stack.
5244
LD A,(DE) 1A
Fetch the first byte of the control block at Register Pair DE into Register A.
5245
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device name.
5247
If the Z FLAG is set (an asterisk and a device name), JUMP to 5286H to remove the device.
5249
GOSUB to 4424H (@OPEN) to open the file whose control block is at Register Pair DE. Register Pair HL, the buffer address it notes, is left where 530AH stopped inside the control block: KILL reads and writes no record of the file.
524C
If the NZ FLAG is set (the file could not be opened), JUMP to 5209H, which reports the error in Register A.
524E
LD A,(5381H) 3A 81 53
Fetch byte +01H of the control block from 5381H into Register A: bits 2-0 the access the file's password allows.
5251
AND 07H E6 07
Mask Register A with 07H: the access level 0-7.
5253
CP 02H FE 02
Compare Register A against 02H: the NO CARRY FLAG is set for level 2 and above, below KILL.
5255
LD A,25H 3E 25
Load Register A with 25H, error 37 (illegal access attempted to protected file). LD does not change the flags.
5257
If the NO CARRY FLAG is set (the file may not be killed), JUMP to 5341H to report error 25H.
525A
LD HL,5371H 21 71 53
Point Register Pair HL to 5371H, the name in the message.
525D
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
525E
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for the 0DH (or 03H) that ends the name.
5260
If the NO CARRY FLAG is set (a character of the name), JUMP to 5270H.
5262
LD (HL),3AH 36 3A
The name has no drive: store 3AH, a colon, at Register Pair HL over its end.
5264
INC HL 23
INCrement Register Pair HL past the colon just stored.
5265
LD A,(5386H) 3A 86 53
Fetch byte +06H of the control block from 5386H into Register A: the drive the file was found on.
5268
ADD A,30H C6 30
ADD 30H to Register A: the character of the drive's digit.
526A
LD (HL),A 77
Store Register A (the digit) at Register Pair HL.
526B
INC HL 23
INCrement Register Pair HL past the drive's digit.
526C
LD (HL),0DH 36 0D
Store 0DH, ENTER, at Register Pair HL: the message ends after name:d.
526E
JUMP to 5275H to show the message and delete the file.
5270
CP 3AH FE 3A
Compare Register A against 3AH, a colon: the specification already names its drive.
5272
INC HL 23
INCrement Register Pair HL to the next character. INC does not change the flags.
5273
If the NZ FLAG is set (not a colon), LOOP BACK to 525DH.
5275
GOSUB to 527DH to display Deleting: and the name.
5278
GOSUB to 442CH (@KILL) to delete the file whose control block is at Register Pair DE.
527B
JUMP to 5209H for the next specification; an error from @KILL is reported there.

527DH - Helper: Display the Deleting Line

Displays Deleting: followed by the name built at 5371H. Register Pair DE (the control block) is kept.

527D
LD HL,5367H 21 67 53
Point Register Pair HL to 5367H, the text Deleting: that runs on into the name at 5371H.
5280
PUSH DE D5
Save Register Pair DE (the control block) to the stack.
5281
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 0DH.
5284
POP DE D1
Restore Register Pair DE (the control block) from the stack.
5285
RET C9
RETurn to the caller with Register Pair DE = the control block.

5286H - Remove a Device

The two letters after the asterisk name the device. Its device control block is looked for among KI, DO and PR (4015H-402CH), then JL, SI, SO and the five spare blocks (43C0H-43FFH); not found is error 08H. KI, DO, PR and JL cannot be removed (error 28H), nor a device that is assigned (bit 3 of its type clear: error 27H). The block is cleared to 00H, every device routed to it (type bit 4) becomes unassigned (08H), the first eight bytes of the control block at 5380H are cleared, and Deleting: with the device's name is shown.

5286
PUSH DE D5
Save Register Pair DE (5380H, the control block with the asterisk and the device name) to the stack.
5287
POP IX DD E1
Restore it into Index Register IX: Index Register IX = the control block.
5289
LD E,(IX+01H) DD 5E 01
Fetch the first letter of the device name from byte +01H of the control block at Index Register IX into Register E.
528C
LD D,(IX+02H) DD 56 02
Fetch the second letter from byte +02H of the control block at Index Register IX into Register D.
528F
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
5292
PUSH HL E5
Save Register Pair HL (the block being looked at) to the stack.
5293
LD A,L 7D
Copy Register L (the low byte of the block's address) into Register A.
5294
ADD A,06H C6 06
ADD 06H to Register A: byte +06H, the block's two letter name.
5296
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the name of the block.
5297
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
5298
INC L 2C
INCrement Register L to the second letter of the block's name.
5299
CP E BB
Compare Register A against Register E (the first letter wanted).
529A
If the NZ FLAG is set (another device), JUMP to 52A3H.
529C
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
529D
CP D BA
Compare Register A against Register D (the second letter wanted).
529E
If the NZ FLAG is set (another device), JUMP to 52A3H.
52A0
POP HL E1
Restore Register Pair HL (the block found) from the stack.
52A1
JUMP to 52B6H to check whether the block may be removed.
52A3
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
52A4
INC L 2C
INCrement Register L from byte +07H to the next block, eight bytes on.
52A5
If the NZ FLAG is set (Register L did not wrap past 43FFH), JUMP to 52ACH.
52A7
LD A,08H 3E 08
Load Register A with 08H, error 8 (device not available): no block has the name.
52A9
JUMP to 5341H to report error 08H and end the command.
52AC
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
52AD
CP 2DH FE 2D
Compare Register A against 2DH: 402DH follows the printer's block 4025H.
52AF
If the NZ FLAG is set (blocks left in this table), LOOP BACK to 5292H.
52B1
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the second table of device control blocks.
52B4
LOOP BACK to 5292H to search the second table of blocks.
52B6
LD A,L 7D
Copy Register L (the low byte of the block found) into Register A.
52B7
CP C1H FE C1
Compare Register A against C1H: the NO CARRY FLAG is set for the blocks from 43C8H (SI) on.
52B9
If the NO CARRY FLAG is set (SI, SO or a spare block), JUMP to 52C0H.
52BB
LD A,28H 3E 28
Load Register A with 28H, error 40 (protected system device): KI, DO, PR and JL stay.
52BD
JUMP to 5341H to report error 28H and end the command.
52C0
BIT 3,(HL) CB 5E
Test bit 3 of the block's type at Register Pair HL: set when nothing is assigned to the device.
52C2
If the NZ FLAG is set (not assigned), JUMP to 52C9H to remove it.
52C4
LD A,27H 3E 27
Load Register A with 27H, error 39 (device in use): the device is assigned.
52C6
JUMP to 5341H to report error 27H and end the command.
52C9
GOSUB to 5302H to clear the eight bytes of the block at Register Pair HL to 00H.
52CC
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, the first device control block, to look for devices routed to the removed block.
52CF
LD A,08H 3E 08
Load Register A with 08H, the size of a block.
52D1
LD (52E9H),A 32 E9 52
Store Register A (08H) at 52E9H, the operand of the ADD A at 52E8H (it already holds 08H).
52D4
BIT 4,(HL) CB 66
Test bit 4 of the block's type at Register Pair HL: set for a device routed to another block (its +01H-+02H).
52D6
If the Z FLAG is set (not routed), JUMP to 52E7H for the next block.
52D8
PUSH HL E5
Save Register Pair HL (the routed block) to the stack.
52D9
INC L 2C
INCrement Register L to byte +01H, the low byte of the block the device is routed to.
52DA
LD A,(HL) 7E
Fetch the low byte at Register Pair HL into Register A.
52DB
INC L 2C
INCrement Register L to byte +02H, the high byte of that address.
52DC
LD H,(HL) 66
Fetch the high byte at Register Pair HL into Register H.
52DD
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block the device is routed to.
52DE
LD A,(HL) 7E
Fetch the type of that block at Register Pair HL into Register A.
52DF
POP HL E1
Restore Register Pair HL (the routed block) from the stack. POP does not change the flags.
52E0
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when the block routed to has type 00H, as the one just cleared.
52E1
If the NZ FLAG is set (the block routed to is still in use), JUMP to 52E7H.
52E3
LD (HL),08H 36 08
Store 08H at Register Pair HL: the routed device now has nothing assigned.
52E5
JUMP to 52CCH to scan all the blocks again from the start.
52E7
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
52E8
ADD A,08H C6 08
ADD the block size, the operand at 52E9H (08H), to Register A: the next block.
52EA
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the next block.
52EB
If the Z FLAG is set (past 43F8H, the last block), JUMP to 52F6H.
52ED
CP 2DH FE 2D
Compare Register A against 2DH: 402DH follows the printer's block.
52EF
If the NZ FLAG is set (blocks left in this table), LOOP BACK to 52D4H.
52F1
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, the second table of device control blocks.
52F4
LOOP BACK to 52D4H to scan the second table of blocks.
52F6
PUSH IX DD E5
Save Index Register IX (5380H, the control block) to the stack.
52F8
POP HL E1
Restore it into Register Pair HL: Register Pair HL = 5380H, the control block.
52F9
GOSUB to 5302H to clear the first eight bytes of the control block at Register Pair HL.
52FC
GOSUB to 527DH to display Deleting: with the device's name.
52FF
JUMP to 5208H for the next specification, the Z FLAG set by the XOR A there.

5302H - Helpers: Clear Eight Bytes, Copy a Specification without Its Password

5302H stores 00H in the eight bytes at Register Pair HL. 530AH copies the text at Register Pair HL to Register Pair DE up to a control character, leaving out a password (from a full stop up to the colon of the drive).

5302
LD B,08H 06 08
Load Register B with 08H, the eight bytes to clear.
5304
XOR A AF
Clear Register A (XOR A): 00H, the value to store in each byte.
5305
LD (HL),A 77
Store Register A (00H) at Register Pair HL, one byte of the eight.
5306
INC HL 23
INCrement Register Pair HL to the next byte to be cleared.
5307
DECrement Register B and LOOP BACK to 5305H until the eight bytes are cleared.
5309
RET C9
RETurn with Register Pair HL after the eight bytes.
530A
LD A,(HL) 7E
Fetch the next character of the specification at Register Pair HL into Register A.
530B
CP 20H FE 20
Compare Register A against 20H: the CARRY FLAG is set for a control character (03H or 0DH ends it).
530D
RET C D8
RETurn if the CARRY FLAG is set: the copy is done.
530E
CP 2EH FE 2E
Compare Register A against 2EH, the full stop before a password.
5310
If the NZ FLAG is set (another character), JUMP to 531BH to copy it.
5312
INC HL 23
INCrement Register Pair HL past a character of the password.
5313
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A.
5314
CP 20H FE 20
Compare Register A against 20H: the CARRY FLAG is set for the control character that ends the text.
5316
RET C D8
RETurn if the CARRY FLAG is set: the specification ended in the password.
5317
CP 3AH FE 3A
Compare Register A against 3AH, the colon before the drive.
5319
If the NZ FLAG is set (still the password), LOOP BACK to 5312H.
531B
LDI ED A0
Copy one character: (DE) = (HL), Register Pairs HL and DE count up, Register Pair BC counts down (LDI).
531D
LOOP BACK to 530AH for the next character of the specification.

531FH - Helper: BREAK

Returns the Z FLAG when BREAK was not pressed (bit 0 of KFLAG$, 4423H, clear). When it was, the bit is cleared again and again until the key has been let go for a moment, the keyboard is read until no key is down, and the NZ FLAG returns. Every register is kept.

531F
PUSH HL E5
Save Register Pair HL to the stack: every register is kept.
5320
LD HL,4423H 21 23 44
Point Register Pair HL to 4423H, KFLAG$, the keyboard flags.
5323
BIT 0,(HL) CB 46
Test bit 0 of KFLAG$ at Register Pair HL: set by the interrupt's keyboard scan when BREAK is pressed.
5325
If the Z FLAG is set (no BREAK), JUMP to 533FH to return with the Z FLAG.
5327
PUSH AF F5
Save Register Pair AF (the NZ FLAG of the test) to the stack: it is returned.
5328
PUSH BC C5
Save Register Pair BC to the stack: the ROM's delay uses it.
5329
PUSH DE D5
Save Register Pair DE to the stack: the ROM's keyboard call changes it.
532A
RES 0,(HL) CB 86
Clear bit 0 of KFLAG$ at Register Pair HL, the BREAK bit.
532C
LD BC,0B00H 01 00 0B
Load Register Pair BC with 0B00H, the count of the ROM's delay.
532F
GOSUB to the ROM at 0060H to wait while Register Pair BC counts down to 0.
5332
BIT 0,(HL) CB 46
Test bit 0 of KFLAG$ at Register Pair HL: set again when BREAK is still held.
5334
If the NZ FLAG is set (still held), LOOP BACK to 532AH.
5336
GOSUB to the ROM at 002BH to look at the keyboard once: Register A = a key or 00H.
5339
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set while a key is down.
533A
If the NZ FLAG is set (a key), LOOP BACK to 5336H until the keyboard is clear.
533C
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
533D
POP BC C1
Restore Register Pair BC (as it was at the call) from the stack.
533E
POP AF F1
Restore Register Pair AF from the stack: the NZ FLAG of the BREAK test.
533F
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
5340
RET C9
RETurn: the Z FLAG with no BREAK, the NZ FLAG after BREAK.

5341H - Errors

5341H reports the error number in Register A through @ERROR, which returns; 534CH displays File spec required. Both end the command with Register Pair HL = FFFFH.

5341
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return and bit 6 for the short form of the message.
5343
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5346
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. BREAK (5210H) comes here.
5349
JUMP to 521FH to put the stack back and end the command.
534C
LD HL,5354H 21 54 53
Point Register Pair HL to 5354H, the message File spec required.
534F
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5352
JUMP to 5346H to end the command with Register Pair HL = FFFFH.

5354H - KILL Data: Messages

The two texts of the member. Deleting: runs on into the name that 523DH copies to 5371H (above the file), ended there by 0DH.

5354-5365
DEFM "File spec required" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64
The message of 534CH: the text after KILL is not a file specification.
5366
DEFB 0DH 0D
0DH, the end of the message File spec required, displayed with it.
5367-5370
DEFM "Deleting: " 44 65 6C 65 74 69 6E 67 3A 20
The start of the line of 527DH; the name follows at 5371H, the first byte after the member.

5200H - Member 4 (LIB, CLS, TOF): the Three Entries

One member serves three commands, loaded at 5200H-52D2H: LIB (member 19H) enters at 5200H, CLS (24H) at 5203H and TOF (25H) at 5206H, the entry addresses their member headers in the file give. CLS clears the screen; TOF moves the printer to the top of the next form; LIB lists the library commands (5222H). Each ends with Register Pair HL = 0000H.

5200
LIB: JUMP to 5222H to list the library commands.
5203
CLS: JUMP to 5214H to clear the screen and end the command.
5206
LD DE,4025H 11 25 40
TOF: point Register Pair DE to 4025H, PRDCB$, the printer's device control block.
5209
XOR A AF
Clear Register A (XOR A): Register A = 00H, the control code of a status request.
520A
GOSUB to the ROM at 0023H to send a control request (Register B = 04H) with Register A as the code to the device at Register Pair DE: the ROM's printer driver (058DH) takes code 00H as a status request and returns the Z FLAG when the printer is ready.
520D
LD A,0CH 3E 0C
Load Register A with 0CH, the form feed. LD does not change the flags.
520F
If the Z FLAG is set (the printer is ready), GOSUB to the ROM at 003BH to print Register A (0CH): the ROM's printer driver turns it into the line feeds to the top of the next page.
5212
JUMP to 521EH to end the command with Register Pair HL = 0000H.
5214
LD A,1CH 3E 1C
CLS: load Register A with 1CH, the control code that puts the cursor at the top left corner.
5216
GOSUB to the ROM at 0033H to display the character in Register A (1CH).
5219
LD A,1FH 3E 1F
Load Register A with 1FH, the control code that clears the screen from the cursor to the end.
521B
GOSUB to the ROM at 0033H to display the character in Register A (1FH, or 0DH when 52BCH comes here at the end of LIB).
521E
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5221
RET C9
RETurn through the supervisor dispatcher to the program that ran the command, with Register Pair HL = 0000H.

5222H - LIB: List the Library Commands

Reads the command table of SYS1/SYS at 4EBDH, which stays in memory while a library command runs: eight bytes an entry (a six character name, the member and the flags), 00H after the last. The first pass shows the entries whose flags have bit 6 clear (Library A, SYS6/SYS), the second those with bit 6 set (Library B, SYS7/SYS; BOOT is listed there, its flags byte 4EH having bit 6 set). Each name shows its first letter as stored and the others XOR 20H (small letters), four names to a line.

5222
LD HL,52C7H 21 C7 52
Point Register Pair HL to 52C7H, the heading Library <A>.
5225
GOSUB to 4467H (@DSPLY) to display the heading at Register Pair HL, ended by 0DH.
5228
LD HL,4EBDH 21 BD 4E
Point Register Pair HL to 4EBDH, the first entry of SYS1/SYS's command table.
522B
LD C,04H 0E 04
Load Register C with 04H, the names on a line. 5267H comes here for each new line.
522D
LD B,02H 06 02
Load Register B with 02H, the spaces before the first name of a line.
522F
GOSUB to 52BFH to display Register B (2) spaces at the start of the line.
5232
LD B,05H 06 05
Load Register B with 05H, the characters of a name after its first one.
5234
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A.
5235
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the 00H after the last entry.
5236
If the Z FLAG is set (the table has ended), JUMP to 5269H for Library B.
5238
PUSH HL E5
Save Register Pair HL (the entry) to the stack.
5239
LD DE,0007H 11 07 00
Load Register Pair DE with 0007H, the offset of the flags byte.
523C
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the entry's flags byte.
523D
BIT 6,(HL) CB 76
Test bit 6 of the flags byte at Register Pair HL: set for a Library B command.
523F
If the Z FLAG is set (Library A), JUMP to 5245H to show the name.
5241
POP AF F1
Restore Register Pair AF from the stack: the pushed entry address is only dropped.
5242
INC HL 23
INCrement Register Pair HL from the flags byte to the next entry.
5243
LOOP BACK to 5232H for the next entry of the table.
5245
POP HL E1
Restore Register Pair HL (the entry) from the stack.
5246
LD A,(HL) 7E
Fetch the first letter of the name at Register Pair HL into Register A.
5247
GOSUB to the ROM at 0033H to display Register A, the first letter as it is stored, a capital.
524A
INC HL 23
INCrement Register Pair HL to the next character of the name.
524B
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
524C
CP 20H FE 20
Compare Register A against 20H, a space that pads a short name.
524E
If the Z FLAG is set (a space), JUMP to 5252H to show it as it is.
5250
XOR 20H EE 20
Exclusive OR 20H into Register A: the capital becomes a small letter.
5252
INC HL 23
INCrement Register Pair HL to the next character. INC does not change Register A.
5253
GOSUB to the ROM at 0033H to display the character in Register A.
5256
DECrement Register B (the characters left) and LOOP BACK to 524BH: six characters in all.
5258
LD B,08H 06 08
Load Register B with 08H, the spaces between two names.
525A
GOSUB to 52BFH to display Register B (8) spaces after the name.
525D
INC HL 23
INCrement Register Pair HL past the entry's member byte (+06H).
525E
INC HL 23
INCrement Register Pair HL past the flags byte (+07H) to the next entry.
525F
DEC C 0D
DECrement Register C, the names left on this line.
5260
If the NZ FLAG is set (room on the line), LOOP BACK to 5232H for the next entry.
5262
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line of four names.
5264
GOSUB to the ROM at 0033H to display Register A (0DH).
5267
LOOP BACK to 522BH to start the next line of Library A names.
5269
LD A,0DH 3E 0D
Library A is done: load Register A with 0DH, ENTER, to end the last line.
526B
GOSUB to the ROM at 0033H to display Register A (0DH).
526E
LD HL,52D0H 21 D0 52
Point Register Pair HL to 52D0H, the letter A in the heading.
5271
LD (HL),42H 36 42
Store 42H, the letter B, at Register Pair HL: the heading becomes Library <B>.
5273
LD HL,52C7H 21 C7 52
Point Register Pair HL to 52C7H, the heading.
5276
GOSUB to 4467H (@DSPLY) to display the heading at Register Pair HL.
5279
LD HL,4EBDH 21 BD 4E
Point Register Pair HL to 4EBDH, the first entry of the command table, for the second pass.
527C
LD C,04H 0E 04
Load Register C with 04H, the names on a line. 52B8H comes here for each new line.
527E
LD B,02H 06 02
Load Register B with 02H, the spaces before the first name of a line.
5280
GOSUB to 52BFH to display Register B (2) spaces at the start of the line.
5283
LD B,05H 06 05
Load Register B with 05H, the characters of a name after its first one.
5285
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A.
5286
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the 00H after the last entry.
5287
If the Z FLAG is set (the table has ended), JUMP to 52BAH to finish.
5289
PUSH HL E5
Save Register Pair HL (the entry) to the stack.
528A
LD DE,0007H 11 07 00
Load Register Pair DE with 0007H, the offset of the flags byte.
528D
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the entry's flags byte.
528E
BIT 6,(HL) CB 76
Test bit 6 of the flags byte at Register Pair HL: set for a Library B command.
5290
If the NZ FLAG is set (Library B), JUMP to 5296H to show the name.
5292
POP AF F1
Restore Register Pair AF from the stack: the pushed entry address is only dropped.
5293
INC HL 23
INCrement Register Pair HL from the flags byte to the next entry.
5294
LOOP BACK to 5283H for the next entry of the table.
5296
POP HL E1
Restore Register Pair HL (the entry) from the stack.
5297
LD A,(HL) 7E
Fetch the first letter of the name at Register Pair HL into Register A.
5298
GOSUB to the ROM at 0033H to display Register A, the first letter as it is stored.
529B
INC HL 23
INCrement Register Pair HL to the next character of the name.
529C
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
529D
CP 20H FE 20
Compare Register A against 20H, a space that pads a short name.
529F
If the Z FLAG is set (a space), JUMP to 52A3H to show it as it is.
52A1
XOR 20H EE 20
Exclusive OR 20H into Register A: the capital becomes a small letter.
52A3
INC HL 23
INCrement Register Pair HL to the next character. INC does not change Register A.
52A4
GOSUB to the ROM at 0033H to display the character in Register A.
52A7
DECrement Register B (the characters left) and LOOP BACK to 529CH: six characters in all.
52A9
LD B,08H 06 08
Load Register B with 08H, the spaces between two names.
52AB
GOSUB to 52BFH to display Register B (8) spaces after the name.
52AE
INC HL 23
INCrement Register Pair HL past the entry's member byte (+06H).
52AF
INC HL 23
INCrement Register Pair HL past the flags byte (+07H) to the next entry.
52B0
DEC C 0D
DECrement Register C, the names left on this line.
52B1
If the NZ FLAG is set (room on the line), LOOP BACK to 5283H for the next entry.
52B3
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line of four names.
52B5
GOSUB to the ROM at 0033H to display Register A (0DH).
52B8
LOOP BACK to 527CH to start the next line of Library B names.
52BA
LD A,0DH 3E 0D
Library B is done: load Register A with 0DH, ENTER, to end the last line.
52BC
JUMP to 521BH, which displays Register A (0DH) and ends the command with Register Pair HL = 0000H.

52BFH - Helper: Display Spaces

Displays Register B spaces through the ROM at 0033H.

52BF
LD A,20H 3E 20
Load Register A with 20H, a space, to display Register B times.
52C1
GOSUB to the ROM at 0033H to display the space in Register A.
52C4
DECrement Register B (the spaces left) and LOOP BACK to 52BFH.
52C6
RET C9
RETurn to the caller with Register B = 00H, the spaces displayed.

52C7H - LIB Data: the Heading

The heading of each pass; 5271H changes its letter for Library B.

52C7-52CF
DEFM "Library <" 4C 69 62 72 61 72 79 20 3C
The heading of the listing: Library and an opening angle bracket.
52D0
DEFM "A" 41
The letter of the library: A in the file, B after 5271H stores 42H here.
52D1
DEFM ">" 3E
The closing angle bracket of the heading, before its 0DH.
52D2
DEFB 0DH 0D
0DH, the end of the heading, displayed with it: the last byte of the member.

5200H - Member 5 (DO): Entry, Open the JCL File and Create SYSTEM/JCL

The DO command (library member 91H), loaded at 5200H-59D7H (its end is 5D00H, the symbol table reaching above the loaded bytes). It reads a /JCL source file line by line, works out the lines that are kept and the parameter values put into them, writes the result to a file SYSTEM/JCL on the first writable drive, and runs it. An optional control character after DO changes this: * runs the SYSTEM/JCL that is already there (532BH), = runs a named file without compiling it (5314H), $ compiles to SYSTEM/JCL without running it (52C0H, the quiet flag). The source file keeps its default extension /JCL.

5200
LD (5306H),SP ED 73 06 53
Store the Stack Pointer at 5306H, the operand of the LD SP at 5305H: the exit puts the stack back to this depth.
5204
LD A,(HL) 7E
Fetch the first character after DO at Register Pair HL into Register A.
5205
CP 2AH FE 2A
Compare Register A against 2AH, the control character asterisk.
5207
If the Z FLAG is set (an asterisk control character), JUMP to 532BH to run the compiled SYSTEM/JCL file.
520A
CP 3DH FE 3D
Compare Register A against 3DH, the control character equals sign.
520C
If the Z FLAG is set (DO = filespec), JUMP to 5314H to run the named file without compiling it.
520F
CP 24H FE 24
Compare Register A against 24H, the control character dollar sign.
5211
If the NZ FLAG is set (no control character), JUMP to 521DH to take the file specification.
5213
LD (52C0H),A 32 C0 52
Store Register A (24H) at 52C0H, the operand of the LD A at 52BFH: the quiet flag, so that the compiled file is not run.
5216
INC HL 23
INCrement Register Pair HL past the dollar sign.
5217
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A.
5218
CP 20H FE 20
Compare Register A against 20H, a space, allowed after the control character.
521A
If the NZ FLAG is set (no space), JUMP to 521DH.
521C
INC HL 23
INCrement Register Pair HL past the space after the control character.
521D
LD DE,57BCH 11 BC 57
Point Register Pair DE to 57BCH, the 32 byte control block of the source file.
5220
GOSUB to 441CH (@FSPEC) to take the file specification from the text at Register Pair HL into the control block at Register Pair DE; Register Pair HL comes back after it.
5223
If the NZ FLAG is set (no file specification), JUMP to 5798H to display File spec required.
5226
PUSH HL E5
Save Register Pair HL (the text after the specification) to the stack, for the command tail below.
5227
LD HL,581FH 21 1F 58
Point Register Pair HL to 581FH, the three characters JCL.
522A
GOSUB to 4473H (@FEXT) to give the source file specification at Register Pair DE the extension JCL when it has none.
522D
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the buffer of the source file.
5230
LD B,L 45
Copy Register L (00H) into Register B: a record length of 0 means 256 byte records for @OPEN.
5231
GOSUB to 4424H (@OPEN) to open the source file whose control block is at Register Pair DE.
5234
If the NZ FLAG is set (the file could not be opened), JUMP to 5791H to report the error in Register A.
5237
LD C,FFH 0E FF
Load Register C with FFH, the drive less one: the search below starts at drive 0.
5239
INC C 0C
INCrement Register C to the next drive to try for the SYSTEM/JCL file.
523A
LD A,C 79
Copy Register C (the drive being tried) into Register A.
523B
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG is set when every drive 0-7 has been tried.
523D
If the NO CARRY FLAG is set (no writable drive), JUMP to 57ACH to display Can't create SYSTEM/JCL file.
5240
GOSUB to 44B8H (@CKDRV) to check that drive Register C is ready and holds a diskette; the CARRY FLAG is set when it is write protected.
5243
If the NZ FLAG is set (the drive is not ready), LOOP BACK to 5239H for the next drive.
5245
If the CARRY FLAG is set (write protected), LOOP BACK to 5239H for the next drive.
5247
LD A,C 79
Copy Register C (the drive found) into Register A.
5248
ADD A,30H C6 30
ADD 30H to Register A: the character of the drive's digit.
524A
LD H,A 67
Copy Register A (the drive's digit) into Register H.
524B
LD L,3AH 2E 3A
Load Register L with 3AH, a colon, before the drive's digit.
524D
LD (5823H),HL 22 23 58
Store Register Pair HL (the colon and the drive's digit) at 5823H-5824H, after the SYSTEM/JCL name in the template.
5250
GOSUB to 5330H to copy the SYSTEM/JCL file specification template to JFCB$ at 4358H.
5253
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the control block of the SYSTEM/JCL file.
5256
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, the buffer of the SYSTEM/JCL file.
5259
GOSUB to 4420H (@INIT) to open SYSTEM/JCL, creating it when it is not there, on the first writable drive.
525C
If the NZ FLAG is set (it could not be created), JUMP to 57ACH to display Can't create SYSTEM/JCL file.
525F
POP HL E1
Restore Register Pair HL (the text after the file specification) from the stack: the command tail.

5260H - The Command Tail: Parameters and the Keyin Prompt

The text after the source file is scanned: spaces and commas are passed over, an opening bracket starts the parameter list (533CH), a semicolon prompts with a question mark for more text through @KEYIN, and ENTER ends the command line, so that the compile and the run follow (5384H). Any other character is a parameter error.

5260
LD A,(HL) 7E
Fetch the next character of the command tail at Register Pair HL into Register A.
5261
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the command line.
5263
If the Z FLAG is set (the line has ended), JUMP to 5384H to finish the compile and run the file.
5266
INC HL 23
INCrement Register Pair HL to the character after it.
5267
GOSUB to 577FH to test the character: the Z FLAG is set for a space or a comma.
526A
If the Z FLAG is set (a space or a comma), LOOP BACK to 5260H to pass over it.
526C
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
526E
If the Z FLAG is set (the start of the parameter list), JUMP to 533CH to read the parameters.
5271
CP 3BH FE 3B
Compare Register A against 3BH, a semicolon, the keyin continuation.
5273
If the NZ FLAG is set (not a semicolon), JUMP to 578FH to report a parameter error.
5276
LD A,3FH 3E 3F
Load Register A with 3FH, a question mark, the prompt for more of the command line.
5278
GOSUB to the ROM at 0033H to display the question mark in Register A.
527B
LD HL,4318H 21 18 43
Point Register Pair HL to 4318H, INBUF$, the command line buffer.
527E
LD B,3FH 06 3F
Load Register B with 3FH (63), the most characters the buffer takes.
5280
GOSUB to the ROM at 0040H (@KEYIN) to read a line into the buffer at Register Pair HL; the CARRY FLAG is set on BREAK.
5283
If the CARRY FLAG is set (BREAK), JUMP to 578FH to end the command.
5286
GOSUB to 447EH (@LOGER) to send the line just typed to the job log.
5289
LOOP BACK to 5260H to scan the text just typed for more parameters.

528BH - Pop an Included File off the Include Stack

When the end of an included file is reached, its saved control block is taken back from the include stack: 5906H holds the address above the top entry, each entry 32 bytes. The entry is copied back to the working source control block at 57BCH and the stack pointer lowered.

528B
LD HL,(5906H) 2A 06 59
Fetch the top of the include stack from 5906H-5907H into Register Pair HL.
528E
DEC HL 2B
DECrement Register Pair HL to the last byte of the top entry.
528F
LD DE,57DBH 11 DB 57
Point Register Pair DE to 57DBH, the last byte of the working source control block (57BCH-57DBH), for the copy downwards.
5292
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
5295
LDDR ED B8
Copy the entry back: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting down, into 57BCH-57DBH.
5297
INC HL 23
INCrement Register Pair HL to the address above the entry just taken: the new top of the stack.
5298
LD (5906H),HL 22 06 59
Store Register Pair HL (the new top) at 5906H-5907H.
529B
LD DE,57BCH 11 BC 57
Point Register Pair DE to 57BCH, the source control block just restored.
529E
GOSUB to 4454H (@RREAD) to read the current sector of the restored file again, so the next line is read from where the included file left it.
52A1
If the NZ FLAG is set (the read failed), JUMP to 5791H to report the error in Register A.
52A4
RET C9
RETurn to the caller, reading from the file that did the INCLUDE.

52A5H - Read the Next Source Line

While the include stack is not empty (5906H above 5908H, its base), the end of an included file pops it (528BH) and reading goes on in the file that included it. 53BAH reads one line into 59D8H; 5384H and 53B7H come back here for the next line.

52A5
LD HL,(5906H) 2A 06 59
Fetch the top of the include stack from 5906H-5907H into Register Pair HL.
52A8
LD DE,5908H 11 08 59
Point Register Pair DE to 5908H, the base of the include stack.
52AB
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52AC
SBC HL,DE ED 52
Subtract Register Pair DE (the base) from Register Pair HL (the top): the Z FLAG is set when the stack is empty.
52AE
If the Z FLAG is set (no included file open), JUMP to 52B6H to close the source and finish.
52B0
GOSUB to 528BH to pop the included file and go on reading in the file that included it.
52B3
JUMP to 53BAH to read the next line of that file.
52B6
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the SYSTEM/JCL file.
52B9
GOSUB to 4428H (@CLOSE) to close the SYSTEM/JCL file, its last line written.
52BC
If the NZ FLAG is set (the close failed), JUMP to 5791H to report the error in Register A.
52BF
LD A,00H 3E 00
Load Register A with the quiet flag, the operand at 52C0H (00H in the file, 24H after DO $).
52C1
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set after DO $, compile only.
52C2
If the NZ FLAG is set (compile only), JUMP to 5302H to end the command with Register Pair HL = 0000H.
52C4
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the SYSTEM/JCL file to run.
52C7
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the buffer SYSTEM/JCL is reopened with.
52CA
LD B,L 45
Copy Register L (00H) into Register B: 256 byte records for @OPEN.
52CB
GOSUB to 4424H (@OPEN) to reopen the SYSTEM/JCL file.
52CE
If the NZ FLAG is set (the open failed), JUMP to 5791H to report the error in Register A.
52D1
LD HL,5814H 21 14 58
Point Register Pair HL to 5814H, the four byte stub PUSH AF / LD A,96H / RST 28H.
52D4
LD DE,4409H 11 09 44
Point Register Pair DE to 4409H, @ERROR, the system's error vector.
52D7
LD BC,0004H 01 04 00
Load Register Pair BC with 0004H, the four bytes of the stub.
52DA
LDIR ED B0
Copy the stub: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, over @ERROR at 4409H: the same bytes SYS0/SYS has there, so @ERROR goes to SYS4/SYS (request 96H) during the job whatever a program made of it.
52DC
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
52DF
RES 7,(HL) CB BE
Clear bit 7 of SFLAG$ at Register Pair HL: DEBUG is turned off while the JCL runs.
52E1
LD A,C9H 3E C9
Load Register A with C9H, the opcode of a RET.
52E3
LD (4315H),A 32 15 43
Store Register A (C9H) at 4315H, the BREAK trap switch: the trap is off so that BREAK does not spring a program's trap during the JCL.
52E6
BIT 5,(HL) CB 6E
Test bit 5 of SFLAG$ at Register Pair HL: set when a JCL job already runs (this DO is inside another).
52E8
If the NZ FLAG is set (already in a job), JUMP to 52FFH to hand the compiled file to SYS11/SYS.
52EA
LD HL,402DH 21 2D 40
Point Register Pair HL to 402DH, @EXIT, the first of six bytes of the exit vectors.
52ED
LD DE,4065H 11 65 40
Point Register Pair DE to 4065H, where the six bytes are saved (the DEBUG register save area, free while no program is stopped).
52F0
LD C,06H 0E 06
Load Register C with 06H, the six bytes 402DH-4032H (@EXIT and @ABORT).
52F2
PUSH BC C5
Save Register Pair BC (Register C = 6) to the stack.
52F3
LDIR ED B0
Save the six vector bytes: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, to 4065H-406AH.
52F5
LD HL,580EH 21 0E 58
Point Register Pair HL to 580EH, the two launch stubs LD A,ADH / RST 28H and LD A,BDH / RST 28H.
52F8
POP BC C1
Restore Register Pair BC (Register C = 6) from the stack.
52F9
LDIR ED B0
Copy the stubs after the saved bytes: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, from 580EH to 406BH-4070H, where Register Pair DE was left. SYS11/SYS copies them over @EXIT and @ABORT when it starts the job (its 4E33H), so that a program that ends during the JCL issues request ADH or BDH.
52FB
LD SP,(5306H) ED 7B 06 53
Load the Stack Pointer with the value saved at entry, the operand at 5306H-5307H (0000H in the file, stored by 5200H): the command's stack frame is dropped.
52FF
LD A,9DH 3E 9D
Load Register A with 9DH, the request code of SYS11/SYS's function 10H: start running the SYSTEM/JCL file.
5301
RST 28H EF
RST 28H: call the supervisor dispatcher (400CH, 4BCDH) with the request code in Register A (9DH). SYS11/SYS takes over the job.
5302
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out (DO $, compile only).
5305
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5306H-5307H (0000H in the file, stored by 5200H). 57B9H comes here with Register Pair HL = FFFFH.
5308
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5309
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
530A
RET Z C8
RETurn if the Z FLAG is set, with Register Pair HL = 0000H, through the supervisor dispatcher to the program that ran the command.
530B
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
530E
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5310
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5311
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5314H - DO = : Run a Named File without Compiling

The equals control character runs a file as the compiled SYSTEM/JCL without a compile: the file specification after it is taken into JFCB$ at 4358H and the member jumps to the reopen and run (52C4H).

5314
INC HL 23
INCrement Register Pair HL past the equals sign.
5315
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A.
5316
CP 20H FE 20
Compare Register A against 20H, a space to pass over.
5318
If the Z FLAG is set (a space), LOOP BACK to 5314H to pass over it.
531A
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, where the file to run is named.
531D
GOSUB to 441CH (@FSPEC) to take the file specification from the text at Register Pair HL into the control block at Register Pair DE.
5320
If the NZ FLAG is set (no file specification), JUMP to 5798H to display File spec required.
5323
LD HL,581FH 21 1F 58
Point Register Pair HL to 581FH, the three characters JCL.
5326
GOSUB to 4473H (@FEXT) to give the file specification the extension JCL when it has none.
5329
JUMP to 52C4H to reopen and run the file as the compiled job.

532BH - DO * : Run the Current SYSTEM/JCL File

The asterisk control character runs the SYSTEM/JCL file that a previous compile left: its file specification is copied to JFCB$ at 4358H and the member jumps to the reopen and run (52C4H).

532B
GOSUB to 5330H to copy the SYSTEM/JCL file specification template to JFCB$ at 4358H.
532E
JUMP to 52C4H to reopen and run the SYSTEM/JCL file.

5330H - Helper: Copy the SYSTEM/JCL Specification

Copies the 32 bytes of the template at 5818H (SYSTEM/JCL, with the drive digit patched in at 5823H) to JFCB$ at 4358H.

5330
LD HL,5818H 21 18 58
Point Register Pair HL to 5818H, the SYSTEM/JCL file specification template.
5333
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the destination of the copy.
5336
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of the template.
5339
LDIR ED B0
Copy the template: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up.
533B
RET C9
RETurn to the caller with the specification in JFCB$.

533CH - The Parameter List: Tokens and Their Values

Each item in the brackets is a token of up to eight characters: a plain token is given the logical value true, token=value gives it a character string, and @label names the start the compile is to scan for. 5620H reads the token into 57DCH; a token that begins with @ sets 5343H, so it is kept as the label at 5805H; otherwise 56EAH checks it is not already defined (error Multiply defined parameter) and 56CDH stores it true. 562BH reads a value after =, and 56DFH stores it.

533C
GOSUB to 5620H to read the next token of up to eight characters at Register Pair HL into the buffer at 57DCH; Register A returns the character that ended it.
533F
If the NZ FLAG is set (no token, or a separator came first), JUMP to 5355H to look at that character.
5341
PUSH AF F5
Save Register Pair AF (the character that ended the token) to the stack.
5342
LD A,00H 3E 00
Load Register A with the label flag, the operand at 5343H (00H in the file, set to 40H by 5695H when the token begins with an @).
5344
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when the token is a label.
5345
If the NZ FLAG is set (a label), JUMP to 5371H to keep it as the label to scan for.
5347
GOSUB to 56EAH to look for the token in the stored tokens at 5D00H; the Z FLAG is set when it is already there.
534A
If the Z FLAG is set (the token is defined twice), JUMP to 57B0H to display Multiply defined parameter.
534D
GOSUB to 56CDH to store the token at 57DCH with the logical value true.
5350
POP AF F1
Restore Register Pair AF (the character that ended the token) from the stack.
5351
CP 3DH FE 3D
Compare Register A against 3DH, an equals sign.
5353
If the Z FLAG is set (token=value), JUMP to 5367H to read the value.
5355
GOSUB to 577FH to test the character: the Z FLAG is set for a space or a comma.
5358
If the Z FLAG is set (a space or a comma), LOOP BACK to 533CH for the next token.
535A
CP 29H FE 29
Compare Register A against 29H, a closing bracket.
535C
If the Z FLAG is set (the end of the parameter list), JUMP to 5260H to go on with the command tail.
535F
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5361
If the Z FLAG is set (the line ended inside the brackets), JUMP to 5384H to finish the compile.
5364
JUMP to 578FH to report a parameter error (error 2CH).
5367
GOSUB to 562BH to read the value string at Register Pair HL into the buffer at 57E4H; Register A returns the character that ended it.
536A
PUSH AF F5
Save Register Pair AF (the character that ended the value) to the stack.
536B
GOSUB to 56DFH to store the value at 57E4H against the token just stored.
536E
POP AF F1
Restore Register Pair AF (the character that ended the value) from the stack.
536F
JUMP to 5355H to look at that character for the next token.
5371
PUSH HL E5
A label: save Register Pair HL (the text being read) to the stack.
5372
LD HL,57DCH 21 DC 57
Point Register Pair HL to 57DCH, the token just read.
5375
LD DE,5805H 11 05 58
Point Register Pair DE to 5805H, the buffer that holds the label to scan for.
5378
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of a label.
537B
LDIR ED B0
Copy the label: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, to 5805H-580CH.
537D
XOR A AF
Clear Register A (XOR A): 00H for the label flag.
537E
LD (5343H),A 32 43 53
Store Register A (00H) at 5343H, the label flag, so the next token is a normal one again.
5381
POP HL E1
Restore Register Pair HL (the text being read) from the stack.
5382
JUMP to 536EH to look at the character that ended the label.

5384H - Read Lines, Finding the Named Label

When a label was given (568EH), the source lines are read without being compiled until a line @label matches the wanted label (5805H): 549DH reads a line into 59D8H, and the lines are passed over until the match, the end of the included files popped on the way (Procedure not found when none match). Without a label, the compile starts at once (53BAH).

5384
LD A,(568EH) 3A 8E 56
Fetch the label given flag from 568EH into Register A (00H when no @label was given, else the @ of the label).
5387
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when a label is to be found.
5388
If the Z FLAG is set (no label), JUMP to 53BAH to compile from the first line.
538A
GOSUB to 549DH to read the next line of the source file into 59D8H; the Z FLAG is set when a line was read, the NZ FLAG at the end of the file.
538D
If the Z FLAG is set (a line was read), JUMP to 53A0H to see whether it is the label.
538F
LD HL,(5906H) 2A 06 59
Fetch the top of the include stack from 5906H-5907H into Register Pair HL.
5392
LD DE,5908H 11 08 59
Point Register Pair DE to 5908H, the base of the include stack.
5395
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5396
SBC HL,DE ED 52
Subtract Register Pair DE (the base) from Register Pair HL (the top): the Z FLAG is set when no included file is open.
5398
If the Z FLAG is set (the whole source is read and the label was not found), JUMP to 57A4H to display Procedure not found.
539B
GOSUB to 528BH to pop the included file and go on in the file that included it.
539E
JUMP to 538AH to read the next line of the including file.
53A0
LD HL,59D8H 21 D8 59
Point Register Pair HL to 59D8H, the line just read.
53A3
LD A,(HL) 7E
Fetch the first character of the line at Register Pair HL into Register A.
53A4
CP 40H FE 40
Compare Register A against 40H, the at sign that begins a label line.
53A6
If the NZ FLAG is set (not a label line), JUMP to 538AH to read the next line.
53A8
INC HL 23
INCrement Register Pair HL to the character after the at sign, the label's name.
53A9
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the line's label name.
53AA
LD HL,5805H 21 05 58
Point Register Pair HL to 5805H, the label to scan for.
53AD
LD BC,0808H 01 08 08
Load Register Pair BC with 0808H: Register B = 8 characters, Register C = 08H, the gap to the next entry (unused here).
53B0
GOSUB to 5716H to compare the eight characters at Register Pair DE with the label at Register Pair HL; the Z FLAG is set when they match.
53B3
If the NZ FLAG is set (another label), JUMP to 538AH to read the next line.
53B5
JUMP to 53BAH to compile the source from the line after the label.

53B7H - The Compile Loop: Read a Line and Compile It

549DH reads the next source line into 59D8H; at the end of a file 52A5H pops an included file or finishes. A line is compiled (53C0H) into the buffer at 5200H and written (54CEH): each character is copied, # starts a parameter substitution, % a hexadecimal byte, // a directive, and a line that begins with @ ends the procedure.

53B7
GOSUB to 54CEH to write the compiled line in the buffer at 5200H to the SYSTEM/JCL file.
53BA
GOSUB to 549DH to read the next line of the source file into 59D8H; the Z FLAG is set when a line was read.
53BD
If the NZ FLAG is set (the end of the file), JUMP to 52A5H to pop an included file or finish.
53C0
LD HL,59D8H 21 D8 59
Point Register Pair HL to 59D8H, the line just read.
53C3
LD DE,5200H 11 00 52
Point Register Pair DE to 5200H, the buffer the compiled line is built in.
53C6
LD A,(HL) 7E
Fetch the next character of the source line at Register Pair HL into Register A.
53C7
INC HL 23
INCrement Register Pair HL to the character after it.
53C8
CP 40H FE 40
Compare Register A against 40H, the at sign of a label line.
53CA
If the Z FLAG is set (a label begins a new procedure), JUMP to 52A5H to finish this one.
53CD
CP 2FH FE 2F
Compare Register A against 2FH, a slash, the first character of a directive.
53CF
If the NZ FLAG is set (not a slash), JUMP to 53D5H.
53D1
CP (HL) BE
Compare Register A (the slash) against the next character at Register Pair HL: a second slash means a directive.
53D2
If the Z FLAG is set (two slashes), JUMP to 546FH to carry out the directive.
53D5
CP 23H FE 23
Compare Register A against 23H, a hash, which begins a substitution.
53D7
If the Z FLAG is set (a parameter substitution), JUMP to 53FEH.
53D9
CP 25H FE 25
Compare Register A against 25H, a percent sign.
53DB
If the NZ FLAG is set (an ordinary character), JUMP to 53F4H to copy it.
53DD
GOSUB to 53E2H to read two hexadecimal digits of a percent escape into Register A.
53E0
JUMP to 53FAH to store the percent-escape byte and go on.
53E2
CP (HL) BE
Compare Register A (the percent sign) against the next character at Register Pair HL: a second percent sign means a literal percent.
53E3
If the Z FLAG is set (%%), JUMP to 5406H to store one percent sign.
53E5
GOSUB to 540AH to turn the first character after the percent sign into its hexadecimal value (0-15) in Register A.
53E8
INC HL 23
INCrement Register Pair HL to the second hexadecimal digit.
53E9
RLCA 07
Rotate Register A left one bit (RLCA): first of four rotations that move the first digit into the high four bits.
53EA
RLCA 07
Rotate Register A left one bit again (RLCA): second rotation.
53EB
RLCA 07
Rotate Register A left one bit again (RLCA): third rotation.
53EC
RLCA 07
Rotate Register A left one bit again (RLCA): the first digit is now bits 7-4.
53ED
LD C,A 4F
Copy Register A (the high nibble) into Register C.
53EE
GOSUB to 540AH to turn the second digit into its value 0-15 in Register A.
53F1
OR C B1
OR Register C (the high nibble) into Register A: the byte of the two digits.
53F2
JUMP to 5406H to store the byte of the two hexadecimal digits.
53F4
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the compiled line.
53F5
INC DE 13
INCrement Register Pair DE to the next place of the compiled line.
53F6
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
53F8
If the Z FLAG is set (the line is complete), JUMP to 53B7H to write it.
53FA
LD A,(HL) 7E
Fetch the next character of the source line at Register Pair HL into Register A.
53FB
INC HL 23
INCrement Register Pair HL to the character after it.
53FC
JUMP to 53D5H to look at the character just fetched.
53FE
GOSUB to 5403H to store a hash when the hash is doubled, else fall through to the substitution.
5401
JUMP to 53FAH to go on with the next character.
5403
CP (HL) BE
Compare Register A (the hash) against the next character at Register Pair HL: a second hash means a literal hash.
5404
If the NZ FLAG is set (a single hash, a substitution), JUMP to 541BH to substitute a parameter value.
5406
INC HL 23
INCrement Register Pair HL past the second of the doubled characters.
5407
LD (DE),A 12
Store Register A (the single character) at Register Pair DE in the compiled line.
5408
INC DE 13
INCrement Register Pair DE to the next place.
5409
RET C9
RETurn to the caller with one character stored.

540AH - Helper: A Hexadecimal Digit to Its Value

Register Pair HL = the digit character. Returns Register A = the value 0-15, or jumps to 545AH (Invalid JCL format) for a character that is not a hexadecimal digit. Small letters are folded to capitals.

540A
LD A,(HL) 7E
Fetch the digit character at Register Pair HL into Register A.
540B
SUB 30H D6 30
SUBtract 30H (the character 0) from Register A: the CARRY FLAG is set below the character 0.
540D
If the CARRY FLAG is set (below 0), JUMP to 5419H, which ends the compile with Invalid JCL format.
540F
CP 0AH FE 0A
Compare Register A against 0AH (10): the CARRY FLAG is set for a digit 0-9.
5411
RET C D8
RETurn if the CARRY FLAG is set, with Register A = the digit value 0-9.
5412
RES 5,A CB AF
Clear bit 5 of Register A (RES 5,A): folds a small letter to a capital.
5414
SUB 07H D6 07
SUBtract 07H from Register A: a letter A-F becomes 0AH-0FH.
5416
CP 10H FE 10
Compare Register A against 10H (16): the CARRY FLAG is set for a value below 16.
5418
RET C D8
RETurn if the CARRY FLAG is set, with Register A = the value 10-15 for A-F.
5419
JUMP to 545AH to end the compile with Invalid JCL format, processing aborted.

541BH - Substitute a Parameter Value

A #name# field: 5620H reads the name, which must be followed by a hash. The token is looked up (56EAH) and, when it has a value string (its length byte at +08H not 00H), the string is copied into the compiled line. A token that is not defined or has no value string is left as the literal #name# in the line; a name not followed by a hash is Invalid JCL format.

541B
PUSH HL E5
Save Register Pair HL (the source line) to the stack.
541C
PUSH DE D5
Save Register Pair DE (the compiled line) to the stack.
541D
GOSUB to 5620H to read the name of up to eight characters at Register Pair HL into the buffer at 57DCH; Register A returns the character that ended it.
5420
CP 23H FE 23
Compare Register A against 23H, the hash that must end the name.
5422
If the NZ FLAG is set (no closing hash, a malformed field), JUMP to 545AH to end the compile with Invalid JCL format.
5424
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): Register Pair HL = the compiled line, and the source line is back on the stack.
5425
PUSH HL E5
Save Register Pair HL (the compiled line) to the stack.
5426
GOSUB to 56EAH to look for the token at 57DCH in the stored tokens; Register Pair DE returns the found entry and the NZ FLAG when it is not found.
5429
If the NZ FLAG is set (the token is not defined), JUMP to 543AH to keep the field as a literal.
542B
LD A,(DE) 1A
Fetch the length byte of the stored entry at Register Pair DE (+08H of the entry) into Register A: the length of the token's value string, 00H when it has none.
542C
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when the token has no value string.
542D
If the Z FLAG is set (no value string, a true/false token), JUMP to 543AH to keep the field as a literal.
542F
LD B,00H 06 00
Load Register B with 00H for the high byte of the count.
5431
LD C,A 4F
Copy Register A (the length of the value) into Register C: Register Pair BC = the length.
5432
INC DE 13
INCrement Register Pair DE to the first character of the value string.
5433
POP HL E1
Restore Register Pair HL (the compiled line) from the stack.
5434
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the compiled line, Register Pair HL = the value string.
5435
LDIR ED B0
Copy the value: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, into the compiled line.
5437
POP HL E1
Restore Register Pair HL (the source line) from the stack.
5438
POP AF F1
Restore Register Pair AF from the stack: the source pointer pushed at 541BH (the start of the name) is dropped; the flags are not used.
5439
RET C9
RETurn to the caller with the value in the compiled line.
543A
POP DE D1
The token has no value: restore Register Pair DE (the compiled line) from the stack.
543B
POP AF F1
Restore Register Pair AF from the stack: the place after the name, put on the stack by the EX (SP),HL at 5424H, is dropped.
543C
POP HL E1
Restore Register Pair HL from the stack: the source line at the start of the name, pushed at 541BH, from where the name is copied.
543D
LD A,23H 3E 23
Load Register A with 23H, a hash, to begin the literal #name#.
543F
LD (DE),A 12
Store Register A (the hash) at Register Pair DE in the compiled line.
5440
INC DE 13
INCrement Register Pair DE to the next place.
5441
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
5442
INC HL 23
INCrement Register Pair HL to the character after it.
5443
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5445
If the Z FLAG is set (the line ended inside the field), JUMP to 545AH to end the compile with Invalid JCL format.
5447
CP 23H FE 23
Compare Register A against 23H, the closing hash of the name.
5449
If the NZ FLAG is set (still the name), LOOP BACK to 543FH to copy the character.
544B
LD (DE),A 12
Store Register A (the closing hash) at Register Pair DE in the compiled line.
544C
INC DE 13
INCrement Register Pair DE to the next place.
544D
RET C9
RETurn to the caller with the literal #name# in the compiled line.

544EH - Directives: the Nesting Check and the Error Line

544EH returns when the condition stack at 59A8H holds at least one //IF (its top below the base 59AAH), so that //ELSE and //END have an open block; otherwise it falls into 545AH. 545AH builds the error line Line nnnnn --> Invalid JCL format, processing aborted! from the line number (545EH) and ends the command.

544E
LD DE,(59A8H) ED 5B A8 59
Fetch the top of the condition stack from 59A8H-59A9H into Register Pair DE.
5452
LD HL,59AAH 21 AA 59
Point Register Pair HL to 59AAH, the base of the condition stack (nothing is pushed below it).
5455
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5456
SBC HL,DE ED 52
Subtract Register Pair DE (the top) from Register Pair HL (the base): the Z FLAG is set when the stack is empty.
5458
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the top of the stack, for the caller.
5459
RET NZ C0
RETurn if the NZ FLAG is set (a block is open), with Register Pair HL at the top of the stack.
545A
LD DE,59CFH 11 CF 59
No block is open, or the compile failed: point Register Pair DE to 59CFH, the number field in the error line Line nnnnn -->.
545D
LD HL,0000H 21 00 00
Load Register Pair HL with the number of the line now being compiled, the operand at 545EH-545FH: the line counter that 549DH keeps (0000H in the file).
5460
GOSUB to 5766H to write Register Pair HL (the line number) as five decimal digits into the error line at Register Pair DE (59CFH).
5463
LD HL,59CAH 21 CA 59
Point Register Pair HL to 59CAH, the error line Line nnnnn -->.
5466
GOSUB to 447BH (@LOGOT) to display the line at Register Pair HL and send it to the job log.
5469
LD HL,58C4H 21 C4 58
Point Register Pair HL to 58C4H, the message Invalid JCL format, processing aborted!.
546C
JUMP to 57B3H to display that message and end the command with Register Pair HL = FFFFH.

546FH - A Directive Line: // Dispatch

The name after the two slashes is read (5620H into 57DCH). The conditional directives IF, ELSE and END (table 54FAH) are tried first and run even inside a block being skipped; the other directives SET, RESET, ASSIGN, INCLUDE and QUIT (table 5510H) run only when the block is not being skipped. A // with no name, or an unknown directive, is copied to the compiled line as a comment.

546F
INC HL 23
INCrement Register Pair HL past the second slash to the directive's name.
5470
GOSUB to 5620H to read the directive name of up to eight characters at Register Pair HL into the buffer at 57DCH.
5473
If the NZ FLAG is set (no name: a // comment line), JUMP to 548AH to copy the rest of the line to the output.
5475
GOSUB to 56FBH to look for the name in the conditional directive table at 54FAH (IF, ELSE, END); Register Pair DE returns the handler address and the Z FLAG when found.
5478
PUSH DE D5
Save Register Pair DE (the handler address) to the stack, to be jumped to.
5479
RET Z C8
RETurn if the Z FLAG is set (an IF, ELSE or END): the address pushed runs as the handler.
547A
POP DE D1
Not a conditional directive: restore Register Pair DE from the stack (the handler address, dropped).
547B
LD DE,(59A8H) ED 5B A8 59
Fetch the top of the condition stack from 59A8H-59A9H into Register Pair DE.
547F
LD A,(DE) 1A
Fetch the top condition state byte at Register Pair DE into Register A (00H while the block is compiled, non-zero while it is skipped).
5480
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when the block is being skipped.
5481
If the NZ FLAG is set (the block is skipped), JUMP to 53BAH to read the next line without the directive.
5484
GOSUB to 5704H to look for the name in the other directive table at 5510H (SET, RESET, ASSIGN, INCLUDE, QUIT); Register Pair DE returns the handler address and the Z FLAG when found.
5487
PUSH DE D5
Save Register Pair DE (the handler address) to the stack, to be jumped to.
5488
RET Z C8
RETurn if the Z FLAG is set (a SET, RESET, ASSIGN, INCLUDE or QUIT): the address pushed runs as the handler.
5489
POP DE D1
Not a known directive: restore Register Pair DE from the stack (the handler address, dropped).
548A
LD DE,59D8H 11 D8 59
Copy the directive line as a comment: point Register Pair DE to 59D8H, the start of the source line.
548D
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
548E
SBC HL,DE ED 52
Subtract Register Pair DE (the start of the line) from Register Pair HL (where the name reader stopped): the length read so far.
5490
LD B,H 44
Copy Register H (the high byte of the length) into Register B.
5491
LD C,L 4D
Copy Register L (the low byte of the length) into Register C: Register Pair BC = the bytes read so far.
5492
LD HL,59D8H 21 D8 59
Point Register Pair HL to 59D8H, the start of the source line.
5495
LD DE,5200H 11 00 52
Point Register Pair DE to 5200H, the start of the compiled line.
5498
LDIR ED B0
Copy the //name read so far: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up.
549A
JUMP to 53FAH to go on copying the rest of the line through the compile loop.

549DH - Read One Source Line into 59D8H

Counts the line at 545EH and reads up to 64 characters from the source file (ROM 0013H, @GET) into 59D8H, ended by 0DH, returning the Z FLAG. The end of the file (error 1CH), and a byte of 00H, return the NZ FLAG with Register A = 1CH (54CAH); a line of 64 characters without 0DH ends the command with Line too long!.

549D
LD HL,(545EH) 2A 5E 54
Fetch the count of lines read from 545EH-545FH into Register Pair HL: the line counter, the operand of the LD HL at 545DH.
54A0
INC HL 23
INCrement Register Pair HL: one more line counted.
54A1
LD (545EH),HL 22 5E 54
Store Register Pair HL (the line count) at 545EH-545FH, the operand of the LD HL at 545DH.
54A4
LD HL,59D8H 21 D8 59
Point Register Pair HL to 59D8H, the line buffer.
54A7
LD DE,57BCH 11 BC 57
Point Register Pair DE to 57BCH, the control block of the source file.
54AA
LD B,40H 06 40
Load Register B with 40H (64), the most characters a line may hold.
54AC
GOSUB to the ROM at 0013H (@GET) to read the next byte of the file at Register Pair DE into Register A.
54AF
If the NZ FLAG is set (the read returned an error, such as the end of file), JUMP to 54C5H.
54B1
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for a byte of 00H, which ends the source like the end of the file.
54B2
If the Z FLAG is set (a 00H byte), JUMP to 54CAH to return as at the end of the file.
54B4
LD (HL),A 77
Store Register A (the character) at Register Pair HL in the line buffer.
54B5
INC HL 23
INCrement Register Pair HL to the next place of the buffer.
54B6
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of a line.
54B8
RET Z C8
RETurn if the Z FLAG is set (the line is complete), with the Z FLAG set.
54B9
DECrement Register B (the characters left) and LOOP BACK to 54ACH for the next byte.
54BB
LD (HL),0DH 36 0D
The line reached 64 characters without a 0DH: store 0DH at Register Pair HL to end it.
54BD
LD HL,5839H 21 39 58
Point Register Pair HL to 5839H, the message Line too long!.
54C0
LD (546AH),HL 22 6A 54
Store Register Pair HL (5839H) at 546AH-546BH, the operand of the LD HL at 5469H: the error line names that message.
54C3
JUMP to 545AH to display the error line and end the command.
54C5
CP 1CH FE 1C
Compare Register A (the read error) against 1CH, error 28 (end of file encountered).
54C7
If the NZ FLAG is set (another error), JUMP to 5791H to report the error in Register A.
54CA
LD A,1CH 3E 1C
Load Register A with 1CH, the end of file error.
54CC
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for the end of the file.
54CD
RET C9
RETurn with the NZ FLAG and Register A = 1CH: the end of the file (or a 00H byte). A line read returns from 54B8H with the Z FLAG.

54CEH - Write the Compiled Line to SYSTEM/JCL

When the top of the condition stack (59A8H) holds a skip state, nothing is written. Otherwise the compiled line at 5200H is written to the SYSTEM/JCL file through the ROM (001BH, @PUT), up to its 0DH. A line that begins with two slashes and a full stop (//.) is displayed with @DSPLY instead of written.

54CE
LD HL,(59A8H) 2A A8 59
Fetch the top of the condition stack from 59A8H-59A9H into Register Pair HL.
54D1
LD A,(HL) 7E
Fetch the state byte at Register Pair HL into Register A: 00H to compile, non-zero to skip.
54D2
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when the block is being skipped.
54D3
RET NZ C0
RETurn if the NZ FLAG is set (skipping): the line is not written.
54D4
LD HL,5200H 21 00 52
Point Register Pair HL to 5200H, the compiled line.
54D7
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the SYSTEM/JCL file.
54DA
LD A,(HL) 7E
Fetch the first character of the line at Register Pair HL into Register A.
54DB
CP 2FH FE 2F
Compare Register A against 2FH, a slash at the start of the line.
54DD
If the NZ FLAG is set (not a slash), JUMP to 54ECH to write the line.
54DF
INC HL 23
INCrement Register Pair HL to the second character.
54E0
CP (HL) BE
Compare Register A (the slash) against the second character at Register Pair HL: two slashes are a directive left in the line.
54E1
DEC HL 2B
DECrement Register Pair HL back to the first character.
54E2
If the NZ FLAG is set (a single slash), JUMP to 54ECH to write the line.
54E4
LD A,(5202H) 3A 02 52
Fetch the third character of the line from 5202H into Register A.
54E7
CP 2EH FE 2E
Compare Register A against 2EH, a full stop: a comment that follows the two slashes.
54E9
If the Z FLAG is set (//.comment), JUMP to 4467H (@DSPLY) to display the line instead of writing it; it returns to the caller at 53B7H.
54EC
LD A,(HL) 7E
Fetch the next character of the line at Register Pair HL into Register A.
54ED
GOSUB to the ROM at 001BH (@PUT) to write the character in Register A to the file at Register Pair DE.
54F0
If the NZ FLAG is set (the write failed), JUMP to 5791H to report the error in Register A.
54F3
LD A,(HL) 7E
Fetch the character just written at Register Pair HL into Register A.
54F4
INC HL 23
INCrement Register Pair HL to the next character.
54F5
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
54F7
If the NZ FLAG is set (more of the line), LOOP BACK to 54ECH.
54F9
RET C9
RETurn to the caller at 53B7H with the line written.

54FAH - DO Data: the Conditional Directive Table

The three directives that run even inside a block being skipped: a six character name padded with spaces and the two byte address of the handler, ended by 00H. Searched by 56FBH.

54FA-54FE
DEFM "IF " 49 46 20 20 20
IF: begins a conditional block (a five character entry).
54FF-5500
DEFW 5543H 43 55
DEFW 5543H: the address of the IF handler, 5543H.
5501-5505
DEFM "ELSE " 45 4C 53 45 20
ELSE: the alternative of a conditional block (a five character entry).
5506-5507
DEFW 556BH 6B 55
DEFW 556BH: the address of the ELSE handler, 556BH.
5508-550C
DEFM "END " 45 4E 44 20 20
END: ends a conditional block (a five character entry).
550D-550E
DEFW 5576H 76 55
DEFW 5576H: the address of the END handler, 5576H.
550F
DEFB 00H 00
00H, the end of the conditional directive table.

5510H - DO Data: the Other Directive Table

The directives that run only when the block is compiled: an eight character name padded with spaces and the two byte address of the handler, ended by 00H. Searched by 5704H.

5510-5517
DEFM "SET " 53 45 54 20 20 20 20 20
SET: give a token the value true (an eight character entry).
5518-5519
DEFW 55A5H A5 55
DEFW 55A5H: the address of the SET handler, 55A5H.
551A-5521
DEFM "RESET " 52 45 53 45 54 20 20 20
RESET: give a token the value false (an eight character entry).
5522-5523
DEFW 55B4H B4 55
DEFW 55B4H: the address of the RESET handler, 55B4H.
5524-552B
DEFM "ASSIGN " 41 53 53 49 47 4E 20 20
ASSIGN: give a token a character string value.
552C-552D
DEFW 55C6H C6 55
DEFW 55C6H: the address of the ASSIGN handler, 55C6H.
552E-5535
DEFM "INCLUDE " 49 4E 43 4C 55 44 45 20
INCLUDE: compile another JCL file in place (an eight character entry).
5536-5537
DEFW 55DFH DF 55
DEFW 55DFH: the address of the INCLUDE handler, 55DFH.
5538-553F
DEFM "QUIT " 51 55 49 54 20 20 20 20
QUIT: end the compile (an eight character entry).
5540-5541
DEFW 5614H 14 56
DEFW 5614H: the address of the QUIT handler, 5614H.
5542
DEFB 00H 00
00H, the end of the SET, RESET, ASSIGN, INCLUDE and QUIT table.

5543H - IF: Evaluate the Condition and Push the Block State

The expression after //IF is tokens joined by the operators & (and) and + (or); a token is true when it is defined (set on the DO line, by //SET or by //ASSIGN), and a leading - means not. 557FH evaluates a term of tokens joined by & and returns the Z FLAG for a true term; + starts another term. When a false token is followed by &, the rest of the line is passed over, so the terms after it are not evaluated. The result (00H compile for a true term, FFH skip) is pushed onto the condition stack at 59A8H ORed with the state below it, so a block inside a skipped block is skipped too.

5543
GOSUB to 557FH to evaluate a term of the expression; the Z FLAG is set for a true term and Register A returns the character that ended it.
5546
If the Z FLAG is set (the term is true), JUMP to 5568H to make the block compile.
5548
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the expression.
554A
If the Z FLAG is set (the line ended with every term false), JUMP to 555AH to make the block skip.
554C
CP 2BH FE 2B
Compare Register A against 2BH, a plus sign (or).
554E
If the Z FLAG is set (another term follows), LOOP BACK to 5543H to evaluate it.
5550
CP 26H FE 26
Compare Register A against 26H, an ampersand: the false token is joined by and to more tokens of its term.
5552
If the NZ FLAG is set (an unexpected character), JUMP to 55A8H, which ends the command with Invalid JCL format.
5554
INC HL 23
INCrement Register Pair HL past the ampersand that ended a false term.
5555
LD A,(HL) 7E
Fetch the next character of the expression at Register Pair HL into Register A.
5556
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5558
If the NZ FLAG is set (more of the line), LOOP BACK to 5554H: the rest of the line is passed over, so a + term after a false and term is not evaluated.
555A
LD A,FFH 3E FF
Load Register A with FFH, the skip state: no term was true.
555C
LD HL,(59A8H) 2A A8 59
Fetch the top of the condition stack from 59A8H-59A9H into Register Pair HL (the OR below keeps a skip set in an enclosing block).
555F
OR (HL) B6
OR the state byte at Register Pair HL into Register A: a block inside a skipped block is skipped whatever its own test gave.
5560
INC HL 23
INCrement Register Pair HL to the next place on the condition stack.
5561
LD (HL),A 77
Store Register A (the new block's state) at Register Pair HL.
5562
LD (59A8H),HL 22 A8 59
Store Register Pair HL (the new top) at 59A8H-59A9H.
5565
JUMP to 53BAH to read the next line of the source.
5568
XOR A AF
The term is true: clear Register A (XOR A), the compile state 00H.
5569
JUMP to 555CH to push it (ORed with the state above).

556BH - ELSE: Flip the Block State

Reverses the top of the condition stack, unless an enclosing block is skipped. 544EH makes sure a block is open and returns Register Pair HL at the top state byte. The byte is complemented (compile becomes skip and the other way about) and ORed with the state below it, so an ELSE inside a skipped block stays skipped.

556B
GOSUB to 544EH to make sure a block is open; Register Pair HL = the top condition state byte.
556E
LD A,(HL) 7E
Fetch the top state byte at Register Pair HL into Register A.
556F
CPL 2F
Complement Register A (CPL): a compile state becomes a skip state and the other way about.
5570
DEC HL 2B
DECrement Register Pair HL to the state byte of the enclosing block.
5571
OR (HL) B6
OR the enclosing state at Register Pair HL into Register A: a skipped enclosing block keeps this one skipped.
5572
INC HL 23
INCrement Register Pair HL back to the top state byte.
5573
LD (HL),A 77
Store Register A (the flipped state) at Register Pair HL.
5574
JUMP to 55B1H to read the next line of the source.

5576H - END: Pop the Block

544EH makes sure a block is open and returns Register Pair HL at the top state byte; the stack pointer is lowered by one to drop it.

5576
GOSUB to 544EH to make sure a block is open; Register Pair HL = the top condition state byte.
5579
DEC HL 2B
DECrement Register Pair HL to the state byte below the top.
557A
LD (59A8H),HL 22 A8 59
Store Register Pair HL (the lowered top) at 59A8H-59A9H.
557D
JUMP to 55B1H to read the next line of the source.

557FH - Evaluate a Term of the Condition

A term is one or more tokens joined by & (and): 5589H evaluates one token (with a leading - for not) and returns the NZ FLAG when it is false. A false token makes the whole term false at once; otherwise & joins the next token. Returns the Z FLAG for a true term and Register A = the character after it.

557F
GOSUB to 5589H to evaluate one token: the Z FLAG is set for a true token, and Register A returns the character that ended it.
5582
RET NZ C0
RETurn if the NZ FLAG is set (the token is false): the term is false, Register A at the character after it.
5583
CP 26H FE 26
Compare Register A against 26H, an ampersand (and).
5585
If the Z FLAG is set (another token joined by and), LOOP BACK to 557FH to evaluate it.
5587
XOR A AF
Clear Register A (XOR A): the Z FLAG is set, the term is true.
5588
RET C9
RETurn with the Z FLAG set: every token of the term was true.

5589H - Evaluate One Token

A leading - means not. 5598H reads the token (5620H) and looks it up (56EAH): the Z FLAG when it is defined (true), the NZ FLAG when it is not. After a minus sign the result is turned round with the OR AFH at 5594H, whose AFH is entered as XOR A. Register A returns the character after the token.

5589
LD A,(HL) 7E
Fetch the next character of the expression at Register Pair HL into Register A.
558A
CP 2DH FE 2D
Compare Register A against 2DH, a minus sign (not).
558C
If the NZ FLAG is set (no minus sign), JUMP to 5598H to read the token.
558E
INC HL 23
INCrement Register Pair HL past the minus sign.
558F
GOSUB to 5598H to read and look up the token after the minus sign: the Z FLAG when it is defined (true), Register B = the character after it.
5592
If the NZ FLAG is set (the token is not defined, false), JUMP to 5595H, the AFH inside the OR below, which runs as XOR A: the Z FLAG, true after the minus sign.
5594
OR AFH F6 AF
OR AFH into Register A: on the way from 5592H (a defined token after the minus sign) this gives the NZ FLAG, false. A JR to 5595H runs the AFH alone as XOR A, the Z FLAG.
5596
LD A,B 78
Copy Register B (the character after the token) into Register A. LD does not change the flags.
5597
RET C9
RETurn: the Z FLAG for a true result, Register A = the character after the token.
5598
GOSUB to 5620H to read the token of up to eight characters at Register Pair HL into the buffer at 57DCH; Register A returns the character that ended it.
559B
RET NZ C0
RETurn if the NZ FLAG is set (no token was read): Register A at the character.
559C
PUSH AF F5
Save Register Pair AF (the character that ended the token) to the stack.
559D
PUSH HL E5
Save Register Pair HL (the text) to the stack.
559E
GOSUB to 56EAH to look for the token at 57DCH in the stored tokens; the Z FLAG is set when it is there (a defined token counts as true).
55A1
POP HL E1
Restore Register Pair HL (the text) from the stack.
55A2
POP BC C1
Restore Register Pair BC from the stack: Register B = the character pushed in Register A at 559CH, Register C its flags.
55A3
LD A,B 78
Copy Register B (the character after the token) into Register A. LD does not change the flags.
55A4
RET C9
RETurn with the flags of 56EAH: the Z FLAG when the token is defined (true), the NZ FLAG when it is not.

55A5H - SET: Give a Token the Value True

The token after //SET is read (5620H) and stored true (56EAH looks it up, 56CDH stores it when it is new).

55A5
GOSUB to 5620H to read the token of up to eight characters at Register Pair HL into the buffer at 57DCH.
55A8
If the NZ FLAG is set (no token), JUMP to 545AH to end the command with Invalid JCL format.
55AB
GOSUB to 56EAH to look for the token at 57DCH in the stored tokens; the Z FLAG is set when it is found.
55AE
If the NZ FLAG is set (the token is new), GOSUB to 56CDH to store it with the value true.
55B1
JUMP to 53BAH to read the next line of the source.

55B4H - RESET: Give a Token the Value False

The token after //RESET is read (5620H) and, when it is found (56EAH, Register Pair DE at the entry's length byte), a space is stored over the first character of its name, eight bytes before: the entry can no longer be found, so the token counts as false. A token not already stored is already false.

55B4
GOSUB to 5620H to read the token of up to eight characters at Register Pair HL into the buffer at 57DCH.
55B7
If the NZ FLAG is set (no token), JUMP to 55A8H, which ends the command with Invalid JCL format.
55B9
GOSUB to 56EAH to look for the token at 57DCH in the stored tokens; Register Pair DE returns the found entry and the NZ FLAG when it is not found.
55BC
If the NZ FLAG is set (the token is not stored), JUMP to 55B1H: an unknown token is already false.
55BE
LD HL,FFF8H 21 F8 FF
Load Register Pair HL with FFF8H, minus eight.
55C1
ADD HL,DE 19
ADD Register Pair DE (the entry's length byte, +08H) to Register Pair HL: Register Pair HL = the first character of the entry's name, eight bytes before it.
55C2
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL over the first character of the name: the entry can no longer be found, so the token counts as false.
55C4
JUMP to 55B1H to read the next line of the source.

55C6H - ASSIGN: Give a Token a Character String Value

The token after //ASSIGN is read (5620H) and stored (56EAH, 56CDH); then an equals sign is required, the value string is read (562BH) and stored against the token (56DFH).

55C6
GOSUB to 5620H to read the token of up to eight characters at Register Pair HL into the buffer at 57DCH.
55C9
If the NZ FLAG is set (no token), JUMP to 55A8H, which ends the command with Invalid JCL format.
55CB
PUSH AF F5
Save Register Pair AF (the character that ended the token) to the stack.
55CC
GOSUB to 56EAH to look for the token at 57DCH in the stored tokens; the Z FLAG is set when it is found.
55CF
If the NZ FLAG is set (the token is new), GOSUB to 56CDH to store it.
55D2
POP AF F1
Restore Register Pair AF (the character that ended the token) from the stack.
55D3
CP 3DH FE 3D
Compare Register A against 3DH, an equals sign.
55D5
If the Z FLAG is set (token=value), GOSUB to 562BH to read the value string at Register Pair HL into the buffer at 57E4H.
55D8
If the NZ FLAG is set (no equals sign), JUMP to 55A8H, which ends the command with Invalid JCL format.
55DA
GOSUB to 56DFH to store the value at 57E4H against the token just stored.
55DD
JUMP to 55B1H to read the next line of the source.

55DFH - INCLUDE: Compile Another File in Place

The current source control block at 57BCH is pushed onto the include stack at 5906H (error Too many nested INCLUDEs! when the stack is full, its top at or above 59A8H, the condition stack), the named file is opened in its place, and the compile goes on reading from it.

55DF
PUSH HL E5
Save Register Pair HL (the text after INCLUDE) to the stack.
55E0
LD DE,(5906H) ED 5B 06 59
Fetch the top of the include stack from 5906H-5907H into Register Pair DE.
55E4
LD HL,59A8H 21 A8 59
Point Register Pair HL to 59A8H, the condition stack, which the include stack grows up towards.
55E7
OR A B7
Clear the CARRY FLAG with OR A (Register A is not changed) for the subtraction.
55E8
SBC HL,DE ED 52
Subtract Register Pair DE (the include top) from Register Pair HL: the Z FLAG is set when the include stack has reached the condition stack.
55EA
If the Z FLAG is set (the include stack is full), JUMP to 579CH to display Too many nested INCLUDEs!.
55ED
LD HL,57BCH 21 BC 57
Point Register Pair HL to 57BCH, the current source control block.
55F0
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
55F3
LDIR ED B0
Copy the control block onto the stack: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, to the include top.
55F5
LD (5906H),DE ED 53 06 59
Store Register Pair DE (the address above the saved block) at 5906H-5907H, the new top.
55F9
POP HL E1
Restore Register Pair HL (the text after INCLUDE) from the stack.
55FA
LD DE,57BCH 11 BC 57
Point Register Pair DE to 57BCH, the source control block, now free for the included file.
55FD
GOSUB to 441CH (@FSPEC) to take the file specification from the text at Register Pair HL into the control block at Register Pair DE.
5600
If the NZ FLAG is set (no file specification), JUMP to 55A8H, which ends the command with Invalid JCL format.
5602
LD HL,581FH 21 1F 58
Point Register Pair HL to 581FH, the three characters JCL.
5605
GOSUB to 4473H (@FEXT) to give the file specification the extension JCL when it has none.
5608
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the buffer of the source file.
560B
LD B,L 45
Copy Register L (00H) into Register B: 256 byte records for @OPEN.
560C
GOSUB to 4424H (@OPEN) to open the included file.
560F
If the NZ FLAG is set (the open failed), JUMP to 545AH to end the command with the error line.
5612
JUMP to 55B1H to read the first line of the included file.

5614H - QUIT: End the Compile

The SYSTEM/JCL file is closed and the member jumps to the finish (57B3H with the line at 59D8H, which ends the command).

5614
LD DE,4358H 11 58 43
Point Register Pair DE to 4358H, JFCB$, the SYSTEM/JCL file.
5617
GOSUB to 4428H (@CLOSE) to close the SYSTEM/JCL file.
561A
LD HL,59D8H 21 D8 59
Point Register Pair HL to 59D8H, the source line, which 57B3H displays before ending.
561D
JUMP to 57B3H to display the line and end the command.

5620H - Read a Token or a Value String

5620H reads a token of up to eight characters at Register Pair HL into the buffer at 57DCH; 562BH reads a value string of up to 32 characters into 57E5H and stores its length at 57E4H (error Symbol string too long! above 32). Both call 5667H, which stores the characters, folds small letters to capitals, keeps the characters inside a pair of quotes whole, sets the label flags on an @, and pads the field with spaces.

5620
PUSH DE D5
Save Register Pair DE (the caller's) to the stack.
5621
LD B,08H 06 08
Load Register B with 08H, the eight characters of a token.
5623
LD DE,57DCH 11 DC 57
Point Register Pair DE to 57DCH, the token buffer.
5626
GOSUB to 5667H to read up to Register B characters at Register Pair HL into the buffer at Register Pair DE.
5629
POP DE D1
Restore Register Pair DE (the caller's) from the stack.
562A
RET C9
RETurn to the caller with the token at 57DCH.
562B
PUSH DE D5
Save Register Pair DE (the caller's) to the stack.
562C
LD B,20H 06 20
Load Register B with 20H (32), the most characters of a value string.
562E
LD DE,57E5H 11 E5 57
Point Register Pair DE to 57E5H, one byte into the value buffer (its length goes in front at 57E4H).
5631
GOSUB to 564AH to read the value string at Register Pair HL into the buffer at Register Pair DE.
5634
PUSH AF F5
Save Register Pair AF (the character that ended the value) to the stack.
5635
PUSH HL E5
Save Register Pair HL (the text) to the stack.
5636
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the address after the value string.
5637
LD DE,57E5H 11 E5 57
Point Register Pair DE to 57E5H, the start of the value string.
563A
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
563B
SBC HL,DE ED 52
Subtract Register Pair DE (the start) from Register Pair HL: the length of the value string.
563D
LD A,L 7D
Copy Register L (the low byte of the length) into Register A.
563E
CP 21H FE 21
Compare Register A against 21H (33): the NO CARRY FLAG is set for 33 or more.
5640
If the NO CARRY FLAG is set (the value is too long), JUMP to 57A0H to display Symbol string too long!.
5643
LD (57E4H),A 32 E4 57
Store Register A (the length) at 57E4H, the byte in front of the value string.
5646
POP HL E1
Restore Register Pair HL (the text) from the stack.
5647
POP AF F1
Restore Register Pair AF (the character that ended the value) from the stack.
5648
POP DE D1
Restore Register Pair DE (the caller's) from the stack.
5649
RET C9
RETurn to the caller with the value string at 57E4H.
564A
GOSUB to 5667H to read a run of characters at Register Pair HL into the buffer at Register Pair DE; Register A returns the character that ended it.
564D
GOSUB to 577FH to test the character: the Z FLAG is set for a space or a comma.
5650
RET Z C8
RETurn if the Z FLAG is set (a space or a comma ends the value).
5651
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5653
RET Z C8
RETurn if the Z FLAG is set (the line ended).
5654
CP 3DH FE 3D
Compare Register A against 3DH, an equals sign.
5656
RET Z C8
RETurn if the Z FLAG is set (an equals sign ends the value).
5657
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
5659
RET Z C8
RETurn if the Z FLAG is set (a bracket ends the value).
565A
CP 29H FE 29
Compare Register A against 29H, a closing bracket.
565C
RET Z C8
RETurn if the Z FLAG is set (a bracket ends the value).
565D
CP 23H FE 23
Compare Register A against 23H, a hash, which is doubled for a hash itself.
565F
If the NZ FLAG is set (another ordinary run), LOOP BACK to 564AH to read more.
5661
GOSUB to 5403H: a doubled hash stores one hash in the value; a single hash substitutes the value of the token named up to the next hash (541BH).
5664
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A.
5665
LOOP BACK to 564DH to go on reading the value.

5667H - The Character Reader of a Token or Value

Register B = the most characters, Register Pair DE = the buffer, Register Pair HL = the text. Characters are stored until 03H, 0DH or a character not allowed in a token; a pair of quotes keeps whatever is between them; an @ at a token sets the label flags (a second @ is Too many Proc labels!); the field is padded with spaces to Register B characters. Returns the character that ended it in Register A, the Z FLAG when a character was stored.

5667
LD A,B 78
Copy Register B (the field width) into Register A.
5668
LD (56C9H),A 32 C9 56
Store Register A (the count) at 56C9H, the operand of the LD A at 56C8H: it becomes 00H once a character is stored.
566B
INC B 04
INCrement Register B: one more than the field width, counted down below.
566C
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A.
566D
CP 03H FE 03
Compare Register A against 03H, the end of a specification.
566F
If the Z FLAG is set (03H), JUMP to 56BDH to pad the field and return.
5671
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of a line.
5673
If the Z FLAG is set (0DH), JUMP to 56BDH to pad the field and return.
5675
INC HL 23
INCrement Register Pair HL to the character after it.
5676
CP 22H FE 22
Compare Register A against 22H, a quotation mark.
5678
If the NZ FLAG is set (not a quote), JUMP to 5681H.
567A
XOR 22H EE 22
Exclusive OR the quote flag, the operand at 567BH (22H in the file), into Register A (22H): 00H inside a pair of quotes, 22H outside.
567C
LD (567BH),A 32 7B 56
Store Register A (the quote flag) at 567BH, the operand of the XOR at 567AH: it toggles with each quote.
567F
LOOP BACK to 566CH for the character after the quote.
5681
LD C,A 4F
Copy Register A (the character) into Register C, to keep it.
5682
LD A,(567BH) 3A 7B 56
Fetch the quote flag from 567BH into Register A: 00H while inside a pair of quotes, 22H outside.
5685
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set inside quotes.
5686
LD A,C 79
Copy Register C (the character) into Register A.
5687
If the Z FLAG is set (inside quotes), JUMP to 56AFH to store the character as it is.
5689
CP 40H FE 40
Compare Register A against 40H, an at sign, which begins a label.
568B
If the NZ FLAG is set (not an at sign), JUMP to 569AH to check the quoted character.
568D
SUB 00H D6 00
SUBtract the label flag, the operand at 568EH (00H until the first @), from Register A (40H): the Z FLAG is set only when an @ label was already seen.
568F
If the Z FLAG is set (a second label), JUMP to 57A8H to display Too many Proc labels!.
5692
LD (568EH),A 32 8E 56
Store Register A (40H) at 568EH, the label given flag and the operand of the SUB at 568DH, so a later @ is caught.
5695
LD (5343H),A 32 43 53
Store Register A (40H) at 5343H, the label flag the parameter reader tests at 5342H.
5698
LOOP BACK to 566CH to read the characters of the label's name.
569A
CP 2EH FE 2E
Outside quotes: compare Register A against 2EH, a full stop (the lowest character a token accepts).
569C
If the CARRY FLAG is set (below the full stop), JUMP to 56BDH to end the field.
569E
CP 3BH FE 3B
Compare Register A against 3BH, a semicolon, above the drive colon.
56A0
If the CARRY FLAG is set (a full stop up to the colon, allowed), JUMP to 56AFH to store it.
56A2
CP 41H FE 41
Compare Register A against 41H, the letter A.
56A4
If the CARRY FLAG is set (between the semicolon and A), JUMP to 56BDH to end the field.
56A6
CP 5BH FE 5B
Compare Register A against 5BH, one above the letter Z.
56A8
If the CARRY FLAG is set (a capital letter), JUMP to 56AFH to store it.
56AA
GOSUB to 5785H to fold a small letter a-z to a capital in Register A; the CARRY FLAG is set for a character that is not a letter.
56AD
If the CARRY FLAG is set (not a letter), JUMP to 56BDH to end the field.
56AF
DEC B 05
DECrement Register B, the characters left in the field.
56B0
If the Z FLAG is set (the field is full), JUMP to 56BAH to ignore the extra character.
56B2
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the buffer.
56B3
XOR A AF
Clear Register A (XOR A): 00H for the stored flag.
56B4
LD (56C9H),A 32 C9 56
Store Register A (00H) at 56C9H, the operand of the LD A at 56C8H: a character has been stored.
56B7
INC DE 13
INCrement Register Pair DE to the next place of the buffer.
56B8
LOOP BACK to 566CH for the next character of the field.
56BA
INC B 04
INCrement Register B back (the field is full): the extra character is dropped.
56BB
LOOP BACK to 566CH for the next character of the field.
56BD
LD C,A 4F
Copy Register A (the character that ended the field) into Register C, to return it.
56BE
PUSH DE D5
Save Register Pair DE (the place in the buffer) to the stack.
56BF
JUMP to 56C5H to count the spaces that pad the field.
56C1
LD A,20H 3E 20
Load Register A with 20H, a space, to pad the field.
56C3
LD (DE),A 12
Store Register A (a space) at Register Pair DE in the buffer.
56C4
INC DE 13
INCrement Register Pair DE to the next place of the buffer.
56C5
DECrement Register B (the places left) and LOOP BACK to 56C1H until the field is padded with spaces.
56C7
POP DE D1
Restore Register Pair DE (the place in the buffer) from the stack.
56C8
LD A,00H 3E 00
Load Register A with the stored flag, the operand at 56C9H (00H when a character was stored, else the field width).
56CA
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when a character was stored.
56CB
LD A,C 79
Copy Register C (the character that ended the field) into Register A, to return it.
56CC
RET C9
RETurn: the Z FLAG when a character was stored, Register A the character after the field.

56CDH - Store a Token in the Token Table

Register Pair DE = the free entry 56EAH found (the 00H that ends the table). The eight character name at 57DCH is copied into it, its length byte (+08H) is set to 00H (no value string), and the first byte of the next entry, 41 bytes on, is cleared to end the table.

56CD
PUSH HL E5
Save Register Pair HL (the text) to the stack.
56CE
LD HL,57DCH 21 DC 57
Point Register Pair HL to 57DCH, the token name just read.
56D1
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name.
56D4
LDIR ED B0
Copy the name: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, into the slot.
56D6
XOR A AF
Clear Register A (XOR A): 00H, the length of a value string that is not there.
56D7
LD (DE),A 12
Store Register A (00H) at Register Pair DE, the length byte after the name (+08H): the token has no value string.
56D8
LD HL,0021H 21 21 00
Load Register Pair HL with 0021H (33), the length byte and the 32 bytes of the value.
56DB
ADD HL,DE 19
ADD Register Pair DE (the length byte) to Register Pair HL: Register Pair HL = the first byte of the next entry.
56DC
LD (HL),A 77
Store Register A (00H) at Register Pair HL: the first byte of the next slot, ending the table.
56DD
POP HL E1
Restore Register Pair HL (the text) from the stack.
56DE
RET C9
RETurn to the caller with the token stored in the table.

56DFH - Store a Value String against a Token

Register Pair DE = the length byte of the token just stored (after its name). The 33 bytes at 57E4H (the length and up to 32 characters) are copied there, so the token carries its value string.

56DF
PUSH HL E5
Save Register Pair HL (the text) to the stack.
56E0
LD HL,57E4H 21 E4 57
Point Register Pair HL to 57E4H, the length byte in front of the value string.
56E3
LD BC,0021H 01 21 00
Load Register Pair BC with 0021H (33), the length byte and the 32 characters.
56E6
LDIR ED B0
Copy the value: (DE) = (HL) for Register Pair BC bytes, Register Pairs HL and DE counting up, into the token's value area.
56E8
POP HL E1
Restore Register Pair HL (the text) from the stack.
56E9
RET C9
RETurn to the caller with the value string stored in the token.

56EAH - Look for a Token in the Token Table

The token name at 57DCH is searched in the table at 5D00H (41 byte entries: eight name, one length, 32 value; 00H ends the table). 5716H returns Register Pair HL at the length byte of the matching entry, or at the 00H free slot. Returns Register Pair DE = that address and the Z FLAG when the token was found.

56EA
PUSH HL E5
Save Register Pair HL (the text) to the stack.
56EB
LD DE,57DCH 11 DC 57
Point Register Pair DE to 57DCH, the token name to look for.
56EE
LD HL,5D00H 21 00 5D
Point Register Pair HL to 5D00H, the first entry of the token table.
56F1
LD BC,0829H 01 29 08
Load Register Pair BC with 0829H: Register B = 8 name characters, Register C = 29H (41), the bytes of a table entry.
56F4
GOSUB to 5716H to search the table; Register Pair HL comes back at the length byte of the match, or at the 00H of a free slot, and the Z FLAG is set on a match.
56F7
LD D,H 54
Copy Register H (the high byte) into Register D.
56F8
LD E,L 5D
Copy Register L (the low byte) into Register E: Register Pair DE = the found entry or the free slot.
56F9
POP HL E1
Restore Register Pair HL (the text) from the stack.
56FA
RET C9
RETurn to the caller: the Z FLAG when the token was found.

56FBH - Search a Directive Table

56FBH searches the conditional directive table at 54FAH (7 byte entries), 5704H the other directive table at 5510H (10 byte entries), for the name at 57DCH. 5716H returns Register Pair HL at the two byte handler address after the matched name, which is read into Register Pair DE. The Z FLAG is set when the name was found.

56FB
PUSH HL E5
Save Register Pair HL (the caller's) to the stack.
56FC
LD HL,54FAH 21 FA 54
Point Register Pair HL to 54FAH, the conditional directive table.
56FF
LD BC,0507H 01 07 05
Load Register Pair BC with 0507H: Register B = 5 name characters, Register C = 07H, the bytes of an entry.
5702
JUMP to 570BH to search the conditional directive table.
5704
PUSH HL E5
Save Register Pair HL (the caller's) to the stack.
5705
LD HL,5510H 21 10 55
Point Register Pair HL to 5510H, the other directive table.
5708
LD BC,080AH 01 0A 08
Load Register Pair BC with 080AH: Register B = 8 name characters, Register C = 0AH (10), the bytes of an entry.
570B
LD DE,57DCH 11 DC 57
Point Register Pair DE to 57DCH, the directive name to look for.
570E
GOSUB to 5716H to search the table; Register Pair HL comes back at the handler address after the matched name, and the Z FLAG is set on a match.
5711
LD E,(HL) 5E
Fetch the low byte of the handler address at Register Pair HL into Register E.
5712
INC HL 23
INCrement Register Pair HL to the high byte of the handler address.
5713
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the handler address.
5714
POP HL E1
Restore Register Pair HL (the caller's) from the stack.
5715
RET C9
RETurn: the Z FLAG when the directive was found.

5716H - The Name Table Search

Register Pair HL = the table, Register Pair DE = the name wanted, Register B = the characters compared, Register C = the bytes of an entry. Each entry's name is compared with the wanted name, spaces at the end of either counting as the end; on a match Register Pair HL is left just past the entry's name, on no match it steps on by Register C bytes. A 00H where a name begins ends the table, returning the NZ FLAG.

5716
LD A,(HL) 7E
Fetch the first character of the entry at Register Pair HL into Register A.
5717
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the 00H that ends the table.
5718
If the NZ FLAG is set (an entry), JUMP to 571CH to compare it.
571A
INC A 3C
INCrement Register A: Register A = 01H, the NZ FLAG set, the name was not found.
571B
RET C9
RETurn with the NZ FLAG set: the end of the table.
571C
LD A,(DE) 1A
Fetch the first character of the wanted name at Register Pair DE into Register A.
571D
GOSUB to 5785H to fold a small letter to a capital in Register A.
5720
CP (HL) BE
Compare Register A (the wanted character) against the entry's character at Register Pair HL.
5721
If the Z FLAG is set (the first characters match), JUMP to 572AH to compare the rest.
5723
PUSH BC C5
Save Register Pair BC (the counts) to the stack.
5724
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the bytes of an entry (Register C).
5726
ADD HL,BC 09
ADD Register Pair BC (the entry size) to Register Pair HL: the next entry.
5727
POP BC C1
Restore Register Pair BC (the counts) from the stack.
5728
LOOP BACK to 5716H to compare the next entry.
572A
PUSH HL E5
Save Register Pair HL (the entry) to the stack.
572B
PUSH DE D5
Save Register Pair DE (the wanted name) to the stack.
572C
PUSH BC C5
Save Register Pair BC (the counts) to the stack.
572D
DEC B 05
DECrement Register B, the characters after the first to compare.
572E
INC DE 13
INCrement Register Pair DE to the next character of the wanted name.
572F
INC HL 23
INCrement Register Pair HL to the next character of the entry.
5730
LD A,(DE) 1A
Fetch the next character of the wanted name at Register Pair DE into Register A.
5731
CP 20H FE 20
Compare Register A against 20H, a space that ends a short name.
5733
If the Z FLAG is set (the wanted name ended), JUMP to 575CH to check the entry has ended too.
5735
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, which also ends the name.
5737
If the Z FLAG is set (the wanted name ended), JUMP to 575CH.
5739
GOSUB to 5785H to fold a small letter to a capital in Register A.
573C
CP (HL) BE
Compare Register A (the wanted character) against the entry's character at Register Pair HL.
573D
If the NZ FLAG is set (a different character), JUMP to 574CH: not this entry.
573F
DECrement Register B (the characters left) and LOOP BACK to 572EH.
5741
POP BC C1
The names match fully: restore Register Pair BC (the counts) from the stack.
5742
POP DE D1
Restore Register Pair DE (the wanted name) from the stack.
5743
POP HL E1
Restore Register Pair HL (the entry) from the stack.
5744
PUSH BC C5
Save Register Pair BC (the counts) to the stack.
5745
LD C,B 48
Copy Register B (the name length) into Register C.
5746
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the name length.
5748
ADD HL,BC 09
ADD Register Pair BC (the name length) to Register Pair HL: Register Pair HL just past the entry's name, at its data.
5749
POP BC C1
Restore Register Pair BC (the counts) from the stack.
574A
XOR A AF
Clear Register A (XOR A): the Z FLAG is set, the name was found.
574B
RET C9
RETurn with the Z FLAG set and Register Pair HL at the entry's data.
574C
CP 30H FE 30
A character differed: compare Register A (the wanted character) against 30H, the character 0.
574E
If the CARRY FLAG is set (below 0: the wanted name ended), JUMP to 575CH.
5750
CP 3AH FE 3A
Compare Register A against 3AH, one above the character 9.
5752
If the CARRY FLAG is set (a digit), JUMP to 5761H: the names differ, next entry.
5754
CP 41H FE 41
Compare Register A against 41H, the letter A.
5756
If the CARRY FLAG is set (between the digits and A: the wanted name ended), JUMP to 575CH.
5758
CP 5BH FE 5B
Compare Register A against 5BH, one above the letter Z.
575A
If the CARRY FLAG is set (a capital letter), JUMP to 5761H: the names differ, next entry.
575C
LD A,(HL) 7E
Fetch the entry's character at Register Pair HL into Register A.
575D
CP 20H FE 20
Compare Register A against 20H, a space at the end of the entry's name.
575F
If the Z FLAG is set (the entry's name has ended too), LOOP BACK to 5741H: a match on both ends.
5761
POP BC C1
Restore Register Pair BC (the counts) from the stack.
5762
POP DE D1
Restore Register Pair DE (the wanted name) from the stack.
5763
POP HL E1
Restore Register Pair HL (the entry) from the stack.
5764
JUMP to 5723H to step on to the next entry of the table.

5766H - Helper: Write a Number in Decimal

Register Pair HL = the number, Register Pair DE = the first of five places. The places are filled with spaces, then the digits are written from the right by dividing by ten (@DIV) until the number is 0.

5766
LD B,05H 06 05
Load Register B with 05H, the five decimal places.
5768
LD A,20H 3E 20
Load Register A with 20H, a space to fill the places.
576A
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
576B
INC DE 13
INCrement Register Pair DE to the next place.
576C
DECrement Register B (the places left) and LOOP BACK to 576AH until all five are spaces.
576E
PUSH DE D5
Save Register Pair DE (the address after the five places) to the stack.
576F
DEC DE 1B
DECrement Register Pair DE to the units place.
5770
LD A,0AH 3E 0A
Load Register A with 0AH (10), the divisor for the next digit.
5772
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A (10): Register Pair HL = the quotient, Register A = the next digit from the right.
5775
ADD A,30H C6 30
ADD 30H to Register A: the character of the decimal digit.
5777
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
5778
DEC DE 1B
DECrement Register Pair DE to the place on the left.
5779
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
577A
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when the quotient is 0.
577B
If the NZ FLAG is set (digits left), LOOP BACK to 5770H for the next digit.
577D
POP DE D1
Restore Register Pair DE (the address after the five places) from the stack.
577E
RET C9
RETurn to the caller with the number written.

577FH - Helper: Test for a Space or a Comma

Returns the Z FLAG for a space or a comma in Register A, the NZ FLAG otherwise. Register A is kept.

577F
CP 20H FE 20
Compare Register A against 20H, a space separator.
5781
RET Z C8
RETurn if the Z FLAG is set (a space ended the item).
5782
CP 2CH FE 2C
Compare Register A against 2CH, a comma separator.
5784
RET C9
RETurn: the Z FLAG for a comma, the NZ FLAG otherwise.

5785H - Helper: Fold a Small Letter to a Capital

A character a-z (61H-7AH) has 20H taken off to make it a capital; the CARRY FLAG is set for a character that is not a letter a-z. Any other character is left as it is.

5785
CP 61H FE 61
Compare Register A against 61H, the small letter a.
5787
RET C D8
RETurn if the CARRY FLAG is set (below a, not a small letter): Register A is unchanged.
5788
CP 7BH FE 7B
Compare Register A against 7BH, one above the small letter z.
578A
CCF 3F
Complement the CARRY FLAG (CCF): it is set when Register A is above z, not a small letter.
578B
RET C D8
RETurn if the CARRY FLAG is set (above z): Register A is unchanged.
578C
XOR 20H EE 20
Exclusive OR 20H into Register A: a small letter a-z becomes the capital A-Z.
578E
RET C9
RETurn with Register A folded from a small letter to a capital.

578FH - Parameter Error and the Message Selector

578FH reports error 2CH (parameter error) through @ERROR; 5798H and the five entries below it are a chain of LD IX instructions whose DD prefixes make each entry but the one jumped to a dead load, so entering at 5798H, 579CH, 57A0H, 57A4H, 57A8H, 57ACH or 57B0H each loads Register Pair HL with one message. 57B3H displays it and ends the command.

578F
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
5791
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return and bit 6 for the short form of the message.
5793
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5796
JUMP to 57B6H to end the command with Register Pair HL = FFFFH.
5798
LD HL,5825H 21 25 58
Point Register Pair HL to 5825H, the message File spec required!, the first entry of the chain.
579B
LD IX,58ECH DD 21 EC 58
Load Index Register IX with 58ECH. The bytes DD 21 EC 58 make this a dead load of Index Register IX on fall-through; entering at 579CH runs 21 EC 58 as LD HL,58ECH, the message Too many nested INCLUDEs!.
579F
LD IX,5848H DD 21 48 58
Load Index Register IX with 5848H. Entering at 57A0H runs 21 48 58 as LD HL,5848H, the message Symbol string too long!.
57A3
LD IX,5860H DD 21 60 58
Load Index Register IX with 5860H. Entering at 57A4H runs 21 60 58 as LD HL,5860H, the message Procedure not found!.
57A7
LD IX,5875H DD 21 75 58
Load Index Register IX with 5875H. Entering at 57A8H runs 21 75 58 as LD HL,5875H, the message Too many Proc labels!.
57AB
LD IX,588BH DD 21 8B 58
Load Index Register IX with 588BH. Entering at 57ACH runs 21 8B 58 as LD HL,588BH, the message Can't create SYSTEM/JCL file!.
57AF
LD IX,58A9H DD 21 A9 58
Load Index Register IX with 58A9H. Entering at 57B0H runs 21 A9 58 as LD HL,58A9H, the message Multiply defined parameter.
57B3
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
57B6
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
57B9
JUMP to 5305H to put the stack back and end the command.

580DH - DO Data: Launch Stubs and the SYSTEM/JCL Name

The stubs copied over the exit and error vectors while the JCL runs, and the file specification SYSTEM/JCL with its drive patched in.

580D
DEFB 00H 00
00H, a byte before the launch stubs that no code reads.
580E-5810
DEFB 3EH, ADH, EFH 3E AD EF
LD A,ADH / RST 28H: copied to 406BH by 52F9H; SYS11/SYS copies it over @EXIT at 402DH, so a program that ends during the JCL issues request ADH to SYS11/SYS.
5811-5813
DEFB 3EH, BDH, EFH 3E BD EF
LD A,BDH / RST 28H: copied to 406EH by 52F9H; SYS11/SYS copies it over @ABORT at 4030H, so a program that aborts during the JCL issues request BDH to SYS11/SYS.
5814-5817
DEFB F5H, 3EH, 96H, EFH F5 3E 96 EF
PUSH AF / LD A,96H / RST 28H: copied over @ERROR at 4409H by 52DAH, the bytes of @ERROR as SYS0/SYS loads them, so that an error during the JCL goes to SYS4/SYS (request 96H).
5818-5821
DEFM "SYSTEM/JCL" 53 59 53 54 45 4D 2F 4A 43 4C
The file specification of the compiled JCL file, copied to JFCB$ at 4358H by 5330H.
5822
DEFB 03H 03
03H, the end of the name when no drive has been patched in.
5823-5824
DEFB 03H, 03H 03 03
The colon and the drive digit of the writable drive, stored here by 524DH over these two bytes.

5825H - DO Data: the Messages

The messages the selector at 5798H and the error path at 5469H choose between, each ended by 0DH.

5825-5837
DEFM "File spec required!" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 5798H: no file was named after DO.
5838
DEFB 0DH 0D
0DH, the end of the message File spec required!.
5839-5846
DEFM "Line too long!" 4C 69 6E 65 20 74 6F 6F 20 6C 6F 6E 67 21
The message of 54BDH: a source line was longer than 63 characters.
5847
DEFB 0DH 0D
0DH, the end of the message Line too long!, displayed with it.
5848-585E
DEFM "Symbol string too long!" 53 79 6D 62 6F 6C 20 73 74 72 69 6E 67 20 74 6F 6F 20 6C 6F 6E 67 21
The message of 57A0H: a value string was longer than 32 characters.
585F
DEFB 0DH 0D
0DH, the end of the message Symbol string too long!.
5860-5873
DEFM "Procedure not found!" 50 72 6F 63 65 64 75 72 65 20 6E 6F 74 20 66 6F 75 6E 64 21
The message of 57A4H: a label named on the DO line is in no source file.
5874
DEFB 0DH 0D
0DH, the end of the message Procedure not found!.
5875-5889
DEFM "Too many Proc labels!" 54 6F 6F 20 6D 61 6E 79 20 50 72 6F 63 20 6C 61 62 65 6C 73 21
The message of 57A8H: a second label was named in the parameters.
588A
DEFB 0DH 0D
0DH, the end of the message Too many Proc labels!.
588B-58A7
DEFM "Can't create SYSTEM/JCL file!" 43 61 6E 27 74 20 63 72 65 61 74 65 20 53 59 53 54 45 4D 2F 4A 43 4C 20 66 69 6C 65 21
The message of 57ACH: no drive was ready and writable for the SYSTEM/JCL file.
58A8
DEFB 0DH 0D
0DH, the end of the message Can't create SYSTEM/JCL file!.
58A9-58C2
DEFM "Multiply defined parameter" 4D 75 6C 74 69 70 6C 79 20 64 65 66 69 6E 65 64 20 70 61 72 61 6D 65 74 65 72
The message of 57B0H: a token was given twice in the parameters.
58C3
DEFB 0DH 0D
0DH, the end of the message Multiply defined parameter.
58C4-58EA
DEFM "Invalid JCL format, processing aborted!" 49 6E 76 61 6C 69 64 20 4A 43 4C 20 66 6F 72 6D 61 74 2C 20 70 72 6F 63 65 73 73 69 6E 67 20 61 62 6F 72 74 65 64 21
The message of 5469H: a line the compiler could not make sense of.
58EB
DEFB 0DH 0D
0DH, the end of the message Invalid JCL format, processing aborted!.
58EC-5904
DEFM "Too many nested INCLUDEs!" 54 6F 6F 20 6D 61 6E 79 20 6E 65 73 74 65 64 20 49 4E 43 4C 55 44 45 73 21
The message of 579CH: the include stack was full.
5905
DEFB 0DH 0D
0DH, the end of the message Too many nested INCLUDEs!.

5906H - DO Data: Stacks and the Error Line

The include stack and the condition stack grow in the work area; their pointers are kept here, and the error line holds the line number.

5906-5907
DEFW 5908H 08 59
The top of the include stack: 5908H, its base, in the file. 55F5H raises it on //INCLUDE and 5298H lowers it at the end of an included file.
5908-59A7
DEFS 160
The include stack: up to five saved source control blocks of 32 bytes, filled by 55F3H. Not loaded from the file.
59A8-59A9
DEFW 59AAH AA 59
The top of the condition stack: 59AAH, its base, in the file. 5562H raises it on //IF and 557AH lowers it on //END.
59AA
DEFB 00H 00
The first state byte of the condition stack: 00H, a block compiled, before any //IF.
59AB-59C9
DEFS 31
The condition stack: one state byte for each open //IF block (00H compiled, non-zero skipped). Not loaded from the file.
59CA-59D7
DEFM "Line xxxxx -->" 4C 69 6E 65 20 78 78 78 78 78 20 2D 2D 3E
The error line of 5463H: Line, five digits written by 5766H at 59CFH, and an arrow, followed at once by the source line at 59D8H, whose 0DH ends the text @LOGOT shows.

5D00H - DO Data: the Token Table

The table of tokens set on the DO line, by //SET or by //ASSIGN. Each entry is eight name characters, a length byte and a 32 byte value string (41 bytes); a 00H name byte ends it. Built in the work area above the member.

5D00
DEFB 00H 00
00H, the empty first entry of the token table: no token is set until the parameters are read.

5200H - Member 6 (SPOOL): Entry and an Installed Spooler

The SPOOL command (library member A2H), loaded at 5200H-59DAH. It builds a printer spooler in high memory: a module of 016BH bytes (copied from 5844H), a queue block of 44 bytes (from 59AFH), a table of 4 byte slots, one for each 256 byte memory page and each disk sector of the buffer, and the memory pages. The module takes over the output of the device (its control block's driver address), stores each character in the queue, sends the queue to the device from an interrupt task (slot 9) two characters a tick while the device is ready, and moves pages between memory and the spool file from the keyboard task (@KITSK, 4300H), since a disk transfer cannot run inside the interrupt. The spooler's parameter block (module +0AH, 10 bytes) is addressed by Index Register IY at 584EH while the member runs and by 4DF0H-4DF1H once it is installed. When a spooler was installed before (4DF1H not 00H), its parameter block is copied back here and only OFF, PAUSE, RESUME and CLEAR are accepted.

5200
LD (5639H),SP ED 73 39 56
Store the Stack Pointer at 5639H, the operand of the LD SP at 5638H: the exit puts the stack back to this depth whatever the member has pushed, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,584EH 11 4E 58
Load Register Pair DE with 584EH, the spooler's parameter block in the module image (module +0AH, 10 bytes, not loaded from the file).
5207
PUSH DE D5
Save Register Pair DE (584EH) to the stack, to move it into Index Register IY.
5208
POP IY FD E1
Restore Index Register IY from the stack: Index Register IY = 584EH, the parameter block. Its fields: +00H-+01H the top of the spooler's memory, +02H-+03H the HIGH$ the install left, +04H-+05H MEM, +06H-+07H DISK, +08H-+09H the address of the module's output control block cell.
520A
LD IX,441FH DD 21 1F 44
Point Index Register IX to 441FH, DFLAG$, the device flags (bit 0 the spooler is installed, bit 3 PR/FLT installed, bit 4 KI/DVR installed); IX+04H is 4423H, KFLAG$, whose bit 4 lets the spooler send its queue.
520E
LD A,(4DF1H) 3A F1 4D
Fetch the high byte of 4DF0H-4DF1H, the address of an installed spooler's parameter block, from 4DF1H into Register A.
5211
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when 4DF1H holds 00H, no spooler was ever installed.
5212
If the Z FLAG is set (no spooler in memory), JUMP to 523FH to check the command level first.
5214
PUSH HL E5
A spooler is in memory: save Register Pair HL (the parameters of the command) to the stack.
5215
LD H,A 67
Copy Register A (the high byte from 4DF1H) into Register H.
5216
LD A,(4DF0H) 3A F0 4D
Fetch the low byte of the parameter block's address from 4DF0H into Register A.
5219
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the installed spooler's parameter block in high memory.
521A
LD (55AFH),HL 22 AF 55
Store Register Pair HL (the installed parameter block) at 55AFH, the operand of the LD HL at 55AEH, which CLEAR uses to reach the installed queue block.
521D
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the 10 bytes of a parameter block.
5220
LDIR ED B0
Copy the 10 bytes from the installed parameter block at Register Pair HL to 584EH at Register Pair DE (LDIR, Register Pair BC = the count): the old settings become the member's.
5222
LD E,(IY+04H) FD 5E 04
Fetch the low byte of the installed MEM value from IY+04H (Index Register IY = 584EH) into Register E.
5225
LD D,(IY+05H) FD 56 05
Fetch the high byte of the installed MEM value from IY+05H (Index Register IY = 584EH) into Register D.
5228
LD (538EH),DE ED 53 8E 53
Store Register Pair DE (the installed MEM value) at 538EH, the operand of the LD BC at 538DH where MEM is read: the memory size cannot be changed.
522C
LD E,(IY+06H) FD 5E 06
Fetch the low byte of the installed DISK value from IY+06H (Index Register IY = 584EH) into Register E.
522F
LD D,(IY+07H) FD 56 07
Fetch the high byte of the installed DISK value from IY+07H (Index Register IY = 584EH) into Register D.
5232
LD (5356H),DE ED 53 56 53
Store Register Pair DE (the installed DISK value) at 5356H, the operand of the LD BC at 5355H where DISK is read: the disk size cannot be changed.
5236
LD HL,5803H 21 03 58
Load Register Pair HL with 5803H, the part of the parameter table from OFF on (OFF, N, PAUSE, P, RESUME, R, CLEAR, C).
5239
LD (52C7H),HL 22 C7 52
Store Register Pair HL (5803H) at 52C7H, the operand of the LD DE at 52C6H: @PARAM no longer knows MEM, M, DISK and D.
523C
POP HL E1
Restore Register Pair HL (the parameters of the command) from the stack.
523D
JUMP to 5259H to read the device: the command level check is not made again for a spooler in memory.

523FH - Check for LDOS Command Level

A spooler may only be installed at LDOS command level: @EXIT (402DH) must not be taken over by a running program (a JP there), and the command must not come from a program through 4451H (bit 1 of 4758H). While a JCL job runs, SYS11/SYS keeps the original bytes of 402DH at 4065H, so those are tested instead. Otherwise the message Can't -- Valid only at LDOS Command level! ends the command.

523F
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5242
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
5244
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
5247
If the Z FLAG is set (no JCL job), JUMP to 524CH to test that byte.
5249
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
524C
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with a JP only while a program has taken it over.
524E
If the Z FLAG is set (a program owns @EXIT), JUMP to 5658H to display Can't -- Valid only at LDOS Command level! and end the command.
5251
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
5254
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
5256
If the NZ FLAG is set (a program ran the command), JUMP to 5658H to refuse it.

5259H - Read the Device and the Spool File

The first specification is the device (an asterisk and two letters; PR when none is given) and goes to the control block at 57B8H. A file specification after it, or one given without a device, names the spool file; it is put together in the queue block at 59AFH, whose first 32 bytes are the spool file's control block. With no file name the name is the two letters of the device; the extension is SPL unless one is given, and a drive alone (:d) is added to that name.

5259
LD DE,57B8H 11 B8 57
Point Register Pair DE to 57B8H, the control block that receives the device specification.
525C
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL (the parameters) to Register Pair DE (57B8H); it returns the Z FLAG and Register A = 00H for a valid one, Register Pair HL past it.
525F
PUSH HL E5
Save Register Pair HL (the parameters after the specification) to the stack. PUSH does not change the flags.
5260
If the NZ FLAG is set (no specification, the parameters start with a bracket or end), JUMP to 5284H to use the device PR.
5262
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE (57B8H) into Register A.
5263
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk that starts a device name.
5265
If the Z FLAG is set (a device was named), JUMP to 5287H to read the spool file after it.
5267
EX DE,HL EB
A file was named without a device: exchange Register Pairs DE and HL, so that Register Pair HL = 57B8H, the specification.
5268
LD DE,59AFH 11 AF 59
Point Register Pair DE to 59AFH, the queue block, whose first 32 bytes are the spool file's control block.
526B
PUSH DE D5
Save Register Pair DE (59AFH, the spool file's control block) to the stack.
526C
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
526F
LDIR ED B0
Copy the 32 bytes from 57B8H at Register Pair HL to 59AFH at Register Pair DE (LDIR, Register Pair BC = the count): the file named is the spool file.
5271
GOSUB to 5278H to put the device PR into 57B8H, since none was named.
5274
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, so that 5297H keeps the file name and adds no drive.
5275
POP DE D1
Restore Register Pair DE (59AFH, the spool file's specification) from the stack.
5276
JUMP to 5297H to add the extension SPL to the file named.
5278
LD HL,57DFH 21 DF 57
Point Register Pair HL to 57DFH, the default device text PR after an asterisk, ended by 03H.
527B
LD DE,57B8H 11 B8 57
Point Register Pair DE to 57B8H, the device's control block.
527E
LD BC,0004H 01 04 00
Load Register Pair BC with 0004H, the asterisk, the two letters and the 03H.
5281
LDIR ED B0
Copy the 4 bytes from 57DFH at Register Pair HL to 57B8H at Register Pair DE (LDIR, Register Pair BC = the count).
5283
RET C9
RETurn to the caller with 57B8H holding the device PR.
5284
No specification was given: GOSUB to 5278H to put the device PR into 57B8H.
5287
POP HL E1
Restore Register Pair HL (the parameters after the device) from the stack.
5288
LD DE,(57B9H) ED 5B B9 57
Fetch the two letters of the device from 57B9H-57BAH into Register Pair DE (Register E the first, Register D the second).
528C
LD (57D8H),DE ED 53 D8 57
Store Register Pair DE (the two letters) at 57D8H-57D9H, over XX in the default file name XX/SPL.
5290
LD DE,59AFH 11 AF 59
Point Register Pair DE to 59AFH, the spool file's control block in the queue block.
5293
GOSUB to 441CH (@FSPEC) to copy a file specification at Register Pair HL to Register Pair DE (59AFH); the NZ FLAG and Register A = the character it stopped at when there is none (a colon for a drive alone).
5296
PUSH HL E5
Save Register Pair HL (the parameters after the file specification) to the stack.
5297
PUSH AF F5
Save Register Pair AF (the result of @FSPEC, or 00H with the Z FLAG from 5274H) to the stack.
5298
LD HL,57D8H 21 D8 57
Point Register Pair HL to 57D8H, the default file name (the device's two letters, /SPL, 03H).
529B
If the NZ FLAG is set (no file was named), GOSUB to 441CH (@FSPEC) to copy the default name at Register Pair HL into the control block at Register Pair DE (59AFH).
529E
LD HL,57DBH 21 DB 57
Point Register Pair HL to 57DBH, the extension SPL.
52A1
GOSUB to 4473H (@FEXT) to add the extension at Register Pair HL to the specification at Register Pair DE (59AFH) when it has none.
52A4
POP AF F1
Restore Register Pair AF (the result of the first @FSPEC on the file) from the stack.
52A5
POP HL E1
Restore Register Pair HL (the parameters after the file specification) from the stack.
52A6
CP 3AH FE 3A
Compare Register A against 3AH, a colon: @FSPEC stopped at a drive given without a name.
52A8
If the NZ FLAG is set (not a drive alone), JUMP to 52C6H to read the parameters.
52AA
LD A,(DE) 1A
Fetch the character of the spool file's specification at Register Pair DE (from 59AFH) into Register A.
52AB
CP 0DH FE 0D
Compare Register A against 0DH, an ENTER that can end a specification.
52AD
If the Z FLAG is set (the end), JUMP to 52B6H to add the drive there.
52AF
CP 03H FE 03
Compare Register A against 03H, the end mark @FSPEC stores after a specification.
52B1
If the Z FLAG is set (the end), JUMP to 52B6H to add the drive there.
52B3
INC DE 13
INCrement Register Pair DE to the next character of the specification.
52B4
LOOP BACK to 52AAH for the next character of the specification.
52B6
LD A,3AH 3E 3A
Load Register A with 3AH, a colon, to start the drive part.
52B8
LD (DE),A 12
Store Register A (the colon) at Register Pair DE, over the end of the specification.
52B9
INC DE 13
INCrement Register Pair DE to the place of the drive.
52BA
LD A,(HL) 7E
Fetch the drive character at Register Pair HL (the character after the colon in the parameters) into Register A.
52BB
CP 0DH FE 0D
Compare Register A against 0DH, the end of the command line.
52BD
If the Z FLAG is set (a colon with no drive), JUMP to 5647H to report error 2CH (parameter error).
52C0
INC HL 23
INCrement Register Pair HL past the drive character.
52C1
LD (DE),A 12
Store Register A (the drive character) at Register Pair DE.
52C2
INC DE 13
INCrement Register Pair DE past the drive character just stored.
52C3
LD A,03H 3E 03
Load Register A with 03H, the end mark of a specification.
52C5
LD (DE),A 12
Store Register A (03H) at Register Pair DE: the spool file is the device's name/SPL on the drive given.

52C6H - Read the Parameters

@PARAM reads the parameters into the operands that use them (table 57E3H: MEM, DISK, OFF, PAUSE, RESUME, CLEAR; or from 5803H for a spooler in memory). OFF, RESUME, PAUSE and CLEAR are tested in that order; each one given goes to its own routine. With none, the spooler is installed.

52C6
LD DE,57E3H 11 E3 57
Point Register Pair DE to 57E3H, the parameter table of SPOOL (5236H changes this operand to 5803H when a spooler is in memory).
52C9
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE. Each value is stored at the address the table names; a keyword given without a value stores FFFFH.
52CC
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5647H to report error 2CH (parameter error).
52CF
LD DE,0000H 11 00 00
Load Register Pair DE with the OFF parameter, the operand at 52D0H-52D1H: 0000H in the file, FFFFH when OFF (or N) was given.
52D2
INC E 1C
INCrement Register E (the low byte of the OFF parameter): FFH becomes 00H and sets the Z FLAG.
52D3
If the Z FLAG is set (OFF was given), JUMP to 5539H to turn the spooler off.
52D6
LD DE,0000H 11 00 00
Load Register Pair DE with the RESUME parameter, the operand at 52D7H-52D8H: 0000H in the file, FFFFH when RESUME (or R) was given.
52D9
INC E 1C
INCrement Register E (the low byte of the RESUME parameter): the Z FLAG is set for FFH.
52DA
If the Z FLAG is set (RESUME was given), JUMP to 5524H to let the spooler send again.
52DD
LD DE,0000H 11 00 00
Load Register Pair DE with the PAUSE parameter, the operand at 52DEH-52DFH: 0000H in the file, FFFFH when PAUSE (or P) was given.
52E0
INC E 1C
INCrement Register E (the low byte of the PAUSE parameter): the Z FLAG is set for FFH.
52E1
If the Z FLAG is set (PAUSE was given), JUMP to 550FH to stop the sending.
52E4
LD DE,0000H 11 00 00
Load Register Pair DE with the CLEAR parameter, the operand at 52E5H-52E6H: 0000H in the file, FFFFH when CLEAR (or C) was given.
52E7
INC E 1C
INCrement Register E (the low byte of the CLEAR parameter): the Z FLAG is set for FFH.
52E8
If the Z FLAG is set (CLEAR was given), JUMP to 55A7H to empty the queue.

52EBH - Install: Find the Device

An installed and running spooler (DFLAG$ bit 0) is not installed twice, and KI/DVR must be installed (DFLAG$ bit 4), since the queue is moved between memory and disk from the keyboard task. The device's control block is looked for by its two letters; a routed device (type bit 4) is followed to the control block it is routed to. When PR/FLT is installed (DFLAG$ bit 3) and its saved control block address equals the one found, the spooler is put behind the filter: it takes the filter's own control block copy.

52EB
LD A,(IX+00H) DD 7E 00
Fetch DFLAG$, the device flags at IX+00H (Index Register IX = 441FH), into Register A.
52EE
RRCA 0F
Rotate Register A right (RRCA): bit 0 of DFLAG$ (the spooler is installed) goes into the CARRY FLAG and bit 4 (KI/DVR installed) moves to bit 3.
52EF
If the CARRY FLAG is set (a spooler is installed and on), JUMP to 5627H to display Spooler is already active.
52F2
BIT 3,A CB 5F
Test bit 3 of Register A, which is bit 4 of DFLAG$: KI/DVR is installed.
52F4
If the Z FLAG is set (no KI/DVR), JUMP to 5650H to display SPOOLER requires KI/DVR active!.
52F7
LD DE,(57B9H) ED 5B B9 57
Fetch the two letters of the device from 57B9H-57BAH into Register Pair DE (Register E the first, Register D the second).
52FB
GOSUB to 55F1H to look for the device control block named by Register Pair DE; it returns the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H.
52FE
If the NZ FLAG is set (no such device), JUMP to 5649H to report the error in Register A (08H, device not available).
5301
BIT 4,(HL) CB 66
Test bit 4 of the type byte at Register Pair HL (the device control block): set when the device is routed to another block.
5303
If the Z FLAG is set (not routed), JUMP to 530CH: this is the block whose output the spooler takes.
5305
INC HL 23
INCrement Register Pair HL to +01H of the control block.
5306
LD A,(HL) 7E
Fetch the low byte of the block the device is routed to, from +01H at Register Pair HL, into Register A.
5307
INC HL 23
INCrement Register Pair HL to +02H of the control block.
5308
LD H,(HL) 66
Fetch the high byte of the block it is routed to, from +02H at Register Pair HL, into Register H.
5309
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the control block the device is routed to.
530A
LOOP BACK to 5301H to test that block's type in its turn.
530C
BIT 3,(IX+00H) DD CB 00 5E
Test bit 3 of DFLAG$ at IX+00H (Index Register IX = 441FH): set when PR/FLT is installed.
5310
If the Z FLAG is set (no PR/FLT), JUMP to 5337H with Register Pair HL = the device's control block.
5312
PUSH HL E5
Save Register Pair HL (the device's control block) to the stack.
5313
LD A,(4DF6H) 3A F6 4D
Fetch the low byte of PR/FLT's module address from 4DF6H into Register A.
5316
LD L,A 6F
Copy Register A (the low byte) into Register L.
5317
LD A,(4DF7H) 3A F7 4D
Fetch the high byte of PR/FLT's module address from 4DF7H into Register A.
531A
LD H,A 67
Copy Register A (the high byte) into Register H: Register Pair HL = PR/FLT's module in high memory.
531B
INC HL 23
INCrement Register Pair HL to +01H of the module header (the offset of its JR).
531C
INC HL 23
INCrement Register Pair HL to +02H of the module header (the low byte of its link word).
531D
INC HL 23
INCrement Register Pair HL to +03H of the module header (the high byte of its link word).
531E
INC HL 23
INCrement Register Pair HL to +04H of the module header, the length of the module's name.
531F
LD E,(HL) 5E
Fetch the length of the name at Register Pair HL into Register E.
5320
INC E 1C
INCrement Register E: the name and its length byte.
5321
LD D,00H 16 00
Load Register D with 00H, so that Register Pair DE = the length of the name plus 1.
5323
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the byte after the name, the start of PR/FLT's control block.
5324
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = PR/FLT's control block.
5325
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the offset of the word PR/FLT keeps the control block it filters in.
5328
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = PR/FLT's control block +08H.
5329
LD A,(HL) 7E
Fetch the low byte of the filtered device's control block at Register Pair HL into Register A.
532A
INC HL 23
INCrement Register Pair HL to the high byte of that word.
532B
LD H,(HL) 66
Fetch the high byte at Register Pair HL into Register H.
532C
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the control block PR/FLT filters.
532D
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the filtered block, Register Pair HL = PR/FLT's control block.
532E
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (EX (SP),HL, the Stack Pointer's word): Register Pair HL = the device's control block, PR/FLT's control block is kept on the stack.
532F
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the filtered block, Register Pair DE = the device's control block.
5330
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5331
SBC HL,DE ED 52
Subtract Register Pair DE (the device's block) from Register Pair HL (the filtered block): the Z FLAG is set when they are the same.
5333
POP DE D1
Restore Register Pair DE (PR/FLT's control block) from the stack. POP does not change the flags.
5334
If the NZ FLAG is set (PR/FLT filters another device), JUMP to 5337H; Register Pair HL then holds the difference of the two addresses, not a control block, and that is stored.
5336
EX DE,HL EB
The device is the one PR/FLT filters: exchange Register Pairs DE and HL, so that Register Pair HL = PR/FLT's control block, its own copy of the device's control block.
5337
LD (5442H),HL 22 42 54
Store Register Pair HL (the control block whose output the spooler takes) at 5442H, the operand of the LD HL at 5441H.

533AH - Install: Make the Spool File

DISK (in K, 4 in the file) is the size of the spool file; DISK= with no value gives 0 and no file. The file is opened or made with records of 256 bytes, its last sector (DISK x 4 - 1) is written so that its space is taken, it is rewound and its end of file is set to its start, and bit 7 of byte +01H of its directory record is set so that the space is kept when the file is closed.

533A
LD DE,(5356H) ED 5B 56 53
Fetch the DISK parameter from 5356H-5357H, the operand of the LD BC at 5355H, into Register Pair DE.
533E
LD (IY+06H),E FD 73 06
Store Register E (the low byte of DISK) at IY+06H of the parameter block (Index Register IY = 584EH).
5341
LD (IY+07H),D FD 72 07
Store Register D (the high byte of DISK) at IY+07H of the parameter block (Index Register IY = 584EH).
5344
LD A,D 7A
Copy Register D (the high byte of DISK) into Register A.
5345
OR E B3
OR Register E (the low byte of DISK) into Register A: the Z FLAG is set when DISK is 0.
5346
If the Z FLAG is set (no disk space), JUMP to 538DH: the queue is in memory only.
5348
LD DE,59AFH 11 AF 59
Point Register Pair DE to 59AFH, the spool file's control block.
534B
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, SBUFF$, the system buffer, as the file's buffer.
534E
LD B,L 45
Copy Register L (00H) into Register B: records of 256 bytes.
534F
GOSUB to 4420H (@INIT) to open the file whose specification is at Register Pair DE, or make it when it is not there, with the buffer at Register Pair HL and the record length in Register B.
5352
If the NZ FLAG is set (the file could not be opened or made), JUMP to 5649H to report the error in Register A.
5355
LD BC,0004H 01 04 00
Load Register Pair BC with the DISK parameter, the operand at 5356H-5357H: 0004H (4K) in the file, the value of DISK= when it was given.
5358
LD A,B 78
Copy Register B (the high byte of DISK) into Register A.
5359
AND F0H E6 F0
AND F0H into Register A: the NZ FLAG is set when DISK is 1000H or more. 5392H comes here with the NZ FLAG set for a MEM of 256 or more.
535B
If the NZ FLAG is set (too large), JUMP to 5647H to report error 2CH (parameter error).
535E
SLA C CB 21
Shift Register C (the low byte of the size) left (SLA C), bit 7 into the CARRY FLAG.
5360
RL B CB 10
Rotate Register B (the high byte of the size) left through the CARRY FLAG (RL B): Register Pair BC = DISK x 2.
5362
SLA C CB 21
Shift Register C left again (SLA C), bit 7 into the CARRY FLAG.
5364
RL B CB 10
Rotate Register B left through the CARRY FLAG (RL B): Register Pair BC = DISK x 4, the sectors of 256 bytes in DISK K.
5366
LD (53EFH),BC ED 43 EF 53
Store Register Pair BC (the sectors of the spool file) at 53EFH, the operand of the LD DE at 53EEH, for the disk slots.
536A
DEC BC 0B
DECrement Register Pair BC to the number of the file's last record.
536B
GOSUB to 4442H (@POSN) to position the file at Register Pair DE (59AFH) to record Register Pair BC.
536E
GOSUB to 4439H (@WRITE) to write the buffer as that record: the file takes the space of all its records.
5371
If the NZ FLAG is set (the write failed, the disk is full), JUMP to 5649H to report the error in Register A.
5374
GOSUB to 443FH (@REW) to position the file at Register Pair DE back to its first record.
5377
GOSUB to 444EH (@WEOF) to set the end of the file at Register Pair DE to the present position: the file is empty but keeps its space.
537A
LD BC,(59B5H) ED 4B B5 59
Fetch the drive and directory entry code of the file from 59B5H-59B6H (control block +06H and +07H) into Register Pair BC: Register C the drive, Register B the entry.
537E
GOSUB to 4B10H (DIRRD) to read the directory sector holding record Register B of drive Register C into 4200H; Register Pair HL = the record.
5381
If the NZ FLAG is set (the directory could not be read), JUMP to 5649H to report the error in Register A.
5384
INC HL 23
INCrement Register Pair HL to +01H of the directory record.
5385
SET 7,(HL) CB FE
Set bit 7 of +01H of the directory record at Register Pair HL: the file's space is kept when it is closed, as for a file made by CREATE.
5387
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back.
538A
If the NZ FLAG is set (the directory could not be written), JUMP to 5649H to report the error in Register A.

538DH - Install: Lay Out the Spooler's Memory

MEM (in K, 1 in the file) is the memory buffer. HIGH$ less 8100H, divided by 4 and counted in K from its high byte only, must leave room for it. Below the top of the spooler's memory (HIGH$, or the top recorded at an earlier install) come, from the top down: MEM x 4 pages of 256 bytes ending at the page boundary at or below the top, a table of (MEM + DISK) x 4 + 1 slots of 4 bytes, the queue block of 44 bytes and the module of 016BH bytes. A memory slot is 00H 00H, the page, 00H; a disk slot is 00H 00H, the sector number low, the sector number high OR 80H; the last slot is 00H 00H FFH FFH. The first two bytes of a slot are 0000H for a free slot, else the address of the next slot of the queue, the last one pointing at itself.

538D
LD BC,0001H 01 01 00
Load Register Pair BC with the MEM parameter, the operand at 538EH-538FH: 0001H (1K) in the file, the value of MEM= when it was given.
5390
LD A,B 78
Copy Register B (the high byte of MEM) into Register A.
5391
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when MEM is 256 or more.
5392
If the NZ FLAG is set (too large), JUMP BACK to 535BH, whose JP NZ reports error 2CH (parameter error).
5394
LD (IY+04H),C FD 71 04
Store Register C (the low byte of MEM) at IY+04H of the parameter block (Index Register IY = 584EH).
5397
LD (IY+05H),B FD 70 05
Store Register B (00H, the high byte of MEM) at IY+05H of the parameter block (Index Register IY = 584EH).
539A
LD A,(404AH) 3A 4A 40
Fetch the high byte of HIGH$ from 404AH into Register A.
539D
SUB 81H D6 81
SUBtract 81H from Register A: the pages above 8100H; the CARRY FLAG is set below it.
539F
RRA 1F
Rotate Register A right through the CARRY FLAG (RRA): half of it. Below 8100H the borrow goes into bit 7, so the result is large and the test below passes.
53A0
SRL A CB 3F
Shift Register A right (SRL A): a quarter of the pages above 8100H, the K that may be used.
53A2
SUB C 91
SUBtract Register C (MEM in K) from Register A: the CARRY FLAG is set when MEM is more than that.
53A3
If the CARRY FLAG is set (not enough memory), JUMP to 5647H to report error 2CH (parameter error).
53A6
LD HL,(5356H) 2A 56 53
Fetch the DISK parameter from 5356H-5357H into Register Pair HL.
53A9
ADD HL,BC 09
ADD Register Pair BC (MEM) to Register Pair HL: Register Pair HL = MEM + DISK in K.
53AA
ADD HL,HL 29
Double Register Pair HL (ADD HL,HL): (MEM + DISK) x 2.
53AB
ADD HL,HL 29
Double Register Pair HL again: Register Pair HL = (MEM + DISK) x 4, the pages and sectors, one slot each.
53AC
INC HL 23
INCrement Register Pair HL for the last slot of the table.
53AD
ADD HL,HL 29
Double Register Pair HL (ADD HL,HL): the slots x 2.
53AE
ADD HL,HL 29
Double Register Pair HL again: Register Pair HL = the bytes of the slot table, 4 a slot.
53AF
PUSH HL E5
Save Register Pair HL (the size of the slot table) to the stack.
53B0
LD A,(4DF1H) 3A F1 4D
Fetch the high byte of 4DF0H-4DF1H from 4DF1H into Register A: not 00H when a spooler was installed before.
53B3
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no spooler was installed before.
53B4
If the Z FLAG is set (the first install), JUMP to 53BEH to take HIGH$ as the top.
53B6
LD L,(IY+00H) FD 6E 00
Fetch the low byte of the top recorded at the earlier install from IY+00H (Index Register IY = 584EH) into Register L.
53B9
LD H,(IY+01H) FD 66 01
Fetch the high byte of that top from IY+01H (Index Register IY = 584EH) into Register H: the same memory is used again.
53BC
JUMP to 53C7H with Register Pair HL = the top.
53BE
LD HL,(4049H) 2A 49 40
Fetch HIGH$, the highest address free for programs, from 4049H-404AH into Register Pair HL.
53C1
LD (IY+00H),L FD 75 00
Store Register L (the low byte of the top) at IY+00H of the parameter block (Index Register IY = 584EH).
53C4
LD (IY+01H),H FD 74 01
Store Register H (the high byte of the top) at IY+01H of the parameter block (Index Register IY = 584EH).
53C7
LD (5846H),HL 22 46 58
Store Register Pair HL (the top) at 5846H-5847H, the link word of the module header: the highest address of the memory the module holds.
53CA
INC HL 23
INCrement Register Pair HL to the byte above the top.
53CB
LD L,00H 2E 00
Load Register L with 00H: Register Pair HL = the start of the page holding that byte, the page boundary at or below the top + 1.
53CD
LD A,(538EH) 3A 8E 53
Fetch the low byte of MEM from 538EH into Register A.
53D0
RLCA 07
Rotate Register A left (RLCA): MEM x 2, the low byte of MEM taken as the count.
53D1
RLCA 07
Rotate Register A left again (RLCA): MEM x 4, the memory pages of 256 bytes.
53D2
LD B,A 47
Copy Register A (the pages) into Register B, the count for the memory slots.
53D3
NEG ED 44
Negate Register A (NEG): Register A = 0 - the pages.
53D5
ADD A,H 84
ADD Register H (the page above the buffer) to Register A: the first page of the buffer.
53D6
LD H,A 67
Copy Register A into Register H: Register Pair HL = the start of the memory buffer.
53D7
LD (59CFH),HL 22 CF 59
Store Register Pair HL (the start of the buffer) at 59CFH-59D0H, queue block +20H-+21H, where the next character is stored.
53DA
LD (59D1H),HL 22 D1 59
Store Register Pair HL (the start of the buffer) at 59D1H-59D2H, queue block +22H-+23H, where the next character is sent from.
53DD
LD C,H 4C
Copy Register H (the first page of the buffer) into Register C, the page of the first memory slot.
53DE
POP DE D1
Restore Register Pair DE (the size of the slot table) from the stack.
53DF
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction; Register A = 00H for the slots.
53E0
SBC HL,DE ED 52
Subtract Register Pair DE (the size of the table) from Register Pair HL (the buffer): Register Pair HL = the start of the slot table.
53E2
PUSH HL E5
Save Register Pair HL (the slot table) to the stack.
53E3
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +00H of the slot: the low byte of a free link.
53E4
INC HL 23
INCrement Register Pair HL to +01H of the slot.
53E5
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +01H: the link word is 0000H, the slot is free.
53E6
INC HL 23
INCrement Register Pair HL to +02H of the slot.
53E7
LD (HL),C 71
Store Register C (the page of this slot) at Register Pair HL, +02H.
53E8
INC HL 23
INCrement Register Pair HL to +03H of the slot.
53E9
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +03H: a memory slot.
53EA
INC HL 23
INCrement Register Pair HL to +00H of the next slot of the table.
53EB
INC C 0C
INCrement Register C to the next page of the buffer.
53EC
DECrement Register B (the memory slots left) and LOOP BACK to 53E3H until every page has its slot.
53EE
LD DE,0000H 11 00 00
Load Register Pair DE with the sectors of the spool file, the operand at 53EFH-53F0H: 0000H in the file, DISK x 4 stored by 5366H.
53F1
LD A,D 7A
Copy Register D (the high byte of the sectors) into Register A.
53F2
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when there is no spool file.
53F3
If the Z FLAG is set (no disk slots), JUMP to 540AH with Register A = 00H for the last slot.
53F5
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the first sector of the spool file.
53F8
LD (HL),00H 36 00
Store 00H at Register Pair HL, +00H of the slot: the low byte of a free link.
53FA
INC HL 23
INCrement Register Pair HL to +01H of the slot.
53FB
LD (HL),00H 36 00
Store 00H at Register Pair HL, +01H: the slot is free.
53FD
INC HL 23
INCrement Register Pair HL to +02H of the slot.
53FE
LD (HL),C 71
Store Register C (the low byte of the sector number) at Register Pair HL, +02H.
53FF
INC HL 23
INCrement Register Pair HL to +03H of the slot.
5400
LD (HL),B 70
Store Register B (the high byte of the sector number) at Register Pair HL, +03H.
5401
SET 7,(HL) CB FE
Set bit 7 of +03H at Register Pair HL: a disk slot.
5403
INC HL 23
INCrement Register Pair HL to +00H of the next slot of the table.
5404
INC BC 03
INCrement Register Pair BC to the next sector of the spool file.
5405
DEC DE 1B
DECrement Register Pair DE, the disk slots left.
5406
LD A,D 7A
Copy Register D (the high byte of the count) into Register A.
5407
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when every sector has its slot.
5408
If the NZ FLAG is set (sectors left), LOOP BACK to 53F8H. Register A is 00H at the end.
540A
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +00H of the last slot.
540B
INC HL 23
INCrement Register Pair HL to +01H of the last slot.
540C
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +01H.
540D
INC HL 23
INCrement Register Pair HL to +02H of the last slot.
540E
CPL 2F
Complement Register A (CPL): Register A = FFH, the mark of the last slot.
540F
LD (HL),A 77
Store Register A (FFH) at Register Pair HL, +02H of the last slot.
5410
INC HL 23
INCrement Register Pair HL to +03H of the last slot.
5411
LD (HL),A 77
Store Register A (FFH) at Register Pair HL, +03H: the end of the table.
5412
POP HL E1
Restore Register Pair HL (the slot table) from the stack.
5413
PUSH HL E5
Save Register Pair HL (the slot table) to the stack again.
5414
LD (59D3H),HL 22 D3 59
Store Register Pair HL (the slot table) at 59D3H-59D4H, queue block +24H-+25H, where the search for a free slot starts.
5417
LD (59D5H),HL 22 D5 59
Store Register Pair HL (the first slot) at 59D5H-59D6H, queue block +26H-+27H, the last slot of the queue, where characters are stored.
541A
LD (59D7H),HL 22 D7 59
Store Register Pair HL (the first slot) at 59D7H-59D8H, queue block +28H-+29H, the first slot of the queue, whose page is sent.
541D
LD A,H 7C
Copy Register H (the high byte of the first slot) into Register A.
541E
LD (HL),L 75
Store Register L (the low byte of the first slot) at Register Pair HL, +00H of the first slot.
541F
INC HL 23
INCrement Register Pair HL to +01H of the first slot.
5420
LD (HL),A 77
Store Register A (the high byte) at Register Pair HL: the first slot points at itself, the only slot of the queue.
5421
POP HL E1
Restore Register Pair HL (the slot table) from the stack.
5422
LD BC,002CH 01 2C 00
Load Register Pair BC with 002CH, the 44 bytes of the queue block.
5425
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
5426
SBC HL,BC ED 42
Subtract Register Pair BC (44) from Register Pair HL: Register Pair HL = the address of the queue block, just below the slot table.
5428
PUSH HL E5
Save Register Pair HL (the queue block) to the stack.
5429
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the queue block in high memory.
542A
LD HL,59AFH 21 AF 59
Point Register Pair HL to 59AFH, the queue block as the member built it.
542D
LDIR ED B0
Copy the 44 bytes from 59AFH at Register Pair HL to the high memory block at Register Pair DE (LDIR, Register Pair BC = the count): the spool file's control block and the queue cells.
542F
POP HL E1
Restore Register Pair HL (the queue block in high memory) from the stack.
5430
PUSH HL E5
Save Register Pair HL (the queue block) to the stack again.
5431
LD (5865H),HL 22 65 58
Store Register Pair HL (the queue block) at 5865H, the operand of the LD IX at 5863H in the module.
5434
LD (5911H),HL 22 11 59
Store Register Pair HL (the queue block) at 5911H, the operand of the LD IX at 590FH in the module.
5437
LD (5950H),HL 22 50 59
Store Register Pair HL (the queue block) at 5950H, the operand of the LD IX at 594EH in the module.
543A
LD BC,0023H 01 23 00
Load Register Pair BC with 0023H, the offset of the queue block's +23H, the page being sent.
543D
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL = the queue block +23H.
543E
LD (5946H),HL 22 46 59
Store Register Pair HL (queue block +23H) at 5946H, the operand of the LD A at 5945H in the module.
5441
LD HL,0000H 21 00 00
Load Register Pair HL with the control block whose output the spooler takes, the operand at 5442H-5443H: 0000H in the file, stored by 5337H.
5444
LD (5907H),HL 22 07 59
Store Register Pair HL (the control block) at 5907H-5908H, the operand of the LD IX at 5905H in the module: the module's output control block cell.
5447
INC HL 23
INCrement Register Pair HL to +01H of the control block.
5448
LD C,(HL) 4E
Fetch the low byte of the device's driver address from +01H at Register Pair HL into Register C.
5449
INC HL 23
INCrement Register Pair HL to +02H of the control block.
544A
LD B,(HL) 46
Fetch the high byte of the driver address from +02H at Register Pair HL into Register B: Register Pair BC = the driver of the device.
544B
LD (592FH),BC ED 43 2F 59
Store Register Pair BC (the driver) at 592FH, the operand of the CALL at 592EH in the module, which sends a character.
544F
LD (590AH),BC ED 43 0A 59
Store Register Pair BC (the driver) at 590AH, the operand of the CALL at 5909H in the module, which asks the device whether it is ready.
5453
LD A,(4300H) 3A 00 43
Fetch the first byte of @KITSK, the keyboard task hook, from 4300H into Register A: C9H (RET) or C3H (JP).
5456
LD HL,(4301H) 2A 01 43
Fetch the address of the @KITSK jump from 4301H-4302H into Register Pair HL.
5459
LD (593FH),A 32 3F 59
Store Register A (the first byte of @KITSK) at 593FH in the module, after its CALL 5942H.
545C
LD (5940H),HL 22 40 59
Store Register Pair HL (the rest of @KITSK) at 5940H-5941H in the module: the keyboard task carries on as before after the spooler's part.
545F
POP HL E1
Restore Register Pair HL (the queue block in high memory) from the stack.
5460
LD BC,016BH 01 6B 01
Load Register Pair BC with 016BH, the length of the module (5844H-59AEH).
5463
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
5464
SBC HL,BC ED 42
Subtract Register Pair BC (016BH) from Register Pair HL: Register Pair HL = the start of the module, just below the queue block.
5466
DEC HL 2B
DECrement Register Pair HL to the byte below the module: the new HIGH$.
5467
LD A,(4DF1H) 3A F1 4D
Fetch the high byte of 4DF0H-4DF1H from 4DF1H into Register A: not 00H when a spooler was installed before.
546A
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for the first install.
546B
If the Z FLAG is set (the first install), JUMP to 547FH to lower HIGH$.
546D
LD E,(IY+02H) FD 5E 02
Fetch the low byte of the HIGH$ the earlier install left from IY+02H (Index Register IY = 584EH) into Register E.
5470
LD D,(IY+03H) FD 56 03
Fetch the high byte of that HIGH$ from IY+03H (Index Register IY = 584EH) into Register D.
5473
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the earlier HIGH$, Register Pair DE = the one needed now.
5474
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the comparison below.
5475
SBC HL,DE ED 52
Subtract Register Pair DE (the HIGH$ needed now) from Register Pair HL (the earlier one).
5477
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair HL = the HIGH$ needed now. EX does not change the flags.
5478
If the Z FLAG is set (the same layout), JUMP to 5488H: the old memory is used again.
547A
If the CARRY FLAG is set (the earlier HIGH$ is lower, so the new layout fits), JUMP to 5488H.
547C
The new layout needs more memory than the earlier install left: JUMP to 5654H to display Request exceeds available memory!.
547F
LD (4049H),HL 22 49 40
Store Register Pair HL (the new HIGH$) at 4049H-404AH, HIGH$: the memory above it is now the spooler's.
5482
LD (IY+02H),L FD 75 02
Store Register L (the low byte of the new HIGH$) at IY+02H of the parameter block (Index Register IY = 584EH).
5485
LD (IY+03H),H FD 74 03
Store Register H (the high byte of the new HIGH$) at IY+03H of the parameter block (Index Register IY = 584EH).

5488H - Install: Move the Module and Start It

The module's addresses are made to point at its place in high memory, the module is copied there, 4DF0H-4DF1H gets its parameter block, the device's control block gets the module as its driver, the despooler is put into task slot 9, @KITSK is made a jump into the module, and DFLAG$ bit 0 and KFLAG$ bit 4 are set.

5488
INC HL 23
INCrement Register Pair HL from the new HIGH$ to the start of the module in high memory.
5489
PUSH HL E5
Save Register Pair HL (the module) to the stack.
548A
LD DE,00C3H 11 C3 00
Load Register Pair DE with 00C3H, the offset of the module's output control block cell (5907H in the image).
548D
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +C3H.
548E
LD (IY+08H),L FD 75 08
Store Register L (the low byte of the module +C3H) at IY+08H of the parameter block (Index Register IY = 584EH): PR/FLT installed later puts its own control block there.
5491
LD (IY+09H),H FD 74 09
Store Register H (the high byte of the module +C3H) at IY+09H of the parameter block (Index Register IY = 584EH).
5494
POP HL E1
Restore Register Pair HL (the module) from the stack.
5495
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
5496
LD DE,00C3H 11 C3 00
Load Register Pair DE with 00C3H, the offset of the output control block cell.
5499
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +C3H.
549A
LD (592CH),HL 22 2C 59
Store Register Pair HL (the module +C3H) at 592CH, the operand of the LD IX,(nnnn) at 592AH in the module.
549D
POP HL E1
Restore Register Pair HL (the module) from the stack.
549E
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
549F
LD DE,001FH 11 1F 00
Load Register Pair DE with 001FH, the offset of the store routine (5863H in the image).
54A2
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +1FH.
54A3
LD (585FH),HL 22 5F 58
Store Register Pair HL (the module +1FH) at 585FH, the operand of the CALL at 585EH in the module.
54A6
POP HL E1
Restore Register Pair HL (the module) from the stack.
54A7
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54A8
LD DE,00FEH 11 FE 00
Load Register Pair DE with 00FEH, the offset of the page change routine (5942H in the image).
54AB
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +FEH.
54AC
LD (589BH),HL 22 9B 58
Store Register Pair HL (the module +FEH) at 589BH, the operand of the CALL at 589AH in the module.
54AF
LD (593DH),HL 22 3D 59
Store Register Pair HL (the module +FEH) at 593DH, the operand of the CALL at 593CH in the module.
54B2
POP HL E1
Restore Register Pair HL (the module) from the stack.
54B3
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54B4
LD DE,00B7H 11 B7 00
Load Register Pair DE with 00B7H, the offset of the send routine (58FBH in the image).
54B7
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +B7H.
54B8
LD (5875H),HL 22 75 58
Store Register Pair HL (the module +B7H) at 5875H, the operand of the CALL at 5874H in the module.
54BB
LD (5897H),HL 22 97 58
Store Register Pair HL (the module +B7H) at 5897H, the operand of the CALL at 5896H in the module.
54BE
LD (58F9H),HL 22 F9 58
Store Register Pair HL (the module +B7H) at 58F9H, the operand of the CALL at 58F8H in the module.
54C1
LD (597AH),HL 22 7A 59
Store Register Pair HL (the module +B7H) at 597AH, the operand of the CALL at 5979H in the module.
54C4
POP DE D1
Restore Register Pair DE (the module in high memory) from the stack.
54C5
PUSH DE D5
Save Register Pair DE (the module) to the stack again.
54C6
LD HL,5844H 21 44 58
Point Register Pair HL to 5844H, the module image in the member.
54C9
LDIR ED B0
Copy the module from 5844H at Register Pair HL to high memory at Register Pair DE (LDIR, Register Pair BC = 016BH, still the count from 5460H), with its parameter block at +0AH.
54CB
POP HL E1
Restore Register Pair HL (the module) from the stack.
54CC
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54CD
LD DE,000AH 11 0A 00
Load Register Pair DE with 000AH, the offset of the parameter block.
54D0
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +0AH, the parameter block.
54D1
LD (4DF0H),HL 22 F0 4D
Store Register Pair HL (the parameter block) at 4DF0H-4DF1H: the installed spooler is known by it from now on.
54D4
POP HL E1
Restore Register Pair HL (the module) from the stack.
54D5
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54D6
LD DE,(5442H) ED 5B 42 54
Fetch the control block whose output the spooler takes from 5442H-5443H into Register Pair DE.
54DA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the control block, Register Pair DE = the module.
54DB
INC HL 23
INCrement Register Pair HL to +01H of the control block.
54DC
LD (HL),E 73
Store Register E (the low byte of the module) at +01H of the control block at Register Pair HL.
54DD
INC HL 23
INCrement Register Pair HL to +02H of the control block.
54DE
LD (HL),D 72
Store Register D (the high byte of the module) at +02H of the control block at Register Pair HL: the module is now the device's driver.
54DF
POP HL E1
Restore Register Pair HL (the module) from the stack.
54E0
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54E1
LD DE,00B2H 11 B2 00
Load Register Pair DE with 00B2H, the offset of the task block (58F6H in the image).
54E4
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +B2H, the task block.
54E5
LD D,H 54
Copy Register H (the high byte of the task block) into Register D.
54E6
LD E,L 5D
Copy Register L (the low byte of the task block) into Register E: Register Pair DE = the task block.
54E7
LD BC,0002H 01 02 00
Load Register Pair BC with 0002H, the two bytes of the task block's word.
54EA
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL = the module +B4H, the despool task (58F8H in the image).
54EB
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the task block, Register Pair DE = the task.
54EC
LD (HL),E 73
Store Register E (the low byte of the task) at Register Pair HL, the task block.
54ED
INC HL 23
INCrement Register Pair HL to the high byte of the task block's word.
54EE
LD (HL),D 72
Store Register D (the high byte of the task) at Register Pair HL: the task block's word points at the task.
54EF
DEC HL 2B
DECrement Register Pair HL back to the start of the task block.
54F0
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the task block.
54F1
LD A,09H 3E 09
Load Register A with 09H, task slot 9, run on every tick of the clock interrupt.
54F3
GOSUB to 4410H (@ADTSK) to put the task block at Register Pair DE into task slot Register A (9).
54F6
POP HL E1
Restore Register Pair HL (the module) from the stack.
54F7
PUSH HL E5
Save Register Pair HL (the module) to the stack again.
54F8
LD DE,00F8H 11 F8 00
Load Register Pair DE with 00F8H, the offset of the keyboard task part (593CH in the image).
54FB
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +F8H.
54FC
LD (4301H),HL 22 01 43
Store Register Pair HL (the module +F8H) at 4301H-4302H, the address of the @KITSK jump.
54FF
LD A,C3H 3E C3
Load Register A with C3H, the opcode of JP, for the @KITSK hook.
5501
LD (4300H),A 32 00 43
Store Register A (C3H) at 4300H: @KITSK is now JP to the module, so every keyboard scan moves the queue's pages.
5504
SET 0,(IX+00H) DD CB 00 C6
Set bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): the spooler is installed.
5508
SET 4,(IX+04H) DD CB 04 E6
Set bit 4 of KFLAG$ at IX+04H (Index Register IX = 441FH, so 4423H): the spooler may send its queue.
550C
JUMP to 5623H to display Spooler is now operational and end the command.

550FH - PAUSE and RESUME

Both need the spooler installed and on (DFLAG$ bit 0). PAUSE clears KFLAG$ bit 4, so the despool task sends nothing while characters are still queued; RESUME sets it again. Each says whether the bit was already as asked.

550F
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): set while the spooler is on.
5513
If the Z FLAG is set (the spooler is off), JUMP to 562BH to display Spooler is not active.
5516
BIT 4,(IX+04H) DD CB 04 66
Test bit 4 of KFLAG$ at IX+04H (Index Register IX = 441FH, so 4423H): set while the queue is being sent.
551A
RES 4,(IX+04H) DD CB 04 A6
Clear bit 4 of KFLAG$ at IX+04H (4423H, Index Register IX = 441FH): the sending stops. RES does not change the flags.
551E
If the Z FLAG is set (it was already paused), JUMP to 562FH to display Spooler already active but paused.
5521
JUMP to 561FH to display Despooling now paused.
5524
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): set while the spooler is on.
5528
If the Z FLAG is set (the spooler is off), JUMP to 562BH to display Spooler is not active.
552B
BIT 4,(IX+04H) DD CB 04 66
Test bit 4 of KFLAG$ at IX+04H (Index Register IX = 441FH, so 4423H): set while the queue is being sent.
552F
SET 4,(IX+04H) DD CB 04 E6
Set bit 4 of KFLAG$ at IX+04H (4423H, Index Register IX = 441FH): the sending goes on. SET does not change the flags.
5533
If the NZ FLAG is set (it was not paused), JUMP to 5627H to display Spooler is already active.
5536
JUMP to 561BH to display Despooling now resumed.

5539H - OFF: Turn the Spooler Off

The spooler is taken out of DFLAG$, the sending stops, @KITSK gets back the three bytes saved in the module, and task slot 9 is emptied. When HIGH$ is still the one the install left, the memory is given back (HIGH$ = the top) and 4DF0H-4DF1H is cleared; otherwise the spooler stays in memory to be turned on again in the same place. Then the device is reset by running the command RESET with its name through 4451H, which ends the member. The spool file is not closed here.

5539
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): set while the spooler is on.
553D
If the Z FLAG is set (the spooler is off), JUMP to 562BH to display Spooler is not active.
5540
RES 0,(IX+00H) DD CB 00 86
Clear bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): the spooler is off.
5544
RES 4,(IX+04H) DD CB 04 A6
Clear bit 4 of KFLAG$ at IX+04H (Index Register IX = 441FH, so 4423H): nothing is sent.
5548
LD HL,4512H 21 12 45
Point Register Pair HL to 4512H, the entry of task slot 9 in the task table.
554B
LD A,(HL) 7E
Fetch the low byte of slot 9's task block at Register Pair HL into Register A.
554C
INC HL 23
INCrement Register Pair HL to the high byte of the entry.
554D
LD H,(HL) 66
Fetch the high byte of the task block at Register Pair HL into Register H.
554E
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the task block, the spooler's module +B2H.
554F
LD BC,0049H 01 49 00
Load Register Pair BC with 0049H, the distance from the task block to the saved @KITSK bytes (module +FBH, 593FH in the image).
5552
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL = the three bytes the install saved from 4300H-4302H.
5553
DI F3
Disable the interrupts (DI) while @KITSK and task slot 9 are changed.
5554
LD A,(HL) 7E
Fetch the saved first byte of @KITSK at Register Pair HL into Register A.
5555
LD (4300H),A 32 00 43
Store Register A at 4300H, the first byte of @KITSK.
5558
INC HL 23
INCrement Register Pair HL to the saved low byte of the jump address.
5559
LD A,(HL) 7E
Fetch the saved low byte at Register Pair HL into Register A.
555A
INC HL 23
INCrement Register Pair HL to the saved high byte.
555B
LD H,(HL) 66
Fetch the saved high byte at Register Pair HL into Register H.
555C
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the saved address of the @KITSK jump.
555D
LD (4301H),HL 22 01 43
Store Register Pair HL at 4301H-4302H: @KITSK is as it was before the install.
5560
LD A,09H 3E 09
Load Register A with 09H, task slot 9, the slot of the despool task.
5562
GOSUB to 4413H (@RMTSK) to empty task slot Register A (9): the despool task stops.
5565
EI FB
Enable the interrupts again (EI) after the changes to @KITSK and the task table.
5566
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the RESET command line.
5568
LD (57BBH),A 32 BB 57
Store Register A (0DH) at 57BBH, after the asterisk and the two letters of the device at 57B8H: the line Reset and the device name ends there.
556B
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
556E
LD E,(IY+02H) FD 5E 02
Fetch the low byte of the HIGH$ the install left from IY+02H (Index Register IY = 584EH, the copy made at 5220H) into Register E.
5571
LD D,(IY+03H) FD 56 03
Fetch the high byte of that HIGH$ from IY+03H (Index Register IY = 584EH) into Register D.
5574
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the comparison; Register A = 00H.
5575
SBC HL,DE ED 52
Subtract Register Pair DE (the HIGH$ the install left) from Register Pair HL (HIGH$ now): the Z FLAG is set when nothing was installed below the spooler since.
5577
LD E,(IY+00H) FD 5E 00
Fetch the low byte of the top of the spooler's memory from IY+00H (Index Register IY = 584EH) into Register E.
557A
LD (IY+00H),A FD 77 00
Store Register A (00H) at IY+00H of the copy at 584EH (Index Register IY = 584EH). The parameter block in high memory keeps its top.
557D
LD D,(IY+01H) FD 56 01
Fetch the high byte of the top from IY+01H (Index Register IY = 584EH) into Register D: Register Pair DE = the top.
5580
LD (IY+01H),A FD 77 01
Store Register A (00H) at IY+01H of the copy at 584EH (Index Register IY = 584EH).
5583
LD HL,5713H 21 13 57
Point Register Pair HL to 5713H, the message Can't reclaim memory space. LD does not change the flags.
5586
If the NZ FLAG is set (HIGH$ has been lowered since), JUMP to 5595H to display it: the spooler stays in memory.
5588
LD (4049H),DE ED 53 49 40
Store Register Pair DE (the top) at 4049H-404AH: HIGH$ is given back its value from before the install.
558C
LD (4DF0H),A 32 F0 4D
Store Register A (00H) at 4DF0H, the low byte of the installed spooler's parameter block.
558F
LD (4DF1H),A 32 F1 4D
Store Register A (00H) at 4DF1H, the high byte: no spooler is in memory.
5592
LD HL,572EH 21 2E 57
Point Register Pair HL to 572EH, the message Memory space reclaimed.
5595
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5598
LD HL,57B2H 21 B2 57
Point Register Pair HL to 57B2H, the line Reset followed by the device name.
559B
PUSH HL E5
Save Register Pair HL (57B2H, the RESET command line) to the stack.
559C
GOSUB to 447BH (@LOGOT) to display the line at Register Pair HL and send it to the job log.
559F
POP HL E1
Restore Register Pair HL (57B2H, the command line) from the stack.
55A0
LD SP,(5639H) ED 7B 39 56
Load the Stack Pointer from 5639H, the depth saved at 5200H, so that the stack is as the member was entered.
55A4
JUMP to 4451H to run the command line at Register Pair HL (RESET and the device name) through SYS1/SYS; that command returns to the program that ran SPOOL.

55A7H - CLEAR: Empty the Queue

Needs the spooler on. Every slot of the installed spooler's table is made free, the first slot becomes the whole queue again (pointing at itself, as the first and last slot), and the store and send places are both put at the start of its page, so the characters queued are lost.

55A7
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of DFLAG$ at IX+00H (Index Register IX = 441FH): set while the spooler is on.
55AB
If the Z FLAG is set (the spooler is off), JUMP to 562BH to display Spooler is not active.
55AE
LD HL,0000H 21 00 00
Load Register Pair HL with the installed spooler's parameter block, the operand at 55AFH-55B0H: 0000H in the file, stored by 521AH.
55B1
LD DE,0161H 11 61 01
Load Register Pair DE with 0161H, the distance from the parameter block (module +0AH) to the queue block (module +016BH).
55B4
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the installed queue block.
55B5
PUSH IX DD E5
Save Index Register IX (441FH, DFLAG$) to the stack while it addresses the queue block.
55B7
PUSH HL E5
Save Register Pair HL (the queue block) to the stack, to move it into Index Register IX.
55B8
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the installed queue block.
55BA
LD L,(IX+24H) DD 6E 24
Fetch the low byte of the slot table from IX+24H (Index Register IX = the queue block) into Register L.
55BD
LD H,(IX+25H) DD 66 25
Fetch the high byte of the slot table from IX+25H into Register H (Index Register IX = the queue block): Register Pair HL = the first slot.
55C0
PUSH HL E5
Save Register Pair HL (the first slot) to the stack.
55C1
XOR A AF
Clear Register A (XOR A): Register A = 00H for the link word of a free slot.
55C2
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +00H of the slot.
55C3
INC HL 23
INCrement Register Pair HL to +01H of the slot.
55C4
LD (HL),A 77
Store Register A (00H) at Register Pair HL, +01H: the slot is free.
55C5
INC HL 23
INCrement Register Pair HL to +02H of the slot.
55C6
INC HL 23
INCrement Register Pair HL to +03H of the slot.
55C7
LD A,(HL) 7E
Fetch +03H of the slot at Register Pair HL into Register A: FFH only in the last slot.
55C8
INC HL 23
INCrement Register Pair HL to +00H of the next slot of the table.
55C9
INC A 3C
INCrement Register A: FFH becomes 00H and sets the Z FLAG.
55CA
If the NZ FLAG is set (not the last slot), LOOP BACK to 55C1H.
55CC
POP HL E1
Restore Register Pair HL (the first slot) from the stack.
55CD
LD (IX+26H),L DD 75 26
Store Register L (the low byte of the first slot) at IX+26H, the last slot of the queue (Index Register IX = the queue block).
55D0
LD (IX+27H),H DD 74 27
Store Register H (the high byte of the first slot) at IX+27H (Index Register IX = the queue block).
55D3
LD (IX+28H),L DD 75 28
Store Register L (the low byte of the first slot) at IX+28H, the first slot of the queue (Index Register IX = the queue block).
55D6
LD (IX+29H),H DD 74 29
Store Register H (the high byte of the first slot) at IX+29H (Index Register IX = the queue block).
55D9
LD A,H 7C
Copy Register H (the high byte of the first slot) into Register A.
55DA
LD (HL),L 75
Store Register L (the low byte of the first slot) at Register Pair HL, +00H of the first slot.
55DB
INC HL 23
INCrement Register Pair HL to +01H of the first slot.
55DC
LD (HL),A 77
Store Register A (the high byte) at Register Pair HL: the first slot points at itself.
55DD
INC HL 23
INCrement Register Pair HL to +02H of the first slot.
55DE
LD B,(HL) 46
Fetch the page of the first slot at Register Pair HL into Register B.
55DF
XOR A AF
Clear Register A (XOR A): Register A = 00H, the start of a page.
55E0
LD (IX+21H),B DD 70 21
Store Register B (the page) at IX+21H, the high byte of the store place (Index Register IX = the queue block).
55E3
LD (IX+20H),A DD 77 20
Store Register A (00H) at IX+20H, the low byte of the store place (Index Register IX = the queue block).
55E6
LD (IX+23H),B DD 70 23
Store Register B (the page) at IX+23H, the high byte of the send place (Index Register IX = the queue block).
55E9
LD (IX+22H),A DD 77 22
Store Register A (00H) at IX+22H, the low byte of the send place (Index Register IX = the queue block): the queue is empty.
55EC
POP IX DD E1
Restore Index Register IX (441FH) from the stack.
55EE
JUMP to 5617H to display SPOOL buffer cleared and end the command.

55F1H - Find a Device Control Block by Name

Register Pair DE holds the two letters of the name (Register E the first). The blocks of 8 bytes are searched, their names at +06H-+07H: KI, DO and PR at 4015H-402CH, then 43C0H-43FFH (JL, SI, SO and the spare blocks). Returns the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H (device not available).

55F1
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
55F4
PUSH HL E5
Save Register Pair HL (the block) to the stack.
55F5
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
55F6
ADD A,06H C6 06
ADD 06H to Register A: the low byte of the block's name at +06H.
55F8
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name (no block crosses a page).
55F9
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
55FA
INC L 2C
INCrement Register L to the second letter of the name.
55FB
CP E BB
Compare Register A against Register E, the first letter asked for.
55FC
If the NZ FLAG is set (not the same), JUMP to 5605H for the next block.
55FE
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
55FF
CP D BA
Compare Register A against Register D, the second letter asked for.
5600
If the NZ FLAG is set (not the same), JUMP to 5605H for the next block.
5602
POP HL E1
Restore Register Pair HL (the block found) from the stack.
5603
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, found.
5604
RET C9
RETurn to the caller with Register Pair HL at the device control block.
5605
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
5606
INC L 2C
INCrement Register L from the block's +07H to the next block.
5607
If the NZ FLAG is set (Register L did not pass FFH), JUMP to 560DH.
5609
LD A,08H 3E 08
Register Pair HL passed 43FFH, the last block: load Register A with 08H, the error number of a device not available.
560B
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, not found.
560C
RET C9
RETurn to the caller with the NZ FLAG and Register A = 08H.
560D
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
560E
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
5610
If the NZ FLAG is set (still among KI, DO and PR, or in 43C0H-43FFH), LOOP BACK to 55F4H.
5612
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the next device control block.
5615
LOOP BACK to 55F4H to test the block at 43C0H and those after it.

5617H - The Messages and the Exit

5617H and the six entries below it are a chain of LD IX instructions whose DD prefixes make each entry but the one jumped to a dead load, so entering at 5617H, 561BH, 561FH, 5623H, 5627H, 562BH or 562FH loads Register Pair HL with one message. 5632H displays it and ends the command with Register Pair HL = 0000H; 5638H puts the stack back and, for HL = FFFFH during a JCL job, ends the job through @ABORT. 5647H reports error 2CH (parameter error) through @ERROR, and 5650H, 5654H and 5658H are a second chain for the refusals.

5617
LD HL,5664H 21 64 56
Point Register Pair HL to 5664H, the message SPOOL buffer cleared (from 55EEH).
561A
LD IX,568FH DD 21 8F 56
Load Index Register IX with 568FH. The bytes DD 21 8F 56 make this a dead load of Index Register IX on fall-through; entering at 561BH runs 21 8F 56 as LD HL,568FH, the message Despooling now resumed.
561E
LD IX,5679H DD 21 79 56
Load Index Register IX with 5679H. Entering at 561FH runs 21 79 56 as LD HL,5679H, the message Despooling now paused.
5622
LD IX,56F8H DD 21 F8 56
Load Index Register IX with 56F8H. Entering at 5623H runs 21 F8 56 as LD HL,56F8H, the message Spooler is now operational.
5626
LD IX,56BCH DD 21 BC 56
Load Index Register IX with 56BCH. Entering at 5627H runs 21 BC 56 as LD HL,56BCH, the message Spooler is already active.
562A
LD IX,56A6H DD 21 A6 56
Load Index Register IX with 56A6H. Entering at 562BH runs 21 A6 56 as LD HL,56A6H, the message Spooler is not active.
562E
LD IX,56D6H DD 21 D6 56
Load Index Register IX with 56D6H. Entering at 562FH runs 21 D6 56 as LD HL,56D6H, the message Spooler already active but paused.
5632
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5635
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5638
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 5639H-563AH (0000H in the file). 5661H comes here with Register Pair HL = FFFFH.
563B
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
563C
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
563D
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran SPOOL.
563E
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5641
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5643
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5644
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.
5647
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
5649
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message. 52FEH, 5352H, 5371H, 5381H and 538AH come here with the error number of the failed call.
564B
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
564E
JUMP to 565EH to end the command with Register Pair HL = FFFFH.
5650
LD HL,5767H 21 67 57
Point Register Pair HL to 5767H, the message SPOOLER requires KI/DVR active! (from 52F4H).
5653
LD IX,5745H DD 21 45 57
Load Index Register IX with 5745H. The bytes DD 21 45 57 make this a dead load of Index Register IX on fall-through; entering at 5654H runs 21 45 57 as LD HL,5745H, the message Request exceeds available memory!.
5657
LD IX,5787H DD 21 87 57
Load Index Register IX with 5787H. Entering at 5658H runs 21 87 57 as LD HL,5787H, the message Can't -- Valid only at LDOS Command level!.
565B
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
565E
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5661
JUMP to 5638H to put the stack back and end the command with Register Pair HL = FFFFH.

5664H - SPOOL Data: the Messages

The messages of the selectors at 5617H and 5650H, each ended by 0DH, displayed by @LOGOT.

5664-5677
DEFM "SPOOL buffer cleared" 53 50 4F 4F 4C 20 62 75 66 66 65 72 20 63 6C 65 61 72 65 64
The message of 5617H: CLEAR emptied the queue.
5678
DEFB 0DH 0D
0DH, the end of the message SPOOL buffer cleared.
5679-568D
DEFM "Despooling now paused" 44 65 73 70 6F 6F 6C 69 6E 67 20 6E 6F 77 20 70 61 75 73 65 64
The message of 561FH: PAUSE stopped the sending.
568E
DEFB 0DH 0D
0DH, the end of the message Despooling now paused.
568F-56A4
DEFM "Despooling now resumed" 44 65 73 70 6F 6F 6C 69 6E 67 20 6E 6F 77 20 72 65 73 75 6D 65 64
The message of 561BH: RESUME let the sending go on.
56A5
DEFB 0DH 0D
0DH, the end of the message Despooling now resumed.
56A6-56BA
DEFM "Spooler is not active" 53 70 6F 6F 6C 65 72 20 69 73 20 6E 6F 74 20 61 63 74 69 76 65
The message of 562BH: OFF, PAUSE, RESUME or CLEAR with the spooler off.
56BB
DEFB 0DH 0D
0DH, the end of the message Spooler is not active.
56BC-56D4
DEFM "Spooler is already active" 53 70 6F 6F 6C 65 72 20 69 73 20 61 6C 72 65 61 64 79 20 61 63 74 69 76 65
The message of 5627H: SPOOL with the spooler on, or RESUME when it was not paused.
56D5
DEFB 0DH 0D
0DH, the end of the message Spooler is already active.
56D6-56F6
DEFM "Spooler already active but paused" 53 70 6F 6F 6C 65 72 20 61 6C 72 65 61 64 79 20 61 63 74 69 76 65 20 62 75 74 20 70 61 75 73 65 64
The message of 562FH: PAUSE when the sending was already stopped.
56F7
DEFB 0DH 0D
0DH, the end of the message Spooler already active but paused.
56F8-5711
DEFM "Spooler is now operational" 53 70 6F 6F 6C 65 72 20 69 73 20 6E 6F 77 20 6F 70 65 72 61 74 69 6F 6E 61 6C
The message of 5623H: the install is done and the spooler is running.
5712
DEFB 0DH 0D
0DH, the end of the message Spooler is now operational.
5713-572C
DEFM "Can't reclaim memory space" 43 61 6E 27 74 20 72 65 63 6C 61 69 6D 20 6D 65 6D 6F 72 79 20 73 70 61 63 65
The message of 5583H: OFF found HIGH$ lowered below the spooler since its install.
572D
DEFB 0DH 0D
0DH, the end of the message Can't reclaim memory space.
572E-5743
DEFM "Memory space reclaimed" 4D 65 6D 6F 72 79 20 73 70 61 63 65 20 72 65 63 6C 61 69 6D 65 64
The message of 5592H: OFF gave the spooler's memory back.
5744
DEFB 0DH 0D
0DH, the end of the message Memory space reclaimed.
5745-5765
DEFM "Request exceeds available memory!" 52 65 71 75 65 73 74 20 65 78 63 65 65 64 73 20 61 76 61 69 6C 61 62 6C 65 20 6D 65 6D 6F 72 79 21
The message of 5654H: a spooler turned on again needs more memory than its first install left.
5766
DEFB 0DH 0D
0DH, the end of the message Request exceeds available memory!.
5767-5785
DEFM "SPOOLER requires KI/DVR active!" 53 50 4F 4F 4C 45 52 20 72 65 71 75 69 72 65 73 20 4B 49 2F 44 56 52 20 61 63 74 69 76 65 21
The message of 5650H: bit 4 of DFLAG$ is clear.
5786
DEFB 0DH 0D
0DH, the end of the message SPOOLER requires KI/DVR active!.
5787-57B0
DEFM "Can't -- Valid only at LDOS Command level!" 43 61 6E 27 74 20 2D 2D 20 56 61 6C 69 64 20 6F 6E 6C 79 20 61 74 20 4C 44 4F 53 20 43 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C 21
The message of 5658H: a program owns @EXIT, or a program ran the command.
57B1
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS Command level!.

57B2H - SPOOL Data: the RESET Line and the Device

The command line OFF runs (5598H): Reset, then the device's specification, which @FSPEC writes into the control block that follows (an asterisk, two letters and 03H), with 0DH stored after the letters at 57BBH.

57B2-57B7
DEFM "Reset " 52 65 73 65 74 20
The start of the command line of 5598H: the RESET command and a space.
57B8-57D7
DEFS 32
The device's control block (5259H): @FSPEC writes the device's specification here; 57B9H-57BAH hold its two letters. Not loaded from the file.

57D8H - SPOOL Data: Default Names and the Parameter Table

The default spool file name, the default device and the table @PARAM reads (52C6H): twelve entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H. Each address is the operand of an instruction that uses the value; the short form of each keyword names the same address. A spooler in memory is read from 5803H on, without MEM and DISK.

57D8-57D9
DEFM "XX" 58 58
The name of the default spool file: 528CH writes the device's two letters here.
57DA-57DD
DEFM "/SPL" 2F 53 50 4C
The extension of the default name; 57DBH-57DDH, SPL, is also the extension @FEXT adds (529EH).
57DE
DEFB 03H 03
03H, the end of the default name XX/SPL that 529BH hands to @FSPEC.
57DF-57E1
DEFM "*PR" 2A 50 52
The default device of 5278H: the printer, PR, after an asterisk.
57E2
DEFB 03H 03
03H, the end of the default device that 5278H copies to 57B8H.
57E3-57EA
DEFM "MEM " / DEFW 538EH 4D 45 4D 20 20 20 8E 53
MEM: its value goes to 538EH-538FH, the operand of the LD BC at 538DH (0001H in the file).
57EB-57F2
DEFM "M " / DEFW 538EH 4D 20 20 20 20 20 8E 53
M, the short form of MEM: its value goes to 538EH-538FH too.
57F3-57FA
DEFM "DISK " / DEFW 5356H 44 49 53 4B 20 20 56 53
DISK: its value goes to 5356H-5357H, the operand of the LD BC at 5355H (0004H in the file).
57FB-5802
DEFM "D " / DEFW 5356H 44 20 20 20 20 20 56 53
D, the short form of DISK: its value goes to 5356H-5357H too.
5803-580A
DEFM "OFF " / DEFW 52D0H 4F 46 46 20 20 20 D0 52
OFF: its value goes to 52D0H-52D1H, the operand of the LD DE at 52CFH. The table of a spooler in memory starts here.
580B-5812
DEFM "N " / DEFW 52D0H 4E 20 20 20 20 20 D0 52
N, the short form of OFF: its value goes to 52D0H-52D1H too.
5813-581A
DEFM "PAUSE " / DEFW 52DEH 50 41 55 53 45 20 DE 52
PAUSE: its value goes to 52DEH-52DFH, the operand of the LD DE at 52DDH.
581B-5822
DEFM "P " / DEFW 52DEH 50 20 20 20 20 20 DE 52
P, the short form of PAUSE: its value goes to 52DEH-52DFH too.
5823-582A
DEFM "RESUME" / DEFW 52D7H 52 45 53 55 4D 45 D7 52
RESUME: its value goes to 52D7H-52D8H, the operand of the LD DE at 52D6H.
582B-5832
DEFM "R " / DEFW 52D7H 52 20 20 20 20 20 D7 52
R, the short form of RESUME: its value goes to 52D7H-52D8H too.
5833-583A
DEFM "CLEAR " / DEFW 52E5H 43 4C 45 41 52 20 E5 52
CLEAR: its value goes to 52E5H-52E6H, the operand of the LD DE at 52E4H.
583B-5842
DEFM "C " / DEFW 52E5H 43 20 20 20 20 20 E5 52
C, the short form of CLEAR: its value goes to 52E5H-52E6H too.
5843
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.

5844H - The Spooler Module: Header and Driver Entry

5844H-59AEH (016BH bytes) is copied to high memory by 54C9H and runs there, at the module's start (HIGH$ + 1) plus the distance from 5844H; the rows show it at its place in the member. 5488H-54C1H point every address the module uses inside itself at its new place. It starts with a module header (a JR over the header, a link word holding the top of its memory, the length of the name and SPOOL) and its parameter block. The device's control block points at 5844H as its driver: a character sent to the device (the Z FLAG set) is queued; a status request (Register C = 00H) is answered as ready, and anything else returns Register A = Register C.

5844
JUMP over the module header to 5858H (module +14H): the driver entry, reached through the device's control block +01H-+02H.
5846-5847
DEFW 0000H 00 00
The link word of the header: the top of the spooler's memory, stored by 53C7H; the next module's header below follows it.
5848
DEFB 05H 05
The length of the module's name, 5. 5313H-5323H read such a byte to step over a name.
5849-584D
DEFM "SPOOL" 53 50 4F 4F 4C
The name of the module, shown by the MEMORY command's list of modules.
584E-5857
DEFS 10
The parameter block (module +0AH), addressed by Index Register IY while the member runs and by 4DF0H-4DF1H once installed: +00H-+01H the top of the spooler's memory, +02H-+03H the HIGH$ the install left, +04H-+05H MEM in K, +06H-+07H DISK in K, +08H-+09H the address of the module +C3H (the output control block cell). Not loaded from the file.
5858
If the Z FLAG is set (a character to send, Register C), JUMP to 585DH to queue it.
585A
LD A,C 79
Copy Register C (the request byte) into Register A.
585B
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for a status request, Register C = 00H, so the device is always ready; the CARRY FLAG is cleared.
585C
RET C9
RETurn to the program with Register A = Register C.
585D
PUSH AF F5
Save Register Pair AF (the Z FLAG of an output request) to the stack.
585E
GOSUB to 5863H (module +1FH; 54A3H points the operand there) to store the character in Register C in the queue.
5861
POP AF F1
Restore Register Pair AF (the Z FLAG) from the stack, so the program sees the character as sent.
5862
RET C9
RETurn to the program that sent the character.

5863H - The Spooler Module: Queue a Character

Stores Register C at the store place (queue block +20H-+21H) and moves it on. While the page has room, one character is sent if the device is ready and the page change of 5942H is tried. When the page is full a free slot is looked for in the table: a memory slot becomes the last slot of the queue and its page receives the next characters; a disk slot takes the full page, which is written to that sector of the spool file and linked in before the last slot, so that the same page can be filled again. With no free slot the module sends and changes pages until one is free.

5863
LD IX,59AFH DD 21 AF 59
Point Index Register IX to 59AFH, the queue block (the operand is changed to its place in high memory by 5431H).
5867
LD L,(IX+20H) DD 6E 20
Fetch the low byte of the store place from IX+20H (Index Register IX = the queue block) into Register L.
586A
LD H,(IX+21H) DD 66 21
Fetch the high byte of the store place from IX+21H into Register H (Index Register IX = the queue block): Register Pair HL = where the character goes.
586D
LD (HL),C 71
Store Register C (the character) at Register Pair HL, the store place.
586E
DI F3
Disable the interrupts (DI): the despool task must not run while the store place moves.
586F
INC (IX+20H) DD 34 20
INCrement IX+20H (Index Register IX = the queue block), the low byte of the store place: 00H after FFH, when the page is full.
5872
If the Z FLAG is set (the page is full), JUMP to 587AH to take another slot.
5874
GOSUB to 58FBH (module +B7H; 54B8H points the operand there) to send one character if the device is ready.
5877
EI FB
Enable the interrupts again (EI): the store place has moved.
5878
JUMP to 58C5H, which goes on to 5942H to change the page being sent when it is done, and RETurns.
587A
LD L,(IX+24H) DD 6E 24
Fetch the low byte of the slot table from IX+24H (Index Register IX = the queue block) into Register L.
587D
LD H,(IX+25H) DD 66 25
Fetch the high byte of the slot table from IX+25H into Register H (Index Register IX = the queue block): Register Pair HL = the first slot.
5880
LD A,(HL) 7E
Fetch the low byte of the slot's link word at Register Pair HL into Register A.
5881
INC HL 23
INCrement Register Pair HL to +01H of the slot.
5882
OR (HL) B6
OR the high byte of the link word at Register Pair HL into Register A: the Z FLAG is set for 0000H, a free slot.
5883
If the Z FLAG is set (a free slot), JUMP to 588AH.
5885
INC HL 23
INCrement Register Pair HL to +02H of the slot.
5886
INC HL 23
INCrement Register Pair HL to +03H of the slot.
5887
INC HL 23
INCrement Register Pair HL to +00H of the next slot of the table.
5888
LOOP BACK to 5880H to test the next slot of the table.
588A
DEC HL 2B
DECrement Register Pair HL back to +00H of the free slot.
588B
PUSH HL E5
Save Register Pair HL (the free slot) to the stack.
588C
INC HL 23
INCrement Register Pair HL to +01H of the slot.
588D
INC HL 23
INCrement Register Pair HL to +02H of the slot.
588E
LD B,(HL) 46
Fetch +02H of the slot at Register Pair HL (the page, or the low byte of the sector) into Register B.
588F
INC HL 23
INCrement Register Pair HL to +03H of the slot.
5890
LD A,(HL) 7E
Fetch +03H of the slot at Register Pair HL into Register A: 00H for a memory slot, 80H and the sector's high bits for a disk slot, FFH for the end of the table.
5891
CP FFH FE FF
Compare Register A against FFH, the mark of the last slot.
5893
If the NZ FLAG is set (a free slot was found), JUMP to 58A0H.
5895
POP HL E1
No slot is free: restore Register Pair HL (the end of the table) from the stack, only to drop it.
5896
GOSUB to 58FBH (module +B7H; 54BBH points the operand there) to send one character if the device is ready.
5899
EI FB
Enable the interrupts (EI) so that the despool task can send too.
589A
GOSUB to 5942H (module +FEH; 54ACH points the operand there) to change the page being sent when it is done: a slot becomes free.
589D
DI F3
Disable the interrupts again (DI) for the search of the table.
589E
LOOP BACK to 587AH to look for a free slot again.
58A0
BIT 7,A CB 7F
Test bit 7 of Register A (+03H of the slot): set for a disk slot.
58A2
If the NZ FLAG is set (a disk slot), JUMP to 58C7H to write the full page to the spool file.
58A4
POP HL E1
A memory slot: restore Register Pair HL (the free slot) from the stack.
58A5
PUSH HL E5
Save Register Pair HL (the free slot) to the stack again.
58A6
LD (HL),L 75
Store Register L (the low byte of the slot) at Register Pair HL, +00H of the slot.
58A7
LD A,H 7C
Copy Register H (the high byte of the slot) into Register A.
58A8
INC HL 23
INCrement Register Pair HL to +01H of the slot.
58A9
LD (HL),A 77
Store Register A (the high byte) at Register Pair HL: the slot points at itself, the new last slot of the queue.
58AA
LD (IX+21H),B DD 70 21
Store Register B (the slot's page) at IX+21H (Index Register IX = the queue block): the store place is the start of that page (IX+20H is 00H).
58AD
LD L,(IX+26H) DD 6E 26
Fetch the low byte of the last slot of the queue from IX+26H (Index Register IX = the queue block) into Register L.
58B0
LD H,(IX+27H) DD 66 27
Fetch the high byte from IX+27H into Register H (Index Register IX = the queue block): Register Pair HL = the slot that was last.
58B3
LD (IX+2AH),L DD 75 2A
Store Register L at IX+2AH (Index Register IX = the queue block): the slot before the new last slot, where a disk slot is linked in.
58B6
LD (IX+2BH),H DD 74 2B
Store Register H at IX+2BH (Index Register IX = the queue block).
58B9
POP BC C1
Restore Register Pair BC (the new slot) from the stack.
58BA
LD (HL),C 71
Store Register C (the low byte of the new slot) at Register Pair HL, the link word of the slot that was last.
58BB
INC HL 23
INCrement Register Pair HL to the high byte of that link word.
58BC
LD (HL),B 70
Store Register B (the high byte of the new slot) at Register Pair HL: the old last slot points at the new one.
58BD
LD (IX+26H),C DD 71 26
Store Register C (the low byte of the new slot) at IX+26H (Index Register IX = the queue block), the last slot of the queue.
58C0
LD (IX+27H),B DD 70 27
Store Register B (the high byte of the new slot) at IX+27H (Index Register IX = the queue block).
58C3
EI FB
Enable the interrupts again (EI): the new slot is linked in.
58C4
RET C9
RETurn to the driver entry (5861H) with the character queued.
58C5
JUMP to 5942H to change the page being sent when it is done; its RET goes back to the driver entry.
58C7
EI FB
A disk slot: enable the interrupts (EI), since the write takes longer than a tick.
58C8
LD C,B 48
Copy Register B (the low byte of the sector number) into Register C.
58C9
AND 0FH E6 0F
AND 0FH into Register A (+03H of the slot): the high bits of the sector number, bit 7 cleared.
58CB
LD B,A 47
Copy Register A into Register B: Register Pair BC = the sector of the spool file.
58CC
PUSH IX DD E5
Save Index Register IX (the queue block) to the stack.
58CE
POP DE D1
Restore Register Pair DE from the stack: Register Pair DE = the queue block, whose first 32 bytes are the spool file's control block.
58CF
GOSUB to 4442H (@POSN) to position the spool file at Register Pair DE to record Register Pair BC.
58D2
LD C,(IX+26H) DD 4E 26
Fetch the low byte of the last slot of the queue from IX+26H (Index Register IX = the queue block) into Register C.
58D5
LD B,(IX+27H) DD 46 27
Fetch the high byte from IX+27H into Register B (Index Register IX = the queue block): Register Pair BC = the last slot, whose page is full.
58D8
POP HL E1
Restore Register Pair HL (the disk slot) from the stack.
58D9
PUSH HL E5
Save Register Pair HL (the disk slot) to the stack again.
58DA
LD (HL),C 71
Store Register C (the low byte of the last slot) at Register Pair HL, the disk slot's link word.
58DB
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
58DC
LD (HL),B 70
Store Register B (the high byte) at Register Pair HL: the disk slot points at the last slot.
58DD
POP BC C1
Restore Register Pair BC (the disk slot) from the stack.
58DE
LD L,(IX+2AH) DD 6E 2A
Fetch the low byte of the slot before the last from IX+2AH (Index Register IX = the queue block) into Register L.
58E1
LD H,(IX+2BH) DD 66 2B
Fetch the high byte from IX+2BH into Register H (Index Register IX = the queue block): Register Pair HL = the slot before the last.
58E4
LD (HL),C 71
Store Register C (the low byte of the disk slot) at Register Pair HL, that slot's link word.
58E5
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
58E6
LD (HL),B 70
Store Register B (the high byte of the disk slot) at Register Pair HL: the disk slot is linked in before the last slot.
58E7
LD (IX+2AH),C DD 71 2A
Store Register C (the low byte of the disk slot) at IX+2AH (Index Register IX = the queue block): the next disk slot goes after this one.
58EA
LD (IX+2BH),B DD 70 2B
Store Register B (the high byte of the disk slot) at IX+2BH (Index Register IX = the queue block).
58ED
LD B,(IX+21H) DD 46 21
Fetch the full page, the high byte of the store place, from IX+21H (Index Register IX = the queue block) into Register B.
58F0
LD (IX+04H),B DD 70 04
Store Register B (the page) at IX+04H (Index Register IX = the queue block), +04H of the spool file's control block, the high byte of its buffer (+03H is 00H).
58F3
JUMP to 4439H (@WRITE) to write the page as the sector; its RET goes back to the driver entry, and the page is filled again from its start.

58F6H - The Spooler Module: the Despool Task

The task block (module +B2H) put into slot 9 by 54F3H: its word points at 58F8H, which runs the send routine twice, so up to two characters go to the device on each tick. 58FBH sends nothing while KFLAG$ bit 4 is clear (PAUSE) or the device is not ready, nothing when the page being sent is empty (queue block +23H = 00H) or the send place has reached the store place; after the last byte of a page it sets +23H to 00H, and 5942H chooses the next page outside the interrupt.

58F6-58F7
DEFS 2
The task block's word: the address of the task, the module +B4H, stored by 54ECH. Not loaded from the file.
58F8
GOSUB to 58FBH (module +B7H; 54BEH points the operand there) to send one character; its RET comes back to 58FBH, which sends a second one.
58FB
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
58FE
AND 10H E6 10
AND 10H into Register A, bit 4: set while the spooler may send.
5900
RET Z C8
RETurn if the Z FLAG is set (paused by PAUSE or OFF).
5901
LD C,00H 0E 00
Load Register C with 00H, a status request for the device.
5903
PUSH IX DD E5
Save Index Register IX (the caller's value) to the stack.
5905
LD IX,4025H DD 21 25 40
Point Index Register IX to the device's control block, the operand at 5907H-5908H (4025H, PRDCB$, in the file; 5444H stores the block found, and PR/FLT installed later stores its own copy there).
5909
CALL 0000H CD 00 00
GOSUB to the device's driver, the operand at 590AH-590BH (0000H in the file, stored by 544FH), with Register C = 00H and the NZ and NO CARRY FLAGS from the AND: a control request asking whether the device is ready.
590C
POP IX DD E1
Restore Index Register IX (the caller's value) from the stack.
590E
RET NZ C0
RETurn if the NZ FLAG is set: the device is busy.
590F
LD IX,59AFH DD 21 AF 59
Point Index Register IX to 59AFH, the queue block (the operand is changed to its place in high memory by 5434H).
5913
LD A,(IX+23H) DD 7E 23
Fetch the page being sent from IX+23H (Index Register IX = the queue block) into Register A.
5916
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, no page to send.
5917
RET Z C8
RETurn if the Z FLAG is set: 5942H has not yet chosen the next page.
5918
LD H,A 67
Copy Register A (the page being sent) into Register H.
5919
CP (IX+21H) DD BE 21
Compare Register A against IX+21H (Index Register IX = the queue block), the page of the store place.
591C
LD A,(IX+22H) DD 7E 22
Fetch the low byte of the send place from IX+22H (Index Register IX = the queue block) into Register A. LD does not change the flags.
591F
If the NZ FLAG is set (another page), JUMP to 5925H: there is something to send.
5921
CP (IX+20H) DD BE 20
Compare Register A against IX+20H (Index Register IX = the queue block), the low byte of the store place.
5924
RET Z C8
RETurn if the Z FLAG is set: the send place has caught up with the store place, the queue is empty.
5925
LD L,A 6F
Copy Register A (the low byte of the send place) into Register L: Register Pair HL = the next character to send.
5926
XOR A AF
Clear Register A (XOR A): the Z FLAG set and the CARRY FLAG clear, an output request.
5927
LD C,(HL) 4E
Fetch the character at Register Pair HL into Register C.
5928
PUSH IX DD E5
Save Index Register IX (the queue block) to the stack.
592A
LD IX,(5907H) DD 2A 07 59
Load Index Register IX from the module +C3H (5907H in the image; 549AH changes the operand at 592CH-592DH to its place in high memory): Index Register IX = the device's control block.
592E
CALL 0000H CD 00 00
GOSUB to the device's driver, the operand at 592FH-5930H (0000H in the file, stored by 544BH), to send the character in Register C.
5931
POP IX DD E1
Restore Index Register IX (the queue block) from the stack.
5933
INC (IX+22H) DD 34 22
INCrement IX+22H (Index Register IX = the queue block), the low byte of the send place: 00H after the last byte of the page.
5936
RET NZ C0
RETurn if the NZ FLAG is set: the page is not done.
5937
LD (IX+23H),00H DD 36 23 00
Store 00H at IX+23H (Index Register IX = the queue block): the page is sent; 5942H chooses the next one.
593B
RET C9
RETurn to the task dispatcher, or to 58FBH for the second character.

593CH - The Spooler Module: the Keyboard Task Part

@KITSK (4300H) jumps here (module +F8H) on each keyboard scan once the spooler is on. The page change runs here, outside the interrupt, since it can read a sector of the spool file; then the three bytes saved from @KITSK carry on as @KITSK did before the install.

593C
GOSUB to 5942H (module +FEH; 54AFH points the operand there) to change the page being sent when it is done.
593F-5941
DEFB 52H, 6FH, 79H 52 6F 79
Three bytes replaced at the install by the first three bytes of @KITSK (5459H, 545CH): a RET, or a JP to the keyboard task that was there. OFF puts them back into 4300H-4302H (5554H).

5942H - The Spooler Module: Change the Page Being Sent

Does nothing while a page is being sent (queue block +23H not 00H). Otherwise the first slot of the queue is done: when the slot after it is a memory slot, the first slot is made free and that slot becomes the first, its page sent next. When the slot after it is a disk slot, its sector is read into the first slot's page, the disk slot is made free and taken out of the queue, and the first slot's page is sent again. Then one character is sent if the device is ready. Every register is kept.

5942
PUSH AF F5
Save Register Pair AF (the caller's value) to the stack.
5943
PUSH IX DD E5
Save Index Register IX (the caller's value) to the stack.
5945
LD A,(59D2H) 3A D2 59
Fetch the page being sent from 59D2H, the queue block +23H, into Register A (5946H is changed to the queue block's place in high memory by 543EH).
5948
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set while a page is being sent.
5949
If the NZ FLAG is set (the page is not done), JUMP to 5978H to send a character only.
594B
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
594C
PUSH DE D5
Save Register Pair DE (the caller's value) to the stack.
594D
PUSH BC C5
Save Register Pair BC (the caller's value) to the stack.
594E
LD IX,59AFH DD 21 AF 59
Point Index Register IX to 59AFH, the queue block (the operand is changed to its place in high memory by 5437H).
5952
LD L,(IX+28H) DD 6E 28
Fetch the low byte of the first slot of the queue from IX+28H (Index Register IX = the queue block) into Register L.
5955
LD H,(IX+29H) DD 66 29
Fetch the high byte from IX+29H into Register H (Index Register IX = the queue block): Register Pair HL = the first slot, whose page is sent.
5958
PUSH HL E5
Save Register Pair HL (the first slot) to the stack.
5959
LD C,(HL) 4E
Fetch the low byte of the first slot's link word at Register Pair HL into Register C.
595A
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
595B
LD B,(HL) 46
Fetch the high byte at Register Pair HL into Register B: Register Pair BC = the next slot of the queue.
595C
LD HL,0002H 21 02 00
Load Register Pair HL with 0002H, the offset of +02H in a slot.
595F
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL = +02H of the next slot.
5960
LD A,(HL) 7E
Fetch +02H of the next slot at Register Pair HL (its page, or the low byte of its sector) into Register A.
5961
INC HL 23
INCrement Register Pair HL to +03H of the next slot.
5962
BIT 7,(HL) CB 7E
Test bit 7 of +03H at Register Pair HL: set for a disk slot.
5964
If the NZ FLAG is set (a disk slot), JUMP to 5981H to read its sector.
5966
LD (IX+23H),A DD 77 23
Store Register A (the next slot's page) at IX+23H (Index Register IX = the queue block): it is sent next, from its start (IX+22H is 00H).
5969
POP HL E1
Restore Register Pair HL (the first slot, now done) from the stack.
596A
LD (HL),00H 36 00
Store 00H at Register Pair HL, the low byte of its link word.
596C
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
596D
LD (HL),00H 36 00
Store 00H at Register Pair HL: the slot is free.
596F
LD (IX+28H),C DD 71 28
Store Register C (the low byte of the next slot) at IX+28H (Index Register IX = the queue block), the first slot of the queue.
5972
LD (IX+29H),B DD 70 29
Store Register B (the high byte of the next slot) at IX+29H (Index Register IX = the queue block).
5975
POP BC C1
Restore Register Pair BC from the stack. 59ADH comes here after a sector was read.
5976
POP DE D1
Restore Register Pair DE (the caller's value) from the stack.
5977
POP HL E1
Restore Register Pair HL (the caller's value) from the stack.
5978
DI F3
Disable the interrupts (DI) while a character is sent.
5979
GOSUB to 58FBH (module +B7H; 54C1H points the operand there) to send one character if the device is ready.
597C
EI FB
Enable the interrupts again (EI) after the character.
597D
POP IX DD E1
Restore Index Register IX (the caller's value) from the stack.
597F
POP AF F1
Restore Register Pair AF (the caller's value) from the stack.
5980
RET C9
RETurn to the caller with every register as it was.
5981
LD C,A 4F
A disk slot: copy Register A (the low byte of its sector) into Register C.
5982
LD A,(HL) 7E
Fetch +03H of the disk slot at Register Pair HL into Register A.
5983
AND 0FH E6 0F
AND 0FH into Register A: the high bits of the sector number, bit 7 cleared.
5985
LD B,A 47
Copy Register A into Register B: Register Pair BC = the sector of the spool file.
5986
PUSH IX DD E5
Save Index Register IX (the queue block) to the stack.
5988
POP DE D1
Restore Register Pair DE from the stack: Register Pair DE = the queue block, the spool file's control block.
5989
GOSUB to 4442H (@POSN) to position the spool file at Register Pair DE to record Register Pair BC.
598C
POP HL E1
Restore Register Pair HL (the first slot) from the stack.
598D
PUSH HL E5
Save Register Pair HL (the first slot) to the stack again.
598E
INC HL 23
INCrement Register Pair HL to +01H of the first slot.
598F
INC HL 23
INCrement Register Pair HL to +02H of the first slot.
5990
LD B,(HL) 46
Fetch the first slot's page at Register Pair HL into Register B.
5991
LD (IX+04H),B DD 70 04
Store Register B (the page) at IX+04H (Index Register IX = the queue block), the high byte of the spool file's buffer.
5994
GOSUB to 4436H (@READ) to read the sector into the first slot's page.
5997
POP HL E1
Restore Register Pair HL (the first slot) from the stack.
5998
PUSH HL E5
Save Register Pair HL (the first slot) to the stack again.
5999
LD A,(HL) 7E
Fetch the low byte of the first slot's link word at Register Pair HL into Register A.
599A
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
599B
LD H,(HL) 66
Fetch the high byte at Register Pair HL into Register H.
599C
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the disk slot.
599D
LD C,(HL) 4E
Fetch the low byte of the disk slot's link word at Register Pair HL into Register C.
599E
LD (HL),00H 36 00
Store 00H at Register Pair HL, the low byte of the disk slot's link word.
59A0
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
59A1
LD B,(HL) 46
Fetch the high byte at Register Pair HL into Register B: Register Pair BC = the slot after the disk slot.
59A2
LD (HL),00H 36 00
Store 00H at Register Pair HL: the disk slot is free.
59A4
POP HL E1
Restore Register Pair HL (the first slot) from the stack.
59A5
LD (HL),C 71
Store Register C (the low byte of the slot after the disk slot) at Register Pair HL, the first slot's link word.
59A6
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
59A7
LD (HL),B 70
Store Register B (the high byte) at Register Pair HL: the disk slot is out of the queue.
59A8
INC HL 23
INCrement Register Pair HL to +02H of the first slot.
59A9
LD B,(HL) 46
Fetch the first slot's page at Register Pair HL into Register B.
59AA
LD (IX+23H),B DD 70 23
Store Register B (the page) at IX+23H (Index Register IX = the queue block): the page, now holding the sector, is sent from its start.
59AD
JUMP BACK to 5975H to restore the registers and send a character.

59AFH - The Spooler Module: the Queue Block

The 44 bytes copied below the slot table by 542DH (the module +016BH in high memory). The first 32 bytes are the spool file's control block; +20H-+2BH are the queue's cells. The member fills it in place (5268H, 5293H, 534FH, 53D7H-541AH) before the copy.

59AF-59D8
DEFS 42
+00H-+1FH the spool file's control block (its buffer high byte at +04H, drive at +06H, directory entry at +07H); +20H-+21H the store place; +22H-+23H the send place (+23H = 00H when a page is done); +24H-+25H the slot table; +26H-+27H the last slot of the queue; +28H-+29H the first slot, whose page is sent. Not loaded from the file.
59D9-59DA
DEFW 0000H 00 00
+2AH-+2BH: the slot before the last slot, where a disk slot is linked in (58B3H, 58E7H); 0000H until the queue takes a second slot.

5200H - Member 7 (COPY, APPEND): the Two Entries and APPEND

One member serves COPY (member 32H, entry 5200H) and APPEND (member 31H, entry 5203H), loaded at 5200H-5A6DH. The source's control block is 5986H and the destination's 59DAH. APPEND opens both files (the destination must exist and be a file), refuses files whose directory records give different record lengths, and positions the destination at its end. When its end is at a sector boundary and STRIP is not given, whole sectors are copied (53DCH); otherwise, and for a device as the source, byte by byte (5519H). STRIP backs the destination up one byte first.

5200
COPY (member 32H) enters here: JUMP to 52B1H, the COPY command.
5203
LD (548AH),SP ED 73 8A 54
APPEND: store the Stack Pointer at 548AH, the operand of the LD SP at 5489H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5207
XOR A AF
Clear Register A (XOR A): Register A = 00H for the CLONE parameter.
5208
LD (544BH),A 32 4B 54
Store Register A (00H) at 544BH, the low byte of the operand of the LD DE at 544AH (the CLONE parameter, FFFFH in the file).
520B
LD (544CH),A 32 4C 54
Store Register A (00H) at 544CH, its high byte: APPEND never copies the source's directory bytes.
520E
LD BC,5845H 01 45 58
Load Register Pair BC with 5845H, the message Appending: .
5211
LD (56A4H),BC ED 43 A4 56
Store Register Pair BC (5845H) at 56A4H, the operand of the LD HL at 56A3H: the banner says Appending: instead of Copying: .
5215
GOSUB to 54B8H to set the highest page the copy may use and clear the BREAK, pause and ENTER bits of KFLAG$.
5218
LD DE,5986H 11 86 59
Point Register Pair DE to 5986H, the source's control block.
521B
GOSUB to 441CH (@FSPEC) to copy the source specification at Register Pair HL (the parameters) to Register Pair DE (5986H); the NZ FLAG when there is none.
521E
If the NZ FLAG is set (no source), JUMP to 5823H to display File spec required.
5221
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5224
GOSUB to 441CH (@FSPEC) to copy the destination specification at Register Pair HL to Register Pair DE (59DAH); the NZ FLAG when it is not a full specification.
5227
If the NZ FLAG is set (a part of a specification, such as :1 or /EXT), GOSUB to 5564H to copy the destination text as it was typed into 59DAH.
522A
LD A,(59DAH) 3A DA 59
Fetch the first character of the destination at 59DAH into Register A.
522D
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
522F
If the Z FLAG is set (the destination is a device), JUMP to 5823H to display File spec required: APPEND writes only to a file.
5232
LD DE,5A4DH 11 4D 5A
Point Register Pair DE to 5A4DH, the part of the parameter table that holds STRIP, S, ECHO and E.
5235
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names.
5238
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5816H to report error 2CH (parameter error).
523B
GOSUB to 558EH to fill the parts of the destination left out (name, extension, password) from the source.
523E
GOSUB to 5806H to open the destination at Register Pair DE (59DAH, left there by 558EH) with @OPEN, the buffer at 5B00H.
5241
GOSUB to 5690H to copy the destination's name as shown (59A6H) to 59CAH, after " to " in the banner.
5244
GOSUB to 56BDH to fetch the destination's record length from its directory record into Register A.
5247
LD (5260H),A 32 60 52
Store Register A (the destination's record length) at 5260H, the operand of the LD B at 525FH.
524A
LD (5448H),A 32 48 54
Store Register A (the record length) at 5448H, the operand of the LD (HL) at 5447H that writes the record length back into the directory record at the end.
524D
GOSUB to 5803H to open the source (5986H) with @OPEN, the buffer at 5B00H.
5250
GOSUB to 568AH to copy the source's name as shown (59A6H) to 59B6H, the banner.
5253
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 5986H, the source's control block.
5254
BIT 7,(HL) CB 7E
Test bit 7 of +00H of the source's control block at Register Pair HL: set for an open file, clear for a device.
5256
EX DE,HL EB
Exchange Register Pairs DE and HL back. EX does not change the flags.
5257
If the Z FLAG is set (the source is a device), GOSUB to 56A1H to display the banner. CALL does not change the flags on the way.
525A
If the Z FLAG is set (the source is a device), JUMP to 5275H to append byte by byte.
525C
GOSUB to 56BDH to fetch the source's record length from its directory record into Register A.
525F
LD B,00H 06 00
Load Register B with the destination's record length, the operand at 5260H stored by 5247H.
5261
XOR B A8
Exclusive OR Register B into Register A: the NZ FLAG is set when the two record lengths differ.
5262
If the NZ FLAG is set (different record lengths), JUMP to 582BH to display Files have different LRLs.
5265
GOSUB to 56A1H to display the banner Appending: source to destination.
5268
LD DE,0000H 11 00 00
Load Register Pair DE with the STRIP parameter, the operand at 5269H-526AH: 0000H in the file, FFFFH when STRIP (or S) was given.
526B
LD A,D 7A
Copy Register D (the high byte of STRIP) into Register A.
526C
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when STRIP was not given.
526D
If the NZ FLAG is set (STRIP), JUMP to 5275H to append byte by byte.
526F
LD A,(59E2H) 3A E2 59
Fetch the destination's end of file byte from 59E2H (its control block +08H) into Register A: the bytes used in its last sector.
5272
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when the file ends at a sector boundary.
5273
If the Z FLAG is set (a sector boundary), JUMP to 5294H to append whole sectors.
5275
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5278
GOSUB to 4448H (@PEOF) to position the destination at Register Pair DE at its end.
527B
LD A,(5269H) 3A 69 52
Fetch the low byte of the STRIP parameter from 5269H into Register A.
527E
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when STRIP was not given.
527F
If the Z FLAG is set (no STRIP), JUMP to 528BH.
5281
LD HL,59E3H 21 E3 59
Point Register Pair HL to 59E3H, the destination's record length (control block +09H).
5284
LD B,(HL) 46
Fetch the record length at Register Pair HL into Register B, to keep it.
5285
LD (HL),01H 36 01
Store 01H at Register Pair HL: records of one byte for the moment.
5287
GOSUB to 4445H (@BKSP) to step the destination at Register Pair DE back one record, here one byte: the first byte appended goes over the last byte of the file.
528A
LD (HL),B 70
Store Register B (the record length) back at Register Pair HL (59E3H).
528B
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, the destination's buffer for the byte copy (the source uses 5B00H).
528E
LD (59DDH),HL 22 DD 59
Store Register Pair HL (5C00H) at 59DDH-59DEH, the destination's buffer address (control block +03H-+04H).
5291
JUMP to 5519H to append byte by byte through @GET and @PUT.
5294
LD BC,(5992H) ED 4B 92 59
Fetch the source's ending record number from 5992H-5993H (its control block +0CH-+0DH) into Register Pair BC.
5298
LD A,B 78
Copy Register B (the high byte) into Register A.
5299
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set for an empty source.
529A
If the Z FLAG is set (nothing to append), JUMP to 547AH to close the destination and end.
529D
LD HL,(59E6H) 2A E6 59
Fetch the destination's ending record number from 59E6H-59E7H (its control block +0CH-+0DH) into Register Pair HL.
52A0
PUSH HL E5
Save Register Pair HL (the destination's ending record number) to the stack.
52A1
ADD HL,BC 09
ADD Register Pair BC (the source's records) to Register Pair HL: the records the destination will have.
52A2
LD B,H 44
Copy Register H (the high byte) into Register B.
52A3
LD C,L 4D
Copy Register L (the low byte) into Register C: Register Pair BC = the destination's new size.
52A4
GOSUB to 54D4H to write the last sector of that size, so that the destination takes its space at once.
52A7
POP HL E1
Restore Register Pair HL (the destination's old ending record number) from the stack.
52A8
LD (59E6H),HL 22 E6 59
Store Register Pair HL at 59E6H-59E7H: the destination's end is its old end again.
52AB
GOSUB to 4448H (@PEOF) to position the destination at Register Pair DE (59DAH) at that end.
52AE
JUMP to 53DCH to append whole sectors through memory.

52B1H - COPY: Read the Specifications and Parameters

Both specifications are read; a part of a destination (:1, /EXT) is kept as typed. A device at either end copies byte by byte (54F4H). X, the copy on one drive between two diskettes, may not run during a JCL job or with a device: the drive is taken from the source's specification and put into the two prompts, the destination becomes the source's specification, SYS2/SYS is loaded while the system diskette is still in, and the source diskette's name, date and password hash (GAT +CEH-+DFH) are kept to recognise it.

52B1
LD (548AH),SP ED 73 8A 54
COPY: store the Stack Pointer at 548AH, the operand of the LD SP at 5489H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
52B5
GOSUB to 54B8H to set the highest page the copy may use and clear the BREAK, pause and ENTER bits of KFLAG$.
52B8
LD DE,5986H 11 86 59
Point Register Pair DE to 5986H, the source's control block.
52BB
GOSUB to 441CH (@FSPEC) to copy the source specification at Register Pair HL (the parameters) to Register Pair DE (5986H); the NZ FLAG when there is none.
52BE
If the NZ FLAG is set (no source), JUMP to 5823H to display File spec required.
52C1
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
52C4
GOSUB to 441CH (@FSPEC) to copy the destination specification at Register Pair HL to Register Pair DE (59DAH); the NZ FLAG when it is not a full specification.
52C7
If the NZ FLAG is set (a part of a specification or none), GOSUB to 5564H to copy the destination text as it was typed into 59DAH.
52CA
LD DE,5A25H 11 25 5A
Point Register Pair DE to 5A25H, the parameter table of COPY (LRL, L, CLONE, C, X, STRIP, S, ECHO, E).
52CD
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names.
52D0
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5816H to report error 2CH (parameter error).
52D3
LD DE,0000H 11 00 00
Load Register Pair DE with the X parameter, the operand at 52D4H-52D5H: 0000H in the file, FFFFH when X was given.
52D6
LD A,D 7A
Copy Register D (the high byte of X) into Register A.
52D7
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when X was not given.
52D8
If the NZ FLAG is set (X), JUMP to 52E5H for the copy on one drive.
52DA
GOSUB to 57CEH, which returns the Z FLAG when the source or the destination is a device.
52DD
If the Z FLAG is set (a device), JUMP to 54F4H to copy byte by byte.
52E0
GOSUB to 558EH to fill the parts of the destination left out from the source.
52E3
JUMP to 533DH to open the source and go on with the copy.
52E5
LD A,(430FH) 3A 0F 43
X: fetch SFLAG$, the system flags, from 430FH into Register A.
52E8
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52EA
If the NZ FLAG is set (a JCL job), JUMP to 5827H to display Invalid command during <DO> processing.
52ED
GOSUB to 57CEH, which returns the Z FLAG when the source or the destination is a device.
52F0
If the Z FLAG is set (a device), JUMP to 5823H to display File spec required.
52F3
LD HL,5986H 21 86 59
Point Register Pair HL to 5986H, the source's specification, to find its drive.
52F6
LD C,00H 0E 00
Load Register C with 00H, drive 0 when the specification names none.
52F8
LD A,(HL) 7E
Fetch the next character of the source's specification at Register Pair HL into Register A.
52F9
INC HL 23
INCrement Register Pair HL past the character just fetched.
52FA
CP 3AH FE 3A
Compare Register A against 3AH, the colon before a drive.
52FC
If the Z FLAG is set (a drive follows), JUMP to 5304H.
52FE
CP 20H FE 20
Compare Register A against 20H: the CARRY FLAG is set for a control character, the end of the specification.
5300
If the CARRY FLAG is set (the end), JUMP to 5308H with Register C = 0.
5302
LOOP BACK to 52F8H for the next character of the specification.
5304
LD A,(HL) 7E
Fetch the drive digit at Register Pair HL into Register A.
5305
SUB 30H D6 30
SUBtract 30H from Register A: the digit becomes the drive number.
5307
LD C,A 4F
Copy Register A (the drive number) into Register C, the drive of the X copy.
5308
LD A,C 79
Copy Register C (the drive of the X copy, 0 or the digit given) into Register A.
5309
LD (5712H),A 32 12 57
Store Register A (the drive) at 5712H, the operand of the LD A at 5711H, the drive the X copy uses.
530C
ADD A,30H C6 30
ADD 30H to Register A: the drive number becomes its digit.
530E
LD (5938H),A 32 38 59
Store Register A (the digit) at 5938H, the drive in Insert SOURCE disk in drive :0.
5311
LD (5971H),A 32 71 59
Store Register A (the digit) at 5971H, the drive in Insert DESTINATION disk in drive :0.
5314
LD HL,5986H 21 86 59
Point Register Pair HL to 5986H, the source's specification.
5317
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
531A
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
531D
LDIR ED B0
Copy the 32 bytes from 5986H at Register Pair HL to 59DAH at Register Pair DE (LDIR, Register Pair BC = the count): the destination is the same specification on the other diskette.
531F
GOSUB to 57C5H to issue request 84H, which loads SYS2/SYS (the opens) while the system diskette is in the drive.
5322
LD HL,5919H 21 19 59
Point Register Pair HL to 5919H, the prompt Insert SOURCE disk in drive :d and press <ENTER>.
5325
GOSUB to 576EH to flash the prompt at Register Pair HL until ENTER is pressed (BREAK ends the command).
5328
LD A,(5712H) 3A 12 57
Fetch the drive of the X copy from 5712H into Register A.
532B
LD C,A 4F
Copy Register A (the drive of the X copy) into Register C for the GAT read.
532C
GOSUB to 57EDH to read the GAT of drive Register C into 4200H; the NZ FLAG and Register A = 14H when it cannot be read.
532F
If the NZ FLAG is set (the GAT could not be read), JUMP to 5810H to report the error in Register A.
5332
LD HL,42CEH 21 CE 42
Point Register Pair HL to 42CEH, the GAT's +CEH: the diskette's password hash, name and date.
5335
LD DE,59FAH 11 FA 59
Point Register Pair DE to 59FAH, where the source diskette's 18 bytes are kept.
5338
LD BC,0012H 01 12 00
Load Register Pair BC with 0012H, the 18 bytes 42CEH-42DFH.
533B
LDIR ED B0
Copy the 18 bytes from 42CEH at Register Pair HL to 59FAH at Register Pair DE (LDIR, Register Pair BC = the count).

533DH - COPY: Open the Source and the Destination

The source is opened and its directory bytes +00H-+02H and +10H-+13H are kept (56CCH). The record length for the destination's directory record is the LRL parameter, or the source's own. 5466H records the date formats of the two drives (bit set in 475DH: the time and date layout with the time in +12H-+13H). For X the destination diskette is asked for, recognised by its GAT bytes, and refused when it is the source diskette. The destination is opened or made with @INIT; without X a destination that is the source's own directory record on the same drive is refused.

533D
GOSUB to 5803H to open the source (5986H) with @OPEN, the buffer at 5B00H.
5340
GOSUB to 568AH to copy the source's name as shown (59A6H) to 59B6H, the banner.
5343
GOSUB to 56CCH to keep +00H-+02H and +10H-+13H of the source's directory record at 5A1EH; Register Pair HL returns at the record +14H.
5346
LD A,(598CH) 3A 8C 59
Fetch the source's drive from 598CH (its control block +06H) into Register A.
5349
GOSUB to 57DAH to test the drive's bit in 475DH: the NZ FLAG when the drive uses the date layout with the time.
534C
If the NZ FLAG is set (the source has that layout), JUMP to 5353H.
534E
LD A,FFH 3E FF
Load Register A with FFH, the date layout code for an older source.
5350
LD (5466H),A 32 66 54
Store Register A (FFH) at 5466H, the operand of the LD A at 5465H (FEH in the file): the source has the older date layout.
5353
LD A,L 7D
Copy Register L (the low byte of the record +14H) into Register A.
5354
SUB 10H D6 10
SUBtract 10H from Register A: the low byte of the record +04H, the record length.
5356
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +04H of the source's directory record at 4200H.
5357
LD A,(HL) 7E
Fetch the source's record length at Register Pair HL into Register A.
5358
LD BC,FF00H 01 00 FF
Load Register Pair BC with the LRL parameter, the operand at 5359H-535AH: FF00H in the file, the value of LRL= (1 to 256) when given.
535B
INC B 04
INCrement Register B (the high byte): FFH becomes 00H and sets the Z FLAG when LRL was not given.
535C
If the NZ FLAG is set (LRL was given), JUMP to 535FH with Register C = the low byte of the LRL (00H for 256).
535E
LD C,A 4F
Copy Register A (the source's record length) into Register C.
535F
LD A,C 79
Copy Register C (the record length for the destination) into Register A.
5360
LD (5448H),A 32 48 54
Store Register A at 5448H, the operand of the LD (HL) at 5447H that writes the record length into the destination's directory record.
5363
LD A,(52D4H) 3A D4 52
Fetch the low byte of the X parameter from 52D4H into Register A.
5366
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given.
5367
If the Z FLAG is set (no X), JUMP to 5396H to open the destination.
5369
LD HL,594DH 21 4D 59
Point Register Pair HL to 594DH, the prompt Insert DESTINATION disk in drive :d and press <ENTER>.
536C
GOSUB to 576EH to flash the prompt at Register Pair HL until ENTER is pressed.
536F
LD A,(5712H) 3A 12 57
Fetch the drive of the X copy from 5712H into Register A.
5372
LD C,A 4F
Copy Register A (the drive) into Register C for the GAT read.
5373
GOSUB to 57EDH to read the GAT of drive Register C into 4200H; the NZ FLAG and Register A = 14H when it cannot be read.
5376
If the NZ FLAG is set (the GAT could not be read), JUMP to 5810H to report the error in Register A.
5379
LD HL,42CEH 21 CE 42
Point Register Pair HL to 42CEH, the GAT's +CEH: the diskette's password hash, name and date.
537C
LD DE,5A0CH 11 0C 5A
Point Register Pair DE to 5A0CH, where the destination diskette's 18 bytes are kept.
537F
PUSH DE D5
Save Register Pair DE (5A0CH, the destination diskette's bytes) to the stack.
5380
LD BC,0012H 01 12 00
Load Register Pair BC with 0012H, the 18 bytes 42CEH-42DFH.
5383
LDIR ED B0
Copy the 18 bytes from 42CEH at Register Pair HL to 5A0CH at Register Pair DE (LDIR, Register Pair BC = the count).
5385
POP DE D1
Restore Register Pair DE (5A0CH) from the stack.
5386
LD HL,59FAH 21 FA 59
Point Register Pair HL to 59FAH, the source diskette's 18 bytes.
5389
LD B,12H 06 12
Load Register B with 12H, the 18 bytes to compare.
538B
GOSUB to 5762H to compare Register B bytes at Register Pair DE and Register Pair HL: the Z FLAG when they are the same.
538E
If the NZ FLAG is set (another diskette), JUMP to 5396H to open the destination.
5390
The same diskette: GOSUB to 570CH to ask for the system diskette back when the drive is 0.
5393
JUMP to 581FH to display Source and destination disks are the same and end the command.
5396
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5399
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the destination's buffer.
539C
GOSUB to 57FFH to open the destination at Register Pair DE with @INIT (made when it is not there), the buffer at Register Pair HL.
539F
GOSUB to 5690H to copy the destination's name as shown (59A6H) to 59CAH, after " to " in the banner.
53A2
LD A,(59E0H) 3A E0 59
Fetch the destination's drive from 59E0H (its control block +06H) into Register A.
53A5
GOSUB to 57DAH to test the drive's bit in 475DH: the NZ FLAG when the drive uses the date layout with the time.
53A8
If the Z FLAG is set (the older layout), JUMP to 53AEH.
53AA
LD HL,5466H 21 66 54
Point Register Pair HL to 5466H, the operand of the LD A at 5465H.
53AD
INC (HL) 34
INCrement the byte at Register Pair HL: FEH becomes FFH (both drives have the layout with the time), FFH becomes 00H (the source has the older one, the destination the newer).
53AE
LD A,(52D4H) 3A D4 52
Fetch the low byte of the X parameter from 52D4H into Register A.
53B1
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given; the CARRY FLAG is cleared.
53B2
If the NZ FLAG is set (X: two diskettes), JUMP to 53C0H.
53B4
LD HL,(598CH) 2A 8C 59
Fetch the source's drive and directory entry from 598CH-598DH (control block +06H-+07H) into Register Pair HL.
53B7
LD DE,(59E0H) ED 5B E0 59
Fetch the destination's drive and directory entry from 59E0H-59E1H into Register Pair DE.
53BB
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG is set when both are the same directory record of the same drive.
53BD
If the Z FLAG is set (the file onto itself), JUMP to 582FH to display Destination spec required.
53C0
GOSUB to 570CH to ask for the system diskette back when X uses drive 0.
53C3
GOSUB to 57C8H to issue request 8AH, which loads SYS8/SYS (the file space allocation the writes need) while the system diskette is in.
53C6
GOSUB to 5740H to ask for the destination diskette when X is given and check that it is the right one.
53C9
GOSUB to 56A1H to display the banner Copying: source to destination.
53CC
LD BC,(5992H) ED 4B 92 59
Fetch the source's ending record number from 5992H-5993H (its control block +0CH-+0DH) into Register Pair BC.
53D0
GOSUB to 54D4H to write the destination's sector number Register Pair BC less 1, so that it takes the source's space at once.
53D3
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, an ending record number of 0.
53D6
LD (59E6H),HL 22 E6 59
Store Register Pair HL (0000H) at 59E6H-59E7H, the destination's ending record number: it is empty again.
53D9
GOSUB to 443FH (@REW) to position the destination at Register Pair DE (59DAH) at its first record.

53DCH - Copy Whole Sectors through Memory

The source is read sector by sector into 5B00H and the pages above it, up to the highest page 54B8H set, then the pages are written to the destination; this goes on until the source reports the end of the file (error 1CH or 1DH). Then the pages read last are written, the destination's control block takes the source's end of file byte, and it is closed. For X each batch asks for the source and then the destination diskette.

53DC
GOSUB to 571EH to ask for the source diskette when X is given and check that it is the right one.
53DF
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the first page of the copy buffer.
53E2
LD (5989H),HL 22 89 59
Store Register Pair HL (the page) at 5989H-598AH, the source's buffer address (control block +03H-+04H).
53E5
LD DE,5986H 11 86 59
Point Register Pair DE to 5986H, the source's control block.
53E8
GOSUB to 4436H (@READ) to read the next sector of the source at Register Pair DE into its buffer.
53EB
If the Z FLAG is set (read), JUMP to 53F8H for the next page.
53ED
CP 1CH FE 1C
Compare Register A (the error) against 1CH, end of file encountered.
53EF
If the Z FLAG is set (the end of the source), JUMP to 5418H to finish.
53F1
CP 1DH FE 1D
Compare Register A against 1DH, record number out of range: the end of the source too.
53F3
If the Z FLAG is set (the end of the source), JUMP to 5418H to finish.
53F5
JUMP to 5810H to report the error in Register A.
53F8
INC H 24
INCrement Register H to the next page of the buffer.
53F9
LD A,H 7C
Copy Register H (the next page) into Register A.
53FA
CP 60H FE 60
Compare Register A against the highest page, the operand at 53FBH (60H in the file, set by 54C6H).
53FC
If the NZ FLAG is set (room left), LOOP BACK to 53E2H to read the next sector.
53FE
The buffer is full: GOSUB to 5740H to ask for the destination diskette when X is given.
5401
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the first page of the buffer.
5404
LD (59DDH),HL 22 DD 59
Store Register Pair HL (the page) at 59DDH-59DEH, the destination's buffer address (control block +03H-+04H).
5407
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
540A
GOSUB to 4439H (@WRITE) to write the page as the destination's next sector.
540D
If the NZ FLAG is set (the write failed), JUMP to 5810H to report the error in Register A.
5410
INC H 24
INCrement Register H to the next page of the buffer.
5411
LD A,H 7C
Copy Register H (the next page) into Register A.
5412
CP 60H FE 60
Compare Register A against the highest page, the operand at 5413H (60H in the file, set by 54C9H).
5414
If the NZ FLAG is set (pages left), LOOP BACK to 5404H to write the next one.
5416
LOOP BACK to 53DCH to read the next batch of the source.
5418
The end of the source: GOSUB to 5498H to write the pages read before it, Register H being the page the read stopped at.
541B
LD HL,(598EH) 2A 8E 59
Fetch the source's end of file byte and record length from 598EH-598FH (its control block +08H-+09H) into Register Pair HL.
541E
LD (59E2H),HL 22 E2 59
Store Register Pair HL at 59E2H-59E3H (the destination's control block +08H-+09H): the destination ends where the source does.
5421
GOSUB to 570CH to ask for the system diskette back when X uses drive 0.
5424
GOSUB to 57CBH to issue request 85H, which loads SYS3/SYS (the close) while the system diskette is in.
5427
LD A,(5712H) 3A 12 57
Fetch the drive of the X copy from 5712H into Register A.
542A
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for drive 0.
542B
If the Z FLAG is set (drive 0), GOSUB to 5740H to ask for the destination diskette again (it returns at once without X).
542E
LD BC,(59E0H) ED 4B E0 59
Fetch the destination's drive and directory entry from 59E0H-59E1H into Register Pair BC: Register C the drive, Register B the entry.
5432
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5435
GOSUB to 4428H (@CLOSE) to close the destination at Register Pair DE.
5438
If the NZ FLAG is set (the close failed), JUMP to 5810H to report the error in Register A.
543B
GOSUB to 4B10H (DIRRD) to read the directory sector holding record Register B of drive Register C into 4200H; Register Pair HL = the destination's record.
543E
If the NZ FLAG is set (the directory could not be read), JUMP to 5810H to report the error in Register A.
5441
PUSH BC C5
Save Register Pair BC (the drive and entry) to the stack.
5442
PUSH HL E5
Save Register Pair HL (the record) to the stack.
5443
LD A,04H 3E 04
Load Register A with 04H, the offset of the record length in a directory record.
5445
ADD A,L 85
ADD Register L (the low byte of the record) to Register A.
5446
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +04H of the record.
5447
LD (HL),00H 36 00
Store the record length, the operand at 5448H (00H in the file; set by 5360H, or by 524AH for APPEND), at Register Pair HL.
5449
POP HL E1
Restore Register Pair HL (the record) from the stack.
544A
LD DE,FFFFH 11 FF FF
Load Register Pair DE with the CLONE parameter, the operand at 544BH-544CH: FFFFH in the file (CLONE is on unless C=N or C=OFF is given), 0000H for APPEND.
544D
LD A,D 7A
Copy Register D (the high byte of CLONE) into Register A.
544E
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when CLONE is off.
544F
If the Z FLAG is set (no CLONE), JUMP to 5474H: the destination keeps its own attributes.
5451
PUSH HL E5
Save Register Pair HL (the record) to the stack.
5452
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the destination's record.
5453
LD HL,5A1EH 21 1E 5A
Point Register Pair HL to 5A1EH, the source's bytes +00H-+02H and +10H-+13H kept by 56CCH.
5456
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the attributes, the flags and month byte, and the day and year byte.
5459
LDIR ED B0
Copy the 3 bytes from 5A1EH at Register Pair HL to +00H-+02H of the record at Register Pair DE (LDIR, Register Pair BC = the count).
545B
LD A,0DH 3E 0D
Load Register A with 0DH, the distance from +03H to +10H.
545D
ADD A,E 83
ADD Register E (the low byte of the record +03H) to Register A.
545E
LD E,A 5F
Copy Register A into Register E: Register Pair DE = the record +10H.
545F
LD BC,0004H 01 04 00
Load Register Pair BC with 0004H, the password hash and +12H-+13H.
5462
LDIR ED B0
Copy the 4 bytes from 5A21H at Register Pair HL to +10H-+13H of the record at Register Pair DE (LDIR, Register Pair BC = the count).
5464
POP HL E1
Restore Register Pair HL (the record) from the stack.
5465
LD A,FEH 3E FE
Load Register A with the date layout code, the operand at 5466H: FEH in the file; FFH set by 5350H or 53ADH; 00H when the source has the older layout and the destination the newer.
5467
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set only for 00H.
5468
If the NZ FLAG is set (no change of layout), JUMP to 5474H.
546A
DEC DE 1B
DECrement Register Pair DE from the record +14H to +13H.
546B
INC HL 23
INCrement Register Pair HL to the record +01H.
546C
INC HL 23
INCrement Register Pair HL to the record +02H, the day and year byte.
546D
LD A,(HL) 7E
Fetch +02H of the record at Register Pair HL into Register A.
546E
AND 07H E6 07
AND 07H into Register A: the year bits 2-0 of the older layout.
5470
LD (DE),A 12
Store Register A (the year) at Register Pair DE, the record +13H: the newer layout keeps the year in its bits 4-0.
5471
DEC DE 1B
DECrement Register Pair DE to the record +12H.
5472
XOR A AF
Clear Register A (XOR A): Register A = 00H for the record +12H.
5473
LD (DE),A 12
Store Register A (00H) at Register Pair DE, the record +12H: the time is 00:00 and the old second password is gone.
5474
POP BC C1
Restore Register Pair BC (the drive and entry) from the stack.
5475
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back.
5478
JUMP to 5480H to test the result of the directory write.
547A
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
547D
GOSUB to 4428H (@CLOSE) to close the destination at Register Pair DE.
5480
If the NZ FLAG is set (a failure), JUMP to 5810H to report the error in Register A.
5483
GOSUB to 570CH to ask for the system diskette back when X uses drive 0.
5486
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5489
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5203H or 52B1H, the operand at 548AH-548BH (0000H in the file). 5838H comes here with Register Pair HL = FFFFH.
548C
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
548D
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
548E
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran it.
548F
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5492
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5494
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5495
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

5498H - Write the Last Pages

Register H is the page where the read of the source stopped. The pages 5B00H up to it are written to the destination; none when it is 5BH.

5498
LD A,H 7C
Copy Register H (the page the read stopped at) into Register A.
5499
CP 5BH FE 5B
Compare Register A against 5BH, the first page: nothing was read.
549B
RET Z C8
RETurn if the Z FLAG is set: no pages to write.
549C
CP 60H FE 60
Compare Register A against the highest page, the operand at 549DH (60H in the file, set by 54CCH).
549E
RET Z C8
RETurn if the Z FLAG is set (the highest page).
549F
GOSUB to 5740H to ask for the destination diskette when X is given.
54A2
LD B,H 44
Copy Register H (the page the read stopped at) into Register B, the end of the pages to write.
54A3
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the first page of the buffer.
54A6
LD (59DDH),HL 22 DD 59
Store Register Pair HL (the page) at 59DDH-59DEH, the destination's buffer address.
54A9
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
54AC
GOSUB to 4439H (@WRITE) to write the page as the destination's next sector.
54AF
If the NZ FLAG is set (the write failed), JUMP to 5810H to report the error in Register A.
54B2
INC H 24
INCrement Register H to the next page of the buffer.
54B3
LD A,H 7C
Copy Register H (the next page) into Register A.
54B4
CP B B8
Compare Register A against Register B, the page the read stopped at.
54B5
If the NZ FLAG is set (pages left), LOOP BACK to 54A6H.
54B7
RET C9
RETurn to the caller with every page written.

54B8H - Set the Highest Page and Clear the Keys

For a command typed at LDOS command level the buffer may reach the page below the one that holds HIGH$ + 1; for a command a program passed through 4451H (bit 1 of 4758H) it stays 5B00H-5FFFH, below 6000H, since the program's memory is above. The page goes into the three compares of the copy loops. Then the BREAK, pause and ENTER bits of KFLAG$ are cleared (57B0H).

54B8
PUSH HL E5
Save Register Pair HL (the parameters) to the stack.
54B9
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
54BC
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
54BE
If the NZ FLAG is set (a program ran the command), JUMP to 54CFH: the highest page stays 60H.
54C0
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
54C3
INC HL 23
INCrement Register Pair HL to the first byte above HIGH$.
54C4
DEC H 25
DECrement Register H: the page below the one that holds HIGH$ + 1.
54C5
LD A,H 7C
Copy Register H (the highest page) into Register A.
54C6
LD (53FBH),A 32 FB 53
Store Register A at 53FBH, the operand of the CP at 53FAH (the read loop).
54C9
LD (5413H),A 32 13 54
Store Register A at 5413H, the operand of the CP at 5412H (the write loop).
54CC
LD (549DH),A 32 9D 54
Store Register A at 549DH, the operand of the CP at 549CH (the last pages).
54CF
GOSUB to 57B0H to clear bits 2-0 of KFLAG$ (ENTER, pause, BREAK).
54D2
POP HL E1
Restore Register Pair HL (the parameters) from the stack.
54D3
RET C9
RETurn to the caller with the highest page set.

54D4H - Give the Destination Its Space

Register Pair BC = the sectors the destination is to have. The destination is positioned to its sector BC - 1 and a sector of E5H bytes is written there, so that the space is allocated before the copy starts.

54D4
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
54D7
LD A,B 78
Copy Register B (the high byte of the size) into Register A.
54D8
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set for 0 sectors.
54D9
RET Z C8
RETurn if the Z FLAG is set: nothing to allocate.
54DA
DEC BC 0B
DECrement Register Pair BC to the number of the last sector.
54DB
GOSUB to 4442H (@POSN) to position the destination at Register Pair DE to record Register Pair BC.
54DE
PUSH DE D5
Save Register Pair DE (59DAH, the destination's control block) to the stack.
54DF
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the destination's buffer.
54E2
LD DE,5B01H 11 01 5B
Point Register Pair DE to 5B01H, the byte after it.
54E5
LD BC,00FFH 01 FF 00
Load Register Pair BC with 00FFH, the other 255 bytes of the page.
54E8
LD (HL),E5H 36 E5
Store E5H at Register Pair HL (5B00H), the byte a formatted sector holds.
54EA
LDIR ED B0
Copy E5H on through the page (LDIR from Register Pair HL to Register Pair DE, Register Pair BC = the count): 5B00H-5BFFH = E5H.
54EC
POP DE D1
Restore Register Pair DE (59DAH) from the stack.
54ED
GOSUB to 4439H (@WRITE) to write the buffer as that sector of the destination at Register Pair DE.
54F0
RET Z C8
RETurn if the Z FLAG is set: the space is allocated.
54F1
JUMP to 5810H to report the error in Register A (the disk is full).

54F4H - COPY with a Device: Open Both Ends

When the source or the destination is a device, both are opened (a device opens as a device), the destination made with @INIT with the record length of LRL (or 256) when it is a file, and the copy goes byte by byte.

54F4
GOSUB to 5803H to open the source (5986H) with @OPEN, the buffer at 5B00H.
54F7
GOSUB to 568AH to copy the source's name as shown (59A6H) to 59B6H, the banner.
54FA
LD A,(5359H) 3A 59 53
Fetch the low byte of the LRL parameter from 5359H into Register A: 00H (256) when LRL was not given.
54FD
LD B,A 47
Copy Register A (the record length) into Register B, for @INIT.
54FE
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5501
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, the destination's buffer.
5504
LD A,20H 3E 20
Load Register A with 20H, the low byte of 4420H (@INIT).
5506
GOSUB to 580CH to open the destination at Register Pair DE with the routine 44xxH named by Register A (@INIT), the buffer at Register Pair HL and record length Register B.
5509
GOSUB to 5690H to copy the destination's name as shown (59A6H) to 59CAH, after " to " in the banner.
550C
GOSUB to 56A1H to display the banner Copying: source to destination.
550F
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 59DAH, the destination's control block.
5510
BIT 7,(HL) CB 7E
Test bit 7 of +00H of the destination's control block at Register Pair HL: set for an open file.
5512
EX DE,HL EB
Exchange Register Pairs DE and HL back. EX does not change the flags.
5513
If the Z FLAG is set (the destination is a device), JUMP to 5519H.
5515
XOR A AF
Clear Register A (XOR A): Register A = 00H, the record length 256.
5516
LD (59E3H),A 32 E3 59
Store Register A (00H) at 59E3H, the destination's control block +09H: the bytes are put into records of 256.

5519H - Copy Byte by Byte

Each byte is taken from the source with @GET (0013H) and given to the destination with @PUT (001BH). A file source ends at its end of file (error 1CH); a device source ends with BREAK (01H), and gives 00H while it has no character. ECHO shows each byte of a device on the screen. BREAK or a pause (SHIFT @) are looked at after each byte (56E9H). The end closes the destination (547AH).

5519
LD A,0EH 3E 0E
Load Register A with 0EH, the code that turns the cursor on.
551B
GOSUB to the ROM at 0033H to display the character in Register A (0EH).
551E
LD DE,5986H 11 86 59
Point Register Pair DE to 5986H, the source's control block.
5521
LD A,(DE) 1A
Fetch +00H of the source's control block at Register Pair DE into Register A.
5522
BIT 7,A CB 7F
Test bit 7 of Register A: set for an open file.
5524
If the Z FLAG is set (the source is a device), JUMP to 5539H.
5526
GOSUB to the ROM at 0013H (@GET) to take the next byte of the file at Register Pair DE into Register A; the Z FLAG when there is one.
5529
If the Z FLAG is set (a byte), JUMP to 554DH to put it.
552B
CP 1CH FE 1C
Compare Register A (the error) against 1CH, end of file encountered.
552D
If the Z FLAG is set (the end of the source), JUMP to 547AH to close the destination and end.
5530
JUMP to 5810H to report the error in Register A.
5533
GOSUB to 56E9H to look at BREAK and the pause: the NZ FLAG when BREAK was pressed.
5536
If the NZ FLAG is set (BREAK), JUMP to 547AH to close the destination and end.
5539
GOSUB to the ROM at 0013H (@GET) to take a character from the device at Register Pair DE into Register A.
553C
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, no character yet.
553D
If the Z FLAG is set (no character), LOOP BACK to 5533H to look at BREAK and ask again.
553F
CP 01H FE 01
Compare Register A against 01H, the code of BREAK.
5541
If the Z FLAG is set (BREAK), JUMP to 547AH to close the destination and end.
5544
LD DE,0000H 11 00 00
Load Register Pair DE with the ECHO parameter, the operand at 5545H-5546H: 0000H in the file, FFFFH when ECHO (or E) was given.
5547
INC D 14
INCrement Register D (the high byte of ECHO): FFH becomes 00H and sets the Z FLAG when ECHO was given.
5548
PUSH AF F5
Save Register Pair AF (the character and the Z FLAG) to the stack.
5549
If the Z FLAG is set (ECHO), GOSUB to the ROM at 0033H to display the character in Register A.
554C
POP AF F1
Restore Register Pair AF (the character) from the stack.
554D
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's control block.
5550
GOSUB to the ROM at 001BH (@PUT) to give the byte in Register A to the destination at Register Pair DE; the Z FLAG when it was taken.
5553
If the Z FLAG is set (the byte was taken), JUMP to 555CH.
5555
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 59DAH, the destination's control block.
5556
BIT 7,(HL) CB 7E
Test bit 7 of +00H of the destination's control block at Register Pair HL: set for a file.
5558
EX DE,HL EB
Exchange Register Pairs DE and HL back. EX does not change the flags.
5559
If the NZ FLAG is set (the file could not be written), JUMP to 5810H to report the error in Register A; a device that refuses the byte is passed over.
555C
GOSUB to 56E9H to look at BREAK and the pause: the NZ FLAG when BREAK was pressed.
555F
If the NZ FLAG is set (BREAK), JUMP to 547AH to close the destination and end.
5562
LOOP BACK to 551EH for the next byte of the source.

5564H - Keep a Destination as It Was Typed

When @FSPEC refuses the destination (a drive alone, /EXT, .PASSWORD), its text is copied into 59DAH as it was typed: from the character @FSPEC stopped at (the one before Register Pair HL), spaces skipped first, small letters made capitals, up to 32 characters, ending at 0DH or a bracket, with 0DH stored after it. 558EH completes it from the source.

5564
GOSUB to 556CH to copy the text at Register Pair HL to Register Pair DE (59DAH).
5567
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the copied text.
5569
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, after the text.
556A
RET C9
RETurn to the caller with the destination text at 59DAH.
556B
INC HL 23
INCrement Register Pair HL past a space before the destination.
556C
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
556D
CP 0DH FE 0D
Compare Register A against 0DH, the end of the command line.
556F
RET Z C8
RETurn if the Z FLAG is set: nothing was typed after the source.
5570
CP 20H FE 20
Compare Register A against 20H, a space before the destination.
5572
If the Z FLAG is set (a space), LOOP BACK to 556BH to skip it.
5574
DEC HL 2B
DECrement Register Pair HL to the character before: @FSPEC stepped past the character it stopped at.
5575
LD B,20H 06 20
Load Register B with 20H, the 32 characters a control block holds.
5577
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5578
CP 61H FE 61
Compare Register A against 61H, a small a, the first small letter.
557A
If the CARRY FLAG is set (below a), JUMP to 5582H to store it as it is.
557C
CP 7BH FE 7B
Compare Register A against 7BH, one above a small z.
557E
If the NO CARRY FLAG is set (above z), JUMP to 5582H to store it as it is.
5580
RES 5,A CB AF
Clear bit 5 of Register A: the small letter becomes a capital.
5582
LD (DE),A 12
Store Register A (the character) at Register Pair DE.
5583
CP 0DH FE 0D
Compare Register A against 0DH, the end of the line.
5585
RET Z C8
RETurn if the Z FLAG is set: the text has ended.
5586
CP 28H FE 28
Compare Register A against 28H, the bracket that starts the parameters.
5588
RET Z C8
RETurn if the Z FLAG is set: the text has ended at the parameters.
5589
INC HL 23
INCrement Register Pair HL to the next character of the text.
558A
INC DE 13
INCrement Register Pair DE to the next place in 59DAH.
558B
DECrement Register B (the places left) and LOOP BACK to 5577H while there is room.
558D
RET C9
RETurn to the caller with 32 characters copied.

558EH - Complete the Destination from the Source

A destination that is missing, or starts with a digit, is refused (Destination spec required). A destination that starts with something other than a letter (/EXT, .PW, :d) gets the source's name put in front of it; then a missing extension (after /) and a missing password (after .) are taken from the source when it has them. The source's characters are put in at the place in the destination text, the rest of it moved up.

558E
LD HL,5986H 21 86 59
Point Register Pair HL to 5986H, the source's specification.
5591
LD DE,59DAH 11 DA 59
Point Register Pair DE to 59DAH, the destination's specification.
5594
LD A,(DE) 1A
Fetch the first character of the destination at Register Pair DE into Register A.
5595
CP 0DH FE 0D
Compare Register A against 0DH, ENTER: no destination was typed.
5597
If the Z FLAG is set (none), JUMP to 582FH to display Destination spec required.
559A
CP 30H FE 30
Compare Register A against 30H, the digit 0, the first digit.
559C
If the CARRY FLAG is set (below 0, such as / or .), JUMP to 55A3H.
559E
CP 3AH FE 3A
Compare Register A against 3AH, the colon after the digit 9.
55A0
If the CARRY FLAG is set (a digit), JUMP to 582FH to display Destination spec required.
55A3
PUSH DE D5
Save Register Pair DE (59DAH, the destination) to the stack.
55A4
LD A,(DE) 1A
Fetch the first character of the destination at Register Pair DE into Register A.
55A5
CP 41H FE 41
Compare Register A against 41H, the letter A.
55A7
If the CARRY FLAG is set (not a letter, so no name), GOSUB to 55DEH to put the source's name in front.
55AA
LD B,2FH 06 2F
Load Register B with 2FH, the slash before an extension.
55AC
GOSUB to 55B7H to add the source's extension when the destination has none.
55AF
LD B,2EH 06 2E
Load Register B with 2EH, the full stop before a password.
55B1
GOSUB to 55B7H to add the source's password when the destination has none.
55B4
POP DE D1
Restore Register Pair DE (59DAH) from the stack.
55B5
RET C9
RETurn to the caller with the destination complete.
55B6
INC DE 13
INCrement Register Pair DE to the next character of the destination.
55B7
LD A,(DE) 1A
Fetch the character of the destination at Register Pair DE into Register A.
55B8
CP B B8
Compare Register A against Register B, the separator looked for.
55B9
If the Z FLAG is set (the destination has this part), JUMP to 55C9H.
55BB
CP 41H FE 41
Compare Register A against 41H, the letter A.
55BD
If the NO CARRY FLAG is set (a letter or above), LOOP BACK to 55B6H.
55BF
CP 30H FE 30
Compare Register A against 30H, the digit 0, the first digit.
55C1
If the CARRY FLAG is set (below 0: another separator or the end), JUMP to 55CBH.
55C3
CP 3AH FE 3A
Compare Register A against 3AH, the colon after the digit 9.
55C5
If the CARRY FLAG is set (a digit), LOOP BACK to 55B6H.
55C7
JUMP to 55CBH: the colon or a character above it ends the part.
55C9
INC DE 13
INCrement Register Pair DE past the separator.
55CA
RET C9
RETurn to the caller: the destination has its own part.
55CB
PUSH HL E5
Save Register Pair HL (the place in the source) to the stack.
55CC
LD A,(HL) 7E
Fetch the character of the source at Register Pair HL into Register A.
55CD
INC HL 23
INCrement Register Pair HL to the next character of the source.
55CE
CP 03H FE 03
Compare Register A against 03H, the end mark of the source's specification.
55D0
If the Z FLAG is set (the source has no such part), JUMP to 55DCH.
55D2
CP 0DH FE 0D
Compare Register A against 0DH, an ENTER that can end it.
55D4
If the Z FLAG is set (the end), JUMP to 55DCH.
55D6
CP B B8
Compare Register A against Register B, the separator looked for.
55D7
If the NZ FLAG is set (not yet), LOOP BACK to 55CCH.
55D9
GOSUB to 55EAH to put the separator in Register A into the destination, then the source's characters after it.
55DC
POP HL E1
Restore Register Pair HL (the place in the source) from the stack.
55DD
RET C9
RETurn to the caller with the part added or not there.
55DE
LD A,(HL) 7E
Fetch the character of the source at Register Pair HL into Register A.
55DF
CP 30H FE 30
Compare Register A against 30H, the digit 0, the first digit.
55E1
RET C D8
RETurn if the CARRY FLAG is set: a separator or the end of the source's part.
55E2
CP 3AH FE 3A
Compare Register A against 3AH, the colon after the digit 9.
55E4
If the CARRY FLAG is set (a digit), JUMP to 55E9H to put it in.
55E6
CP 41H FE 41
Compare Register A against 41H, the letter A.
55E8
RET C D8
RETurn if the CARRY FLAG is set: a character between the digits and the letters.
55E9
INC HL 23
INCrement Register Pair HL to the next character of the source.
55EA
PUSH HL E5
Save Register Pair HL (the place in the source) to the stack.
55EB
LD H,D 62
Copy Register D (the high byte of the place in the destination) into Register H.
55EC
LD L,E 6B
Copy Register E (the low byte) into Register L: Register Pair HL = the place in the destination.
55ED
LD C,(HL) 4E
Fetch the character of the destination at Register Pair HL into Register C, to move it up.
55EE
LD (HL),A 77
Store Register A (the character put in) at Register Pair HL.
55EF
INC HL 23
INCrement Register Pair HL to the next place of the destination.
55F0
LD A,C 79
Copy Register C (the character moved up) into Register A.
55F1
CP 03H FE 03
Compare Register A against 03H, the end mark.
55F3
If the Z FLAG is set (the end mark), JUMP to 55F9H to store it.
55F5
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the other end mark.
55F7
If the NZ FLAG is set (not the end), LOOP BACK to 55EDH to move it up one place.
55F9
LD (HL),A 77
Store Register A (the end mark) at Register Pair HL.
55FA
POP HL E1
Restore Register Pair HL (the place in the source) from the stack.
55FB
INC DE 13
INCrement Register Pair DE past the character put in.
55FC
LOOP BACK to 55DEH for the next character of the source.

55FEH - Open a File or Device and Check Its Access

Register Pair DE = the control block holding a specification, Register Pair HL = the buffer, Register B = the record length, Register A = the low byte of the routine: 24H for @OPEN (4424H), 20H for @INIT (4420H). First the name to show is built at 59A6H: the specification up to its password or drive (a slash with no extension after it left out), then a colon and the drive (filled in after the open, 5679H) and 03H; a device keeps its name alone. After a good @INIT the drive is checked for write protection (@CKDRV). Access: a file opened with @OPEN needs a level below 6 (read), one made or opened with @INIT a level below 5 (write); otherwise it is closed and error 19H (file access denied) is reported.

55FE
PUSH AF F5
Save Register Pair AF (the routine's low byte) to the stack.
55FF
PUSH HL E5
Save Register Pair HL (the buffer) to the stack.
5600
PUSH DE D5
Save Register Pair DE (the control block) to the stack.
5601
LD HL,59A6H 21 A6 59
Point Register Pair HL to 59A6H, where the name to show is built.
5604
LD A,(DE) 1A
Fetch the next character of the specification at Register Pair DE into Register A.
5605
CP 2FH FE 2F
Compare Register A against 2FH, the slash before an extension.
5607
If the NZ FLAG is set (not a slash), JUMP to 5611H to copy the character.
5609
INC DE 13
INCrement Register Pair DE to the character after the slash.
560A
LD A,(DE) 1A
Fetch the character after the slash at Register Pair DE into Register A.
560B
CP 41H FE 41
Compare Register A against 41H, the letter A.
560D
If the CARRY FLAG is set (no extension follows), JUMP to 5611H: the slash is left out and this character copied.
560F
DEC DE 1B
DECrement Register Pair DE back to the slash.
5610
LD A,(DE) 1A
Fetch the slash at Register Pair DE into Register A again, to copy it.
5611
LD (HL),A 77
Store Register A (the character) at Register Pair HL in the name.
5612
INC HL 23
INCrement Register Pair HL to the next place of the name.
5613
INC DE 13
INCrement Register Pair DE to the next character of the specification.
5614
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 03H or 0DH, the end.
5616
If the CARRY FLAG is set (the end), JUMP to 5620H.
5618
CP 3AH FE 3A
Compare Register A against 3AH, the colon before the drive.
561A
If the Z FLAG is set (the drive), JUMP to 5620H.
561C
CP 2EH FE 2E
Compare Register A against 2EH, the full stop before a password, which is not shown.
561E
If the NZ FLAG is set (another character), LOOP BACK to 5604H.
5620
DEC HL 2B
DECrement Register Pair HL back to the character that ended the name.
5621
POP DE D1
Restore Register Pair DE (the control block) from the stack.
5622
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
5623
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5625
If the Z FLAG is set (a device), JUMP to 562EH: no drive is shown.
5627
LD (HL),3AH 36 3A
Store 3AH, a colon, at Register Pair HL, before the drive digit.
5629
INC HL 23
INCrement Register Pair HL to the place of the drive digit.
562A
LD (5687H),HL 22 87 56
Store Register Pair HL (the place of the drive digit) at 5687H, the operand of the LD (nnnn),A at 5686H.
562D
INC HL 23
INCrement Register Pair HL past the drive digit.
562E
LD (HL),03H 36 03
Store 03H, the end mark, at Register Pair HL.
5630
POP HL E1
Restore Register Pair HL (the buffer) from the stack.
5631
POP AF F1
Restore Register Pair AF (the routine's low byte) from the stack.
5632
LD (5636H),A 32 36 56
Store Register A at 5636H, the low byte of the operand of the CALL at 5635H: 4424H (@OPEN) or 4420H (@INIT).
5635
GOSUB to 4424H (@OPEN), or 4420H (@INIT) when 5632H stored 20H, to open the file at Register Pair DE with the buffer at Register Pair HL and record length Register B.
5638
PUSH AF F5
Save Register Pair AF (the result of the open) to the stack.
5639
GOSUB to 5679H to put the drive digit into the name: the NZ FLAG when the control block is an open file.
563C
If the Z FLAG is set (a device, or nothing open), JUMP to 5651H.
563E
LD A,(5636H) 3A 36 56
Fetch the routine's low byte from 5636H into Register A.
5641
CP 20H FE 20
Compare Register A against 20H, the low byte of @INIT.
5643
If the NZ FLAG is set (@OPEN), JUMP to 5651H.
5645
POP AF F1
Restore Register Pair AF (the result of @INIT) from the stack.
5646
PUSH AF F5
Save Register Pair AF (the result of @INIT) on the stack again.
5647
If the NZ FLAG is set (@INIT failed), JUMP to 5651H.
5649
GOSUB to 44B8H (@CKDRV) to test the drive Register C (from 5679H): the CARRY FLAG when its diskette is write protected.
564C
LD A,0FH 3E 0F
Load Register A with 0FH, the error number of a write protected disk. LD does not change the flags.
564E
If the CARRY FLAG is set (write protected), JUMP to 5810H to report error 0FH.
5651
POP AF F1
Restore Register Pair AF (the result of the open) from the stack.
5652
RET NZ C0
RETurn if the NZ FLAG is set: the open failed, Register A = the error.
5653
BIT 7,(IX+00H) DD CB 00 7E
Test bit 7 of +00H of the control block at IX+00H (Index Register IX = the control block, from 5679H): set for an open file.
5657
If the Z FLAG is set (a device), JUMP to 5677H: no access check.
5659
LD A,(IX+01H) DD 7E 01
Fetch +01H of the control block from IX+01H (Index Register IX = the control block) into Register A.
565C
AND 07H E6 07
AND 07H into Register A: bits 2-0, the access level the password gave.
565E
LD B,A 47
Copy Register A (the access level) into Register B.
565F
LD A,(5636H) 3A 36 56
Fetch the routine's low byte from 5636H into Register A.
5662
CP 20H FE 20
Compare Register A against 20H, the low byte of @INIT.
5664
LD A,B 78
Copy Register B (the access level) into Register A. LD does not change the flags.
5665
If the Z FLAG is set (@INIT, a file to write), JUMP to 5673H.
5667
CP 06H FE 06
Compare Register A against 06H: the CARRY FLAG is set for levels 0-5, which allow reading.
5669
If the CARRY FLAG is set (reading allowed), JUMP to 5677H.
566B
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE.
566E
LD A,19H 3E 19
Load Register A with 19H, the error number of file access denied.
5670
JUMP to 5810H to report error 19H (file access denied).
5673
CP 05H FE 05
Compare Register A against 05H: the NO CARRY FLAG is set for levels 5-7, which do not allow writing.
5675
If the NO CARRY FLAG is set (writing not allowed), JUMP BACK to 566BH to close the file and report error 19H.
5677
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG, opened.
5678
RET C9
RETurn to the caller with the file or device open.
5679
PUSH DE D5
Save Register Pair DE (the control block) to the stack, to move it into Index Register IX.
567A
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the control block.
567C
LD A,(DE) 1A
Fetch +00H of the control block at Register Pair DE into Register A.
567D
BIT 7,A CB 7F
Test bit 7 of Register A: set for an open file.
567F
RET Z C8
RETurn if the Z FLAG is set: a device or nothing open, no drive to show.
5680
LD A,(IX+06H) DD 7E 06
Fetch the file's drive from IX+06H (Index Register IX = the control block) into Register A.
5683
LD C,A 4F
Copy Register A (the drive) into Register C, for @CKDRV.
5684
ADD A,30H C6 30
ADD 30H to Register A: the drive number becomes its digit.
5686
LD (0000H),A 32 00 00
Store Register A (the digit) at the place of the drive digit in the name, the operand at 5687H-5688H (0000H in the file, set by 562AH).
5689
RET C9
RETurn to the caller with the NZ FLAG from the BIT above: an open file.
568A
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
568B
LD HL,59B6H 21 B6 59
Point Register Pair HL to 59B6H, the place of the source's name in the banner.
568E
JUMP to 5694H to copy the name to the source's place in the banner.
5690
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
5691
LD HL,59CAH 21 CA 59
Point Register Pair HL to 59CAH, the place of the destination's name in the banner.
5694
PUSH DE D5
Save Register Pair DE (the caller's value) to the stack.
5695
LD DE,59A6H 11 A6 59
Point Register Pair DE to 59A6H, the name just built by 55FEH.
5698
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 59A6H, Register Pair DE = the place in the banner.
5699
LD BC,000FH 01 0F 00
Load Register Pair BC with 000FH, the 15 bytes of a name.
569C
LDIR ED B0
Copy the 15 bytes from 59A6H at Register Pair HL to the banner at Register Pair DE (LDIR, Register Pair BC = the count).
569E
POP DE D1
Restore Register Pair DE (the caller's value) from the stack.
569F
POP HL E1
Restore Register Pair HL (the caller's value) from the stack.
56A0
RET C9
RETurn to the caller with the name in the banner.

56A1H - Display the Banner

Copying: (or Appending: for APPEND, 5211H), the source's name (59B6H), " to " and the destination's name (59C6H runs on into 59CAH), then ENTER.

56A1
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
56A2
PUSH DE D5
Save Register Pair DE (the caller's value) to the stack.
56A3
LD HL,583BH 21 3B 58
Point Register Pair HL to the first word of the banner, the operand at 56A4H: 583BH, Copying: , or 5845H, Appending: , stored by 5211H.
56A6
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, ended by 03H.
56A9
LD HL,59B6H 21 B6 59
Point Register Pair HL to 59B6H, the source's name.
56AC
GOSUB to 4467H (@DSPLY) to display the name at Register Pair HL, ended by 03H.
56AF
LD HL,59C6H 21 C6 59
Point Register Pair HL to 59C6H, " to " and the destination's name after it.
56B2
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, ended by the name's 03H.
56B5
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line.
56B7
GOSUB to the ROM at 0033H to display the character in Register A (0DH).
56BA
POP DE D1
Restore Register Pair DE (the caller's value) from the stack.
56BB
POP HL E1
Restore Register Pair HL (the caller's value) from the stack.
56BC
RET C9
RETurn to the caller with the banner shown on the screen.

56BDH - The Record Length of a File

Register Pair DE = the control block of a file just opened, whose directory sector is still at 4200H. Its directory record is the 32 byte slot of +07H AND E0H; Register A returns the record's +04H, the record length.

56BD
PUSH DE D5
Save Register Pair DE (the control block) to the stack, to move it into Index Register IX.
56BE
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the control block.
56C0
LD A,(IX+07H) DD 7E 07
Fetch the directory entry code from IX+07H (Index Register IX = the control block) into Register A.
56C3
AND E0H E6 E0
AND E0H into Register A: bits 7-5, the place of the record in its sector (32 bytes each).
56C5
ADD A,04H C6 04
ADD 04H to Register A: the offset of the record length.
56C7
LD L,A 6F
Copy Register A (the offset in the sector) into Register L.
56C8
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = the record +04H in the sector at 4200H.
56CA
LD A,(HL) 7E
Fetch the record length at Register Pair HL into Register A.
56CB
RET C9
RETurn to the caller with the record length in Register A.

56CCH - Keep the Source's Directory Bytes

Register Pair DE = the source's control block, its directory sector at 4200H. The record's +00H-+02H (attributes, flags and month, day and year) and +10H-+13H (the password hash and the time field) are copied to 5A1EH-5A24H for CLONE. Register Pair HL returns at the record +14H.

56CC
PUSH DE D5
Save Register Pair DE (the control block) to the stack, to move it into Index Register IX.
56CD
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the control block.
56CF
LD A,(IX+07H) DD 7E 07
Fetch the directory entry code from IX+07H (Index Register IX = the control block) into Register A.
56D2
AND E0H E6 E0
AND E0H into Register A: bits 7-5, the place of the record in its sector.
56D4
LD L,A 6F
Copy Register A (the offset of the record in the sector) into Register L.
56D5
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = the record in the sector at 4200H.
56D7
LD DE,5A1EH 11 1E 5A
Point Register Pair DE to 5A1EH, where the bytes are kept.
56DA
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the record's +00H-+02H.
56DD
LDIR ED B0
Copy the 3 bytes from the record at Register Pair HL to 5A1EH at Register Pair DE (LDIR, Register Pair BC = the count).
56DF
LD A,0DH 3E 0D
Load Register A with 0DH, the distance from +03H to +10H.
56E1
ADD A,L 85
ADD Register L (the low byte of the record +03H) to Register A.
56E2
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record +10H.
56E3
LD BC,0004H 01 04 00
Load Register Pair BC with 0004H, the record's +10H-+13H.
56E6
LDIR ED B0
Copy the 4 bytes from the record at Register Pair HL to 5A21H at Register Pair DE (LDIR, Register Pair BC = the count).
56E8
RET C9
RETurn to the caller with Register Pair HL at the record +14H.

56E9H - BREAK and the Pause

During a JCL job nothing is looked at (Z FLAG). Otherwise BREAK (KFLAG$ bit 0) returns the NZ FLAG; a pause (bit 1, SHIFT @) waits until BREAK (NZ) or another key than SHIFT @ (Z, the copy goes on).

56E9
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
56EC
AND 20H E6 20
AND 20H into Register A: bit 5, set while a JCL job runs.
56EE
XOR 20H EE 20
Exclusive OR 20H into Register A: the Z FLAG is set during a JCL job.
56F0
RET Z C8
RETurn if the Z FLAG is set: a JCL job is not stopped by the keys.
56F1
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
56F4
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed.
56F6
RET NZ C0
RETurn if the NZ FLAG is set: BREAK ends the copy.
56F7
BIT 1,A CB 4F
Test bit 1 of Register A: set when SHIFT @ asked for a pause.
56F9
RET Z C8
RETurn if the Z FLAG is set: no pause, the copy goes on.
56FA
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A again.
56FD
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed during the pause.
56FF
RET NZ C0
RETurn if the NZ FLAG is set: BREAK ends the copy.
5700
GOSUB to the ROM at 002BH (@KBD) to scan the keyboard: Register A = the key, 00H for none.
5703
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is pressed.
5704
If the Z FLAG is set (no key), LOOP BACK to 56FAH.
5706
CP 60H FE 60
Compare Register A against 60H, the code of SHIFT @ itself.
5708
If the Z FLAG is set (the pause key again), LOOP BACK to 56FAH.
570A
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG, the copy goes on.
570B
RET C9
RETurn to the caller after the pause, the copy going on.

570CH - The Diskette Prompts of X

570CH asks for the system diskette, but only for X on drive 0, where the system diskette has to come back for the overlays. 571EH asks for the source diskette and 5740H for the destination diskette until the GAT of the diskette in the drive has the 18 bytes kept for it (59FAH, 5A0CH). Without X each returns at once.

570C
LD A,(52D4H) 3A D4 52
Fetch the low byte of the X parameter from 52D4H into Register A.
570F
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given.
5710
RET Z C8
RETurn if the Z FLAG is set: no diskettes are changed.
5711
LD A,00H 3E 00
Load Register A with the drive of the X copy, the operand at 5712H (00H in the file, stored by 5309H).
5713
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for drive 1 or above.
5714
RET NZ C0
RETurn if the NZ FLAG is set: the system diskette stays in drive 0.
5715
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
5716
LD HL,58FBH 21 FB 58
Point Register Pair HL to 58FBH, the prompt Insert SYSTEM disk <ENTER>.
5719
GOSUB to 576EH to flash the prompt at Register Pair HL until ENTER is pressed.
571C
POP HL E1
Restore Register Pair HL (the caller's value) from the stack.
571D
RET C9
RETurn to the caller with the system diskette in.
571E
LD A,(52D4H) 3A D4 52
Fetch the low byte of the X parameter from 52D4H into Register A.
5721
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given.
5722
RET Z C8
RETurn if the Z FLAG is set: the source is in its drive.
5723
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
5724
LD HL,5919H 21 19 59
Point Register Pair HL to 5919H, the prompt Insert SOURCE disk in drive :d and press <ENTER>.
5727
GOSUB to 576EH to flash the prompt at Register Pair HL until ENTER is pressed.
572A
LD A,(5712H) 3A 12 57
Fetch the drive of the X copy from 5712H into Register A.
572D
LD C,A 4F
Copy Register A (the drive) into Register C for the GAT read.
572E
GOSUB to 57EDH to read the GAT of drive Register C into 4200H.
5731
LD HL,42CEH 21 CE 42
Point Register Pair HL to 42CEH, the GAT's +CEH: the diskette's password hash, name and date.
5734
LD DE,59FAH 11 FA 59
Point Register Pair DE to 59FAH, the source diskette's 18 bytes.
5737
LD B,12H 06 12
Load Register B with 12H, the 18 bytes to compare.
5739
GOSUB to 5762H to compare Register B bytes at Register Pair DE and Register Pair HL: the Z FLAG when they are the same.
573C
POP HL E1
Restore Register Pair HL from the stack. POP does not change the flags.
573D
If the NZ FLAG is set (another diskette), LOOP BACK to 571EH to ask again.
573F
RET C9
RETurn to the caller with the source diskette in.
5740
LD A,(52D4H) 3A D4 52
Fetch the low byte of the X parameter from 52D4H into Register A.
5743
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given.
5744
RET Z C8
RETurn if the Z FLAG is set: the destination is in its drive.
5745
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
5746
LD HL,594DH 21 4D 59
Point Register Pair HL to 594DH, the prompt Insert DESTINATION disk in drive :d and press <ENTER>.
5749
GOSUB to 576EH to flash the prompt at Register Pair HL until ENTER is pressed.
574C
LD A,(5712H) 3A 12 57
Fetch the drive of the X copy from 5712H into Register A.
574F
LD C,A 4F
Copy Register A (the drive) into Register C for the GAT read.
5750
GOSUB to 57EDH to read the GAT of drive Register C into 4200H.
5753
LD HL,42CEH 21 CE 42
Point Register Pair HL to 42CEH, the GAT's +CEH: the diskette's password hash, name and date.
5756
LD DE,5A0CH 11 0C 5A
Point Register Pair DE to 5A0CH, the destination diskette's 18 bytes.
5759
LD B,12H 06 12
Load Register B with 12H, the 18 bytes to compare.
575B
GOSUB to 5762H to compare Register B bytes at Register Pair DE and Register Pair HL: the Z FLAG when they are the same.
575E
POP HL E1
Restore Register Pair HL from the stack. POP does not change the flags.
575F
If the NZ FLAG is set (another diskette), LOOP BACK to 5740H to ask again.
5761
RET C9
RETurn to the caller with the destination diskette in.
5762
LD A,(DE) 1A
Fetch the byte at Register Pair DE into Register A.
5763
CP (HL) BE
Compare Register A against the byte at Register Pair HL.
5764
RET NZ C0
RETurn if the NZ FLAG is set: the bytes differ.
5765
INC HL 23
INCrement Register Pair HL to the next byte to compare.
5766
INC DE 13
INCrement Register Pair DE to the next byte to compare.
5767
DECrement Register B (the bytes left) and LOOP BACK to 5762H until all are compared.
5769
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG, the same.
576A
RET C9
RETurn to the caller with the Z FLAG set: the bytes are the same.

576BH - Flash a Prompt until ENTER

Waits until BREAK and ENTER are let go, then shows the prompt at Register Pair HL (it ends with 1DH, the cursor back to the start of the line) and erases it with 1EH, again and again, while KFLAG$ is watched: BREAK ends the command with Transfer aborted through @ABORT; ENTER clears the keys and returns to the caller of 576EH.

576B
GOSUB to 57B0H to clear bits 2-0 of KFLAG$ (ENTER, pause, BREAK), which the keyboard scan sets again while the key is held.
576E
LD BC,41FDH 01 FD 41
Load Register Pair BC with 41FDH, the count of the ROM's delay loop.
5771
GOSUB to the ROM at 0060H (@PAUSE) to wait Register Pair BC turns of its delay loop.
5774
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
5777
AND 05H E6 05
AND 05H into Register A: bit 0 (BREAK) and bit 2 (ENTER).
5779
If the NZ FLAG is set (still held), LOOP BACK to 576BH to wait.
577B
GOSUB to 57B0H to clear bits 2-0 of KFLAG$ before the prompt is shown.
577E
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL; its 1DH puts the cursor back to the start of the line.
5781
LD BC,4000H 01 00 40
Load Register Pair BC with 4000H, the time the prompt is shown.
5784
GOSUB to 5794H to wait Register Pair BC turns while watching BREAK and ENTER.
5787
LD A,1EH 3E 1E
Load Register A with 1EH, the code that erases to the end of the line.
5789
GOSUB to the ROM at 0033H to display the character in Register A (1EH): the prompt goes off.
578C
LD BC,3333H 01 33 33
Load Register Pair BC with 3333H, the time the prompt is off.
578F
GOSUB to 5794H to wait Register Pair BC turns while watching BREAK and ENTER.
5792
LOOP BACK to 577EH to show the prompt again, until ENTER or BREAK.
5794
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
5797
RRCA 0F
Rotate Register A right (RRCA): bit 0 (BREAK) goes into the CARRY FLAG and bit 2 (ENTER) moves to bit 1.
5798
If the CARRY FLAG is set (BREAK), JUMP to 57B9H to end with Transfer aborted.
579A
BIT 1,A CB 4F
Test bit 1 of Register A, which is bit 2 of KFLAG$: ENTER was pressed.
579C
If the NZ FLAG is set (ENTER), JUMP to 57A4H.
579E
DEC BC 0B
DECrement Register Pair BC, the turns of the wait left.
579F
LD A,B 78
Copy Register B (the high byte of the count) into Register A.
57A0
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set at the end of the wait.
57A1
If the NZ FLAG is set (turns left), LOOP BACK to 5794H.
57A3
RET C9
RETurn to the flashing loop at the end of the wait.
57A4
POP AF F1
Restore Register Pair AF from the stack: the return address into the flashing loop is dropped, so the RET below goes back to the caller of 576EH.
57A5
GOSUB to the ROM at 002BH (@KBD) to take a key from the keyboard into Register A.
57A8
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is left.
57A9
If the NZ FLAG is set (a key), LOOP BACK to 57A5H to take the next one.
57AB
LD A,1EH 3E 1E
Load Register A with 1EH, the code that erases to the end of the line.
57AD
GOSUB to the ROM at 0033H to display the character in Register A (1EH): the prompt is erased.
57B0
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
57B3
AND F8H E6 F8
AND F8H into Register A: bits 2-0 (ENTER, pause, BREAK) cleared.
57B5
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, with bits 2-0 cleared.
57B8
RET C9
RETurn to the caller with the keys of KFLAG$ cleared.
57B9
LD HL,5885H 21 85 58
Point Register Pair HL to 5885H, the message Transfer aborted.
57BC
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
57BF
GOSUB to 570CH to ask for the system diskette back when X uses drive 0.
57C2
JUMP to 4030H (@ABORT) to end the command and any JCL job.

57C5H - Three Overlay Loads, a Device Test, the Date Layout Test and the GAT Read

57C5H, 57C8H and 57CBH each issue one request whose function does nothing (00H): the supervisor loads SYS2/SYS (84H), SYS8/SYS (8AH) or SYS3/SYS (85H) into 4E00H, where the next open, write or close then finds it, which matters while another diskette than the system diskette is in drive 0. The supervisor drops the RST's return address, so each returns to its caller. 57CEH tests for a device; 57DAH for the date layout of a drive; 57EDH reads a GAT.

57C5
LD A,84H 3E 84
Load Register A with 84H, a request to SYS2/SYS with function 00H.
57C7
RST 28H EF
RST 28H: the supervisor loads SYS2/SYS and returns to the caller of 57C5H.
57C8
LD A,8AH 3E 8A
Load Register A with 8AH, a request to SYS8/SYS with function 00H.
57CA
RST 28H EF
RST 28H: the supervisor loads SYS8/SYS and returns to the caller of 57C8H.
57CB
LD A,85H 3E 85
Load Register A with 85H, a request to SYS3/SYS with function 00H.
57CD
RST 28H EF
RST 28H: the supervisor loads SYS3/SYS and returns to the caller of 57CBH.
57CE
LD A,(5986H) 3A 86 59
Fetch the first character of the source at 5986H into Register A.
57D1
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
57D3
RET Z C8
RETurn if the Z FLAG is set: the source is a device.
57D4
LD A,(59DAH) 3A DA 59
Fetch the first character of the destination at 59DAH into Register A.
57D7
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
57D9
RET C9
RETurn with the Z FLAG set when the destination is a device.
57DA
AND 07H E6 07
AND 07H into Register A: the drive number, 0 to 7.
57DC
LD B,A 47
Copy Register A (the drive number) into Register B.
57DD
INC B 04
INCrement Register B: the count, the drive plus 1.
57DE
LD A,3FH 3E 3F
Load Register A with 3FH, which is 47H less 8, for the first turn.
57E0
ADD A,08H C6 08
ADD 08H to Register A, once for each turn of Register B.
57E2
DECrement Register B and LOOP BACK to 57E0H: Register A = 47H + 8 x the drive, the second byte of BIT n,A for bit n = the drive.
57E4
LD (57EBH),A 32 EB 57
Store Register A at 57EBH, the second byte of the instruction at 57EAH, which becomes BIT drive,A.
57E7
LD A,(475DH) 3A 5D 47
Fetch the drive flags from 475DH into Register A: a bit set for each drive whose diskettes keep the time in +12H-+13H of a directory record.
57EA
RLC B CB 00
Rotate Register B left (RLC B, CB 00H in the file); 57E4H makes it BIT drive,A, the drive's bit of Register A (475DH).
57EC
RET C9
RETurn: the NZ FLAG when the drive's bit is set.
57ED
PUSH DE D5
Save Register Pair DE (the caller's value) to the stack.
57EE
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
57EF
GOSUB to 4B65H (DIRCYL) to fetch the directory cylinder of drive Register C into Register D.
57F2
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, SBUFF$, the buffer.
57F5
LD E,L 5D
Copy Register L (00H) into Register E: sector 0, the GAT.
57F6
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL.
57F9
POP HL E1
Restore Register Pair HL (the caller's value) from the stack.
57FA
POP DE D1
Restore Register Pair DE (the caller's value) from the stack.
57FB
RET Z C8
RETurn if the Z FLAG is set: the GAT is at 4200H.
57FC
LD A,14H 3E 14
Load Register A with 14H, the error number of a GAT read error.
57FE
RET C9
RETurn with the NZ FLAG and Register A = 14H.

57FFH - Open the Source or the Destination

57FFH opens the control block at Register Pair DE with @INIT (20H); 5803H the source (5986H) and 5806H the control block at Register Pair DE with @OPEN (24H), at 5B00H; 580CH with the routine named by Register A. Register B = Register L, 00H: records of 256. A failure goes to the error report.

57FF
LD A,20H 3E 20
Load Register A with 20H, the low byte of 4420H (@INIT).
5801
JUMP to 580BH to open with records of 256 bytes.
5803
LD DE,5986H 11 86 59
Point Register Pair DE to 5986H, the source's control block.
5806
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the buffer of the file to open.
5809
LD A,24H 3E 24
Load Register A with 24H, the low byte of 4424H (@OPEN).
580B
LD B,L 45
Copy Register L (00H) into Register B: records of 256.
580C
GOSUB to 55FEH to open the control block at Register Pair DE with the routine 44xxH named by Register A and check its access.
580F
RET Z C8
RETurn if the Z FLAG is set: the file or device is open.

5810H - Errors and the Message Selector

5810H reports the error number in Register A (5816H: error 2CH, parameter error) through @ERROR, after asking for the system diskette back for X on drive 0. 581FH and the four entries below it are a chain of LD IX instructions whose DD prefixes make each entry but the one jumped to a dead load, so entering at 581FH, 5823H, 5827H, 582BH or 582FH loads Register Pair HL with one message. Each ends the command with Register Pair HL = FFFFH.

5810
PUSH AF F5
Save Register Pair AF (the error number) to the stack.
5811
GOSUB to 570CH to ask for the system diskette back when X uses drive 0, so that SYS4/SYS can be loaded.
5814
POP AF F1
Restore Register Pair AF (the error number) from the stack.
5815
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH. On the way from 5814H this only covers the bytes 3EH 2CH: a JP to 5816H runs them as LD A,2CH, the error number of a parameter error. Register Pair BC is not used afterwards.
5818
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
581A
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
581D
JUMP to 5835H to end the command with Register Pair HL = FFFFH.
581F
LD HL,58D1H 21 D1 58
Point Register Pair HL to 58D1H, the message Source and destination disks are the same (from 5393H).
5822
LD IX,5897H DD 21 97 58
Load Index Register IX with 5897H. The bytes DD 21 97 58 make this a dead load of Index Register IX on fall-through; entering at 5823H runs 21 97 58 as LD HL,5897H, the message File spec required.
5826
LD IX,58AAH DD 21 AA 58
Load Index Register IX with 58AAH. Entering at 5827H runs 21 AA 58 as LD HL,58AAH, the message Invalid command during <DO> processing.
582A
LD IX,5851H DD 21 51 58
Load Index Register IX with 5851H. Entering at 582BH runs 21 51 58 as LD HL,5851H, the message Files have different LRLs.
582E
LD IX,586BH DD 21 6B 58
Load Index Register IX with 586BH. Entering at 582FH runs 21 6B 58 as LD HL,586BH, the message Destination spec required.
5832
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5835
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5838
JUMP to 5489H to put the stack back and end the command with Register Pair HL = FFFFH.

583BH - COPY Data: the Messages

The two banner words end with 03H so that the name follows on the same line; the error messages end with 0DH; the four prompts start with 1DH 1EH (the cursor to the start of the line, the line erased) and end with 1DH 03H, so that 1EH can erase them again (576BH). The drive digit of the last two is written by 530EH and 5311H.

583B-5843
DEFM "Copying: " 43 6F 70 79 69 6E 67 3A 20
The first word of the banner of COPY (56A3H).
5844
DEFB 03H 03
03H, the end of Copying: , so that the source's name follows it.
5845-584F
DEFM "Appending: " 41 70 70 65 6E 64 69 6E 67 3A 20
The first word of the banner of APPEND (5211H stores its address at 56A4H).
5850
DEFB 03H 03
03H, the end of Appending: , so that the source's name follows it.
5851-5869
DEFM "Files have different LRLs" 46 69 6C 65 73 20 68 61 76 65 20 64 69 66 66 65 72 65 6E 74 20 4C 52 4C 73
The message of 582BH: APPEND found two record lengths (5262H).
586A
DEFB 0DH 0D
0DH, the end of the message Files have different LRLs.
586B-5883
DEFM "Destination spec required" 44 65 73 74 69 6E 61 74 69 6F 6E 20 73 70 65 63 20 72 65 71 75 69 72 65 64
The message of 582FH: no destination, one starting with a digit, or the source itself (5597H, 55A0H, 53BDH).
5884
DEFB 0DH 0D
0DH, the end of the message Destination spec required.
5885
DEFB 1DH 1D
1DH, the cursor to the start of the line, over the flashing prompt that BREAK ended (57B9H).
5886-5895
DEFM "Transfer aborted" 54 72 61 6E 73 66 65 72 20 61 62 6F 72 74 65 64
The message of 57B9H: BREAK at a diskette prompt.
5896
DEFB 0DH 0D
0DH, the end of the message Transfer aborted.
5897-58A8
DEFM "File spec required" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64
The message of 5823H: no source, a device given to APPEND as the destination or to X.
58A9
DEFB 0DH 0D
0DH, the end of the message File spec required.
58AA-58CF
DEFM "Invalid command during <DO> processing" 49 6E 76 61 6C 69 64 20 63 6F 6D 6D 61 6E 64 20 64 75 72 69 6E 67 20 3C 44 4F 3E 20 70 72 6F 63 65 73 73 69 6E 67
The message of 5827H: X during a JCL job (52EAH).
58D0
DEFB 0DH 0D
0DH, the end of the message Invalid command during <DO> processing.
58D1-58F9
DEFM "Source and destination disks are the same" 53 6F 75 72 63 65 20 61 6E 64 20 64 65 73 74 69 6E 61 74 69 6F 6E 20 64 69 73 6B 73 20 61 72 65 20 74 68 65 20 73 61 6D 65
The message of 581FH: for X the destination diskette had the source's GAT bytes.
58FA
DEFB 0DH 0D
0DH, the end of the message Source and destination disks are the same.
58FB-58FC
DEFB 1DH, 1EH 1D 1E
The start of the prompt of 5716H: 1DH puts the cursor at the start of the line, 1EH erases it.
58FD-5916
DEFM "Insert SYSTEM disk <ENTER>" 49 6E 73 65 72 74 20 53 59 53 54 45 4D 20 64 69 73 6B 20 3C 45 4E 54 45 52 3E
The prompt for the system diskette (X on drive 0).
5917-5918
DEFB 1DH, 03H 1D 03
1DH, the cursor back to the start of the line, and 03H, the end of the prompt.
5919-591A
DEFB 1DH, 1EH 1D 1E
The start of the prompt of 5322H and 5724H: the cursor to the start of the line, the line erased.
591B-5937
DEFM "Insert SOURCE disk in drive :" 49 6E 73 65 72 74 20 53 4F 55 52 43 45 20 64 69 73 6B 20 69 6E 20 64 72 69 76 65 20 3A
The prompt for the source diskette, up to the drive.
5938
DEFM "0" 30
The drive digit of the prompt, written by 530EH.
5939-594A
DEFM " and press <ENTER>" 20 61 6E 64 20 70 72 65 73 73 20 3C 45 4E 54 45 52 3E
The end of the prompt for the source diskette.
594B-594C
DEFB 1DH, 03H 1D 03
1DH, the cursor back to the start of the line, and 03H, the end of the prompt.
594D-594E
DEFB 1DH, 1EH 1D 1E
The start of the prompt of 5369H and 5746H: the cursor to the start of the line, the line erased.
594F-5970
DEFM "Insert DESTINATION disk in drive :" 49 6E 73 65 72 74 20 44 45 53 54 49 4E 41 54 49 4F 4E 20 64 69 73 6B 20 69 6E 20 64 72 69 76 65 20 3A
The prompt for the destination diskette, up to the drive.
5971
DEFM "0" 30
The drive digit of the prompt, written by 5311H.
5972-5983
DEFM " and press <ENTER>" 20 61 6E 64 20 70 72 65 73 73 20 3C 45 4E 54 45 52 3E
The end of the prompt for the destination diskette.
5984-5985
DEFB 1DH, 03H 1D 03
1DH, the cursor back to the start of the line, and 03H, the end of the prompt.

5986H - COPY Data: the Control Blocks and the Names

The work areas above the code. Only " to " at 59C6H-59C9H is loaded from the file.

5986-59A5
DEFS 32
The source's control block: @FSPEC writes its specification here (521BH, 52BBH), @OPEN makes it the open file's block (+03H-+04H the buffer, +06H the drive, +07H the directory entry, +08H the end of file byte, +09H the record length, +0CH-+0DH the ending record number). Not loaded from the file.
59A6-59B5
DEFS 16
The name to show, built by 55FEH from the specification and the drive. Not loaded from the file.
59B6-59C5
DEFS 16
The source's name in the banner, copied by 568AH. Not loaded from the file.
59C6-59C9
DEFM " to " 20 74 6F 20
The word between the two names of the banner (56AFH), followed at once by the destination's name.
59CA-59D9
DEFS 16
The destination's name in the banner, copied by 5690H. Not loaded from the file.
59DA-59F9
DEFS 32
The destination's control block: its specification from @FSPEC or as typed (5564H), completed by 558EH, then the open file's block. Not loaded from the file.
59FA-5A0B
DEFS 18
For X: the source diskette's GAT bytes +CEH-+DFH (the password hash, the name and the date), copied by 5332H. Not loaded from the file.
5A0C-5A1D
DEFS 18
For X: the destination diskette's GAT bytes +CEH-+DFH, copied by 537CH. Not loaded from the file.
5A1E-5A24
DEFS 7
The source's directory record +00H-+02H and +10H-+13H, kept by 56CCH for CLONE (5453H). Not loaded from the file.

5A25H - COPY Data: the Parameter Table

The table @PARAM reads: COPY from 5A25H (52CAH), APPEND from 5A4DH (5232H), so APPEND knows only STRIP and ECHO. Ten entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H. Each address is the operand of an instruction that uses the value; the short form of each keyword names the same address.

5A25-5A2C
DEFM "LRL " / DEFW 5359H 4C 52 4C 20 20 20 59 53
LRL: its value goes to 5359H-535AH, the operand of the LD BC at 5358H (FF00H in the file).
5A2D-5A34
DEFM "L " / DEFW 5359H 4C 20 20 20 20 20 59 53
L, the short form of LRL: its value goes to 5359H-535AH too.
5A35-5A3C
DEFM "CLONE " / DEFW 544BH 43 4C 4F 4E 45 20 4B 54
CLONE: its value goes to 544BH-544CH, the operand of the LD DE at 544AH (FFFFH in the file: on).
5A3D-5A44
DEFM "C " / DEFW 544BH 43 20 20 20 20 20 4B 54
C, the short form of CLONE: its value goes to 544BH-544CH too.
5A45-5A4C
DEFM "X " / DEFW 52D4H 58 20 20 20 20 20 D4 52
X: its value goes to 52D4H-52D5H, the operand of the LD DE at 52D3H.
5A4D-5A54
DEFM "STRIP " / DEFW 5269H 53 54 52 49 50 20 69 52
STRIP: its value goes to 5269H-526AH, the operand of the LD DE at 5268H. APPEND's table starts here.
5A55-5A5C
DEFM "S " / DEFW 5269H 53 20 20 20 20 20 69 52
S, the short form of STRIP: its value goes to 5269H-526AH too.
5A5D-5A64
DEFM "ECHO " / DEFW 5545H 45 43 48 4F 20 20 45 55
ECHO: its value goes to 5545H-5546H, the operand of the LD DE at 5544H.
5A65-5A6C
DEFM "E " / DEFW 5545H 45 20 20 20 20 20 45 55
E, the short form of ECHO: its value goes to 5545H-5546H too.
5A6D
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.

5200H - Member 8 (LIST): Entry, Parameters and the File

The LIST command (library member 41H), loaded at 5200H-563BH. It lists a file on the screen, or with P on the printer, as text (ASCII) or with HEX as records in hexadecimal and characters. The parameters (table 55C2H) are read only when a bracket follows; their values go straight into the operands that use them. The file is opened with the extension TXT added when it has none, and when that file is not found, as typed. Its control block is 564CH (a copy of the specification at 566CH), its buffer 5700H.

5200
LD (538BH),SP ED 73 8B 53
Store the Stack Pointer at 538BH, the operand of the LD SP at 538AH: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
GOSUB to 5548H to clear bits 2-0 of KFLAG$ (ENTER, pause, BREAK).
5207
PUSH HL E5
Save Register Pair HL (the parameters of the command) to the stack.
5208
LD A,(HL) 7E
Fetch the next character of the command line at Register Pair HL into Register A.
5209
CP 28H FE 28
Compare Register A against 28H, the bracket that starts the parameters.
520B
If the Z FLAG is set (a bracket), JUMP to 5214H to read the parameters.
520D
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH, the end of the line.
520F
If the CARRY FLAG is set (no parameters), JUMP to 522FH: the cells keep their values from the file.
5211
INC HL 23
INCrement Register Pair HL to the next character of the line.
5212
LOOP BACK to 5208H to look for the bracket of the parameters.
5214
LD DE,55C2H 11 C2 55
Point Register Pair DE to 55C2H, the parameter table of LIST.
5217
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names, a keyword alone storing FFFFH.
521A
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5583H to report error 2CH (parameter error).
521D
LD HL,FFFFH 21 FF FF
Load Register Pair HL with the C parameter, the operand at 521EH-521FH: FFFFH in the file (the compressed hexadecimal layout), 0000H when C=N or C=OFF was given.
5220
LD A,H 7C
Copy Register H (the high byte of C) into Register A.
5221
OR L B5
OR Register L (the low byte) into Register A: 00H when C is off.
5222
LD (53F4H),A 32 F4 53
Store Register A at 53F4H, the operand of the LD A at 53F3H: not 00H leaves out the space after each byte.
5225
LD (5412H),A 32 12 54
Store Register A at 5412H, the operand of the LD A at 5411H, which chooses the layout of the characters.
5228
If the Z FLAG is set (C off), JUMP to 522FH: the bytes are grouped by eight.
522A
LD A,03H 3E 03
Load Register A with 03H, the mask for groups of four.
522C
LD (53FBH),A 32 FB 53
Store Register A (03H) at 53FBH, the operand of the AND at 53FAH (07H in the file): the bytes are grouped by four.
522F
POP HL E1
Restore Register Pair HL (the parameters) from the stack.
5230
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5231
INC HL 23
INCrement Register Pair HL past the character just fetched.
5232
CP 20H FE 20
Compare Register A against 20H, a space before the specification.
5234
If the Z FLAG is set (a space), LOOP BACK to 5230H to skip it.
5236
DEC HL 2B
DECrement Register Pair HL back to the first character of the file's specification.
5237
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
523A
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL to Register Pair DE (564CH); the NZ FLAG when there is none.
523D
If the NZ FLAG is set (no file), JUMP to 558CH to display File spec required!.
5240
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
5241
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5243
If the Z FLAG is set (a device), JUMP to 558CH to display File spec required!: LIST lists only files.
5246
PUSH HL E5
Save Register Pair HL (the command line) to the stack.
5247
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
524A
LD DE,566CH 11 6C 56
Point Register Pair DE to 566CH, where the specification is kept.
524D
LD HL,564CH 21 4C 56
Point Register Pair HL to 564CH, the specification.
5250
PUSH HL E5
Save Register Pair HL (564CH, the control block) to the stack.
5251
LDIR ED B0
Copy the 32 bytes from 564CH at Register Pair HL to 566CH at Register Pair DE (LDIR, Register Pair BC = the count).
5253
POP DE D1
Restore Register Pair DE (564CH) from the stack.
5254
LD HL,55BFH 21 BF 55
Point Register Pair HL to 55BFH, the extension TXT.
5257
GOSUB to 4473H (@FEXT) to add the extension at Register Pair HL to the specification at Register Pair DE when it has none.
525A
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the file's buffer.
525D
LD B,L 45
Copy Register L (00H) into Register B: records of 256.
525E
GOSUB to 4424H (@OPEN) to open the file at Register Pair DE with the buffer at Register Pair HL and record length Register B.
5261
If the Z FLAG is set (the file is open), JUMP to 527EH.
5263
CP 18H FE 18
Compare Register A (the error) against 18H, file not in directory.
5265
If the NZ FLAG is set (another error), JUMP to 5585H to report the error in Register A.
5268
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
526B
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the control block.
526E
PUSH DE D5
Save Register Pair DE (564CH, the control block) to the stack.
526F
LD HL,566CH 21 6C 56
Point Register Pair HL to 566CH, the specification as typed.
5272
LDIR ED B0
Copy the 32 bytes from 566CH at Register Pair HL back to 564CH at Register Pair DE (LDIR, Register Pair BC = the count): the name without TXT.
5274
POP DE D1
Restore Register Pair DE (564CH) from the stack.
5275
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the file's buffer.
5278
GOSUB to 4424H (@OPEN) to open the file at Register Pair DE with the buffer at Register Pair HL and record length Register B (00H, left by the LDIR).
527B
If the NZ FLAG is set (the open failed), JUMP to 5585H to report the error in Register A.

527EH - Record Length, TAB, Device and Mode

The record length comes from LRL; the test that would take the file's own from its directory record gives the Z FLAG only for an LRL of FFFEH, so with LRL not given (FF00H) it is 00H, 256. TAB (8 when given alone) must be 1-32. P lists on the printer (PRDCB$) without stopping, else on the screen (DODCB$). HEX goes to 5399H. For text the page is 15 lines and the screen is not cleared between pages; LINE skips to its line first.

527E
PUSH DE D5
Save Register Pair DE (564CH, the control block) to the stack, to move it into Index Register IX.
527F
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the file's control block.
5281
LD HL,(53B9H) 2A B9 53
Fetch the LRL parameter from 53B9H-53BAH, the operand of the LD BC at 53B8H (FF00H in the file), into Register Pair HL.
5284
INC L 2C
INCrement Register L (the low byte of the LRL cell).
5285
LD A,H 7C
Copy Register H (the high byte) into Register A.
5286
AND L A5
AND Register L (the low byte plus 1) into Register A.
5287
INC A 3C
INCrement Register A: the Z FLAG is set only when Register H was FFH and Register L FEH.
5288
If the NZ FLAG is set (every value but FFFEH), JUMP to 5298H to use the LRL cell as it is.
528A
LD A,(IX+07H) DD 7E 07
Fetch the directory entry code from IX+07H (Index Register IX = the control block) into Register A.
528D
AND E0H E6 E0
AND E0H into Register A: bits 7-5, the place of the record in its sector at 4200H.
528F
ADD A,04H C6 04
ADD 04H to Register A: the offset of the record length.
5291
LD L,A 6F
Copy Register A (the offset of the record length) into Register L.
5292
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = the record +04H at 4200H.
5294
LD A,(HL) 7E
Fetch the file's record length at Register Pair HL into Register A.
5295
LD (53B9H),A 32 B9 53
Store Register A (the record length) at 53B9H, the LRL cell.
5298
LD A,(53B9H) 3A B9 53
Fetch the low byte of the LRL cell from 53B9H into Register A: 00H (256) unless LRL was given.
529B
LD (IX+09H),A DD 77 09
Store Register A (the record length) at IX+09H (Index Register IX = the control block), +09H, the record length the hexadecimal listing counts.
529E
SET 7,(IX+01H) DD CB 01 FE
Set bit 7 of +01H at IX+01H (Index Register IX = the control block): the file is read byte by byte.
52A2
LD HL,(5343H) 2A 43 53
Fetch the TAB parameter from 5343H-5344H, the operand of the LD DE at 5342H (0008H in the file), into Register Pair HL.
52A5
LD A,H 7C
Copy Register H (the high byte) into Register A.
52A6
AND L A5
AND Register L (the low byte) into Register A.
52A7
INC A 3C
INCrement Register A: the Z FLAG is set for FFFFH, TAB given without a value.
52A8
LD A,L 7D
Copy Register L (the low byte of TAB) into Register A. LD does not change the flags.
52A9
If the NZ FLAG is set (a value), JUMP to 52ADH with Register A = the tab width.
52AB
LD A,08H 3E 08
Load Register A with 08H, the tab width of TAB alone.
52AD
LD (534DH),A 32 4D 53
Store Register A (the tab width) at 534DH, the operand of the LD C at 534CH.
52B0
DEC A 3D
DECrement Register A: a width of 0 becomes FFH.
52B1
CP 20H FE 20
Compare Register A against 20H: the NO CARRY FLAG is set for a width of 0 or above 32.
52B3
If the NO CARRY FLAG is set (a bad width), JUMP to 5583H to report error 2CH (parameter error).
52B6
LD BC,0000H 01 00 00
Load Register Pair BC with the P parameter, the operand at 52B7H-52B8H: 0000H in the file, FFFFH when P was given.
52B9
LD A,B 78
Copy Register B (the high byte of P) into Register A.
52BA
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when P was not given, Register A = 00H.
52BB
LD DE,401DH 11 1D 40
Point Register Pair DE to 401DH, DODCB$, the screen's device control block. LD does not change the flags.
52BE
If the Z FLAG is set (no P), JUMP to 52CCH with Register A = 00H.
52C0
LD (54F6H),BC ED 43 F6 54
Store Register Pair BC (FFFFH) at 54F6H-54F7H, the N parameter: the printer listing does not stop.
52C4
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, the line end for the printer.
52C6
LD (547EH),A 32 7E 54
Store Register A (0DH) at 547EH, the operand of the LD A at 547DH (03H in the file): each hexadecimal line ends with ENTER on the printer.
52C9
LD DE,4025H 11 25 40
Point Register Pair DE to 4025H, PRDCB$, the printer's device control block.
52CC
LD (540DH),A 32 0D 54
Store Register A (00H for the screen, 0DH for the printer) at 540DH, the operand of the LD A at 540CH and the printer flag 54ECH reads.
52CF
LD (54CAH),DE ED 53 CA 54
Store Register Pair DE (the device control block) at 54CAH, the operand of the LD DE at 54C9H, where every character goes.
52D3
PUSH DE D5
Save Register Pair DE (the device control block) to the stack, for @MSG.
52D4
LD BC,0000H 01 00 00
Load Register Pair BC with the HEX parameter, the operand at 52D5H-52D6H: 0000H in the file, FFFFH when HEX (or H) was given.
52D7
LD A,B 78
Copy Register B (the high byte of HEX) into Register A.
52D8
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set for a text listing, Register A = 00H.
52D9
If the NZ FLAG is set (HEX was given), JUMP to 5399H for the hexadecimal listing.
52DC
LD (54F4H),A 32 F4 54
Store Register A (00H) at 54F4H over the PUSH DE there: a NOP, so that no ENTER is added at the start of each line of text.
52DF
LD (551EH),A 32 1E 55
Store Register A (00H) at 551EH over the POP AF there: a NOP, the PUSH being gone.
52E2
LD A,0FH 3E 0F
Load Register A with 0FH, 15 lines a page of text.
52E4
LD (54FCH),A 32 FC 54
Store Register A (0FH) at 54FCH, the operand of the LD A at 54FBH, the lines left on the first page.
52E7
LD (551AH),A 32 1A 55
Store Register A (0FH) at 551AH, the operand of the LD A at 5519H, the lines of each new page.
52EA
LD A,11H 3E 11
Load Register A with 11H, the opcode of LD DE,nnnn.
52EC
LD (5516H),A 32 16 55
Store Register A (11H) at 5516H over the CD of CALL 01C9H: it becomes LD DE,01C9H, so the screen is not cleared between pages of text.
52EF
LD BC,0001H 01 01 00
Load Register Pair BC with the LINE parameter, the operand at 52F0H-52F1H: 0001H in the file, the first line to list.
52F2
DEC BC 0B
DECrement Register Pair BC: the lines to skip.
52F3
LD A,B 78
Copy Register B (the high byte) into Register A.
52F4
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when no line is skipped.
52F5
If the Z FLAG is set (from line 1), JUMP to 5309H.
52F7
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
52FA
GOSUB to the ROM at 0013H (@GET) to take the next byte of the file at Register Pair DE into Register A.
52FD
If the NZ FLAG is set (an error or the end of the file), JUMP to 5585H to report the error in Register A.
5300
CP 0DH FE 0D
Compare Register A against 0DH, the end of a line.
5302
If the NZ FLAG is set (not the end of a line), LOOP BACK to 52FAH.
5304
DEC BC 0B
DECrement Register Pair BC, the lines left to skip.
5305
LD A,B 78
Copy Register B (the high byte) into Register A.
5306
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when every line is skipped.
5307
If the NZ FLAG is set (lines left), LOOP BACK to 52FAH.

5309H - List the Text

Each character is taken with @GET and sent through 54C9H. NUM puts the line number (5 places, from LINE) in front of each line. Without ASCII8 bit 7 of each character is cleared. A tab goes to the next multiple of the TAB width. At the start of each line (and after a character with bit 7 set) BREAK and the pause are looked at. The end of the file (error 1CH or 1DH) ends the listing with ENTER; any other error is reported.

5309
LD HL,(52F0H) 2A F0 52
Fetch the LINE parameter (the number of the first line listed) from 52F0H-52F1H into Register Pair HL.
530C
LD DE,55ACH 11 AC 55
Point Register Pair DE to 55ACH, the five places of the line number.
530F
GOSUB to 5559H to write Register Pair HL in decimal into the five places at Register Pair DE, spaces in front.
5312
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
5315
GOSUB to the ROM at 0013H (@GET) to take the next byte of the file at Register Pair DE into Register A; the NZ FLAG at the end or for an error.
5318
If the NZ FLAG is set (the end or an error), JUMP to 5377H.
531A
LD (5330H),A 32 30 53
Store Register A (the first character of the line) at 5330H, the operand of the LD A at 532FH, since the line number below needs Register A.
531D
LD BC,0000H 01 00 00
Load Register Pair BC with the NUM parameter, the operand at 531EH-531FH: 0000H in the file, FFFFH when NUM was given.
5320
LD A,B 78
Copy Register B (the high byte of NUM) into Register A.
5321
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when NUM was not given.
5322
If the Z FLAG is set (no line numbers), JUMP to 532FH.
5324
LD HL,55ACH 21 AC 55
Point Register Pair HL to 55ACH, the line number text (five places, a full stop, a space, 03H).
5327
POP DE D1
Restore Register Pair DE (the device control block) from the stack.
5328
PUSH DE D5
Save Register Pair DE (the device control block) on the stack again.
5329
GOSUB to 4479H (@MSG) to send the text at Register Pair HL to the device whose control block is at Register Pair DE.
532C
GOSUB to 5572H to count the line number at 55ACH up by one.
532F
LD A,00H 3E 00
Load Register A with the first character of the line, the operand at 5330H (00H in the file, stored by 531AH).
5331
RLCA 07
Rotate Register A left (RLCA): bit 7 goes into the CARRY FLAG and into bit 0. 5375H comes here with the next character.
5332
LD DE,0000H 11 00 00
Load Register Pair DE with the ASCII8 parameter, the operand at 5333H-5334H: 0000H in the file, FFFFH when ASCII8 (or A8) was given.
5335
INC D 14
INCrement Register D (the high byte of ASCII8).
5336
DEC D 15
DECrement Register D again: the Z FLAG is set when Register D is 00H, ASCII8 not given.
5337
If the NZ FLAG is set (ASCII8), JUMP to 533CH, the 0FH inside the LD E below, which runs as RRCA and gives the character back with all 8 bits.
5339
SRL A CB 3F
Shift Register A right (SRL A): the character with bit 7 cleared; the CARRY FLAG = its bit 7.
533B
LD E,0FH 1E 0F
Load Register E with 0FH. On the way from 5339H this only covers the byte 0FH; from 5337H it runs as RRCA, which turns Register A back to the character as read, the CARRY FLAG = its bit 7. Register E is not used afterwards.
533D
PUSH AF F5
Save Register Pair AF (the character and the CARRY FLAG, its bit 7) to the stack.
533E
CP 09H FE 09
Compare Register A against 09H, a tab, which is expanded with spaces.
5340
If the NZ FLAG is set (not a tab), JUMP to 535DH to send it.
5342
LD DE,0008H 11 08 00
Load Register Pair DE with the TAB parameter, the operand at 5343H-5344H (0008H in the file).
5345
INC E 1C
INCrement Register E (the low byte of the TAB parameter).
5346
DEC E 1D
DECrement Register E again: the Z FLAG is set when it is 00H.
5347
If the Z FLAG is set (a width of 0), JUMP to 535DH to send the tab as it is; 52B3H has refused such a width.
5349
LD A,(563BH) 3A 3B 56
Fetch the column from 563BH into Register A, 0 at the start of a line.
534C
LD C,08H 0E 08
Load Register C with the tab width, the operand at 534DH (08H in the file, stored by 52ADH).
534E
SUB C 91
SUBtract Register C (the width) from Register A.
534F
If the NO CARRY FLAG is set (not below 0 yet), LOOP BACK to 534EH.
5351
NEG ED 44
Negate Register A (NEG): the spaces to the next multiple of the width, 1 to the width.
5353
LD B,A 47
Copy Register A (the spaces) into Register B, the count.
5354
LD A,20H 3E 20
Load Register A with 20H, a space, to fill up to the tab stop.
5356
GOSUB to 54C9H to send the space in Register A to the device.
5359
DECrement Register B (the spaces left) and LOOP BACK to 5354H.
535B
JUMP to 5360H, the tab having been sent as spaces to the stop.
535D
GOSUB to 54C9H to send the character in Register A to the device.
5360
LD A,(563BH) 3A 3B 56
Fetch the column from 563BH into Register A, 0 at the start of a line.
5363
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set at the start of a line.
5364
If the Z FLAG is set (a new line), GOSUB to 5525H to look at BREAK and the pause.
5367
POP AF F1
Restore Register Pair AF (the character and its bit 7 in the CARRY FLAG) from the stack.
5368
If the CARRY FLAG is set (bit 7 of the character was set), GOSUB to 5525H to look at BREAK and the pause.
536B
CP 0DH FE 0D
Compare Register A against 0DH, the end of a line.
536D
If the Z FLAG is set (the end of a line), LOOP BACK to 5312H for the next line and its number.
536F
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
5372
GOSUB to the ROM at 0013H (@GET) to take the next byte of the file at Register Pair DE into Register A.
5375
If the Z FLAG is set (a byte), LOOP BACK to 5331H for it.
5377
PUSH AF F5
Save Register Pair AF (the error number) to the stack.
5378
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the last line.
537A
GOSUB to 54C9H to send Register A (0DH) to the device.
537D
POP AF F1
Restore Register Pair AF (the error number) from the stack.
537E
CP 1CH FE 1C
Compare Register A against 1CH, end of file encountered.
5380
If the Z FLAG is set (the end of the file), JUMP to 5387H to end the command.
5382
CP 1DH FE 1D
Compare Register A against 1DH, record number out of range: the end of the file too.
5384
If the NZ FLAG is set (another error), JUMP to 5585H to report the error in Register A.
5387
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
538A
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 538BH-538CH (0000H in the file). 5595H comes here with Register Pair HL = FFFFH.
538D
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
538E
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
538F
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran LIST.
5390
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5393
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5395
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5396
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

5399H - List in Hexadecimal

From record REC on, each record of the record length (256 when it is 00H) is shown as lines of 16 bytes: the record number and the offset in hexadecimal (rrrr:oo = ), the bytes in hexadecimal, then the characters (a full stop for one below 20H or above 7EH). With C (on when any parameter is given) the bytes follow each other in groups of four and the characters are on the same line; with C off each byte is followed by a space, the groups are of eight and the characters are on a second line under the bytes. On the printer the characters follow on the same line. N or P puts a blank line after each record.

5399
LD BC,0000H 01 00 00
Load Register Pair BC with the REC parameter, the operand at 539AH-539BH: 0000H in the file, the first record to list.
539C
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
539F
GOSUB to 4442H (@POSN) to position the file at Register Pair DE to record Register Pair BC.
53A2
If the NZ FLAG is set (no such record), JUMP to 5585H to report the error in Register A.
53A5
XOR A AF
Clear Register A (XOR A): Register A = 00H, the offset of the first line of a record.
53A6
LD (53BCH),A 32 BC 53
Store Register A (00H) at 53BCH, the operand of the LD A at 53BBH, the offset of the line.
53A9
LD DE,(539AH) ED 5B 9A 53
Fetch the number of the record from 539AH-539BH into Register Pair DE.
53AD
LD HL,55B4H 21 B4 55
Point Register Pair HL to 55B4H, the four places of the record number in the line head.
53B0
GOSUB to 4D76H to write Register Pair DE as four hexadecimal digits at Register Pair HL.
53B3
INC DE 13
INCrement Register Pair DE to the number of the next record.
53B4
LD (539AH),DE ED 53 9A 53
Store Register Pair DE (the next record) at 539AH-539BH.
53B8
LD BC,FF00H 01 00 FF
Load Register Pair BC with the LRL cell, the operand at 53B9H-53BAH (FF00H in the file): Register C = the record length (00H for 256), the bytes left in the record.
53BB
LD A,00H 3E 00
Load Register A with the offset of the line in the record, the operand at 53BCH. 548DH comes here for each line of a record.
53BD
LD HL,55B9H 21 B9 55
Point Register Pair HL to 55B9H, the two places of the offset in the line head.
53C0
GOSUB to 4D7BH to write Register A as two hexadecimal digits at Register Pair HL.
53C3
LD HL,55B4H 21 B4 55
Point Register Pair HL to 55B4H, the line head rrrr:oo = , ended by 03H.
53C6
POP DE D1
Restore Register Pair DE (the device control block) from the stack.
53C7
PUSH DE D5
Save Register Pair DE (the device control block) on the stack again.
53C8
GOSUB to 4479H (@MSG) to send the text at Register Pair HL to the device whose control block is at Register Pair DE.
53CB
LD A,(53BCH) 3A BC 53
Fetch the offset of the line from 53BCH into Register A.
53CE
ADD A,10H C6 10
ADD 10H to Register A: the offset of the next line.
53D0
LD (53BCH),A 32 BC 53
Store Register A (the offset of the next line) at 53BCH.
53D3
LD B,10H 06 10
Load Register B with 10H, the 16 bytes of a line.
53D5
LD HL,563CH 21 3C 56
Point Register Pair HL to 563CH, where the bytes of the line are kept for the characters.
53D8
LD DE,564CH 11 4C 56
Point Register Pair DE to 564CH, the file's control block.
53DB
GOSUB to the ROM at 0013H (@GET) to take the next byte of the file at Register Pair DE into Register A.
53DE
If the Z FLAG is set (a byte), JUMP to 53EBH.
53E0
PUSH AF F5
Save Register Pair AF (the error number and the NZ FLAG) to the stack.
53E1
CP 1CH FE 1C
Compare Register A against 1CH, end of file encountered.
53E3
If the Z FLAG is set (the end of the file), JUMP to 53EAH.
53E5
CP 1DH FE 1D
Compare Register A against 1DH, record number out of range: the end of the file too.
53E7
If the NZ FLAG is set (another error), JUMP to 5585H to report the error in Register A.
53EA
POP AF F1
Restore Register Pair AF (the error number and the NZ FLAG) from the stack.
53EB
If the NZ FLAG is set (the end of the file), JUMP to 5406H to finish the line.
53ED
LD (HL),A 77
Store Register A (the byte) at Register Pair HL in the line buffer.
53EE
INC HL 23
INCrement Register Pair HL to the next place of the line buffer.
53EF
GOSUB to 54B8H to send Register A as two hexadecimal digits.
53F2
DEC B 05
DECrement Register B, the bytes left in the line.
53F3
LD A,00H 3E 00
Load Register A with the C flag, the operand at 53F4H (00H in the file; not 00H when C is on).
53F5
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when C is off.
53F6
If the Z FLAG is set (C off), GOSUB to 54A8H to send a space after the byte.
53F9
LD A,B 78
Copy Register B (the bytes left) into Register A.
53FA
AND 07H E6 07
AND 07H into Register A, the operand at 53FBH (03H when C is on): the Z FLAG is set at the end of a group.
53FC
If the Z FLAG is set (the end of a group), GOSUB to 54A8H to send a space.
53FF
DEC C 0D
DECrement Register C, the bytes left in the record.
5400
If the Z FLAG is set (the end of the record), JUMP to 5406H.
5402
LD A,B 78
Copy Register B (the bytes left in the line) into Register A.
5403
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set at the end of the line.
5404
If the NZ FLAG is set (bytes left), LOOP BACK to 53D8H for the next byte.
5406
PUSH AF F5
Save Register Pair AF (the NZ FLAG at the end of the file) to the stack.
5407
LD A,B 78
Copy Register B (the bytes left in the line) into Register A.
5408
CP 10H FE 10
Compare Register A against 10H: the Z FLAG is set when the line has no byte.
540A
If the Z FLAG is set (an empty line), JUMP to 547DH to end it.
540C
LD A,00H 3E 00
Load Register A with the printer flag, the operand at 540DH (00H for the screen, 0DH for the printer, 52CCH).
540E
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for the printer.
540F
If the NZ FLAG is set (the printer), JUMP to 5457H for the printer's layout.
5411
LD A,00H 3E 00
Load Register A with the C flag, the operand at 5412H.
5413
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when C is off.
5414
If the Z FLAG is set (C off), JUMP to 5424H for the characters on a second line.
5416
PUSH BC C5
Save Register Pair BC (the counts) to the stack.
5417
LD A,B 78
Copy Register B (the bytes missing from the line) into Register A.
5418
RRCA 0F
Rotate Register A right (RRCA): the bytes missing divided by 2.
5419
RRCA 0F
Rotate Register A right again (RRCA): divided by 4.
541A
AND 03H E6 03
AND 03H into Register A: the groups of four the line is short.
541C
ADD A,B 80
ADD Register B (the bytes missing) to Register A.
541D
ADD A,B 80
ADD Register B again: Register A = 2 x the bytes missing + the groups, the columns to fill.
541E
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for a full line.
541F
If the Z FLAG is set (a full line), JUMP to 5466H to send the characters.
5421
INC A 3C
INCrement Register A: one more space, the space after the last group.
5422
JUMP to 5462H to send that many spaces before the characters.
5424
LD A,03H 3E 03
C off: load Register A with 03H, which ends the line of bytes (the column becomes 0) without a character.
5426
GOSUB to 54C9H to send Register A (03H) to the device; at the start of the new line ENTER is sent and the page counted.
5429
PUSH BC C5
Save Register Pair BC (the counts) to the stack.
542A
LD B,0BH 06 0B
Load Register B with 0BH, the 11 places of the line head.
542C
GOSUB to 5451H to send Register B spaces under the line head.
542F
POP BC C1
Restore Register Pair BC (the counts) from the stack.
5430
LD A,10H 3E 10
Load Register A with 10H, the bytes of a full line.
5432
SUB B 90
SUBtract Register B (the bytes missing) from Register A: the bytes of this line.
5433
LD B,A 47
Copy Register A (the bytes of this line) into Register B, the count.
5434
SUB 07H D6 07
SUBtract 07H from Register A: the count left after the eighth character.
5436
LD (5449H),A 32 49 54
Store Register A at 5449H, the operand of the CP at 5448H.
5439
LD HL,563CH 21 3C 56
Point Register Pair HL to 563CH, the bytes of the line.
543C
LD A,(HL) 7E
Fetch the next byte of the line at Register Pair HL into Register A.
543D
INC HL 23
INCrement Register Pair HL to the next byte of the line.
543E
GOSUB to 54ACH to send the byte as a character, or a full stop.
5441
GOSUB to 54A8H to send a space after the character.
5444
GOSUB to 54A8H to send a second space: the character sits under its two digits.
5447
LD A,B 78
Copy Register B (the bytes left) into Register A.
5448
CP 09H FE 09
Compare Register A against the count after the eighth character, the operand at 5449H (09H in the file, stored by 5436H).
544A
If the Z FLAG is set (after the eighth character), GOSUB to 54A8H to send the space between the two groups.
544D
DECrement Register B (the bytes left) and LOOP BACK to 543CH.
544F
JUMP to 547DH to end the second line, the line of characters.
5451
GOSUB to 54A8H to send a space; Register B counts them.
5454
DECrement Register B (the spaces left) and LOOP BACK to 5451H.
5456
RET C9
RETurn to the caller with Register B spaces sent.
5457
PUSH BC C5
The printer: save Register Pair BC (the counts) to the stack.
5458
LD A,B 78
Copy Register B (the bytes missing) into Register A.
5459
RLCA 07
Rotate Register A left (RLCA): 2 x the bytes missing.
545A
ADD A,B 80
ADD Register B to Register A: 3 x the bytes missing, the digits and spaces they would take.
545B
LD B,A 47
Copy Register A (3 x the bytes missing) into Register B.
545C
CP 18H FE 18
Compare Register A against 18H (24): the CARRY FLAG is set below 24, when the space between the groups is not missing.
545E
CCF 3F
Complement the CARRY FLAG (CCF): set for 24 and above.
545F
LD A,03H 3E 03
Load Register A with 03H, the spaces before the characters. LD does not change the flags.
5461
ADC A,B 88
ADD Register B and the CARRY FLAG to Register A (ADC A,B): the spaces to send.
5462
LD B,A 47
Copy Register A (the spaces) into Register B, the count.
5463
GOSUB to 5451H to send Register B spaces before the characters.
5466
POP BC C1
Restore Register Pair BC (the counts) from the stack.
5467
PUSH BC C5
Save Register Pair BC (the counts) on the stack again.
5468
LD C,08H 0E 08
Load Register C with 08H, the characters before the space in the middle.
546A
LD A,10H 3E 10
Load Register A with 10H, the bytes of a full line.
546C
SUB B 90
SUBtract Register B (the bytes missing) from Register A: the bytes of this line.
546D
LD B,A 47
Copy Register A (the bytes of this line) into Register B, the count.
546E
LD HL,563CH 21 3C 56
Point Register Pair HL to 563CH, the bytes of the line.
5471
LD A,(HL) 7E
Fetch the next byte of the line at Register Pair HL into Register A.
5472
INC HL 23
INCrement Register Pair HL to the next byte of the line.
5473
GOSUB to 54ACH to send the byte as a character, or a full stop.
5476
DEC C 0D
DECrement Register C, the characters before the middle.
5477
If the Z FLAG is set (after the eighth character), GOSUB to 54A8H to send a space.
547A
DECrement Register B (the bytes left) and LOOP BACK to 5471H.
547C
POP BC C1
Restore Register Pair BC (the counts) from the stack.
547D
LD A,03H 3E 03
Load Register A with the line end, the operand at 547EH: 03H for the screen, 0DH for the printer (52C6H).
547F
GOSUB to 54C9H to send Register A to the device.
5482
POP AF F1
Restore Register Pair AF (the NZ FLAG at the end of the file) from the stack.
5483
LD A,1CH 3E 1C
Load Register A with 1CH, the end of the file. LD does not change the flags.
5485
If the NZ FLAG is set (the end of the file), JUMP to 5377H to end the listing.
5488
GOSUB to 5525H to look at BREAK and the pause.
548B
LD A,C 79
Copy Register C (the bytes left in the record) into Register A.
548C
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set at the end of the record.
548D
If the NZ FLAG is set (bytes left), JUMP to 53BBH for the next line of the record.
5490
LD A,(54F6H) 3A F6 54
Fetch the low byte of the N parameter from 54F6H into Register A.
5493
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when N (or P) was not given.
5494
If the Z FLAG is set (the listing stops at each page), JUMP to 549FH.
5496
GOSUB to 54A8H to send a space on the line after the record.
5499
LD A,(547EH) 3A 7E 54
Fetch the line end from 547EH into Register A (03H or 0DH).
549C
GOSUB to 54C9H to send it: an empty line after the record.
549F
LD HL,55B4H 21 B4 55
Point Register Pair HL to 55B4H, the record number in the line head.
54A2
GOSUB to 5573H to count the last digit of 55B7H up as a decimal digit; 53B0H writes the four digits again for the next record, so nothing of it is shown.
54A5
JUMP to 53A5H to list the next record of the file.

54A8H - Send a Character and Count the Page

54A8H sends a space, 54ACH a byte as a character (a full stop below 20H or from 7FH up), 54B8H a byte as two hexadecimal digits. 54C9H sends Register A to the device of the listing (@PUT) and keeps the column (563BH, 0-63); 03H, 0AH and 0DH put it back to 0. At column 0 on the screen the page is counted: in hexadecimal ENTER is sent first (5520H). When a page is full the listing waits for a key: BREAK ends it, C goes on without stopping, any other key clears the screen (hexadecimal) and lists the next page. 54C9H keeps Register Pair HL, and Register A except at the start of a line.

54A8
LD A,20H 3E 20
Load Register A with 20H, a space, to send to the device.
54AA
JUMP to 54C9H to send the space in Register A.
54AC
CP 20H FE 20
Compare Register A against 20H, the first character that is shown.
54AE
If the CARRY FLAG is set (a control code), JUMP to 54B4H.
54B0
CP 7FH FE 7F
Compare Register A against 7FH, past the last character that is shown.
54B2
If the CARRY FLAG is set (20H-7EH), JUMP to 54B6H to send it as it is.
54B4
LD A,2EH 3E 2E
Load Register A with 2EH, a full stop, in place of the byte.
54B6
JUMP to 54C9H to send the character in Register A.
54B8
PUSH AF F5
Save Register Pair AF (the byte) to the stack.
54B9
RRCA 0F
Rotate Register A right (RRCA): one of four, to bring the high digit down.
54BA
RRCA 0F
Rotate Register A right again (RRCA): two of four.
54BB
RRCA 0F
Rotate Register A right again (RRCA): three of four.
54BC
RRCA 0F
Rotate Register A right again (RRCA): the high digit is in bits 3-0.
54BD
GOSUB to 54C1H to send the high digit of the byte.
54C0
POP AF F1
Restore Register Pair AF (the byte) from the stack, to send its low digit.
54C1
AND 0FH E6 0F
AND 0FH into Register A: the digit in bits 3-0.
54C3
ADD A,90H C6 90
ADD 90H to Register A (the first step of the digit conversion).
54C5
DAA 27
Decimal adjust Register A (DAA): 90H-99H for 0-9, 00H-05H with the CARRY FLAG for A-F.
54C6
ADC A,40H CE 40
ADD 40H and the CARRY FLAG to Register A (ADC A,40H).
54C8
DAA 27
Decimal adjust Register A (DAA): Register A = 30H-39H or 41H-46H, the digit as a character.
54C9
LD DE,0000H 11 00 00
Load Register Pair DE with the device control block, the operand at 54CAH-54CBH (0000H in the file; 401DH or 4025H, stored by 52CFH).
54CC
PUSH HL E5
Save Register Pair HL (the caller's value) to the stack.
54CD
LD HL,563BH 21 3B 56
Point Register Pair HL to 563BH, the column of the listing.
54D0
INC (HL) 34
INCrement the column at Register Pair HL for the character sent.
54D1
PUSH AF F5
Save Register Pair AF (the character) to the stack.
54D2
GOSUB to the ROM at 001BH (@PUT) to send the character in Register A to the device at Register Pair DE.
54D5
LD A,(HL) 7E
Fetch the column at Register Pair HL into Register A.
54D6
AND 3FH E6 3F
AND 3FH into Register A: after column 63 the next is 0, the 64 columns of a screen line.
54D8
LD (HL),A 77
Store Register A (the column) at Register Pair HL.
54D9
POP AF F1
Restore Register Pair AF (the character) from the stack.
54DA
CP 03H FE 03
Compare Register A against 03H, the line end of the screen's hexadecimal lines.
54DC
If the Z FLAG is set (03H), JUMP to 54E6H to put the column back to 0.
54DE
CP 0AH FE 0A
Compare Register A against 0AH, a line feed, which starts a line.
54E0
If the Z FLAG is set (0AH), JUMP to 54E6H to put the column back to 0.
54E2
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, which starts a line.
54E4
If the NZ FLAG is set (another character), JUMP to 54E7H, the 00H operand of the LD below, which runs as NOP: the column stays.
54E6
LD (HL),00H 36 00
Store 00H at Register Pair HL: the column is 0. The 00H at 54E7H is a NOP when 54E4H jumps there.
54E8
INC (HL) 34
INCrement the column at Register Pair HL, to test it.
54E9
DEC (HL) 35
DECrement the column at Register Pair HL again: the Z FLAG is set when it is 0.
54EA
POP HL E1
Restore Register Pair HL from the stack. POP does not change the flags.
54EB
RET NZ C0
RETurn if the NZ FLAG is set: not the start of a line.
54EC
LD A,(540DH) 3A 0D 54
Fetch the printer flag from 540DH into Register A (0DH for the printer).
54EF
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for the printer.
54F0
RET NZ C0
RETurn if the NZ FLAG is set: the printer has no pages.
54F1
LD DE,5520H 11 20 55
Load Register Pair DE with 5520H, the routine that sends ENTER to the screen.
54F4
PUSH DE D5
Save Register Pair DE (5520H) to the stack: the RETs below go there first and send ENTER. For a text listing 52DCH makes this a NOP.
54F5
LD DE,0000H 11 00 00
Load Register Pair DE with the N parameter, the operand at 54F6H-54F7H: 0000H in the file, FFFFH for N or P, or the key's DE after C (5512H).
54F8
LD A,D 7A
Copy Register D (the high byte of N) into Register A.
54F9
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when the listing stops at each page.
54FA
RET NZ C0
RETurn if the NZ FLAG is set: no pages are counted.
54FB
LD A,10H 3E 10
Load Register A with the lines left on the page, the operand at 54FCH: 10H in the file, 0FH for text (52E4H).
54FD
DEC A 3D
DECrement Register A, one line less on the page.
54FE
LD (54FCH),A 32 FC 54
Store Register A (the lines left on the page) at 54FCH.
5501
RET NZ C0
RETurn if the NZ FLAG is set: the page is not full.
5502
GOSUB to the ROM at 0049H to wait for a key: Register A = the key; the ROM's keyboard routine returns with Register Pair DE = 4015H, KIDCB$.
5505
CP 01H FE 01
Compare Register A against 01H, the code of BREAK.
5507
If the Z FLAG is set (BREAK), JUMP to 5592H to end the command with Register Pair HL = FFFFH.
550A
SUB 43H D6 43
SUBtract 43H from Register A: the Z FLAG is set for C.
550C
If the Z FLAG is set (the key C), JUMP to 5512H.
550E
SUB 20H D6 20
SUBtract 20H from Register A: the Z FLAG is set for a small c.
5510
If the NZ FLAG is set (another key), JUMP to 5516H for the next page.
5512
LD (54F6H),DE ED 53 F6 54
Store Register Pair DE (4015H, not 0000H) at 54F6H-54F7H, the N parameter: the listing goes on without stopping.
5516
GOSUB to the ROM at 01C9H to clear the screen. For a text listing 52ECH makes this LD DE,01C9H, which only loads Register Pair DE.
5519
LD A,10H 3E 10
Load Register A with the lines of a page, the operand at 551AH: 10H in the file, 0FH for text (52E7H).
551B
LD (54FCH),A 32 FC 54
Store Register A at 54FCH, the lines left on the new page.
551E
POP AF F1
Restore Register Pair AF from the stack: the 5520H pushed at 54F4H is dropped, so no ENTER is sent after the cleared screen. For a text listing 52DFH makes this a NOP.
551F
RET C9
RETurn to the caller of 54C9H with the next page started.
5520
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, for the screen.
5522
JUMP to the ROM at 0033H to display Register A (0DH); its RET goes back to the caller of 54C9H.

5525H - BREAK and the Pause

During a JCL job nothing is looked at. BREAK (KFLAG$ bit 0) sends ENTER and ends the command with Register Pair HL = FFFFH. A pause (bit 1, SHIFT @) waits for BREAK or another key than SHIFT @. 5548H clears bits 2-0 of KFLAG$ and returns the Z FLAG.

5525
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5528
AND 20H E6 20
AND 20H into Register A: bit 5, set while a JCL job runs.
552A
XOR 20H EE 20
Exclusive OR 20H into Register A: the Z FLAG is set during a JCL job.
552C
RET Z C8
RETurn if the Z FLAG is set: a JCL job is not stopped by the keys.
552D
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
5530
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed.
5532
If the NZ FLAG is set (BREAK), JUMP to 5552H to end the listing.
5534
BIT 1,A CB 4F
Test bit 1 of Register A: set when SHIFT @ asked for a pause.
5536
RET Z C8
RETurn if the Z FLAG is set: no pause, the listing goes on.
5537
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A again.
553A
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed during the pause.
553C
If the NZ FLAG is set (BREAK), JUMP to 5552H to end the listing.
553E
GOSUB to the ROM at 002BH (@KBD) to scan the keyboard: Register A = the key, 00H for none.
5541
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is pressed.
5542
If the Z FLAG is set (no key), LOOP BACK to 5537H.
5544
CP 60H FE 60
Compare Register A against 60H, the code of SHIFT @ itself.
5546
If the Z FLAG is set (the pause key again), LOOP BACK to 5537H.
5548
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
554B
AND F8H E6 F8
AND F8H into Register A: bits 2-0 (ENTER, pause, BREAK) cleared.
554D
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, with bits 2-0 cleared.
5550
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG.
5551
RET C9
RETurn to the caller with the keys of KFLAG$ cleared.
5552
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line on BREAK.
5554
GOSUB to 54C9H to send Register A (0DH) to the device.
5557
JUMP to 5592H to end the command with Register Pair HL = FFFFH.

5559H - The Line Number

5559H writes Register Pair HL in decimal into the five places at Register Pair DE, spaces in front. 5572H counts the decimal number whose last digit is 4 places after Register Pair HL up by one (a space counts as 0); 5573H the one whose last digit is 3 places after it.

5559
LD B,05H 06 05
Load Register B with 05H, the five places of the number.
555B
LD A,20H 3E 20
Load Register A with 20H, a space, for the places in front.
555D
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
555E
INC DE 13
INCrement Register Pair DE to the next place.
555F
DECrement Register B (the places left) and LOOP BACK to 555DH.
5561
PUSH DE D5
Save Register Pair DE (the place after the five) to the stack.
5562
DEC DE 1B
DECrement Register Pair DE to the last of the five places.
5563
LD A,0AH 3E 0A
Load Register A with 0AH, ten, the divisor for each digit.
5565
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A: Register Pair HL = the quotient, Register A = the remainder, the last digit.
5568
ADD A,30H C6 30
ADD 30H to Register A: the digit as a character.
556A
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
556B
DEC DE 1B
DECrement Register Pair DE to the place before.
556C
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
556D
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when no digit is left.
556E
If the NZ FLAG is set (digits left), LOOP BACK to 5563H.
5570
POP DE D1
Restore Register Pair DE (the place after the five) from the stack.
5571
RET C9
RETurn to the caller with the number written.
5572
INC HL 23
INCrement Register Pair HL (from 55ACH): one of four places to the last digit.
5573
INC HL 23
INCrement Register Pair HL (from 55B4H): one of three places.
5574
INC HL 23
INCrement Register Pair HL, one place nearer the last digit.
5575
INC HL 23
INCrement Register Pair HL to the last digit.
5576
LD A,(HL) 7E
Fetch the digit at Register Pair HL into Register A.
5577
OR 30H F6 30
OR 30H into Register A: a space (20H) becomes 30H, the digit 0.
5579
INC A 3C
INCrement Register A: the digit plus one, 31H-3AH.
557A
LD (HL),A 77
Store Register A (the digit) at Register Pair HL.
557B
SUB 3AH D6 3A
SUBtract 3AH from Register A: the CARRY FLAG is set while it is 0-9.
557D
RET C D8
RETurn if the CARRY FLAG is set: no carry to the place before.
557E
LD (HL),30H 36 30
Store 30H, the digit 0, at Register Pair HL: a carry into the place before.
5580
DEC HL 2B
DECrement Register Pair HL to the place before.
5581
LOOP BACK to 5576H to carry one into the place before.

5583H - Errors and the Exit

5583H reports error 2CH (parameter error), 5585H the error in Register A, through @ERROR; 558CH displays File spec required!. Each ends the command with Register Pair HL = FFFFH.

5583
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
5585
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
5587
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
558A
JUMP to 5592H to end the command with Register Pair HL = FFFFH.
558C
LD HL,5598H 21 98 55
Point Register Pair HL to 5598H, the message File spec required!.
558F
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5592
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5595
JUMP to 538AH to put the stack back and end the command.

5598H - LIST Data: Texts and the Parameter Table

The message, the line number text, the line head of the hexadecimal listing, the default extension, and the table @PARAM reads (5214H): fifteen entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H. Each address is the operand of an instruction that uses the value; the short form of a keyword names the same address.

5598-55AA
DEFM "File spec required!" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 558CH: no file, or a device, was named.
55AB
DEFB 0DH 0D
0DH, the end of the message File spec required!.
55AC-55B0
DEFM " " 20 20 20 20 20
The five places of the line number, written by 5559H and counted by 5572H.
55B1-55B2
DEFM ". " 2E 20
A full stop and a space after the line number.
55B3
DEFB 03H 03
03H, the end of the line number text sent by @MSG (5329H).
55B4-55B7
DEFM " " 20 20 20 20
The four places of the record number in hexadecimal, written by 53B0H.
55B8
DEFM ":" 3A
A colon between the record number and the offset.
55B9-55BA
DEFM "XX" 58 58
The two places of the offset in the record, written by 53C0H.
55BB-55BD
DEFM " = " 20 3D 20
A space, an equals sign and a space before the bytes.
55BE
DEFB 03H 03
03H, the end of the line head sent by @MSG (53C8H).
55BF-55C1
DEFM "TXT" 54 58 54
The extension @FEXT adds to a file named without one (5254H).
55C2-55C9
DEFM "ASCII8" / DEFW 5333H 41 53 43 49 49 38 33 53
ASCII8: its value goes to 5333H-5334H, the operand of the LD DE at 5332H.
55CA-55D1
DEFM "A8 " / DEFW 5333H 41 38 20 20 20 20 33 53
A8, the short form of ASCII8: its value goes to 5333H-5334H too.
55D2-55D9
DEFM "C " / DEFW 521EH 43 20 20 20 20 20 1E 52
C: its value goes to 521EH-521FH, the operand of the LD HL at 521DH (FFFFH in the file).
55DA-55E1
DEFM "HEX " / DEFW 52D5H 48 45 58 20 20 20 D5 52
HEX: its value goes to 52D5H-52D6H, the operand of the LD BC at 52D4H.
55E2-55E9
DEFM "H " / DEFW 52D5H 48 20 20 20 20 20 D5 52
H, the short form of HEX: its value goes to 52D5H-52D6H too.
55EA-55F1
DEFM "LRL " / DEFW 53B9H 4C 52 4C 20 20 20 B9 53
LRL: its value goes to 53B9H-53BAH, the operand of the LD BC at 53B8H (FF00H in the file).
55F2-55F9
DEFM "L " / DEFW 53B9H 4C 20 20 20 20 20 B9 53
L, the short form of LRL: its value goes to 53B9H-53BAH too.
55FA-5601
DEFM "LINE " / DEFW 52F0H 4C 49 4E 45 20 20 F0 52
LINE: its value goes to 52F0H-52F1H, the operand of the LD BC at 52EFH (0001H in the file).
5602-5609
DEFM "NUM " / DEFW 531EH 4E 55 4D 20 20 20 1E 53
NUM: its value goes to 531EH-531FH, the operand of the LD BC at 531DH.
560A-5611
DEFM "N " / DEFW 54F6H 4E 20 20 20 20 20 F6 54
N: its value goes to 54F6H-54F7H, the operand of the LD DE at 54F5H: the listing does not stop at each page.
5612-5619
DEFM "REC " / DEFW 539AH 52 45 43 20 20 20 9A 53
REC: its value goes to 539AH-539BH, the operand of the LD BC at 5399H.
561A-5621
DEFM "R " / DEFW 539AH 52 20 20 20 20 20 9A 53
R, the short form of REC: its value goes to 539AH-539BH too.
5622-5629
DEFM "P " / DEFW 52B7H 50 20 20 20 20 20 B7 52
P: its value goes to 52B7H-52B8H, the operand of the LD BC at 52B6H.
562A-5631
DEFM "TAB " / DEFW 5343H 54 41 42 20 20 20 43 53
TAB: its value goes to 5343H-5344H, the operand of the LD DE at 5342H (0008H in the file).
5632-5639
DEFM "T " / DEFW 5343H 54 20 20 20 20 20 43 53
T, the short form of TAB: its value goes to 5343H-5344H too.
563A
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.
563B
DEFB 00H 00
The column of the listing (0-63), counted by 54C9H and read by the tab (5349H) and the line start tests.

563CH - LIST Data: the Work Areas

Above the member: the bytes of a hexadecimal line, the file's control block, the copy of the specification and the file's buffer.

563C-564B
DEFS 16
The 16 bytes of the hexadecimal line, kept by 53EDH for the characters. Not loaded from the file.
564C-566B
DEFS 32
The file's control block: the specification from @FSPEC, then the open file. Not loaded from the file.
566C-568B
DEFS 32
The specification as typed, kept by 5251H to try again without TXT. Not loaded from the file.
5700-57FF
DEFS 256
The file's buffer, given to @OPEN (525AH, 5275H). Not loaded from the file.

5200H - Member 9 (RENAME): Read the Two Names

The RENAME command (library member 53H), loaded at 5200H-53A4H. The old file's specification goes to the control block at 53C4H, the new name to 53A4H (as typed when @FSPEC refuses it, such as /EXT); the parts the new name leaves out (name, extension, password) are taken from the old one. The old file must allow renaming (access level 0-2, else error 25H). The new name gets the old file's drive (another drive is error 20H) and must not exist. Then the directory record gets the new name and extension, and the hash index table the new name's hash.

5200
LD (52C2H),SP ED 73 C2 52
Store the Stack Pointer at 52C2H, the operand of the LD SP at 52C1H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,53C4H 11 C4 53
Point Register Pair DE to 53C4H, the old file's control block.
5207
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL (the parameters) to Register Pair DE (53C4H); the NZ FLAG when there is none.
520A
If the NZ FLAG is set (no file), JUMP to 5354H to display File spec required!.
520D
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
520E
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5210
If the Z FLAG is set (a device), JUMP to 5354H to display File spec required!: RENAME renames only files.
5213
LD DE,53A4H 11 A4 53
Point Register Pair DE to 53A4H, where the new name goes.
5216
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL to Register Pair DE (53A4H); the NZ FLAG when it is not a full specification.
5219
If the Z FLAG is set (a full specification), JUMP to 5221H.
521B
LD A,(HL) 7E
Fetch the character at Register Pair HL (the one after the character @FSPEC stopped at) into Register A.
521C
CP 0DH FE 0D
Compare Register A against 0DH, the end of the command line.
521E
If the NZ FLAG is set (more text), GOSUB to 52D3H to copy the new name into 53A4H as it was typed.
5221
LD A,(53A4H) 3A A4 53
Fetch the first character of the new name from 53A4H into Register A (0DH in the file).
5224
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH or 03H, no new name.
5226
If the CARRY FLAG is set (no new name), JUMP to 5358H to display Rename it to what?.
5229
LD HL,53C4H 21 C4 53
Point Register Pair HL to 53C4H, the old name.
522C
LD DE,53A4H 11 A4 53
Point Register Pair DE to 53A4H, the new name.
522F
GOSUB to 52F0H to fill the parts the new name leaves out from the old name.
5232
LD DE,53C4H 11 C4 53
Point Register Pair DE to 53C4H, the old file's control block.
5235
GOSUB to 4424H (@OPEN) to open the old file at Register Pair DE; SYS2/SYS leaves its packed name at 51EAH and its hash at 51E1H.
5238
If the NZ FLAG is set (the file could not be opened), JUMP to 534DH to report the error in Register A.
523B
LD A,(53C5H) 3A C5 53
Fetch +01H of the old file's control block from 53C5H into Register A.
523E
AND 07H E6 07
AND 07H into Register A: bits 2-0, the access level the password gave.
5240
CP 03H FE 03
Compare Register A against 03H: the NO CARRY FLAG is set for levels 3-7, which do not allow renaming.
5242
LD A,25H 3E 25
Load Register A with 25H, the error number of an illegal access to a protected file. LD does not change the flags.
5244
If the NO CARRY FLAG is set (renaming not allowed), JUMP to 534DH to report error 25H.
5247
LD HL,53A4H 21 A4 53
Point Register Pair HL to 53A4H, the new name, to look for its drive.
524A
LD A,(HL) 7E
Fetch the next character of the new name at Register Pair HL into Register A.
524B
INC HL 23
INCrement Register Pair HL past the character just fetched.
524C
CP 0DH FE 0D
Compare Register A against 0DH, an ENTER that ends the name.
524E
If the Z FLAG is set (the end, no drive), JUMP to 5263H to add the old file's drive.
5250
CP 03H FE 03
Compare Register A against 03H, the end mark of a specification.
5252
If the Z FLAG is set (the end, no drive), JUMP to 5263H to add the old file's drive.
5254
CP 3AH FE 3A
Compare Register A against 3AH, the colon before a drive.
5256
If the NZ FLAG is set (not yet), LOOP BACK to 524AH.
5258
LD A,(53CAH) 3A CA 53
Fetch the old file's drive from 53CAH (its control block +06H) into Register A.
525B
XOR (HL) AE
Exclusive OR the drive digit at Register Pair HL (after the colon) into Register A.
525C
AND 07H E6 07
AND 07H into Register A: the Z FLAG is set when the digit names the same drive.
525E
If the NZ FLAG is set (another drive), JUMP to 534BH to report error 20H (illegal drive number).
5261
JUMP to 5272H with the drive of the new name as given.
5263
DEC HL 2B
DECrement Register Pair HL back to the end of the new name.
5264
LD (HL),3AH 36 3A
Store 3AH, a colon, at Register Pair HL, over the end of the new name.
5266
INC HL 23
INCrement Register Pair HL to the place of the drive.
5267
LD A,(53CAH) 3A CA 53
Fetch the old file's drive from 53CAH into Register A.
526A
AND 07H E6 07
AND 07H into Register A: the drive number, 0 to 7.
526C
ADD A,30H C6 30
ADD 30H to Register A: the drive number becomes its digit.
526E
LD (HL),A 77
Store Register A (the digit) at Register Pair HL.
526F
INC HL 23
INCrement Register Pair HL past the drive digit just stored.
5270
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL, the end of the new name: NAME/EXT.PW:d.
5272
LD A,(51E1H) 3A E1 51
Fetch the old name's hash from 51E1H (left by @OPEN in SYS2/SYS) into Register A.
5275
PUSH AF F5
Save Register Pair AF (the old name's hash) to the stack.
5276
LD DE,53A4H 11 A4 53
Point Register Pair DE to 53A4H, the new name.
5279
GOSUB to 4424H (@OPEN) to open a file of the new name at Register Pair DE; SYS2/SYS leaves the new name packed at 51EAH.
527C
If the Z FLAG is set (such a file exists), JUMP to 535CH to display Duplicate file name!.
527F
CP 18H FE 18
Compare Register A (the error) against 18H, file not in directory.
5281
If the NZ FLAG is set (another error), JUMP to 534DH to report the error in Register A.
5284
POP AF F1
Restore Register Pair AF (the old name's hash) from the stack.
5285
LD (51E1H),A 32 E1 51
Store Register A (the old name's hash) at 51E1H again; 52B3H writes the new name's hash there.
5288
LD BC,(53CAH) ED 4B CA 53
Fetch the old file's drive and directory entry from 53CAH-53CBH (its control block +06H-+07H) into Register Pair BC: Register C the drive, Register B the entry.
528C
PUSH BC C5
Save Register Pair BC (the drive and entry) to the stack.
528D
GOSUB to 4B10H (DIRRD) to read the directory sector holding record Register B of drive Register C into 4200H; Register Pair HL = the record.
5290
If the NZ FLAG is set (the directory could not be read), JUMP to 534DH to report the error in Register A.
5293
LD D,H 54
Copy Register H (the high byte of the record) into Register D.
5294
LD A,L 7D
Copy Register L (the low byte of the record) into Register A.
5295
ADD A,05H C6 05
ADD 05H to Register A: the offset of the name in a directory record.
5297
LD E,A 5F
Copy Register A into Register E: Register Pair DE = the record +05H.
5298
LD HL,51EAH 21 EA 51
Point Register Pair HL to 51EAH, the new name and extension packed by SYS2/SYS (eleven bytes).
529B
LD BC,000BH 01 0B 00
Load Register Pair BC with 000BH, the eight name and three extension bytes.
529E
LDIR ED B0
Copy the 11 bytes from 51EAH at Register Pair HL to the record +05H-+0FH at Register Pair DE (LDIR, Register Pair BC = the count).
52A0
POP BC C1
Restore Register Pair BC (the drive and entry) from the stack.
52A1
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back.
52A4
If the NZ FLAG is set (the write failed), JUMP to 534DH to report the error in Register A.
52A7
CALL 51BDH CD BD 51
GOSUB to 51BDH (in SYS2/SYS) to read the hash index table of drive Register C into 4200H.
52AA
If the NZ FLAG is set (the table could not be read), JUMP to 534DH to report the error in Register A.
52AD
LD D,H 54
Copy Register H (42H, from the table at 4200H) into Register D.
52AE
LD E,B 58
Copy Register B (the directory entry) into Register E: Register Pair DE = the entry's byte of the hash index table.
52AF
PUSH BC C5
Save Register Pair BC (the drive and entry) to the stack.
52B0
LD HL,51EAH 21 EA 51
Point Register Pair HL to 51EAH, the new name and extension.
52B3
GOSUB to 52D0H to get the hash of the eleven bytes at Register Pair HL into Register A.
52B6
POP BC C1
Restore Register Pair BC (the drive and entry) from the stack.
52B7
LD (DE),A 12
Store Register A (the new name's hash) at Register Pair DE, the entry's byte of the table.
52B8
CALL 51BEH CD BE 51
GOSUB to 51BEH (in SYS2/SYS) to write the hash index table at 4200H back to drive Register C.
52BB
If the NZ FLAG is set (the write failed), JUMP to 534DH to report the error in Register A.
52BE
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
52C1
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 52C2H-52C3H (0000H in the file). 5365H comes here with Register Pair HL = FFFFH.
52C4
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
52C5
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
52C6
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran RENAME.
52C7
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52CA
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52CC
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
52CD
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.
52D0
LD A,D4H 3E D4
Load Register A with D4H, the request for the name hash of SYS2/SYS.
52D2
RST 28H EF
RST 28H: SYS2/SYS (already at 4E00H) returns the hash of the eleven bytes at Register Pair HL in Register A, also stored at 51E1H; the supervisor drops the RST's return address, so it returns to the caller of 52D0H.

52D3H - Keep the New Name as It Was Typed

When @FSPEC refuses the new name (such as /EXT or .PW), its text is copied into 53A4H: from the character @FSPEC stopped at, spaces skipped, small letters made capitals (any character from 61H up has 20H taken off), up to 32 characters, ending at 0DH or a bracket.

52D3
DEC HL 2B
DECrement Register Pair HL to the character @FSPEC stopped at.
52D4
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52D5
INC HL 23
INCrement Register Pair HL past the character just fetched.
52D6
CP 20H FE 20
Compare Register A against 20H, a space before the new name.
52D8
If the Z FLAG is set (a space), LOOP BACK to 52D4H to skip it.
52DA
DEC HL 2B
DECrement Register Pair HL back to the first character that is not a space.
52DB
LD B,20H 06 20
Load Register B with 20H, the 32 characters of the buffer.
52DD
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52DE
CP 61H FE 61
Compare Register A against 61H, a small a, the first small letter.
52E0
If the CARRY FLAG is set (below a), JUMP to 52E4H to store it as it is.
52E2
SUB 20H D6 20
SUBtract 20H from Register A: a small letter becomes a capital.
52E4
LD (DE),A 12
Store Register A (the character) at Register Pair DE in 53A4H.
52E5
CP 0DH FE 0D
Compare Register A against 0DH, the end of the line.
52E7
RET Z C8
RETurn if the Z FLAG is set: the name has ended.
52E8
CP 28H FE 28
Compare Register A against 28H, a bracket, which ends the name.
52EA
RET Z C8
RETurn if the Z FLAG is set: the name has ended.
52EB
INC HL 23
INCrement Register Pair HL to the next character of the text.
52EC
INC DE 13
INCrement Register Pair DE to the next place of the buffer.
52ED
DECrement Register B (the places left) and LOOP BACK to 52DDH.
52EF
RET C9
RETurn to the caller with 32 characters copied.

52F0H - Complete the New Name from the Old

A new name that starts with something other than a letter gets the old name put in front; then a missing extension (after /) and a missing password (after .) are taken from the old name when it has them. The old name's characters are put in at the place in the new name text, the rest of it moved up.

52F0
PUSH DE D5
Save Register Pair DE (53A4H, the new name) to the stack.
52F1
LD A,(DE) 1A
Fetch the first character of the new name at Register Pair DE into Register A.
52F2
CP 41H FE 41
Compare Register A against 41H, the letter A.
52F4
If the CARRY FLAG is set (not a letter, so no name), GOSUB to 532BH to put the old name in front.
52F7
LD B,2FH 06 2F
Load Register B with 2FH, the slash before an extension.
52F9
GOSUB to 5304H to add the old extension when the new name has none.
52FC
LD B,2EH 06 2E
Load Register B with 2EH, the full stop before a password.
52FE
GOSUB to 5304H to add the old password when the new name has none.
5301
POP DE D1
Restore Register Pair DE (53A4H) from the stack.
5302
RET C9
RETurn to the caller with the new name complete.
5303
INC DE 13
INCrement Register Pair DE to the next character of the new name.
5304
LD A,(DE) 1A
Fetch the character of the new name at Register Pair DE into Register A.
5305
CP B B8
Compare Register A against Register B, the separator looked for.
5306
If the Z FLAG is set (the new name has this part), JUMP to 5316H.
5308
CP 41H FE 41
Compare Register A against 41H, the letter A.
530A
If the NO CARRY FLAG is set (a letter or above), LOOP BACK to 5303H.
530C
CP 30H FE 30
Compare Register A against 30H, the digit 0, the first digit.
530E
If the CARRY FLAG is set (below 0: another separator or the end), JUMP to 5318H.
5310
CP 3AH FE 3A
Compare Register A against 3AH, the colon after the digit 9.
5312
If the CARRY FLAG is set (a digit), LOOP BACK to 5303H.
5314
JUMP to 5318H: the colon or a character above it ends the part.
5316
INC DE 13
INCrement Register Pair DE past the separator.
5317
RET C9
RETurn to the caller: the new name has its own part.
5318
PUSH HL E5
Save Register Pair HL (the place in the old name) to the stack.
5319
LD A,(HL) 7E
Fetch the character of the old name at Register Pair HL into Register A.
531A
INC HL 23
INCrement Register Pair HL to the next character of the old name.
531B
CP 03H FE 03
Compare Register A against 03H, the end mark of a specification.
531D
If the Z FLAG is set (the old name has no such part), JUMP to 5329H.
531F
CP 0DH FE 0D
Compare Register A against 0DH, an ENTER that can end it.
5321
If the Z FLAG is set (the end), JUMP to 5329H.
5323
CP B B8
Compare Register A against Register B, the separator looked for.
5324
If the NZ FLAG is set (not yet), LOOP BACK to 5319H.
5326
GOSUB to 5337H to put the separator in Register A into the new name, then the old name's characters after it.
5329
POP HL E1
Restore Register Pair HL (the place in the old name) from the stack.
532A
RET C9
RETurn to the caller with the part added or not there.
532B
LD A,(HL) 7E
Fetch the character of the old name at Register Pair HL into Register A.
532C
CP 30H FE 30
Compare Register A against 30H, the digit 0, the first digit.
532E
RET C D8
RETurn if the CARRY FLAG is set: a separator or the end of the old name's part.
532F
CP 3AH FE 3A
Compare Register A against 3AH, the colon after the digit 9.
5331
If the CARRY FLAG is set (a digit), JUMP to 5336H to put it in.
5333
CP 41H FE 41
Compare Register A against 41H, the letter A.
5335
RET C D8
RETurn if the CARRY FLAG is set: a character between the digits and the letters.
5336
INC HL 23
INCrement Register Pair HL to the next character of the old name.
5337
PUSH HL E5
Save Register Pair HL (the place in the old name) to the stack.
5338
LD H,D 62
Copy Register D (the high byte of the place in the new name) into Register H.
5339
LD L,E 6B
Copy Register E (the low byte) into Register L: Register Pair HL = the place in the new name.
533A
LD C,(HL) 4E
Fetch the character of the new name at Register Pair HL into Register C, to move it up.
533B
LD (HL),A 77
Store Register A (the character put in) at Register Pair HL.
533C
INC HL 23
INCrement Register Pair HL to the next place of the new name.
533D
LD A,C 79
Copy Register C (the character moved up) into Register A.
533E
CP 03H FE 03
Compare Register A against 03H, the end mark.
5340
If the Z FLAG is set (the end mark), JUMP to 5346H to store it.
5342
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the other end mark.
5344
If the NZ FLAG is set (not the end), LOOP BACK to 533AH to move it up one place.
5346
LD (HL),A 77
Store Register A (the end mark) at Register Pair HL.
5347
POP HL E1
Restore Register Pair HL (the place in the old name) from the stack.
5348
INC DE 13
INCrement Register Pair DE past the character put in.
5349
LOOP BACK to 532BH for the next character of the old name.

534BH - Errors and the Messages

534BH reports error 20H (illegal drive number), 534DH the error in Register A, through @ERROR. 5354H and the two entries below it are a chain of LD IX instructions whose DD prefixes make each entry but the one jumped to a dead load, so entering at 5354H, 5358H or 535CH loads Register Pair HL with one message. Each ends the command with Register Pair HL = FFFFH.

534B
LD A,20H 3E 20
Load Register A with 20H, the error number of an illegal drive number.
534D
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
534F
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5352
JUMP to 5362H to end the command with Register Pair HL = FFFFH.
5354
LD HL,5368H 21 68 53
Point Register Pair HL to 5368H, the message File spec required! (from 520AH and 5210H).
5357
LD IX,537CH DD 21 7C 53
Load Index Register IX with 537CH. The bytes DD 21 7C 53 make this a dead load of Index Register IX on fall-through; entering at 5358H runs 21 7C 53 as LD HL,537CH, the message Rename it to what?.
535B
LD IX,538FH DD 21 8F 53
Load Index Register IX with 538FH. Entering at 535CH runs 21 8F 53 as LD HL,538FH, the message Duplicate file name!.
535F
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5362
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5365
JUMP to 52C1H to put the stack back and end the command.

5368H - RENAME Data

The three messages, each ended by 0DH, and the two control blocks.

5368-537A
DEFM "File spec required!" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 5354H: no old file, or a device, was named.
537B
DEFB 0DH 0D
0DH, the end of the message File spec required!.
537C-538D
DEFM "Rename it to what?" 52 65 6E 61 6D 65 20 69 74 20 74 6F 20 77 68 61 74 3F
The message of 5358H: no new name was given after the old one.
538E
DEFB 0DH 0D
0DH, the end of the message Rename it to what?.
538F-53A2
DEFM "Duplicate file name!" 44 75 70 6C 69 63 61 74 65 20 66 69 6C 65 20 6E 61 6D 65 21
The message of 535CH: a file of the new name exists.
53A3
DEFB 0DH 0D
0DH, the end of the message Duplicate file name!.
53A4
DEFB 0DH 0D
The first byte of the new name's buffer: 0DH, no new name, until @FSPEC (5216H) or 52D3H writes it.
53A5-53C3
DEFS 31
The rest of the new name's buffer (53A4H-53C3H, 32 bytes), then opened as the new file's control block (5279H). Not loaded from the file.
53C4-53E3
DEFS 32
The old file's control block: its specification from @FSPEC (5207H), then the open file (+01H the access level, +06H the drive, +07H the directory entry). Not loaded from the file.

5200H - Member 10 (DEVICE): Parameters and the Drives

The DEVICE command (library member 61H), loaded at 5200H-56DFH. It shows up to three parts, each on unless its parameter is turned off: DRIVES (one line for each drive whose code table starts with a JP, C3H), BYTEIO (the device control blocks) and STATUS (the options and the system modules kept in memory). P sends every line to the printer too. 520DH copies P into the N cell, so the display stops at each page of 14 lines unless P is given. A drive whose diskette can be read shows the diskette's name from its GAT, with WP when it or its code table is write protected.

5200
LD (551AH),SP ED 73 1A 55
Store the Stack Pointer at 551AH, the operand of the LD SP at 5519H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,569FH 11 9F 56
Point Register Pair DE to 569FH, the parameter table of DEVICE (BYTEIO, B, DRIVES, D, N, P, STATUS, S).
5207
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names, a keyword alone storing FFFFH.
520A
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 559DH to report error 2CH (parameter error).
520D
LD HL,(553BH) 2A 3B 55
Fetch the P parameter from 553BH-553CH, the operand of the LD DE at 553AH, into Register Pair HL.
5210
LD (554CH),HL 22 4C 55
Store Register Pair HL (P) at 554CH-554DH, the N parameter: the display runs without stopping exactly when P is on, whatever N was given.
5213
GOSUB to 558CH to clear bits 2-0 of KFLAG$ (ENTER, pause, BREAK).
5216
EI FB
Enable the interrupts (EI), which the keyboard scan for BREAK and the pause needs.
5217
LD HL,FFFFH 21 FF FF
Load Register Pair HL with the DRIVES parameter, the operand at 5218H-5219H: FFFFH in the file (on), 0000H when D=N or D=OFF was given.
521A
LD A,H 7C
Copy Register H (the high byte of DRIVES) into Register A.
521B
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when DRIVES is off.
521C
If the Z FLAG is set (no drives), JUMP to 5365H for the devices.
521F
LD C,00H 0E 00
Load Register C with 00H, drive 0, the first drive of the list.
5221
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the stack.
5222
XOR A AF
Clear Register A (XOR A): Register A = 00H for the write protect flag.
5223
LD (5270H),A 32 70 52
Store Register A (00H) at 5270H, the operand of the LD A at 526FH: the drive is not yet known to be write protected.
5226
GOSUB to 478FH (GETDCT) to point Index Register IY at the code table of drive Register C (4700H + 10 x the drive).
5229
LD A,(IY+00H) FD 7E 00
Fetch the first byte of the drive's code table from IY+00H (Index Register IY = the table) into Register A.
522C
CP C3H FE C3
Compare Register A against C3H, the JP of a drive that is there.
522E
If the NZ FLAG is set (no such drive), JUMP to 535DH for the next drive.
5231
GOSUB to 44B8H (@CKDRV) to test drive Register C: the Z FLAG when a diskette can be read, the CARRY FLAG when it is write protected.
5234
If the NZ FLAG is set (no readable diskette), JUMP to 5257H to show No Disk.
5236
RRA 1F
Rotate Register A (00H) right through the CARRY FLAG (RRA): 80H when the diskette is write protected, else 00H.
5237
LD (5270H),A 32 70 52
Store Register A at 5270H, the write protect flag, the operand of the LD A at 526FH.
523A
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, SBUFF$, the buffer.
523D
LD D,(IY+09H) FD 56 09
Fetch the drive's directory cylinder from IY+09H (Index Register IY = the code table) into Register D.
5240
LD E,L 5D
Copy Register L (00H) into Register E: sector 0, the GAT.
5241
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL.
5244
LD A,14H 3E 14
Load Register A with 14H, the error number of a GAT read error. LD does not change the flags.
5246
If the NZ FLAG is set (the GAT could not be read), JUMP to 559FH to report error 14H.
5249
LD L,D8H 2E D8
Load Register L with D8H: Register Pair HL = 42D8H, the byte after the diskette's name (GAT +D0H-+D7H).
524B
LD (HL),5DH 36 5D
Store 5DH, a closing square bracket, at Register Pair HL.
524D
INC L 2C
INCrement Register L: Register Pair HL = 42D9H, after the bracket.
524E
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL after the bracket.
5250
INC L 2C
INCrement Register L: Register Pair HL = 42DAH, after the space.
5251
LD (HL),03H 36 03
Store 03H at Register Pair HL: 42D0H holds the name, a bracket and a space, ended by 03H.
5253
LD L,D0H 2E D0
Load Register L with D0H: Register Pair HL = 42D0H, the diskette's name.
5255
JUMP to 5262H to show the line of the drive with its name.
5257
LD HL,55AAH 21 AA 55
Point Register Pair HL to 55AAH, the text No Disk] , 03H and a space.
525A
LD DE,42D0H 11 D0 42
Point Register Pair DE to 42D0H, where the name of a readable diskette is.
525D
LD BC,000CH 01 0C 00
Load Register Pair BC with 000CH, the 12 bytes to copy.
5260
LDIR ED B0
Copy the 12 bytes from 55AAH at Register Pair HL to 42D0H at Register Pair DE (LDIR, Register Pair BC = the count).
5262
LD A,3AH 3E 3A
Load Register A with 3AH, a colon, the start of the drive's line.
5264
GOSUB to 5535H to show the character in Register A (and print it when P is on).
5267
POP BC C1
Restore Register Pair BC (Register C = the drive) from the stack.
5268
PUSH BC C5
Save Register Pair BC (the drive) on the stack again.
5269
LD A,C 79
Copy Register C (the drive number) into Register A.
526A
ADD A,30H C6 30
ADD 30H to Register A: the drive number becomes its digit.
526C
GOSUB to 5535H to show the drive digit after the colon.
526F
LD A,00H 3E 00
Load Register A with the write protect flag, the operand at 5270H: 80H when @CKDRV found the diskette write protected.
5271
OR (IY+03H) FD B6 03
OR the drive's +03H at IY+03H (Index Register IY = the code table) into Register A: bit 7 set when the drive is to be treated as write protected.
5274
RLCA 07
Rotate Register A left (RLCA): bit 7 into the CARRY FLAG.
5275
LD A,20H 3E 20
Load Register A with 20H, a space. LD does not change the flags.
5277
LD B,20H 06 20
Load Register B with 20H, a space, the second character.
5279
If the NO CARRY FLAG is set (not write protected), JUMP to 527FH to show two spaces.
527B
LD A,57H 3E 57
Load Register A with 57H, the letter W of WP.
527D
LD B,50H 06 50
Load Register B with 50H, the letter P of WP.
527F
GOSUB to 5535H to show the character in Register A.
5282
LD A,B 78
Copy Register B (the second character) into Register A.
5283
GOSUB to 5535H to show it: WP, or two spaces when not protected.
5286
LD A,20H 3E 20
Load Register A with 20H, a space, before the bracket.
5288
GOSUB to 5535H to show the space in Register A.
528B
LD A,5BH 3E 5B
Load Register A with 5BH, an opening square bracket.
528D
GOSUB to 5535H to show the bracket in Register A.
5290
LD HL,42D0H 21 D0 42
Point Register Pair HL to 42D0H, the diskette's name (or No Disk), a bracket and a space.
5293
GOSUB to 5528H to show the text at Register Pair HL (and print it when P is on).
5296
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the drive's +03H at IY+03H (Index Register IY = the code table): set for an 8 inch drive.
529A
LD A,35H 3E 35
Load Register A with 35H, the digit 5. LD does not change the flags.
529C
If the Z FLAG is set (not 8 inch), JUMP to 52A0H.
529E
LD A,38H 3E 38
Load Register A with 38H, the digit 8, for an 8 inch drive.
52A0
GOSUB to 5535H to show the size digit, 5 or 8.
52A3
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of the drive's +03H at IY+03H (Index Register IY = the code table): set for a rigid drive.
52A7
LD HL,561CH 21 1C 56
Point Register Pair HL to 561CH, the text " Floppy # (an inch mark first). LD does not change the flags.
52AA
If the Z FLAG is set (a floppy drive), JUMP to 52AFH.
52AC
LD HL,5627H 21 27 56
Point Register Pair HL to 5627H, the text " Rigid #.
52AF
GOSUB to 5528H to show the text at Register Pair HL.
52B2
LD A,(IY+04H) FD 7E 04
Fetch the drive's +04H from IY+04H (Index Register IY = the code table) into Register A.
52B5
AND 0FH E6 0F
AND 0FH into Register A: bits 3-0, the number of the unit.
52B7
ADD A,90H C6 90
ADD 90H to Register A (the first step of the digit conversion).
52B9
DAA 27
Decimal adjust Register A (DAA): 90H-99H, or 00H-05H with the CARRY FLAG.
52BA
ADC A,40H CE 40
ADD 40H and the CARRY FLAG to Register A (ADC A,40H).
52BC
DAA 27
Decimal adjust Register A (DAA): Register A = the unit as a hexadecimal digit.
52BD
GOSUB to 5535H to show the unit's digit in Register A.
52C0
LD L,(IY+06H) FD 6E 06
Fetch the highest cylinder from IY+06H (Index Register IY = the code table) into Register L.
52C3
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the highest cylinder.
52C5
INC HL 23
INCrement Register Pair HL: the number of cylinders.
52C6
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of the drive's +03H at IY+03H (Index Register IY = the code table): set for a rigid drive.
52CA
If the Z FLAG is set (a floppy drive), JUMP to 52D3H.
52CC
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of the drive's +04H at IY+04H (Index Register IY = the code table).
52D0
If the Z FLAG is set (bit 5 clear), JUMP to 52D3H.
52D2
ADD HL,HL 29
Double Register Pair HL (ADD HL,HL): a rigid drive with bit 5 of +04H set shows twice the cylinders.
52D3
LD DE,5637H 11 37 56
Point Register Pair DE to 5637H, the places of the number in the text " Cyl=".
52D6
GOSUB to 541BH to write Register Pair HL in decimal, three places, at Register Pair DE.
52D9
LD HL,5632H 21 32 56
Point Register Pair HL to 5632H, the text " Cyl=" and the number.
52DC
GOSUB to 5528H to show the text at Register Pair HL.
52DF
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of the drive's +03H at IY+03H (Index Register IY = the code table): set for a rigid drive.
52E3
If the Z FLAG is set (a floppy drive), JUMP to 52F6H.
52E5
BIT 2,(IY+03H) FD CB 03 56
Test bit 2 of the drive's +03H at IY+03H (Index Register IY = the code table): set for a fixed drive.
52E9
LD HL,563CH 21 3C 56
Point Register Pair HL to 563CH, the text Removable. LD does not change the flags.
52EC
If the Z FLAG is set (removable), JUMP to 52F1H.
52EE
LD HL,5646H 21 46 56
Point Register Pair HL to 5646H, the text Fixed.
52F1
GOSUB to 5528H to show the text at Register Pair HL.
52F4
JUMP to 535AH to end the line of the rigid drive.
52F6
BIT 6,(IY+03H) FD CB 03 76
Test bit 6 of the drive's +03H at IY+03H (Index Register IY = the code table): set for double density.
52FA
LD A,53H 3E 53
Load Register A with 53H, the letter S. LD does not change the flags.
52FC
If the Z FLAG is set (single density), JUMP to 5300H.
52FE
LD A,44H 3E 44
Load Register A with 44H, the letter D, for double density.
5300
GOSUB to 5535H to show S or D, the density, in Register A.
5303
LD HL,564CH 21 4C 56
Point Register Pair HL to 564CH, the text den Side=.
5306
GOSUB to 5528H to show the text at Register Pair HL.
5309
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of the drive's +04H at IY+04H (Index Register IY = the code table): set for two sides.
530D
LD A,31H 3E 31
Load Register A with 31H, the digit 1. LD does not change the flags.
530F
If the Z FLAG is set (one side), JUMP to 5312H.
5311
INC A 3C
INCrement Register A to 32H, the digit 2, for two sides.
5312
GOSUB to 5535H to show the number of sides in Register A.
5315
LD HL,5656H 21 56 56
Point Register Pair HL to 5656H, the text " Step=".
5318
GOSUB to 5528H to show the text at Register Pair HL.
531B
LD A,(IY+03H) FD 7E 03
Fetch the drive's +03H from IY+03H (Index Register IY = the code table) into Register A.
531E
AND 23H E6 23
AND 23H into Register A: bit 5 (8 inch) and bits 1-0 (the stepping rate).
5320
LD B,A 47
Copy Register A (the three bits) into Register B, to keep them.
5321
RRCA 0F
Rotate Register A right (RRCA): one of three, to bring bit 5 down.
5322
RRCA 0F
Rotate Register A right again (RRCA): two of three.
5323
RRCA 0F
Rotate Register A right again (RRCA): bit 5 is now bit 2.
5324
OR B B0
OR Register B into Register A: bit 2 = 8 inch, bits 1-0 = the rate.
5325
RLCA 07
Rotate Register A left (RLCA): those three bits move to bits 3-1.
5326
AND 0EH E6 0E
AND 0EH into Register A: 2 x (4 x 8 inch + the rate), the offset of a two character entry.
5328
LD HL,560CH 21 0C 56
Point Register Pair HL to 560CH, the table of stepping rates (eight entries of two characters).
532B
ADD A,L 85
ADD Register L (the low byte of the table) to Register A.
532C
LD L,A 6F
Copy Register A (the low byte of the entry) into Register L.
532D
ADC A,H 8C
ADD Register H and the CARRY FLAG to Register A (ADC A,H).
532E
SUB L 95
SUBtract Register L from Register A: Register A = Register H plus the carry.
532F
LD H,A 67
Copy Register A into Register H: Register Pair HL = the entry.
5330
LD A,(HL) 7E
Fetch the first character of the rate at Register Pair HL into Register A.
5331
INC HL 23
INCrement Register Pair HL to the second character.
5332
GOSUB to 5535H to show the first character of the rate.
5335
LD A,(HL) 7E
Fetch the second character of the rate at Register Pair HL into Register A.
5336
GOSUB to 5535H to show the second character of the rate.
5339
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the drive's +03H at IY+03H (Index Register IY = the code table): set for an 8 inch drive.
533D
If the NZ FLAG is set (8 inch), JUMP to 535AH: no delay is shown.
533F
LD HL,5660H 21 60 56
Point Register Pair HL to 5660H, the text " Dly=".
5342
GOSUB to 5528H to show the text at Register Pair HL.
5345
BIT 2,(IY+03H) FD CB 03 56
Test bit 2 of the drive's +03H at IY+03H (Index Register IY = the code table): the motor start delay bit.
5349
LD A,20H 3E 20
Load Register A with 20H, a space. LD does not change the flags.
534B
LD B,31H 06 31
Load Register B with 31H, the digit 1, for a delay of one second.
534D
If the Z FLAG is set (bit 2 clear), JUMP to 5353H to show " 1".
534F
LD A,2EH 3E 2E
Load Register A with 2EH, a full stop, for half a second.
5351
LD B,35H 06 35
Load Register B with 35H, the digit 5: the delay shown as .5.
5353
GOSUB to 5535H to show the character in Register A.
5356
LD A,B 78
Copy Register B (the digit of the delay) into Register A.
5357
GOSUB to 5535H to show the digit of the delay.
535A
GOSUB to 5542H to end the line (ENTER), count the page and look at BREAK and the pause.
535D
POP BC C1
Restore Register Pair BC (Register C = the drive) from the stack.
535E
INC C 0C
INCrement Register C to the next drive of the list.
535F
LD A,C 79
Copy Register C (the next drive) into Register A.
5360
CP 08H FE 08
Compare Register A against 08H, past drive 7.
5362
If the NZ FLAG is set (drives left), JUMP to 5221H for the next drive.

5365H - DEVICE: the Device Control Blocks

Each block of 8 bytes that is in use (type not 00H) gets a line: an asterisk and its name, the direction (less than sign for input, bit 0; greater than sign for output, bit 1), then what it points at: the driver address as X'nnnn', Nil for a block with nothing assigned (bit 3), or for a routed block (bit 4) the block it is routed to, followed as far as it goes, or the file it is routed to (an open file's control block, bit 7 of +00H) as <=> and its name. The blocks are KI, DO, PR (4015H-402CH), then 43C0H-43FFH.

5365
LD HL,FFFFH 21 FF FF
Load Register Pair HL with the BYTEIO parameter, the operand at 5366H-5367H: FFFFH in the file (on), 0000H when B=N or B=OFF was given.
5368
LD A,H 7C
Copy Register H (the high byte of BYTEIO) into Register A.
5369
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when BYTEIO is off.
536A
If the Z FLAG is set (no devices), JUMP to 545AH for the options.
536D
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
5370
LD A,(HL) 7E
Fetch the type of the block at Register Pair HL into Register A.
5371
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, a block not in use.
5372
If the Z FLAG is set (not in use), JUMP to 53C2H for the next block.
5374
LD DE,566EH 11 6E 56
Point Register Pair DE to 566EH, the line being built.
5377
PUSH HL E5
Save Register Pair HL (the block) to the stack.
5378
GOSUB to 544AH to put an asterisk and the block's two letter name at Register Pair DE.
537B
POP HL E1
Restore Register Pair HL (the block) from the stack.
537C
PUSH HL E5
Save Register Pair HL (the block) on the stack again.
537D
BIT 4,(HL) CB 66
Test bit 4 of the type at Register Pair HL: set when the device is routed to another block.
537F
If the Z FLAG is set (not routed), JUMP to 5398H.
5381
INC L 2C
INCrement Register L to +01H of the block, the low byte of its address word.
5382
LD A,(HL) 7E
Fetch the low byte of the block it is routed to, from +01H at Register Pair HL, into Register A.
5383
INC L 2C
INCrement Register L to +02H of the block, the high byte of its address word.
5384
LD H,(HL) 66
Fetch the high byte of the block it is routed to, from +02H at Register Pair HL, into Register H.
5385
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the block routed to.
5386
BIT 7,(HL) CB 7E
Test bit 7 of +00H at Register Pair HL: set when it is the control block of an open file.
5388
If the NZ FLAG is set (a file), JUMP to 53D4H to show the file's name.
538A
PUSH HL E5
Save Register Pair HL (the block routed to) to the stack.
538B
GOSUB to 53FCH to put the direction of the block at Register Pair HL into the line.
538E
GOSUB to 544AH to put an asterisk and the name of that block into the line.
5391
POP HL E1
Restore Register Pair HL (the block routed to) from the stack.
5392
BIT 4,(HL) CB 66
Test bit 4 of its type at Register Pair HL: set when it is routed on to another block.
5394
If the NZ FLAG is set (routed on), LOOP BACK to 5381H to follow it.
5396
JUMP to 53B5H to end the line of the routed device.
5398
GOSUB to 53FCH to put the direction of the block at Register Pair HL into the line.
539B
BIT 3,(HL) CB 5E
Test bit 3 of the type at Register Pair HL: set when nothing is assigned to the device.
539D
If the NZ FLAG is set (nothing assigned), JUMP to 53F2H to put Nil.
539F
LD A,58H 3E 58
Load Register A with 58H, the letter X, before the driver address.
53A1
LD (DE),A 12
Store Register A (X) at Register Pair DE in the line.
53A2
INC DE 13
INCrement Register Pair DE to the next place of the line.
53A3
LD A,27H 3E 27
Load Register A with 27H, a quote, after the letter X.
53A5
LD (DE),A 12
Store Register A (the quote) at Register Pair DE in the line.
53A6
INC DE 13
INCrement Register Pair DE to the next place of the line.
53A7
INC L 2C
INCrement Register L to +01H of the block, the low byte of the driver.
53A8
LD A,(HL) 7E
Fetch the low byte of the driver address from +01H at Register Pair HL into Register A.
53A9
INC L 2C
INCrement Register L to +02H of the block, the high byte of the driver.
53AA
LD H,(HL) 66
Fetch the high byte of the driver address from +02H at Register Pair HL into Register H.
53AB
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the driver address.
53AC
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the driver address, Register Pair HL = the place in the line.
53AD
GOSUB to 4D76H to write Register Pair DE as four hexadecimal digits at Register Pair HL.
53B0
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair DE = the place after the digits.
53B1
LD A,27H 3E 27
Load Register A with 27H, the closing quote after the address.
53B3
LD (DE),A 12
Store Register A (the quote) at Register Pair DE in the line.
53B4
INC DE 13
INCrement Register Pair DE to the next place of the line.
53B5
LD A,03H 3E 03
Load Register A with 03H, the end mark of the line.
53B7
LD (DE),A 12
Store Register A (03H) at Register Pair DE, ending the line text.
53B8
LD HL,566EH 21 6E 56
Point Register Pair HL to 566EH, the line just built.
53BB
GOSUB to 5528H to show the line at Register Pair HL (and print it when P is on).
53BE
GOSUB to 5542H to end the line (ENTER), count the page and look at BREAK and the pause.
53C1
POP HL E1
Restore Register Pair HL (the block) from the stack.
53C2
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
53C3
ADD A,08H C6 08
ADD 08H to Register A: the next block, 8 bytes on.
53C5
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the next block.
53C6
If the CARRY FLAG is set (past 43F8H, the last block), JUMP to 545AH for the options.
53C9
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
53CB
If the NZ FLAG is set (another block of the group), JUMP to 5370H.
53CE
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the first block of the second group.
53D1
JUMP to 5370H to show the block at 43C0H and those after it.
53D4
PUSH HL E5
A file: save Register Pair HL (the file's control block) to the stack.
53D5
LD HL,5669H 21 69 56
Point Register Pair HL to 5669H, the text " <=> ".
53D8
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, its five characters.
53DB
LDIR ED B0
Copy the 5 bytes from 5669H at Register Pair HL to the line at Register Pair DE (LDIR, Register Pair BC = the count).
53DD
POP HL E1
Restore Register Pair HL (the file's control block) from the stack.
53DE
LD A,L 7D
Copy Register L (the low byte of the control block) into Register A.
53DF
ADD A,06H C6 06
ADD 06H to Register A: the offset of the drive.
53E1
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the control block +06H.
53E2
LD C,(HL) 4E
Fetch the drive from +06H at Register Pair HL into Register C.
53E3
INC HL 23
INCrement Register Pair HL to +07H of the control block, the directory entry.
53E4
LD B,(HL) 46
Fetch the directory entry from +07H at Register Pair HL into Register B.
53E5
PUSH DE D5
Save Register Pair DE (the place in the line) to the stack.
53E6
GOSUB to 44BBH (@FNAME) to write the name of the file of drive Register C, directory entry Register B, at Register Pair DE.
53E9
POP DE D1
Restore Register Pair DE (the place of the name) from the stack.
53EA
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
53EB
CP 03H FE 03
Compare Register A against 03H, the end of the name @FNAME wrote.
53ED
If the Z FLAG is set (the end of the name), JUMP to 53B5H to end the line there.
53EF
INC DE 13
INCrement Register Pair DE to the next character of the name.
53F0
LOOP BACK to 53EAH to find the end of the name.
53F2
LD HL,5666H 21 66 56
Point Register Pair HL to 5666H, the text Nil.
53F5
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, its three characters.
53F8
LDIR ED B0
Copy the 3 bytes from 5666H at Register Pair HL to the line at Register Pair DE (LDIR, Register Pair BC = the count).
53FA
JUMP to 53B5H to end the line after the text Nil.
53FC
LD A,20H 3E 20
Load Register A with 20H, a space, before the direction.
53FE
LD (DE),A 12
Store Register A (the space) at Register Pair DE in the line.
53FF
INC DE 13
INCrement Register Pair DE to the next place of the line.
5400
BIT 0,(HL) CB 46
Test bit 0 of the type at Register Pair HL: set for a device that gives input.
5402
If the Z FLAG is set (no input), JUMP to 5406H to store the space.
5404
LD A,3CH 3E 3C
Load Register A with 3CH, the less than sign: input.
5406
LD (DE),A 12
Store Register A at Register Pair DE in the line.
5407
INC DE 13
INCrement Register Pair DE to the next place of the line.
5408
LD A,3DH 3E 3D
Load Register A with 3DH, an equals sign, the middle of the arrow.
540A
LD (DE),A 12
Store Register A (the equals sign) at Register Pair DE in the line.
540B
INC DE 13
INCrement Register Pair DE to the next place of the line.
540C
LD A,20H 3E 20
Load Register A with 20H, a space. LD does not change the flags.
540E
BIT 1,(HL) CB 4E
Test bit 1 of the type at Register Pair HL: set for a device that takes output.
5410
If the Z FLAG is set (no output), JUMP to 5414H to store the space.
5412
LD A,3EH 3E 3E
Load Register A with 3EH, the greater than sign: output.
5414
LD (DE),A 12
Store Register A at Register Pair DE in the line.
5415
INC DE 13
INCrement Register Pair DE to the next place of the line.
5416
LD A,20H 3E 20
Load Register A with 20H, a space, after the direction.
5418
LD (DE),A 12
Store Register A (the space) at Register Pair DE in the line.
5419
INC DE 13
INCrement Register Pair DE to the next place of the line.
541A
RET C9
RETurn to the caller with the direction in the line.

541BH - Numbers and Names for the Lines

541BH writes Register Pair HL (below 1000) at Register Pair DE as three places, leading zeros as spaces; 542FH writes one place for the power of ten in Register Pair BC, Register A being the character for a zero (a space until a digit has been written, then 0). 544AH puts an asterisk and the two letter name of the block at Register Pair HL at Register Pair DE.

541B
LD A,20H 3E 20
Load Register A with 20H, a space, for a leading zero.
541D
LD BC,0064H 01 64 00
Load Register Pair BC with 0064H, a hundred, for the first place.
5420
GOSUB to 542FH to write the hundreds at Register Pair DE.
5423
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, ten, for the second place.
5426
GOSUB to 542FH to write the tens at Register Pair DE.
5429
LD A,L 7D
Copy Register L (the units left) into Register A.
542A
ADD A,30H C6 30
ADD 30H to Register A: the units become their digit.
542C
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE.
542D
INC DE 13
INCrement Register Pair DE past the three places of the number.
542E
RET C9
RETurn to the caller with three places written.
542F
PUSH DE D5
Save Register Pair DE (the place) to the stack.
5430
LD E,A 5F
Copy Register A (the character for a zero) into Register E.
5431
LD D,FFH 16 FF
Load Register D with FFH, the count of subtractions less one.
5433
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
5434
INC D 14
INCrement Register D, the count of the subtractions.
5435
SBC HL,BC ED 42
Subtract Register Pair BC (the power of ten) from Register Pair HL.
5437
If the NO CARRY FLAG is set (not below 0 yet), LOOP BACK to 5434H.
5439
ADD HL,BC 09
ADD Register Pair BC back to Register Pair HL: the remainder.
543A
LD A,E 7B
Copy Register E (the character for a zero) into Register A.
543B
LD B,D 42
Copy Register D (the digit of this place) into Register B.
543C
POP DE D1
Restore Register Pair DE (the place) from the stack.
543D
LD (DE),A 12
Store Register A (the character for a zero) at Register Pair DE.
543E
INC B 04
INCrement Register B (the digit), to test it for zero.
543F
DEC B 05
DECrement Register B again: the Z FLAG is set when the digit is 0.
5440
If the Z FLAG is set (a zero), JUMP to 5448H, keeping the character stored.
5442
LD A,B 78
Copy Register B (the digit of this place) into Register A.
5443
ADD A,30H C6 30
ADD 30H to Register A: the digit as a character.
5445
LD (DE),A 12
Store Register A (the digit) at Register Pair DE over it.
5446
LD A,30H 3E 30
Load Register A with 30H, the digit 0: zeros after a digit are shown.
5448
INC DE 13
INCrement Register Pair DE to the next place.
5449
RET C9
RETurn to the caller with Register A = the character for a zero.
544A
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
544B
ADD A,06H C6 06
ADD 06H to Register A: the offset of the name.
544D
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name.
544E
LD A,2AH 3E 2A
Load Register A with 2AH, an asterisk, before a device name.
5450
LD (DE),A 12
Store Register A (the asterisk) at Register Pair DE in the line.
5451
INC DE 13
INCrement Register Pair DE to the next place of the line.
5452
LD A,(HL) 7E
Fetch the first letter of the name at Register Pair HL into Register A.
5453
LD (DE),A 12
Store Register A (the first letter) at Register Pair DE in the line.
5454
INC DE 13
INCrement Register Pair DE to the next place of the line.
5455
INC L 2C
INCrement Register L to the second letter of the name.
5456
LD A,(HL) 7E
Fetch the second letter of the name at Register Pair HL into Register A.
5457
LD (DE),A 12
Store Register A (the second letter) at Register Pair DE in the line.
5458
INC DE 13
INCrement Register Pair DE to the next place of the line.
5459
RET C9
RETurn to the caller with the name in the line.

545AH - DEVICE: the Options and the System Modules

Options: is followed by the options that are on, separated by commas: Smooth (46FDH not 00H, the patch point of the disk driver), the name of each set bit of DFLAG$ (bit 0 Spool, 1 Type, 2 JKL, 3 PR, 4 KI, 5 MiniDOS, 6 KSM, 7 Graphic), Fast or Slow (SFLAG$ bit 3), and , Verify when the @WRITE vector (4439H) goes to 48E6H, the write with verify. Then, when the word at 4BDFH (the operand of the overlay loader's CALL in the supervisor dispatcher) is not 4BF5H, System modules resident: and the number of each system file whose entry in the table 1FH below that address is not 00H.

545A
LD HL,FFFFH 21 FF FF
Load Register Pair HL with the STATUS parameter, the operand at 545BH-545CH: FFFFH in the file (on), 0000H when S=N or S=OFF was given.
545D
LD A,H 7C
Copy Register H (the high byte of STATUS) into Register A.
545E
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when STATUS is off.
545F
If the Z FLAG is set (no options), JUMP to 5516H to end the command.
5462
LD HL,55BDH 21 BD 55
Point Register Pair HL to 55BDH, the text Options:.
5465
GOSUB to 5528H to show the text at Register Pair HL (and print it when P is on).
5468
LD BC,08FFH 01 FF 08
Load Register Pair BC with 08FFH: Register B = the 8 bits of DFLAG$, Register C = FFH, no option shown yet.
546B
LD A,(46FDH) 3A FD 46
Fetch the patch byte of the disk driver from 46FDH into Register A: 00H (a NOP) unless SMOOTH was set.
546E
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when it is 00H.
546F
LD HL,55B5H 21 B5 55
Point Register Pair HL to 55B5H, the text " Smooth". LD does not change the flags.
5472
If the Z FLAG is set (no SMOOTH), JUMP to 5478H.
5474
GOSUB to 5528H to show the text at Register Pair HL.
5477
INC C 0C
INCrement Register C: one option shown, the next gets a comma.
5478
LD HL,55C6H 21 C6 55
Point Register Pair HL to 55C6H, the names of the bits of DFLAG$, the last letter of each with bit 7 set.
547B
LD A,(441FH) 3A 1F 44
Fetch DFLAG$, the device flags, from 441FH into Register A.
547E
PUSH AF F5
Save Register Pair AF (the flags) to the stack.
547F
POP AF F1
Restore Register Pair AF (the flags left to test) from the stack.
5480
RRCA 0F
Rotate Register A right (RRCA): the next bit into the CARRY FLAG.
5481
PUSH AF F5
Save Register Pair AF (the flags left) to the stack.
5482
If the NO CARRY FLAG is set (the bit is clear), JUMP to 549DH to pass over its name.
5484
INC C 0C
INCrement Register C, the options shown: 00H for the first.
5485
If the NZ FLAG is set (not the first), GOSUB to 5533H to show a comma.
5488
LD A,20H 3E 20
Load Register A with 20H, a space, before the name.
548A
GOSUB to 5535H to show the space in Register A.
548D
LD A,(HL) 7E
Fetch the next letter of the name at Register Pair HL into Register A.
548E
INC HL 23
INCrement Register Pair HL to the letter after it.
548F
PUSH AF F5
Save Register Pair AF (the letter with its bit 7) to the stack.
5490
AND 7FH E6 7F
AND 7FH into Register A: the letter without the end mark.
5492
GOSUB to 5535H to show the letter in Register A.
5495
POP AF F1
Restore Register Pair AF (the letter with its bit 7) from the stack.
5496
RLCA 07
Rotate Register A left (RLCA): bit 7, the end mark, into the CARRY FLAG.
5497
If the NO CARRY FLAG is set (more letters), LOOP BACK to 548DH.
5499
DECrement Register B (the bits left) and LOOP BACK to 547FH.
549B
JUMP to 54A4H, every bit of DFLAG$ being done.
549D
LD A,(HL) 7E
Fetch the next letter of the name at Register Pair HL into Register A.
549E
INC HL 23
INCrement Register Pair HL to the letter after it.
549F
RLCA 07
Rotate Register A left (RLCA): bit 7, the end mark, into the CARRY FLAG.
54A0
If the NO CARRY FLAG is set (more letters), LOOP BACK to 549DH to pass over them.
54A2
DECrement Register B (the bits left) and LOOP BACK to 547FH.
54A4
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
54A7
BIT 3,A CB 5F
Test bit 3 of Register A (SFLAG$): set for FAST.
54A9
LD HL,55E7H 21 E7 55
Point Register Pair HL to 55E7H, the text " Fast". LD does not change the flags.
54AC
If the NZ FLAG is set (FAST), JUMP to 54B1H with the text Fast.
54AE
LD HL,55EDH 21 ED 55
Point Register Pair HL to 55EDH, the text " Slow".
54B1
INC C 0C
INCrement Register C, the options shown: 00H when it is the first.
54B2
If the NZ FLAG is set (not the first), GOSUB to 5533H to show a comma.
54B5
GOSUB to 5528H to show Fast or Slow at Register Pair HL.
54B8
POP AF F1
Restore Register Pair AF from the stack: the flags pushed at 5481H are dropped.
54B9
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
54BA
LD HL,(443AH) 2A 3A 44
Fetch the address the @WRITE vector jumps to, from 443AH-443BH, into Register Pair HL.
54BD
LD DE,48E6H 11 E6 48
Load Register Pair DE with 48E6H, the write with verify.
54C0
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG is set when @WRITE verifies.
54C2
LD HL,5696H 21 96 56
Point Register Pair HL to 5696H, the text , Verify. LD does not change the flags.
54C5
If the Z FLAG is set (verify on), GOSUB to 5528H to show the text at Register Pair HL.
54C8
GOSUB to 5542H to end the line (ENTER), count the page and look at BREAK and the pause.
54CB
LD HL,4BDFH 21 DF 4B
Point Register Pair HL to 4BDFH, the operand of the overlay loader's CALL in the supervisor dispatcher.
54CE
LD E,(HL) 5E
Fetch the low byte of the address there at Register Pair HL into Register E.
54CF
INC HL 23
INCrement Register Pair HL to the high byte of the address.
54D0
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the address the dispatcher calls.
54D1
LD HL,4BF5H 21 F5 4B
Point Register Pair HL to 4BF5H, the overlay loader of SYS0/SYS.
54D4
OR A B7
Clear the CARRY FLAG (OR A, Register A unchanged) for the subtraction.
54D5
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG is set when the dispatcher calls the loader itself.
54D7
If the Z FLAG is set (no system files kept in memory), JUMP to 5516H to end the command.
54DA
LD HL,FFE1H 21 E1 FF
Load Register Pair HL with FFE1H, minus 1FH, the distance to the table.
54DD
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the table of system files kept in memory, 1FH below the address.
54DE
PUSH HL E5
Save Register Pair HL (the table) to the stack.
54DF
LD HL,55F3H 21 F3 55
Point Register Pair HL to 55F3H, the text System modules resident:.
54E2
GOSUB to 5528H to show the text at Register Pair HL.
54E5
POP HL E1
Restore Register Pair HL (the table) from the stack.
54E6
LD BC,10FFH 01 FF 10
Load Register Pair BC with 10FFH: Register B = the 16 entries, Register C = FFH, no number shown yet.
54E9
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A: not 00H when that system file is kept in memory.
54EA
INC HL 23
INCrement Register Pair HL to the second byte of the entry.
54EB
INC HL 23
INCrement Register Pair HL to the next entry (two bytes each).
54EC
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H.
54ED
If the Z FLAG is set (not kept), JUMP to 5511H for the next entry.
54EF
INC C 0C
INCrement Register C, the numbers shown: 00H for the first.
54F0
If the NZ FLAG is set (not the first), GOSUB to 5533H to show a comma.
54F3
LD A,20H 3E 20
Load Register A with 20H, a space, before the number.
54F5
GOSUB to 5535H to show the space in Register A.
54F8
LD A,10H 3E 10
Load Register A with 10H, the number of entries.
54FA
SUB B 90
SUBtract Register B (the entries left) from Register A: the number of this system file, 0-15.
54FB
LD D,FFH 16 FF
Load Register D with FFH, the tens less one before counting.
54FD
INC D 14
INCrement Register D, the count of the tens of the number.
54FE
SUB 0AH D6 0A
SUBtract 0AH (ten) from Register A for each ten.
5500
If the NO CARRY FLAG is set (not below 0 yet), LOOP BACK to 54FDH.
5502
PUSH AF F5
Save Register Pair AF (the units less ten) to the stack.
5503
LD A,D 7A
Copy Register D (the tens of the number) into Register A.
5504
ADD A,30H C6 30
ADD 30H to Register A: the tens become their digit.
5506
CP 30H FE 30
Compare Register A against 30H, the digit 0: no tens digit is shown.
5508
If the NZ FLAG is set (a ten), GOSUB to 5535H to show the tens digit.
550B
POP AF F1
Restore Register Pair AF (the units less ten) from the stack.
550C
ADD A,3AH C6 3A
ADD 3AH to Register A: the units plus 30H, the units digit.
550E
GOSUB to 5535H to show the units digit in Register A.
5511
DECrement Register B (the entries left) and LOOP BACK to 54E9H.
5513
GOSUB to 5542H to end the line (ENTER), count the page and look at BREAK and the pause.
5516
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5519
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 551AH-551BH (0000H in the file). 55A7H comes here with Register Pair HL = FFFFH.
551C
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
551D
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
551E
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran DEVICE.
551F
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5522
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5524
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5525
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

5528H - Show and Print

5528H shows the text at Register Pair HL (@DSPLY) and prints it too (@PRINT) when P is on; 5533H a comma and 5535H the character in Register A, on the screen and, with P, the printer. 5542H ends a line: ENTER, then unless the display runs without stopping (P) a page of 14 lines waits for a key (BREAK ends the command, any other clears the screen), then BREAK and the pause are looked at (5569H), unless BREAK is disabled (SFLAG$ bit 4).

5528
GOSUB to 4467H (@DSPLY) to show the text at Register Pair HL, ended by 03H or 0DH.
552B
LD A,(553BH) 3A 3B 55
Fetch the low byte of the P parameter from 553BH into Register A.
552E
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set when P is on.
552F
If the NZ FLAG is set (P), JUMP to 446AH (@PRINT) to print the text at Register Pair HL as well; its RET goes back to the caller.
5532
RET C9
RETurn to the caller with the text shown on the screen.
5533
LD A,2CH 3E 2C
Load Register A with 2CH, a comma, between two options or numbers.
5535
PUSH AF F5
Save Register Pair AF (the character) to the stack.
5536
GOSUB to the ROM at 0033H to show the character in Register A on the screen.
5539
POP AF F1
Restore Register Pair AF (the character) from the stack.
553A
LD DE,0000H 11 00 00
Load Register Pair DE with the P parameter, the operand at 553BH-553CH: 0000H in the file, FFFFH when P was given.
553D
INC E 1C
INCrement Register E (the low byte of P): FFH becomes 00H and sets the Z FLAG.
553E
If the Z FLAG is set (P), JUMP to the ROM at 003BH to print the character in Register A; its RET goes back to the caller.
5541
RET C9
RETurn to the caller with the character shown on the screen.
5542
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, the end of a line.
5544
GOSUB to 5535H to show (and print) the ENTER in Register A.
5547
LD DE,5569H 11 69 55
Load Register Pair DE with 5569H, the BREAK and pause test.
554A
PUSH DE D5
Save Register Pair DE (5569H) to the stack: the RETs below go there first.
554B
LD DE,0000H 11 00 00
Load Register Pair DE with the N parameter, the operand at 554CH-554DH: 0000H in the file, the P value stored by 5210H.
554E
LD A,D 7A
Copy Register D (the high byte of N) into Register A.
554F
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when the display stops at each page.
5550
RET NZ C0
RETurn if the NZ FLAG is set (no pages): to 5569H.
5551
LD A,0EH 3E 0E
Load Register A with the lines left on the page, the operand at 5552H (0EH in the file, 14 lines).
5553
DEC A 3D
DECrement Register A, one line less on the page.
5554
LD (5552H),A 32 52 55
Store Register A (the lines left on the page) at 5552H.
5557
RET NZ C0
RETurn if the NZ FLAG is set (the page is not full): to 5569H.
5558
GOSUB to the ROM at 0049H to wait for a key: Register A = the key.
555B
CP 01H FE 01
Compare Register A against 01H, the code of BREAK.
555D
If the Z FLAG is set (BREAK), JUMP to 55A4H to end the command with Register Pair HL = FFFFH.
5560
GOSUB to the ROM at 01C9H to clear the screen for the next page.
5563
LD A,0EH 3E 0E
Load Register A with 0EH, the 14 lines of a page.
5565
LD (5552H),A 32 52 55
Store Register A (0EH) at 5552H, the lines left on the new page.
5568
RET C9
RETurn to 5569H to look at BREAK and the pause.
5569
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
556C
AND 10H E6 10
AND 10H into Register A: bit 4, set while BREAK is disabled.
556E
XOR 10H EE 10
Exclusive OR 10H into Register A: the Z FLAG is set while BREAK is disabled.
5570
RET Z C8
RETurn if the Z FLAG is set: the keys are not looked at.
5571
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
5574
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed.
5576
If the NZ FLAG is set (BREAK), JUMP to 5596H to end the display.
5578
BIT 1,A CB 4F
Test bit 1 of Register A: set when SHIFT @ asked for a pause.
557A
RET Z C8
RETurn if the Z FLAG is set: no pause, the display goes on.
557B
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A again during the pause.
557E
BIT 0,A CB 47
Test bit 0 of Register A: set when BREAK was pressed during the pause.
5580
If the NZ FLAG is set (BREAK), JUMP to 5596H to end the display.
5582
GOSUB to the ROM at 002BH (@KBD) to scan the keyboard: Register A = the key, 00H for none.
5585
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is pressed.
5586
If the Z FLAG is set (no key), LOOP BACK to 557BH.
5588
CP 60H FE 60
Compare Register A against 60H, the code of SHIFT @ itself.
558A
If the Z FLAG is set (the pause key again), LOOP BACK to 557BH.
558C
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
558F
AND F8H E6 F8
AND F8H into Register A: bits 2-0 (ENTER, pause, BREAK) cleared.
5591
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, with bits 2-0 cleared.
5594
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG.
5595
RET C9
RETurn to the caller with the keys of KFLAG$ cleared.
5596
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line on BREAK.
5598
GOSUB to 5535H to show (and print) the ENTER in Register A.
559B
JUMP to 55A4H to end the command with Register Pair HL = FFFFH.
559D
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error.
559F
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message. 5246H comes here with error 14H.
55A1
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
55A4
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
55A7
JUMP to 5519H to put the stack back and end the command.

55AAH - DEVICE Data: Texts and the Parameter Table

The texts of the three parts (each ended by 03H), the names of the bits of DFLAG$ (the last letter of each with bit 7 set), the table of stepping rates, the line buffer, and the table @PARAM reads (5204H): eight entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H. Each address is the operand of an instruction that uses the value.

55AA-55B3
DEFM "No Disk] " 4E 6F 20 20 44 69 73 6B 5D 20
The name shown for a drive with no readable diskette, copied to 42D0H by 5257H.
55B4
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after No Disk] .
55B5-55BB
DEFM " Smooth" 20 53 6D 6F 6F 74 68
The option shown when the disk driver's patch byte 46FDH is not 00H (546FH); its first byte is also the twelfth byte 5257H copies.
55BC
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Smooth.
55BD-55C4
DEFM "Options:" 4F 70 74 69 6F 6E 73 3A
The start of the line of options (5462H), shown first.
55C5
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Options:.
55C6-55CA
DEFM "Spoo" / DEFB ECH 53 70 6F 6F EC
Spool, the name of DFLAG$ bit 0 (the spooler is installed); ECH is the l with bit 7 set, the end of the name.
55CB-55CE
DEFM "Typ" / DEFB E5H 54 79 70 E5
Type, the name of DFLAG$ bit 1 (type ahead); E5H is the e with bit 7 set.
55CF-55D1
DEFM "JK" / DEFB CCH 4A 4B CC
JKL, the name of DFLAG$ bit 2; CCH is the L with bit 7 set.
55D2-55D3
DEFM "P" / DEFB D2H 50 D2
PR, the name of DFLAG$ bit 3 (PR/FLT installed); D2H is the R with bit 7 set.
55D4-55D5
DEFM "K" / DEFB C9H 4B C9
KI, the name of DFLAG$ bit 4 (KI/DVR installed); C9H is the I with bit 7 set.
55D6-55DC
DEFM "MiniDO" / DEFB D3H 4D 69 6E 69 44 4F D3
MiniDOS, the name of DFLAG$ bit 5; D3H is the S with bit 7 set.
55DD-55DF
DEFM "KS" / DEFB CDH 4B 53 CD
KSM, the name of DFLAG$ bit 6; CDH is the M with bit 7 set.
55E0-55E6
DEFM "Graphi" / DEFB E3H 47 72 61 70 68 69 E3
Graphic, the name of DFLAG$ bit 7; E3H is the c with bit 7 set.
55E7-55EB
DEFM " Fast" 20 46 61 73 74
Shown when bit 3 of SFLAG$ is set (54A9H), the CPU running fast.
55EC
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Fast.
55ED-55F1
DEFM " Slow" 20 53 6C 6F 77
Shown when bit 3 of SFLAG$ is clear (54AEH), the CPU at normal speed.
55F2
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Slow.
55F3-560A
DEFM "System modules resident:" 53 79 73 74 65 6D 20 6D 6F 64 75 6C 65 73 20 72 65 73 69 64 65 6E 74 3A
The start of the line of system files kept in memory (54DFH).
560B
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after System modules resident:.
560C-561B
DEFM " 6122040 3 61015" 20 36 31 32 32 30 34 30 20 33 20 36 31 30 31 35
The stepping rates in milliseconds, eight entries of two characters (5328H): 6, 12, 20, 40 for a 5 inch drive (rates 0-3), 3, 6, 10, 15 for an 8 inch drive.
561C-5625
DEFM 22H, " Floppy #" 22 20 46 6C 6F 70 70 79 20 23
The drive type of a floppy drive (52A7H): the inch mark after the size digit, Floppy and a number sign before the unit.
5626
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after the floppy text.
5627-5630
DEFM 22H, " Rigid #" 22 20 52 69 67 69 64 20 20 23
The drive type of a rigid drive (52ACH): the inch mark, Rigid and a number sign before the unit.
5631
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after the rigid text.
5632-5636
DEFM " Cyl=" 20 43 79 6C 3D
The start of the cylinder field (52D9H), the number following.
5637-563A
DEFM " " 20 20 20 20
The places of the number of cylinders, written by 541BH (three places), and a space.
563B
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after the cylinder field.
563C-5644
DEFM "Removable" 52 65 6D 6F 76 61 62 6C 65
Shown for a rigid drive with bit 2 of its +03H clear (52E9H).
5645
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Removable.
5646-564A
DEFM "Fixed" 46 69 78 65 64
Shown for a rigid drive with bit 2 of its +03H set (52EEH).
564B
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Fixed.
564C-5654
DEFM "den Side=" 64 65 6E 20 53 69 64 65 3D
Shown after S or D for a floppy drive (5303H).
5655
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after den Side=.
5656-565B
DEFM " Step=" 20 53 74 65 70 3D
The start of the stepping rate of a floppy drive (5315H).
565C
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Step=.
565D-565E
DEFM "ms" 6D 73
A unit text that no code of the member shows: no instruction loads its address.
565F
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after ms.
5660-5664
DEFM " Dly=" 20 44 6C 79 3D
The start of the motor delay of a 5 inch drive (533FH).
5665
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after Dly=.
5666-5668
DEFM "Nil" 4E 69 6C
Copied into the line of a device with nothing assigned (53F2H).
5669-566D
DEFM " <=> " 20 3C 3D 3E 20
Copied into the line of a device routed to a file (53D5H).
566E-5695
DEFS 40
The line of a device control block, built by 5374H-53B7H and shown by 53BBH. Not loaded from the file.
5696-569D
DEFM ", Verify" 2C 20 56 65 72 69 66 79
Shown when the @WRITE vector goes to 48E6H (54C2H).
569E
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after , Verify.
569F-56A6
DEFM "BYTEIO" / DEFW 5366H 42 59 54 45 49 4F 66 53
BYTEIO: its value goes to 5366H-5367H, the operand of the LD HL at 5365H (FFFFH in the file).
56A7-56AE
DEFM "B " / DEFW 5366H 42 20 20 20 20 20 66 53
B, the short form of BYTEIO: its value goes to 5366H-5367H too.
56AF-56B6
DEFM "DRIVES" / DEFW 5218H 44 52 49 56 45 53 18 52
DRIVES: its value goes to 5218H-5219H, the operand of the LD HL at 5217H (FFFFH in the file).
56B7-56BE
DEFM "D " / DEFW 5218H 44 20 20 20 20 20 18 52
D, the short form of DRIVES: its value goes to 5218H-5219H too.
56BF-56C6
DEFM "N " / DEFW 554CH 4E 20 20 20 20 20 4C 55
N: its value goes to 554CH-554DH, the operand of the LD DE at 554BH, which 5210H overwrites with P.
56C7-56CE
DEFM "P " / DEFW 553BH 50 20 20 20 20 20 3B 55
P: its value goes to 553BH-553CH, the operand of the LD DE at 553AH.
56CF-56D6
DEFM "STATUS" / DEFW 545BH 53 54 41 54 55 53 5B 54
STATUS: its value goes to 545BH-545CH, the operand of the LD HL at 545AH (FFFFH in the file).
56D7-56DE
DEFM "S " / DEFW 545BH 53 20 20 20 20 20 5B 54
S, the short form of STATUS: its value goes to 545BH-545CH too.
56DF
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.

5200H - Member 11 (LINK): Link Two Devices

The LINK command (library member 62H), loaded at 5200H-53A1H: LINK *d1 *d2. Only at LDOS command level. The first device must not be routed (bit 4 of its type). A module of 41 bytes named LK and the four letters of the two devices (52C7H) is put in high memory (HIGH$ lowered by 29H) or over a module of the same name found by request BCH, and the first device's driver address is pointed at it: the module calls the first device's old driver and then gives the result to the second device with @PUT; for input it asks the second device with @GET when the first has no character. For the keyboard during a JCL job the driver word changed is KIJCL$ (43BEH), where SYS11/SYS keeps the keyboard driver.

5200
LD (52B9H),SP ED 73 B9 52
Store the Stack Pointer at 52B9H, the operand of the LD SP at 52B8H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5207
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
5209
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
520C
If the Z FLAG is set (no JCL job), JUMP to 5211H to test that byte.
520E
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
5211
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with a JP only while a program has taken it over.
5213
If the Z FLAG is set (a program owns @EXIT), JUMP to 5335H to display Can't -- Only valid at LDOS command level.
5216
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
5219
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
521B
If the NZ FLAG is set (a program ran the command), JUMP to 5335H to refuse it.
521E
LD DE,53A2H 11 A2 53
Point Register Pair DE to 53A2H, the control block of the first device.
5221
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL (the parameters) to Register Pair DE (53A2H); the NZ FLAG when there is none.
5224
If the NZ FLAG is set (no specification), JUMP to 5331H to display Device spec required.
5227
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
5228
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
522A
If the NZ FLAG is set (not a device), JUMP to 5331H to display Device spec required.
522D
LD DE,53C2H 11 C2 53
Point Register Pair DE to 53C2H, the control block of the second device.
5230
GOSUB to 441CH (@FSPEC) to copy the next specification at Register Pair HL to Register Pair DE (53C2H).
5233
If the NZ FLAG is set (no second specification), JUMP to 5331H to display Device spec required.
5236
LD A,(DE) 1A
Fetch the first character of the second specification at Register Pair DE into Register A.
5237
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5239
If the NZ FLAG is set (not a device), JUMP to 5331H to display Device spec required.
523C
LD DE,(53A3H) ED 5B A3 53
Fetch the two letters of the first device from 53A3H-53A4H into Register Pair DE.
5240
LD (52CEH),DE ED 53 CE 52
Store Register Pair DE at 52CEH-52CFH, the third and fourth letters of the module's name (LKd1d2).
5244
LD (539DH),DE ED 53 9D 53
Store Register Pair DE at 539DH-539EH, the same place in the name to look for (539BH).
5248
GOSUB to 52F0H to find the control block of the device named by Register Pair DE: the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H.
524B
If the NZ FLAG is set (no such device), JUMP to 5326H to report the error in Register A (08H, device not available).
524E
BIT 4,(HL) CB 66
Test bit 4 of the type at Register Pair HL: set when the first device is routed.
5250
If the NZ FLAG is set (routed), JUMP to 532DH to display Can't Link a Routed Device.
5253
PUSH HL E5
Save Register Pair HL (the first device's block) to the stack.
5254
LD DE,(53C3H) ED 5B C3 53
Fetch the two letters of the second device from 53C3H-53C4H into Register Pair DE.
5258
LD (52D0H),DE ED 53 D0 52
Store Register Pair DE at 52D0H-52D1H, the last two letters of the module's name.
525C
LD (539FH),DE ED 53 9F 53
Store Register Pair DE at 539FH-53A0H, the same place in the name to look for.
5260
GOSUB to 52F0H to find the control block of the second device; Register Pair HL at the block.
5263
If the NZ FLAG is set (no such device), JUMP to 5326H to report the error in Register A (08H).
5266
LD (52DEH),HL 22 DE 52
Store Register Pair HL (the second device's block) at 52DEH-52DFH, the operand of the LD DE at 52DDH in the module.
5269
LD (52EBH),HL 22 EB 52
Store Register Pair HL (the second device's block) at 52EBH-52ECH, the operand of the LD DE at 52EAH in the module.
526C
POP HL E1
Restore Register Pair HL (the first device's block) from the stack.
526D
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
526E
CP 15H FE 15
Compare Register A against 15H: the Z FLAG is set for KIDCB$ (4015H), the keyboard.
5270
INC HL 23
INCrement Register Pair HL to +01H of the block, its driver address. INC HL does not change the flags.
5271
If the NZ FLAG is set (not the keyboard), JUMP to 527DH.
5273
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5276
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5278
If the Z FLAG is set (no JCL job), JUMP to 527DH.
527A
LD HL,43BEH 21 BE 43
Point Register Pair HL to 43BEH, KIJCL$, where SYS11/SYS keeps the keyboard's driver while the job feeds the keyboard.
527D
PUSH HL E5
Save Register Pair HL (the address of the driver word) to the stack.
527E
LD A,(HL) 7E
Fetch the low byte of the first device's driver at Register Pair HL into Register A.
527F
INC HL 23
INCrement Register Pair HL to the high byte of the driver word.
5280
LD H,(HL) 66
Fetch the high byte of the driver at Register Pair HL into Register H.
5281
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the first device's driver.
5282
LD (52D7H),HL 22 D7 52
Store Register Pair HL (the driver) at 52D7H-52D8H, the operand of the CALL at 52D6H in the module.
5285
LD (52E6H),HL 22 E6 52
Store Register Pair HL (the driver) at 52E6H-52E7H, the operand of the CALL at 52E5H in the module.
5288
LD DE,539BH 11 9B 53
Point Register Pair DE to 539BH, the name LKd1d2 to look for, ended by 00H.
528B
GOSUB to 5316H to look for a module of that name in high memory (request BCH); the Z FLAG and Register Pair HL at its header when found, Register Pair DE = its link word.
528E
If the NZ FLAG is set (not found), JUMP to 5299H to make room below HIGH$.
5290
LD (52C9H),DE ED 53 C9 52
Store Register Pair DE (the found module's link word) at 52C9H-52CAH, the link word of the new module: it takes the found module's place.
5294
LD BC,0029H 01 29 00
Load Register Pair BC with 0029H, the 41 bytes of the module.
5297
JUMP to 52A9H to copy the module over the found one at Register Pair HL.
5299
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
529C
LD (52C9H),HL 22 C9 52
Store Register Pair HL (HIGH$) at 52C9H-52CAH, the link word of the module: the top of its memory.
529F
LD BC,0029H 01 29 00
Load Register Pair BC with 0029H, the 41 bytes of the module.
52A2
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52A3
SBC HL,BC ED 42
Subtract Register Pair BC (41) from Register Pair HL: the new HIGH$.
52A5
LD (4049H),HL 22 49 40
Store Register Pair HL (the new HIGH$) at 4049H-404AH: the module's memory is taken.
52A8
INC HL 23
INCrement Register Pair HL to the start of the module, just above HIGH$.
52A9
PUSH HL E5
Save Register Pair HL (where the module goes) to the stack.
52AA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = where the module goes.
52AB
LD HL,52C7H 21 C7 52
Point Register Pair HL to 52C7H, the module in the member.
52AE
LDIR ED B0
Copy the 41 bytes from 52C7H at Register Pair HL to high memory at Register Pair DE (LDIR, Register Pair BC = the count).
52B0
POP DE D1
Restore Register Pair DE (the module in high memory) from the stack.
52B1
POP HL E1
Restore Register Pair HL (the address of the first device's driver word) from the stack.
52B2
LD (HL),E 73
Store Register E (the low byte of the module) at Register Pair HL.
52B3
INC HL 23
INCrement Register Pair HL to the high byte of the driver word.
52B4
LD (HL),D 72
Store Register D (the high byte of the module) at Register Pair HL: the first device's driver is now the module.
52B5
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
52B8
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 52B9H-52BAH (0000H in the file). 533EH comes here with Register Pair HL = FFFFH.
52BB
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
52BC
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
52BD
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran LINK.
52BE
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52C1
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52C3
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
52C4
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

52C7H - The Link Module

52C7H-52EFH (41 bytes) is copied to high memory by 52AEH and runs there as the first device's driver; its CALL and LD operands are absolute addresses outside the module (the old driver, the second device's block), stored by 5266H-5285H, so nothing in it needs moving. It starts with a module header: a JR over the header, the link word, the length 6 and the name LK with the two devices' letters. An input request (the CARRY FLAG) goes to the old driver and, when it gives 00H, to the second device with @GET. Any other request goes to the old driver, and Register A as that driver returned it is then given to the second device with @PUT; the old driver's result is returned.

52C7
JUMP over the module header to 52D2H: the driver entry, reached through the first device's driver word.
52C9-52CA
DEFW 0000H 00 00
The link word of the header: HIGH$ before the module (529CH), or the link of the module it replaces (5290H).
52CB
DEFB 06H 06
The length of the module's name, 6, read by the module search of request BCH.
52CC-52CD
DEFM "LK" 4C 4B
The first two letters of the module's name, LK for a link.
52CE-52D1
DEFM "xxxx" 78 78 78 78
The letters of the first device (5240H) and of the second device (5258H).
52D2
If the CARRY FLAG is set (an input request), JUMP to 52E5H.
52D4
PUSH AF F5
Save Register Pair AF (the request and its flags) to the stack.
52D5
PUSH BC C5
Save Register Pair BC (Register C = the character or the control code) to the stack.
52D6
CALL 0000H CD 00 00
GOSUB to the first device's old driver, the operand at 52D7H-52D8H (0000H in the file, stored by 5282H), with the request as it came.
52D9
POP BC C1
Restore Register Pair BC (the character) from the stack.
52DA
PUSH AF F5
Save Register Pair AF (the old driver's result) to the stack.
52DB
POP HL E1
Restore Register Pair HL from the stack: Register Pair HL = the old driver's result.
52DC
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (EX (SP),HL, the Stack Pointer's word): the old driver's result goes on the stack, the request's AF into Register Pair HL.
52DD
LD DE,0000H 11 00 00
Load Register Pair DE with the second device's control block, the operand at 52DEH-52DFH (0000H in the file, stored by 5266H).
52E0
GOSUB to the ROM at 001BH (@PUT) to give Register A (as the old driver returned it) to the device at Register Pair DE.
52E3
POP AF F1
Restore Register Pair AF (the old driver's result) from the stack.
52E4
RET C9
RETurn to the program with the first device's result.
52E5
CALL 0000H CD 00 00
Input: GOSUB to the first device's old driver, the operand at 52E6H-52E7H (0000H in the file, stored by 5285H), for a character into Register A.
52E8
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 00H, no character.
52E9
RET NZ C0
RETurn if the NZ FLAG is set: the first device gave a character.
52EA
LD DE,0000H 11 00 00
Load Register Pair DE with the second device's control block, the operand at 52EBH-52ECH (0000H in the file, stored by 5269H).
52ED
JUMP to the ROM at 0013H (@GET) to take a character from the device at Register Pair DE; its RET goes back to the program.

52F0H - Find a Device Control Block by Name

Register Pair DE holds the two letters (Register E the first). The blocks of 8 bytes are searched, their names at +06H-+07H: KI, DO and PR at 4015H-402CH, then 43C0H-43FFH. Returns the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H (device not available). 5316H looks for a module by name through request BCH and returns its link word in Register Pair DE.

52F0
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
52F3
PUSH HL E5
Save Register Pair HL (the block) to the stack.
52F4
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
52F5
ADD A,06H C6 06
ADD 06H to Register A: the low byte of the block's name at +06H.
52F7
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name (no block crosses a page).
52F8
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
52F9
INC L 2C
INCrement Register L to the second letter of the name.
52FA
CP E BB
Compare Register A against Register E, the first letter asked for.
52FB
If the NZ FLAG is set (not the same), JUMP to 5304H for the next block.
52FD
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
52FE
CP D BA
Compare Register A against Register D, the second letter asked for.
52FF
If the NZ FLAG is set (not the same), JUMP to 5304H for the next block.
5301
POP HL E1
Restore Register Pair HL (the block found) from the stack.
5302
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, found.
5303
RET C9
RETurn to the caller with Register Pair HL at the device control block.
5304
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
5305
INC L 2C
INCrement Register L from the block's +07H to the next block.
5306
If the NZ FLAG is set (Register L did not pass FFH), JUMP to 530CH.
5308
LD A,08H 3E 08
Register Pair HL passed 43FFH, the last block: load Register A with 08H, the error number of a device not available.
530A
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, not found.
530B
RET C9
RETurn to the caller with the NZ FLAG and Register A = 08H.
530C
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
530D
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
530F
If the NZ FLAG is set (still among KI, DO and PR, or in 43C0H-43FFH), LOOP BACK to 52F3H.
5311
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the next device control block.
5314
LOOP BACK to 52F3H to test the block at 43C0H and those after it.
5316
GOSUB to 5323H to issue request BCH: SYS10/SYS looks for the module named at Register Pair DE in high memory; the Z FLAG and Register Pair HL at its header when found.
5319
PUSH HL E5
Save Register Pair HL (the module's header) to the stack, to move it into Index Register IX.
531A
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the module's header.
531C
LD E,(IX+02H) DD 5E 02
Fetch the low byte of the module's link word from IX+02H (Index Register IX = the header) into Register E.
531F
LD D,(IX+03H) DD 56 03
Fetch the high byte of the link word from IX+03H (Index Register IX = the header) into Register D.
5322
RET C9
RETurn to the caller with the flags of the request (LD and POP do not change them).
5323
LD A,BCH 3E BC
Load Register A with BCH, the request for the module search of SYS10/SYS.
5325
RST 28H EF
RST 28H: SYS10/SYS searches the modules above HIGH$; the supervisor drops the RST's return address, so it returns to the caller of 5323H.

5326H - Errors and the Messages

5326H reports the error in Register A through @ERROR. 532DH and the two entries below it are a chain of LD IX instructions whose DD prefixes make each entry but the one jumped to a dead load, so entering at 532DH, 5331H or 5335H loads Register Pair HL with one message. Each ends the command with Register Pair HL = FFFFH.

5326
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
5328
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
532B
JUMP to 533BH to end the command with Register Pair HL = FFFFH.
532D
LD HL,5341H 21 41 53
Point Register Pair HL to 5341H, the message Can't Link a Routed Device (from 5250H).
5330
LD IX,535CH DD 21 5C 53
Load Index Register IX with 535CH. The bytes DD 21 5C 53 make this a dead load of Index Register IX on fall-through; entering at 5331H runs 21 5C 53 as LD HL,535CH, the message Device spec required.
5334
LD IX,5371H DD 21 71 53
Load Index Register IX with 5371H. Entering at 5335H runs 21 71 53 as LD HL,5371H, the message Can't -- Only valid at LDOS command level.
5338
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
533B
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
533E
JUMP to 52B8H to put the stack back and end the command.

5341H - LINK Data

The three messages, each ended by 0DH, the name looked for, and the two control blocks.

5341-535A
DEFM "Can't Link a Routed Device" 43 61 6E 27 74 20 4C 69 6E 6B 20 61 20 52 6F 75 74 65 64 20 44 65 76 69 63 65
The message of 532DH: the first device is routed.
535B
DEFB 0DH 0D
0DH, the end of the message Can't Link a Routed Device.
535C-536F
DEFM "Device spec required" 44 65 76 69 63 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64
The message of 5331H: a specification is missing or is not a device.
5370
DEFB 0DH 0D
0DH, the end of the message Device spec required.
5371-5399
DEFM "Can't -- Only valid at LDOS command level" 43 61 6E 27 74 20 2D 2D 20 4F 6E 6C 79 20 76 61 6C 69 64 20 61 74 20 4C 44 4F 53 20 63 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C
The message of 5335H: a program owns @EXIT, or a program ran the command.
539A
DEFB 0DH 0D
0DH, the end of the message Can't -- Only valid at LDOS command level.
539B-539C
DEFM "LK" 4C 4B
The start of the name looked for by request BCH (5288H).
539D-53A0
DEFM "xxxx" 78 78 78 78
The letters of the two devices in the name looked for, stored by 5244H and 525CH.
53A1
DEFB 00H 00
00H, the end of the name looked for: the search stops at any byte below 21H.
53A2-53C1
DEFS 32
The first device's control block: @FSPEC writes its specification here (5221H); 53A3H-53A4H hold its letters. Not loaded from the file.
53C2-53E1
DEFS 32
The second device's control block: @FSPEC writes its specification here (5230H); 53C3H-53C4H hold its letters. Not loaded from the file.

5200H - Member 12 (RESET): Read What to Reset

The RESET command (library member 63H), loaded at 5200H-54D5H. With no specification it resets the whole system (5290H); with a device (an asterisk and two letters) that device (5240H); with a file, its record length (LRL) or its date (DATE) in the directory (5374H). The drivers the system started with (KISV$, DOSV$, PRSV$, saved by the boot) are first put into the templates of KI, DO and PR at 542DH.

5200
LD (5282H),SP ED 73 82 52
Store the Stack Pointer at 5282H, the operand of the LD SP at 5281H: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
PUSH HL E5
Save Register Pair HL (the parameters of the command) to the stack.
5205
LD HL,(43B8H) 2A B8 43
Fetch KISV$, the keyboard driver the boot found, from 43B8H-43B9H into Register Pair HL.
5208
LD (542EH),HL 22 2E 54
Store Register Pair HL at 542EH-542FH, the driver address of the KI template.
520B
LD HL,(43BAH) 2A BA 43
Fetch DOSV$, the video driver the boot found, from 43BAH-43BBH into Register Pair HL.
520E
LD (5436H),HL 22 36 54
Store Register Pair HL at 5436H-5437H, the driver address of the DO template.
5211
LD HL,(43BCH) 2A BC 43
Fetch PRSV$, the printer driver the boot found, from 43BCH-43BDH into Register Pair HL.
5214
LD (543EH),HL 22 3E 54
Store Register Pair HL at 543EH-543FH, the driver address of the PR template.
5217
POP HL E1
Restore Register Pair HL (the parameters) from the stack.
5218
PUSH HL E5
Save Register Pair HL (the parameters) on the stack again.
5219
LD A,(HL) 7E
Fetch the next character of the command line at Register Pair HL into Register A.
521A
CP 28H FE 28
Compare Register A against 28H, the bracket that starts the parameters.
521C
If the Z FLAG is set (a bracket), JUMP to 5225H to read the parameters.
521E
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH, the end of the line.
5220
If the CARRY FLAG is set (no parameters), JUMP to 5230H.
5222
INC HL 23
INCrement Register Pair HL to the next character of the line.
5223
LOOP BACK to 5219H to look for the bracket of the parameters.
5225
LD DE,545DH 11 5D 54
Point Register Pair DE to 545DH, the parameter table of RESET (LRL, L, DATE, D).
5228
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names.
522B
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of a parameter error. LD does not change the flags.
522D
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 53DDH to report error 2CH.
5230
POP HL E1
Restore Register Pair HL (the parameters) from the stack.
5231
LD DE,54F6H 11 F6 54
Point Register Pair DE to 54F6H, the control block for the specification.
5234
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL to Register Pair DE (54F6H); the NZ FLAG when there is none.
5237
If the NZ FLAG is set (no specification), JUMP to 5290H to reset the whole system.
523A
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
523B
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
523D
If the NZ FLAG is set (a file), JUMP to 5374H to change the file's directory record.

5240H - Reset One Device

The device's control block is looked for; a file it is routed to (at the end of its routes) is closed. The block's type becomes 08H (nothing assigned). For KI, DO and PR (blocks at 40xxH) the template from 542DH is copied over the block: the driver the boot found. PR also clears DFLAG$ bit 3 (PR/FLT), KI clears DFLAG$ bits 1, 2, 4, 5, 6 and empties task slot 10, and DO clears the screen.

5240
LD DE,(54F7H) ED 5B F7 54
Fetch the two letters of the device from 54F7H-54F8H into Register Pair DE (Register E the first, Register D the second).
5244
GOSUB to 53F0H to find the control block of the device named by Register Pair DE: the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H.
5247
If the NZ FLAG is set (no such device), JUMP to 53DDH to report the error in Register A (08H, device not available).
524A
PUSH HL E5
Save Register Pair HL (the block) to the stack.
524B
GOSUB to 53C1H to close the file the device is routed to, if there is one.
524E
POP HL E1
Restore Register Pair HL (the block) from the stack.
524F
LD (HL),08H 36 08
Store 08H at Register Pair HL, the type of the block: nothing is assigned to the device.
5251
LD A,40H 3E 40
Load Register A with 40H, the high byte of the blocks of KI, DO and PR (4015H-402CH).
5253
CP H BC
Compare Register A against Register H, the high byte of the block.
5254
If the NZ FLAG is set (a block at 43xxH), JUMP to 527EH to end: the device stays with nothing assigned.
5256
DI F3
Disable the interrupts (DI) while the block is written.
5257
LD D,H 54
Copy Register H (the high byte of the block) into Register D.
5258
LD E,L 5D
Copy Register L (the low byte of the block) into Register E: Register Pair DE = the block.
5259
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
525A
LD BC,4015H 01 15 40
Load Register Pair BC with 4015H, KIDCB$, the first of the three blocks.
525D
SBC HL,BC ED 42
Subtract Register Pair BC from Register Pair HL: the block's distance from 4015H (0, 8 or 16).
525F
LD BC,542DH 01 2D 54
Load Register Pair BC with 542DH, the first of the three templates.
5262
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL = the template of this block.
5263
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the 8 bytes of a block.
5266
LDIR ED B0
Copy the 8 bytes from the template at Register Pair HL to the block at Register Pair DE (LDIR, Register Pair BC = the count).
5268
EI FB
Enable the interrupts again (EI): the block is as the boot made it.
5269
LD A,2DH 3E 2D
Load Register A with 2DH, the low byte after PRDCB$ (4025H + 8).
526B
CP E BB
Compare Register A against Register E, the low byte after the block copied.
526C
If the Z FLAG is set (the printer), GOSUB to 5416H to clear bit 3 of DFLAG$, PR/FLT.
526F
LD A,1DH 3E 1D
Load Register A with 1DH, the low byte after KIDCB$ (4015H + 8).
5271
CP E BB
Compare Register A against Register E, the low byte after the block copied.
5272
If the Z FLAG is set (the keyboard), GOSUB to 541CH to clear the keyboard bits of DFLAG$ and empty task slot 10.
5275
LD A,25H 3E 25
Load Register A with 25H, the low byte after DODCB$ (401DH + 8).
5277
CP E BB
Compare Register A against Register E, the low byte after the block copied.
5278
LD HL,542AH 21 2A 54
Point Register Pair HL to 542AH, the codes that clear the screen. LD does not change the flags. 5371H comes here with the Z FLAG set.
527B
If the Z FLAG is set (the video), GOSUB to 4467H (@DSPLY) to send the codes at Register Pair HL: the screen is cleared.
527E
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5281
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 5282H-5283H (0000H in the file). 53EDH comes here with Register Pair HL = FFFFH.
5284
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5285
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5286
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran RESET.
5287
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
528A
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
528C
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
528D
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

5290H - Reset the Whole System

Only at LDOS command level. PR/FLT and the keyboard options are taken out of DFLAG$, and every file a device is routed to is closed. When a task slot (4500H, twelve entries) holds a block above HIGH$, a task in high memory still runs: the message says so, the memory is not given back and only the devices are reset. Otherwise the hooks are put back as the boot left them (45DAH RET, the DEBUG hook 4310H = 4876H, no system files kept in memory, 4DF0H-4DFDH cleared, SFLAG$ bit 0 cleared, the requests below 80H to 4BEFH, the job log and @ICNFG RET), the drive code tables are read again from the system information sector of drive 0 (cylinder 0, sector 2) and HIGH$ is set to the top of memory. Then KI, DO and PR, and JL, SI and SO, get their templates, the five spare blocks are cleared, and the screen is cleared.

5290
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5293
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
5295
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
5298
If the Z FLAG is set (no JCL job), JUMP to 529DH to test that byte.
529A
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
529D
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with a JP only while a program has taken it over.
529F
If the Z FLAG is set (a program owns @EXIT), JUMP to 53E4H to display Can't -- Valid only at LDOS command level!.
52A2
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
52A5
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
52A7
If the NZ FLAG is set (a program ran the command), JUMP to 53E4H to refuse it.
52AA
GOSUB to 5416H to clear bit 3 of DFLAG$, PR/FLT.
52AD
GOSUB to 541CH to clear the keyboard bits of DFLAG$ and empty task slot 10.
52B0
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
52B3
PUSH HL E5
Save Register Pair HL (the block) to the stack.
52B4
GOSUB to 53C1H to close the file the device is routed to, if there is one.
52B7
POP HL E1
Restore Register Pair HL (the block) from the stack.
52B8
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
52B9
ADD A,08H C6 08
ADD 08H to Register A: the next block, 8 bytes on.
52BB
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the next block.
52BC
If the Z FLAG is set (past 43F8H, the last block), JUMP to 52C7H.
52BE
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
52C0
If the NZ FLAG is set (another block of the group), LOOP BACK to 52B3H.
52C2
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the first block of the second group.
52C5
LOOP BACK to 52B3H to close the file of the block at 43C0H and those after it.
52C7
LD B,0CH 06 0C
Load Register B with 0CH, the twelve task slots.
52C9
LD HL,4500H 21 00 45
Point Register Pair HL to 4500H, the task table: the address of each slot's task block.
52CC
LD E,(HL) 5E
Fetch the low byte of the slot's task block at Register Pair HL into Register E.
52CD
INC HL 23
INCrement Register Pair HL to the high byte of the slot's entry.
52CE
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the slot's task block.
52CF
INC HL 23
INCrement Register Pair HL to the entry of the next slot.
52D0
PUSH HL E5
Save Register Pair HL (the next slot) to the stack.
52D1
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
52D4
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52D5
SBC HL,DE ED 52
Subtract Register Pair DE (the task block) from Register Pair HL (HIGH$): the CARRY FLAG is set when the block is above HIGH$.
52D7
POP HL E1
Restore Register Pair HL (the next slot) from the stack. POP does not change the flags.
52D8
If the CARRY FLAG is set (a task in high memory), JUMP to 5331H: the memory cannot be given back.
52DA
DECrement Register B (the slots left) and LOOP BACK to 52CCH.
52DC
LD A,C9H 3E C9
Load Register A with C9H, the opcode of RET, for the clock task.
52DE
LD (45DAH),A 32 DA 45
Store Register A (C9H) at 45DAH, the RET the clock task reaches after midnight.
52E1
LD HL,4876H 21 76 48
Load Register Pair HL with 4876H, the routine OR A / RET.
52E4
LD (4310H),HL 22 10 43
Store Register Pair HL (4876H) at 4310H-4311H: DEBUG's hook for a command it does not know is as the boot left it.
52E7
LD HL,4BF5H 21 F5 4B
Load Register Pair HL with 4BF5H, the overlay loader of SYS0/SYS.
52EA
LD (4BDFH),HL 22 DF 4B
Store Register Pair HL (4BF5H) at 4BDFH-4BE0H, the operand of the loader's CALL in the supervisor dispatcher: no system file is kept in memory.
52ED
LD HL,4DF0H 21 F0 4D
Point Register Pair HL to 4DF0H, the base cells of the modules in high memory.
52F0
LD DE,4DF1H 11 F1 4D
Point Register Pair DE to 4DF1H, the byte after it.
52F3
LD BC,000DH 01 0D 00
Load Register Pair BC with 000DH, the 13 bytes after the first.
52F6
LD (HL),00H 36 00
Store 00H at Register Pair HL (4DF0H), the first base cell.
52F8
LDIR ED B0
Copy the 00H on through 4DF1H-4DFDH (LDIR from Register Pair HL to Register Pair DE, Register Pair BC = the count): the 14 base cells are cleared.
52FA
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
52FD
RES 0,(HL) CB 86
Clear bit 0 of SFLAG$ at Register Pair HL (430FH).
52FF
LD HL,4BEFH 21 EF 4B
Load Register Pair HL with 4BEFH, the handler of the requests below 80H.
5302
LD (4BCFH),HL 22 CF 4B
Store Register Pair HL (4BEFH) at 4BCFH-4BD0H, the operand of the JP P at 4BCEH in the supervisor dispatcher.
5305
LD A,C9H 3E C9
Load Register A with C9H, the opcode of RET, for the two hooks.
5307
LD (44FDH),A 32 FD 44
Store Register A (C9H) at 44FDH, where @LOGER ends: the job log does nothing.
530A
LD (4303H),A 32 03 43
Store Register A (C9H) at 4303H, @ICNFG: no configuration hook.
530D
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: cylinder 0, sector 2, the system information sector.
5310
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, SBUFF$, the buffer.
5313
GOSUB to 4777H (RDSECT) to read cylinder Register D, sector Register E of drive Register C (0, left by the LDIR) into the buffer at Register Pair HL.
5316
If the NZ FLAG is set (the sector could not be read), JUMP to 53DDH to report the error in Register A.
5319
LD L,70H 2E 70
Load Register L with 70H: Register Pair HL = 4270H, the drive tables of the system information sector.
531B
LD DE,4700H 11 00 47
Point Register Pair DE to 4700H, DCT$, the drive code tables.
531E
LD BC,0050H 01 50 00
Load Register Pair BC with 0050H, the 80 bytes of eight tables.
5321
LD A,(442FH) 3A 2F 44
Fetch MFLAG$, the machine flags, from 442FH into Register A.
5324
RRCA 0F
Rotate Register A right (RRCA): bit 0 (a boot through a disk driver) into the CARRY FLAG.
5325
If the NO CARRY FLAG is set (bit 0 clear), JUMP to 5329H.
5327
LD L,20H 2E 20
Load Register L with 20H: Register Pair HL = 4220H, the other block of drive tables.
5329
LDIR ED B0
Copy the 80 bytes from the sector at Register Pair HL to DCT$ at Register Pair DE (LDIR, Register Pair BC = the count).
532B
DI F3
Disable the interrupts (DI) while HIGH$ and the device blocks are written.
532C
LD HL,(4403H) 2A 03 44
Fetch the top of memory from 4403H-4404H into Register Pair HL.
532F
JUMP to 5340H to make the top of memory HIGH$.
5331
LD HL,54A9H 21 A9 54
Point Register Pair HL to 54A9H, the message Can't reset memory, background task(s) exist.
5334
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5337
LD A,03H 3E 03
Load Register A with 03H, an empty text for @DSPLY.
5339
LD (542AH),A 32 2A 54
Store Register A (03H) at 542AH, over the codes that clear the screen, so that the message stays on it.
533C
DI F3
Disable the interrupts (DI) while the device blocks are written.
533D
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL: it stays as it is.
5340
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH, HIGH$.
5343
LD HL,(4020H) 2A 20 40
Fetch the cursor position from 4020H-4021H (DODCB$ +03H-+04H) into Register Pair HL.
5346
PUSH HL E5
Save Register Pair HL (the cursor position) to the stack.
5347
LD HL,542DH 21 2D 54
Point Register Pair HL to 542DH, the templates of KI, DO and PR.
534A
LD DE,4015H 11 15 40
Point Register Pair DE to 4015H, KIDCB$, the first of the three blocks.
534D
LD BC,0018H 01 18 00
Load Register Pair BC with 0018H, the 24 bytes of three blocks.
5350
LDIR ED B0
Copy the 24 bytes from 542DH at Register Pair HL to 4015H-402CH at Register Pair DE (LDIR, Register Pair BC = the count).
5352
POP HL E1
Restore Register Pair HL (the cursor position) from the stack.
5353
LD (4020H),HL 22 20 40
Store Register Pair HL at 4020H-4021H: the cursor stays where it was.
5356
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, for KIJCL$.
5359
LD (43BEH),HL 22 BE 43
Store Register Pair HL (0000H) at 43BEH-43BFH, KIJCL$: no keyboard driver is kept aside.
535C
LD HL,5445H 21 45 54
Point Register Pair HL to 5445H, the templates of JL, SI and SO.
535F
LD DE,43C0H 11 C0 43
Point Register Pair DE to 43C0H, JLDCB$, the first of the three blocks.
5362
LD BC,0018H 01 18 00
Load Register Pair BC with 0018H, the 24 bytes of three blocks.
5365
LDIR ED B0
Copy the 24 bytes from 5445H at Register Pair HL to 43C0H-43D7H at Register Pair DE (LDIR, Register Pair BC = the count).
5367
LD HL,43D8H 21 D8 43
Point Register Pair HL to 43D8H, the first of the five spare blocks.
536A
XOR A AF
Clear Register A (XOR A): Register A = 00H to clear the spare blocks.
536B
LD (HL),A 77
Store Register A (00H) at Register Pair HL in a spare block.
536C
INC L 2C
INCrement Register L to the next byte of the spare blocks.
536D
If the NZ FLAG is set (below 4400H), LOOP BACK to 536BH: 43D8H-43FFH are cleared.
536F
EI FB
Enable the interrupts again (EI): the device blocks are written.
5370
CP A BF
Compare Register A with itself (CP A): the Z FLAG is set, so 527BH clears the screen.
5371
JUMP to 5278H to clear the screen (or, after 5339H, show nothing) and end the command.

5374H - Change a File's Directory Record

The file is opened; it must allow writing (access level 0-4, else error 25H). Its directory record is read: LRL= gives +04H a new record length, any DATE= gives +12H-+13H the value 4296H (the hash of a blank password, the older layout with no time). DATE=ON also sets bit 2 of the control block and closes the file, which stamps it with the date and time; the close reads the directory sector again, so the record is then written as the close left it. Then the sector at 4200H is written.

5374
GOSUB to 4424H (@OPEN) to open the file at Register Pair DE (54F6H).
5377
If the NZ FLAG is set (the file could not be opened), JUMP to 53DDH to report the error in Register A.
5379
PUSH DE D5
Save Register Pair DE (the control block) to the stack, to move it into Index Register IX.
537A
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the file's control block.
537C
LD A,(IX+01H) DD 7E 01
Fetch +01H of the control block from IX+01H (Index Register IX = the control block) into Register A.
537F
AND 07H E6 07
AND 07H into Register A: bits 2-0, the access level the password gave.
5381
CP 05H FE 05
Compare Register A against 05H: the NO CARRY FLAG is set for levels 5-7, which do not allow writing.
5383
LD A,25H 3E 25
Load Register A with 25H, the error number of an illegal access to a protected file. LD does not change the flags.
5385
If the NO CARRY FLAG is set (writing not allowed), JUMP to 53DDH to report error 25H.
5387
LD BC,(54FCH) ED 4B FC 54
Fetch the drive and directory entry from 54FCH-54FDH (control block +06H-+07H) into Register Pair BC: Register C the drive, Register B the entry.
538B
GOSUB to 4B10H (DIRRD) to read the directory sector holding record Register B of drive Register C into 4200H; Register Pair HL = the record.
538E
If the NZ FLAG is set (the directory could not be read), JUMP to 53DDH to report the error in Register A.
5390
PUSH HL E5
Save Register Pair HL (the record) to the stack, to move it into Index Register IY.
5391
POP IY FD E1
Restore Index Register IY from the stack: Index Register IY = the directory record.
5393
LD DE,FF00H 11 00 FF
Load Register Pair DE with the LRL parameter, the operand at 5394H-5395H: FF00H in the file, the value of LRL= when given.
5396
INC D 14
INCrement Register D (the high byte): FFH becomes 00H and sets the Z FLAG when LRL was not given.
5397
If the Z FLAG is set (no LRL), JUMP to 539CH.
5399
LD (IY+04H),E FD 73 04
Store Register E (the new record length, 00H for 256) at IY+04H, +04H of the record (Index Register IY = the record).
539C
LD DE,FF00H 11 00 FF
Load Register Pair DE with the DATE parameter, the operand at 539DH-539EH: FF00H in the file, FFFFH for DATE=ON, 0000H for DATE=OFF.
539F
LD A,D 7A
Copy Register D (the high byte of DATE) into Register A.
53A0
INC A 3C
INCrement Register A: 00H when Register D is FFH.
53A1
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set only for FF00H, DATE not given.
53A2
If the Z FLAG is set (no DATE), JUMP to 53B9H to write the record.
53A4
LD (IY+12H),96H FD 36 12 96
Store 96H at IY+12H, +12H of the record (Index Register IY = the record).
53A8
LD (IY+13H),42H FD 36 13 42
Store 42H at IY+13H (Index Register IY = the record): +12H-+13H = 4296H, the blank password value of the older layout.
53AC
PUSH IX DD E5
Save Index Register IX (the control block) to the stack.
53AE
LD A,D 7A
Copy Register D (the high byte of DATE) into Register A.
53AF
AND E A3
AND Register E (the low byte) into Register A: FFH only for FFFFH, DATE=ON.
53B0
INC A 3C
INCrement Register A: the Z FLAG is set for DATE=ON.
53B1
POP DE D1
Restore Register Pair DE from the stack: Register Pair DE = the control block.
53B2
SET 2,(IX+00H) DD CB 00 D6
Set bit 2 of +00H at IX+00H (Index Register IX = the control block): the file counts as written, so the close stamps it.
53B6
If the Z FLAG is set (DATE=ON), GOSUB to 53D9H to close the file at Register Pair DE: SYS3/SYS stamps the date and time.
53B9
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back.
53BC
If the NZ FLAG is set (the write failed), JUMP to 53DDH to report the error in Register A.
53BE
JUMP to 527EH to end the command with Register Pair HL = 0000H.

53C1H - Close a Routed File

Register Pair HL = a device control block. Its routes (type bit 4: +01H-+02H the next block) are followed; when the last is an open file's control block (bit 7 of +00H), it is copied to 54D6H and that copy is closed. Then the error exit, the refusal and the search for a block by name (as in 55F1H of SPOOL).

53C1
BIT 4,(HL) CB 66
Test bit 4 of the type at Register Pair HL: set when the device is routed to another block.
53C3
If the Z FLAG is set (not routed), JUMP to 53CCH.
53C5
INC HL 23
INCrement Register Pair HL to +01H of the block.
53C6
LD A,(HL) 7E
Fetch the low byte of the block it is routed to, from +01H at Register Pair HL, into Register A.
53C7
INC HL 23
INCrement Register Pair HL to +02H of the block.
53C8
LD H,(HL) 66
Fetch the high byte from +02H at Register Pair HL into Register H.
53C9
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the block it is routed to.
53CA
LOOP BACK to 53C1H to follow the route to the block it names.
53CC
BIT 7,(HL) CB 7E
Test bit 7 of +00H at Register Pair HL: set for the control block of an open file.
53CE
RET Z C8
RETurn if the Z FLAG is set: no file at the end of the routes.
53CF
LD DE,54D6H 11 D6 54
Point Register Pair DE to 54D6H, where the file's control block is copied.
53D2
PUSH DE D5
Save Register Pair DE (54D6H, where the copy goes) to the stack.
53D3
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
53D6
LDIR ED B0
Copy the 32 bytes from the file's control block at Register Pair HL to 54D6H at Register Pair DE (LDIR, Register Pair BC = the count).
53D8
POP DE D1
Restore Register Pair DE (54D6H, the copy) from the stack.
53D9
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE. 53B6H comes here with the file of the command.
53DC
RET Z C8
RETurn if the Z FLAG is set: the file was closed.
53DD
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
53DF
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
53E2
JUMP to 53EAH to end the command with Register Pair HL = FFFFH.
53E4
LD HL,547EH 21 7E 54
Point Register Pair HL to 547EH, the message Can't -- Valid only at LDOS command level!.
53E7
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
53EA
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
53ED
JUMP to 5281H to put the stack back and end the command.
53F0
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
53F3
PUSH HL E5
Save Register Pair HL (the block) to the stack.
53F4
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
53F5
ADD A,06H C6 06
ADD 06H to Register A: the low byte of the block's name at +06H.
53F7
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name (no block crosses a page).
53F8
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
53F9
INC L 2C
INCrement Register L to the second letter of the name.
53FA
CP E BB
Compare Register A against Register E, the first letter asked for.
53FB
If the NZ FLAG is set (not the same), JUMP to 5404H for the next block.
53FD
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
53FE
CP D BA
Compare Register A against Register D, the second letter asked for.
53FF
If the NZ FLAG is set (not the same), JUMP to 5404H for the next block.
5401
POP HL E1
Restore Register Pair HL (the block found) from the stack.
5402
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, found.
5403
RET C9
RETurn to the caller with Register Pair HL at the device control block.
5404
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
5405
INC L 2C
INCrement Register L from the block's +07H to the next block.
5406
If the NZ FLAG is set (Register L did not pass FFH), JUMP to 540CH.
5408
LD A,08H 3E 08
Register Pair HL passed 43FFH, the last block: load Register A with 08H, the error number of a device not available.
540A
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, not found.
540B
RET C9
RETurn to the caller with the NZ FLAG and Register A = 08H.
540C
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
540D
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
540F
If the NZ FLAG is set (still among KI, DO and PR, or in 43C0H-43FFH), LOOP BACK to 53F3H.
5411
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the next device control block.
5414
LOOP BACK to 53F3H to test the block at 43C0H and those after it.

5416H - DFLAG$ and the Templates

5416H clears DFLAG$ bit 3 (PR/FLT). 541CH keeps only bits 7, 3 and 0 of DFLAG$ (the keyboard options off) and empties task slot 10. Then the screen codes and the device control blocks as the boot makes them.

5416
LD HL,441FH 21 1F 44
Point Register Pair HL to 441FH, DFLAG$, the device flags.
5419
RES 3,(HL) CB 9E
Clear bit 3 of DFLAG$ at Register Pair HL: PR/FLT is no longer installed.
541B
RET C9
RETurn to the caller with the printer filter flag cleared.
541C
LD A,(441FH) 3A 1F 44
Fetch DFLAG$, the device flags, from 441FH into Register A.
541F
AND 89H E6 89
AND 89H into Register A: bits 7, 3 and 0 kept; bits 1 (type ahead), 2 (JKL), 4 (KI/DVR), 5 and 6 cleared.
5421
LD (441FH),A 32 1F 44
Store Register A at 441FH, DFLAG$, with the keyboard options off.
5424
LD A,0AH 3E 0A
Load Register A with 0AH, task slot 10, the keyboard driver's task.
5426
GOSUB to 4413H (@RMTSK) to empty task slot Register A (10).
5429
RET C9
RETurn to the caller with the keyboard options off.
542A-542B
DEFB 1CH, 1FH 1C 1F
The codes that clear the screen (527BH): 1CH puts the cursor at the top left corner, 1FH clears to the end. 5339H writes 03H over 1CH.
542C
DEFB 03H 03
03H, the end mark at which @DSPLY stops, after the screen codes.
542D
DEFB 01H 01
The KI template +00H: 01H, the type of an input device.
542E-542F
DEFW 0000H 00 00
The KI template +01H-+02H: the keyboard driver, KISV$ (5208H).
5430-5432
DEFB 00H x 3 00 x 3
The KI template +03H-+05H: 00H, the driver's three bytes.
5433-5434
DEFM "KI" 4B 49
The KI template +06H-+07H: the name KI, the keyboard.
5435
DEFB 07H 07
The DO template +00H: 07H, an input, output and control device.
5436-5437
DEFW 0000H 00 00
The DO template +01H-+02H: the video driver, DOSV$ (520EH).
5438-5439
DEFW 3C00H 00 3C
The DO template +03H-+04H: 3C00H, the cursor at the top left corner of the screen.
543A
DEFB 00H 00
The DO template +05H: 00H, the driver's spare byte.
543B-543C
DEFM "DO" 44 4F
The DO template +06H-+07H: the name DO, the video display.
543D
DEFB 06H 06
The PR template +00H: 06H, an output and control device.
543E-543F
DEFW 0000H 00 00
The PR template +01H-+02H: the printer driver, PRSV$ (5214H).
5440
DEFB 42H 42
The PR template +03H: 42H (66), the lines on a printer page.
5441-5442
DEFB 00H x 2 00 x 2
The PR template +04H-+05H: 00H, no line printed.
5443-5444
DEFM "PR" 50 52
The PR template +06H-+07H: the name PR, the printer.
5445
DEFB 08H 08
The JL template +00H: 08H, the type of a device with nothing assigned.
5446-544A
DEFB 00H x 5 00 x 5
The JL template +01H-+05H: 00H, no driver and no driver bytes.
544B-544C
DEFM "JL" 4A 4C
The JL template +06H-+07H: the name JL, the job log.
544D
DEFB 08H 08
The SI template +00H: 08H, the type of a device with nothing assigned.
544E-5452
DEFB 00H x 5 00 x 5
The SI template +01H-+05H: 00H, no driver and no driver bytes.
5453-5454
DEFM "SI" 53 49
The SI template +06H-+07H: the name SI, the standard input.
5455
DEFB 08H 08
The SO template +00H: 08H, the type of a device with nothing assigned.
5456-545A
DEFB 00H x 5 00 x 5
The SO template +01H-+05H: 00H, no driver and no driver bytes.
545B-545C
DEFM "SO" 53 4F
The SO template +06H-+07H: the name SO, the standard output.

545DH - RESET Data: the Parameter Table, Messages and Control Blocks

The table @PARAM reads (5225H): four entries of eight bytes, a keyword of six characters padded with spaces and the address where its value is stored, then 00H; the two messages; the two control blocks above the member.

545D-5464
DEFM "LRL " / DEFW 5394H 4C 52 4C 20 20 20 94 53
LRL: its value goes to 5394H-5395H, the operand of the LD DE at 5393H (FF00H in the file).
5465-546C
DEFM "L " / DEFW 5394H 4C 20 20 20 20 20 94 53
L, the short form of LRL: its value goes to 5394H-5395H too.
546D-5474
DEFM "DATE " / DEFW 539DH 44 41 54 45 20 20 9D 53
DATE: its value goes to 539DH-539EH, the operand of the LD DE at 539CH (FF00H in the file).
5475-547C
DEFM "D " / DEFW 539DH 44 20 20 20 20 20 9D 53
D, the short form of DATE: its value goes to 539DH-539EH too.
547D
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.
547E-54A7
DEFM "Can't -- Valid only at LDOS command level!" 43 61 6E 27 74 20 2D 2D 20 56 61 6C 69 64 20 6F 6E 6C 79 20 61 74 20 4C 44 4F 53 20 63 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C 21
The message of 53E4H: a program owns @EXIT, or a program ran the command.
54A8
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS command level!.
54A9-54D4
DEFM "Can't reset memory, background task(s) exist" 43 61 6E 27 74 20 72 65 73 65 74 20 6D 65 6D 6F 72 79 2C 20 62 61 63 6B 67 72 6F 75 6E 64 20 74 61 73 6B 28 73 29 20 65 78 69 73 74
The message of 5331H: a task block above HIGH$.
54D5
DEFB 0DH 0D
0DH, the end of the message Can't reset memory, background task(s) exist.
54D6-54F5
DEFS 32
The copy of a routed file's control block, closed by 53D9H. Not loaded from the file.
54F6-5515
DEFS 32
The control block of the specification: @FSPEC writes it (5234H); 54F7H-54F8H the device letters, 54FCH-54FDH the drive and directory entry of an open file. Not loaded from the file.

5200H - Member 13 (ROUTE): Read the Two Specifications

The ROUTE command (library member 64H), loaded at 5200H-53F3H: ROUTE *d1 [TO] *d2 or a file, or ROUTE *d1 (NIL). The first device's control block is found, or a free block (named 0000H) is taken for a new device (none free: error 21H, no device space available); a file it was routed to is closed. Routed to a device, its type becomes 10H and its +01H-+02H the other device's block. Routed to a file, a module named $R and the device's letters is made in high memory (a 9 byte header and the file's control block, below a buffer of 256 bytes), or one of that name is used again; the file is opened with @INIT and positioned at its end unless REWIND is given, and the device points at the control block in the module. NIL makes its type 08H. The parameters (NIL, REWIND) may follow either specification.

5200
LD (527EH),SP ED 73 7E 52
Store the Stack Pointer at 527EH, the operand of the LD SP at 527DH: the exit puts the stack back to this depth, so its RET goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,5434H 11 34 54
Point Register Pair DE to 5434H, the control block of the device to route.
5207
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL (the parameters) to Register Pair DE (5434H); the NZ FLAG when there is none.
520A
If the NZ FLAG is set (no specification), JUMP to 5230H, whose JP NZ shows Device spec required!.
520C
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
520D
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
520F
If the NZ FLAG is set (not a device), JUMP to 5230H, whose JP NZ shows Device spec required!.
5211
LD DE,53D1H 11 D1 53
Point Register Pair DE to 53D1H, the parameter table of ROUTE (NIL, REWIND, R).
5214
GOSUB to 4476H (@PARAM) to read parameters at Register Pair HL against the table at Register Pair DE; each value is stored at the address the table names.
5217
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5351H to report error 2CH (parameter error).
521A
LD DE,(5435H) ED 5B 35 54
Fetch the two letters of the device from 5435H-5436H into Register Pair DE.
521E
LD (53F1H),DE ED 53 F1 53
Store Register Pair DE at 53F1H-53F2H, the last two letters of the module's name $Rxx.
5222
LD BC,0000H 01 00 00
Load Register Pair BC with the NIL parameter, the operand at 5223H-5224H: 0000H in the file, FFFFH when NIL was given.
5225
LD A,B 78
Copy Register B (the high byte of NIL) into Register A.
5226
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when NIL was not given.
5227
If the NZ FLAG is set (NIL), JUMP to 531CH to route the device to nothing.
522A
LD DE,53F4H 11 F4 53
Point Register Pair DE to 53F4H, the control block of the destination.
522D
GOSUB to 441CH (@FSPEC) to copy the destination at Register Pair HL to Register Pair DE (53F4H); the NZ FLAG when there is none.
5230
If the NZ FLAG is set (no destination), JUMP to 535EH to display Device spec required!.
5233
PUSH DE D5
Save Register Pair DE (53F4H, the destination's control block) to the stack.
5234
LD DE,53D1H 11 D1 53
Point Register Pair DE to 53D1H, the parameter table of ROUTE.
5237
GOSUB to 4476H (@PARAM) to read parameters after the destination at Register Pair HL.
523A
POP DE D1
Restore Register Pair DE (53F4H) from the stack. POP does not change the flags.
523B
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 5351H to report error 2CH (parameter error).
523E
LD A,(DE) 1A
Fetch the first character of the destination at Register Pair DE into Register A.
523F
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5241
If the NZ FLAG is set (a file), JUMP to 528CH to route the device to the file.
5243
LD DE,(53F5H) ED 5B F5 53
Fetch the two letters of the destination device from 53F5H-53F6H into Register Pair DE.
5247
LD HL,(5435H) 2A 35 54
Fetch the two letters of the device to route from 5435H-5436H into Register Pair HL.
524A
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL (the CARRY FLAG is clear from the CP): the Z FLAG is set for the same device.
524C
If the Z FLAG is set (a device routed to itself), JUMP to 535EH to display Device spec required!.
524F
GOSUB to 536AH to find the control block of the destination device named by Register Pair DE.
5252
If the NZ FLAG is set (no such device), JUMP to 5353H to report the error in Register A (08H, device not available).

5255H - Point the Device at Its Destination

Register Pair HL (on the stack) is the destination: another device's control block, or the file's control block in the module. 5303H finds or makes the device's block. Its type becomes 10H (routed), its +01H-+02H the destination, and its +06H-+07H the device's letters. The keyboard test, which would put the destination into KIJCL$ (43BEH) during a JCL job, is never reached because of the INC L at 5261H.

5255
PUSH HL E5
Save Register Pair HL (the destination's control block) to the stack. 5300H comes here with the file's control block in the module.
5256
GOSUB to 5303H to find the device's control block or a free one; Register Pair HL = the block, Register Pair DE = the device's letters.
5259
DI F3
Disable the interrupts (DI) while the block is changed.
525A
LD (HL),10H 36 10
Store 10H at Register Pair HL, the block's type: the device is routed.
525C
POP BC C1
Restore Register Pair BC (the destination) from the stack.
525D
PUSH HL E5
Save Register Pair HL (the device's block) to the stack.
525E
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
525F
CP 15H FE 15
Compare Register A against 15H: the Z FLAG is set for KIDCB$ (4015H), the keyboard.
5261
INC L 2C
INCrement Register L to +01H of the block. INC L sets the Z FLAG from its result, which is never 00H here, so the Z FLAG of the compare is lost: the NZ FLAG is always set.
5262
If the NZ FLAG is set (always, after the INC L), JUMP to 526EH: 5264H-526DH, the case of the keyboard during a JCL job, is never reached.
5264
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A. Not reached (5262H always jumps).
5267
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs. Not reached (5262H always jumps).
5269
If the Z FLAG is set (no JCL job), JUMP to 526EH. Not reached (5262H always jumps).
526B
LD HL,43BEH 21 BE 43
Point Register Pair HL to 43BEH, KIJCL$, the keyboard driver word SYS11/SYS keeps during a job. Not reached (5262H always jumps).
526E
LD (HL),C 71
Store Register C (the low byte of the destination) at Register Pair HL.
526F
INC L 2C
INCrement Register L to the high byte of the destination word.
5270
LD (HL),B 70
Store Register B (the high byte of the destination) at Register Pair HL: the device points at its destination.
5271
POP HL E1
Restore Register Pair HL (the device's block) from the stack.
5272
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
5273
ADD A,06H C6 06
ADD 06H to Register A: the offset of the name.
5275
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name.
5276
LD (HL),E 73
Store Register E (the first letter) at Register Pair HL.
5277
INC L 2C
INCrement Register L to the second letter of the name.
5278
LD (HL),D 72
Store Register D (the second letter) at Register Pair HL: the block carries the device's name.
5279
EI FB
Enable the interrupts again (EI): the route is in place.
527A
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
527D
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5200H, the operand at 527EH-527FH (0000H in the file). 5367H comes here with Register Pair HL = FFFFH.
5280
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5281
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5282
RET Z C8
RETurn if the Z FLAG is set: the command was carried out; the RET goes through the supervisor dispatcher to the program that ran ROUTE.
5283
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5286
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5288
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5289
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

528CH - Route a Device to a File

A module of the name $Rxx found by request BCH is used again in its place (HIGH$ is not lowered, 52E5H). Otherwise, only at LDOS command level, the module goes below HIGH$: the page below HIGH$ + 1 is the file's buffer, the module's 41 bytes below it, and HIGH$ just below the module. The file is opened with @INIT (made when it is not there) and, without REWIND, positioned at its end (@PEOF; error 1CH there is the normal end).

528C
PUSH DE D5
Save Register Pair DE (53F4H, the file's control block) to the stack.
528D
LD DE,53EFH 11 EF 53
Point Register Pair DE to 53EFH, the name $Rxx ended by 03H.
5290
GOSUB to 532DH to issue request BCH: SYS10/SYS looks for the module named at Register Pair DE; the Z FLAG and Register Pair HL at its header when found.
5293
POP DE D1
Restore Register Pair DE (53F4H) from the stack. POP does not change the flags.
5294
If the NZ FLAG is set (no such module), JUMP to 52A2H to make a new one.
5296
INC HL 23
INCrement Register Pair HL to +01H of the module's header.
5297
INC HL 23
INCrement Register Pair HL to +02H, the link word.
5298
LD A,(HL) 7E
Fetch the low byte of the link word at Register Pair HL into Register A.
5299
INC HL 23
INCrement Register Pair HL to the high byte of the link word.
529A
LD H,(HL) 66
Fetch the high byte of the link word at Register Pair HL into Register H.
529B
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the top of the module's memory, its link word.
529C
XOR A AF
Clear Register A (XOR A): Register A = 00H for the operand at 52E5H.
529D
LD (52E5H),A 32 E5 52
Store Register A (00H) at 52E5H, the operand of the OR at 52E4H: the old place is used, HIGH$ is not lowered.
52A0
JUMP to 52BFH with Register Pair HL = the top.
52A2
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52A5
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
52A7
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
52AA
If the Z FLAG is set (no JCL job), JUMP to 52AFH to test that byte.
52AC
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
52AF
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with a JP only while a program has taken it over.
52B1
If the Z FLAG is set (a program owns @EXIT), JUMP to 535AH to display Can't -- Valid only at LDOS command level!.
52B4
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
52B7
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
52B9
If the NZ FLAG is set (a program ran the command), JUMP to 535AH to refuse it.
52BC
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL: the top of the new module's memory.
52BF
LD (53ECH),HL 22 EC 53
Store Register Pair HL (the top) at 53ECH-53EDH, the link word of the module's header.
52C2
INC HL 23
INCrement Register Pair HL to the byte above the top.
52C3
DEC H 25
DECrement Register H: Register Pair HL = 256 bytes below that, the file's buffer.
52C4
PUSH HL E5
Save Register Pair HL (the buffer) to the stack.
52C5
LD B,00H 06 00
Load Register B with 00H: the file has records of 256 bytes.
52C7
GOSUB to 4420H (@INIT) to open the file at Register Pair DE (53F4H), made when it is not there, with the buffer at Register Pair HL and record length Register B.
52CA
If the NZ FLAG is set (the file could not be opened or made), JUMP to 52D9H.
52CC
LD BC,0000H 01 00 00
Load Register Pair BC with the REWIND parameter, the operand at 52CDH-52CEH: 0000H in the file, FFFFH when REWIND (or R) was given.
52CF
LD A,B 78
Copy Register B (the high byte of REWIND) into Register A.
52D0
AND C A1
AND Register C (the low byte) into Register A: FFH only for FFFFH.
52D1
INC A 3C
INCrement Register A: the Z FLAG is set when REWIND was given.
52D2
If the NZ FLAG is set (no REWIND), GOSUB to 4448H (@PEOF) to position the file at Register Pair DE at its end, so that what is sent is added.
52D5
If the Z FLAG is set (REWIND, or @PEOF had no error), JUMP to 52D9H.
52D7
CP 1CH FE 1C
Compare Register A (the error of @PEOF) against 1CH, end of file encountered: the Z FLAG is set for the normal end.
52D9
POP HL E1
Restore Register Pair HL (the buffer) from the stack. POP does not change the flags.
52DA
If the NZ FLAG is set (an error), JUMP to 5353H to report the error in Register A.
52DD
LD BC,0029H 01 29 00
Load Register Pair BC with 0029H, the 41 bytes of the module.
52E0
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction.
52E1
SBC HL,BC ED 42
Subtract Register Pair BC (41) from Register Pair HL: the start of the module, just below the buffer.
52E3
PUSH HL E5
Save Register Pair HL (the module) to the stack.
52E4
OR FFH F6 FF
OR FFH into Register A, the operand at 52E5H (00H when the module is used again, 529DH): the NZ FLAG for a new module.
52E6
If the Z FLAG is set (the old place), JUMP to 52ECH: HIGH$ stays.
52E8
DEC HL 2B
DECrement Register Pair HL to the byte below the module.
52E9
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is now below the module.
52EC
POP DE D1
Restore Register Pair DE (the module) from the stack.
52ED
LD BC,0009H 01 09 00
Load Register Pair BC with 0009H, the 9 bytes of the header.
52F0
PUSH BC C5
Save Register Pair BC (9, the size of the header) to the stack.
52F1
PUSH DE D5
Save Register Pair DE (the module) to the stack.
52F2
LD HL,53EAH 21 EA 53
Point Register Pair HL to 53EAH, the module's header in the member.
52F5
LDIR ED B0
Copy the 9 bytes of the header from 53EAH at Register Pair HL to the module at Register Pair DE (LDIR, Register Pair BC = the count).
52F7
INC HL 23
INCrement Register Pair HL past the 03H at 53F3H, to 53F4H, the file's control block.
52F8
LD C,20H 0E 20
Load Register C with 20H, the 32 bytes of a control block (Register B is 00H).
52FA
LDIR ED B0
Copy the 32 bytes of the open file's control block from 53F4H at Register Pair HL to the module at Register Pair DE (LDIR, Register Pair BC = the count).
52FC
POP DE D1
Restore Register Pair DE (the module) from the stack.
52FD
POP HL E1
Restore Register Pair HL (9, the size of the header) from the stack.
52FE
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +09H, the file's control block in it.
52FF
PUSH HL E5
Save Register Pair HL (the file's control block) to the stack, as the destination.
5300
JUMP to 5256H to point the device at the file's control block.

5303H - The Device's Control Block

5303H finds the block named by the device's letters, or else a free block (whose name is 0000H): none is error 21H. A file the device is routed to is closed (5334H). Returns Register Pair HL = the block and Register Pair DE = the letters. 531CH routes the device to nothing (NIL).

5303
LD DE,(5435H) ED 5B 35 54
Fetch the two letters of the device from 5435H-5436H into Register Pair DE.
5307
PUSH DE D5
Save Register Pair DE (the letters) to the stack.
5308
GOSUB to 536AH to find the control block named by Register Pair DE.
530B
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the name of a free block. LD does not change the flags.
530E
If the NZ FLAG is set (no block of that name), GOSUB to 536AH to find a free block, named 0000H.
5311
LD A,21H 3E 21
Load Register A with 21H, the error number of no device space available. LD does not change the flags.
5313
If the NZ FLAG is set (no free block either), JUMP to 5353H to report error 21H.
5315
PUSH HL E5
Save Register Pair HL (the block) to the stack.
5316
GOSUB to 5334H to close a file the device is routed to.
5319
POP HL E1
Restore Register Pair HL (the block) from the stack.
531A
POP DE D1
Restore Register Pair DE (the letters) from the stack.
531B
RET C9
RETurn to the caller with Register Pair HL at the block and Register Pair DE = the letters.
531C
NIL: GOSUB to 5303H to find or make the device's block; Register Pair HL = the block, Register Pair DE = the letters.
531F
LD (HL),08H 36 08
Store 08H at Register Pair HL, the block's type: nothing is assigned to the device.
5321
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
5322
ADD A,06H C6 06
ADD 06H to Register A: the offset of the name.
5324
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name.
5325
DI F3
Disable the interrupts (DI) while the name is written.
5326
GOSUB to 5330H to store the letters in Register Pair DE at Register Pair HL.
5329
EI FB
Enable the interrupts again (EI): the device is routed to nothing.
532A
JUMP to 527AH to end the command with Register Pair HL = 0000H.
532D
LD A,BCH 3E BC
Load Register A with BCH, the request for the module search of SYS10/SYS.
532F
RST 28H EF
RST 28H: SYS10/SYS searches the modules above HIGH$ for the name at Register Pair DE; the supervisor drops the RST's return address, so it returns to the caller of 532DH.
5330
LD (HL),E 73
Store Register E (the first letter) at Register Pair HL.
5331
INC L 2C
INCrement Register L to the next byte of the name.
5332
LD (HL),D 72
Store Register D (the second letter) at Register Pair HL.
5333
RET C9
RETurn to the caller with the two letters of the name stored.
5334
BIT 4,(HL) CB 66
Test bit 4 of the type at Register Pair HL: set when the device is routed to another block.
5336
If the Z FLAG is set (not routed), JUMP to 533FH.
5338
INC HL 23
INCrement Register Pair HL to +01H of the block.
5339
LD A,(HL) 7E
Fetch the low byte of the block it is routed to, from +01H at Register Pair HL, into Register A.
533A
INC HL 23
INCrement Register Pair HL to +02H of the block.
533B
LD H,(HL) 66
Fetch the high byte from +02H at Register Pair HL into Register H.
533C
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the block it is routed to.
533D
LOOP BACK to 5334H to follow the route to the block it names.
533F
BIT 7,(HL) CB 7E
Test bit 7 of +00H at Register Pair HL: set for the control block of an open file.
5341
RET Z C8
RETurn if the Z FLAG is set: no file at the end of the routes.
5342
LD DE,5414H 11 14 54
Point Register Pair DE to 5414H, where the file's control block is copied.
5345
PUSH DE D5
Save Register Pair DE (5414H, where the copy goes) to the stack.
5346
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a control block.
5349
LDIR ED B0
Copy the 32 bytes from the file's control block at Register Pair HL to 5414H at Register Pair DE (LDIR, Register Pair BC = the count).
534B
POP DE D1
Restore Register Pair DE (5414H, the copy) from the stack.
534C
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE.
534F
RET Z C8
RETurn if the Z FLAG is set: the file was closed.
5350
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH. On the way from 534FH this only covers the bytes 3EH 2CH; a JP to 5351H runs them as LD A,2CH, the error number of a parameter error. Register Pair BC is not used afterwards.
5353
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
5355
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5358
JUMP to 5364H to end the command with Register Pair HL = FFFFH.
535A
LD HL,5390H 21 90 53
Point Register Pair HL to 5390H, the message Can't -- Valid only at LDOS command level! (from 52B1H and 52B9H).
535D
LD IX,53BBH DD 21 BB 53
Load Index Register IX with 53BBH. The bytes DD 21 BB 53 make this a dead load of Index Register IX on fall-through; entering at 535EH runs 21 BB 53 as LD HL,53BBH, the message Device spec required!.
5361
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5364
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5367
JUMP to 527DH to put the stack back and end the command.
536A
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
536D
PUSH HL E5
Save Register Pair HL (the block) to the stack.
536E
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
536F
ADD A,06H C6 06
ADD 06H to Register A: the low byte of the block's name at +06H.
5371
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name (no block crosses a page).
5372
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
5373
INC L 2C
INCrement Register L to the second letter of the name.
5374
CP E BB
Compare Register A against Register E, the first letter asked for.
5375
If the NZ FLAG is set (not the same), JUMP to 537EH for the next block.
5377
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
5378
CP D BA
Compare Register A against Register D, the second letter asked for.
5379
If the NZ FLAG is set (not the same), JUMP to 537EH for the next block.
537B
POP HL E1
Restore Register Pair HL (the block found) from the stack.
537C
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, found.
537D
RET C9
RETurn to the caller with Register Pair HL at the device control block.
537E
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
537F
INC L 2C
INCrement Register L from the block's +07H to the next block.
5380
If the NZ FLAG is set (Register L did not pass FFH), JUMP to 5386H.
5382
LD A,08H 3E 08
Register Pair HL passed 43FFH, the last block: load Register A with 08H, the error number of a device not available.
5384
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, not found.
5385
RET C9
RETurn to the caller with the NZ FLAG and Register A = 08H.
5386
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
5387
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
5389
If the NZ FLAG is set (still among KI, DO and PR, or in 43C0H-43FFH), LOOP BACK to 536DH.
538B
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the next device control block.
538E
LOOP BACK to 536DH to test the block at 43C0H and those after it.

5390H - ROUTE Data

The two messages, each ended by 0DH, the parameter table @PARAM reads (5211H, 5234H: three entries of eight bytes, a keyword padded with spaces and the address of its value, then 00H), the module's header and the two control blocks.

5390-53B9
DEFM "Can't -- Valid only at LDOS command level!" 43 61 6E 27 74 20 2D 2D 20 56 61 6C 69 64 20 6F 6E 6C 79 20 61 74 20 4C 44 4F 53 20 63 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C 21
The message of 535AH: a program owns @EXIT, or a program ran the command.
53BA
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS command level!.
53BB-53CF
DEFM "Device spec required!" 44 65 76 69 63 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 535EH: a specification is missing, not a device, or the device itself.
53D0
DEFB 0DH 0D
0DH, the end of the message Device spec required!.
53D1-53D8
DEFM "NIL " / DEFW 5223H 4E 49 4C 20 20 20 23 52
NIL: its value goes to 5223H-5224H, the operand of the LD BC at 5222H.
53D9-53E0
DEFM "REWIND" / DEFW 52CDH 52 45 57 49 4E 44 CD 52
REWIND: its value goes to 52CDH-52CEH, the operand of the LD BC at 52CCH.
53E1-53E8
DEFM "R " / DEFW 52CDH 52 20 20 20 20 20 CD 52
R, the short form of REWIND: its value goes to 52CDH-52CEH too.
53E9
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.
53EA-53EB
DEFB 18H, FEH 18 FE
The start of the module's header (copied by 52F5H): 18H, the mark of a module, and FEH; as code the two bytes are JR 53EAH, a jump to itself, but no code jumps to a route module.
53EC-53ED
DEFW 0000H 00 00
The header's link word: the top of the module's memory, stored by 52BFH.
53EE
DEFB 04H 04
The length of the module's name, 4, read by the module search of request BCH.
53EF-53F0
DEFM "$R" 24 52
The first two characters of the module's name.
53F1-53F2
DEFM "xx" 78 78
The device's letters in the module's name, stored by 521EH.
53F3
DEFB 03H 03
03H, the end of the name for request BCH (any byte below 21H); 52F7H steps over it.
53F4-5413
DEFS 32
The destination's control block: @FSPEC writes it (522DH), @INIT opens a file in it, and 52FAH copies it into the module. Not loaded from the file.
5414-5433
DEFS 32
The copy of a routed file's control block, closed by 534CH. Not loaded from the file.
5434-5453
DEFS 32
The control block of the device to route: @FSPEC writes its specification here (5207H); 5435H-5436H hold its letters. Not loaded from the file.

5A00H - Member 14 (FILTER, SET): Load a Filter or a Driver

One member, loaded at 5A00H-5B43H, serves FILTER *d filespec (member 66H, entry 5A00H) and SET *d filespec (member 65H, entry 5A01H, the AFH inside the OR AFH, which runs as XOR A). Register A after the entry is not 00H for FILTER and 00H for SET; it is kept at 5A84H. Only at LDOS command level. The file gets the extension FLT or DVR when it has none. FILTER needs the device to exist (else error 08H); SET takes a free block for a new device (none: error 21H). SFLAG$ bit 2 and bit 3 of 4758H are set, the file is loaded with @LOAD, SET names the block, and the member jumps to the file's transfer address with Register Pair DE = the device's control block and Register Pair HL = the rest of the command line; the loaded code installs itself and returns to the program that ran the command.

5A00
OR AFH F6 AF
FILTER: OR AFH into Register A (the request code the dispatcher passes): Register A is not 00H. SET enters at 5A01H.
5A02
LD (5A84H),A 32 84 5A
Store Register A (not 00H for FILTER, 00H for SET, which runs the AFH at 5A01H as XOR A) at 5A84H, the operand of the LD A at 5A83H.
5A05
LD (5AE1H),SP ED 73 E1 5A
Store the Stack Pointer at 5AE1H, the operand of the LD SP at 5AE0H, which the error exits use.
5A09
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5A0C
BIT 5,A CB 6F
Test bit 5 of Register A (a JCL job runs): the NZ FLAG is set during a job.
5A0E
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
5A11
If the Z FLAG is set (no JCL job), JUMP to 5A16H to test that byte.
5A13
LD A,(4065H) 3A 65 40
A JCL job runs: fetch the first byte of @EXIT as it was before the job, from 4065H (where SYS11/SYS saved 402DH-4032H), into Register A.
5A16
CP C3H FE C3
Compare Register A against C3H, a JP: @EXIT starts with a JP only while a program has taken it over.
5A18
If the Z FLAG is set (a program owns @EXIT), JUMP to 5AD3H to display Can't -- Valid only at LDOS command level!.
5A1B
LD A,(4758H) 3A 58 47
Fetch the command interpreter's status byte from 4758H into Register A.
5A1E
BIT 1,A CB 4F
Test bit 1 of Register A: SYS1/SYS sets it for a command line a program passed through 4451H.
5A20
If the NZ FLAG is set (a program ran the command), JUMP to 5AD3H to refuse it.
5A23
SET 3,A CB DF
Set bit 3 of Register A: a driver or filter is being loaded by SET or FILTER (KI/DVR, its 520BH, refuses to install without it).
5A25
LD (4758H),A 32 58 47
Store Register A at 4758H, the status byte of the command interpreter, with bit 3 set.
5A28
LD DE,5B44H 11 44 5B
Point Register Pair DE to 5B44H, the device's control block.
5A2B
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL (the parameters) to Register Pair DE (5B44H); the NZ FLAG when there is none.
5A2E
If the NZ FLAG is set (no specification), JUMP to 5ACFH to display Device spec required!.
5A31
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
5A32
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5A34
If the NZ FLAG is set (not a device), JUMP to 5ACFH to display Device spec required!.
5A37
LD DE,5B64H 11 64 5B
Point Register Pair DE to 5B64H, the control block of the file to load.
5A3A
GOSUB to 441CH (@FSPEC) to copy the next specification at Register Pair HL to Register Pair DE (5B64H).
5A3D
If the NZ FLAG is set (no file), JUMP to 5AD7H to display File spec required!.
5A40
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
5A41
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
5A43
If the Z FLAG is set (a device, not a file), JUMP to 5AD7H to display File spec required!.
5A46
PUSH HL E5
Save Register Pair HL (the rest of the command line, the driver's parameters) to the stack.
5A47
LD A,(5A84H) 3A 84 5A
Fetch the mode from 5A84H into Register A: 00H for SET.
5A4A
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for SET.
5A4B
LD HL,5A9CH 21 9C 5A
Point Register Pair HL to 5A9CH, the extension DVR. LD does not change the flags.
5A4E
If the Z FLAG is set (SET), JUMP to 5A53H with DVR.
5A50
LD HL,5A9FH 21 9F 5A
Point Register Pair HL to 5A9FH, the extension FLT.
5A53
GOSUB to 4473H (@FEXT) to add the extension at Register Pair HL to the file's specification at Register Pair DE (5B64H) when it has none.
5A56
LD DE,(5B45H) ED 5B 45 5B
Fetch the two letters of the device from 5B45H-5B46H into Register Pair DE.
5A5A
GOSUB to 5AA2H to find the control block of the device named by Register Pair DE: the Z FLAG and Register Pair HL at the block.
5A5D
If the Z FLAG is set (the device exists), JUMP to 5A74H.
5A5F
LD A,(5A84H) 3A 84 5A
Fetch the mode from 5A84H into Register A: 00H for SET.
5A62
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for FILTER.
5A63
LD A,08H 3E 08
Load Register A with 08H, the error number of a device not available. LD does not change the flags.
5A65
If the NZ FLAG is set (FILTER of a device that does not exist), JUMP to 5AC8H to report error 08H.
5A67
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the name of a free block.
5A6A
GOSUB to 5AA2H to find a free block, named 0000H, for the new device.
5A6D
If the Z FLAG is set (a free block), JUMP to 5A74H.
5A6F
LD A,21H 3E 21
Load Register A with 21H, the error number of no device space available.
5A71
JUMP to 5AC8H to report error 21H, no device space available.
5A74
PUSH HL E5
Save Register Pair HL (the device's control block) to the stack.
5A75
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
5A78
SET 2,(HL) CB D6
Set bit 2 of SFLAG$ at Register Pair HL: a program is being loaded, so @OPEN lets an execute only file be opened for the load.
5A7A
LD DE,5B64H 11 64 5B
Point Register Pair DE to 5B64H, the file's control block.
5A7D
GOSUB to 4430H (@LOAD) to load the file at Register Pair DE; Register Pair HL returns its transfer address.
5A80
If the NZ FLAG is set (the load failed), JUMP to 5AC8H to report the error in Register A.
5A83
LD A,00H 3E 00
Load Register A with the mode, the operand at 5A84H (00H in the file; stored by 5A02H).
5A85
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for FILTER.
5A86
If the NZ FLAG is set (FILTER), JUMP to 5A99H: the device keeps its name.
5A88
POP DE D1
Restore Register Pair DE (the device's control block) from the stack.
5A89
PUSH DE D5
Save Register Pair DE (the device's control block) on the stack again.
5A8A
DI F3
Disable the interrupts (DI) while the name is written.
5A8B
LD A,E 7B
Copy Register E (the low byte of the block) into Register A.
5A8C
ADD A,06H C6 06
ADD 06H to Register A: the offset of the name.
5A8E
LD E,A 5F
Copy Register A into Register E: Register Pair DE = the block's name.
5A8F
LD A,(5B45H) 3A 45 5B
Fetch the first letter of the device from 5B45H into Register A.
5A92
LD (DE),A 12
Store Register A (the first letter) at Register Pair DE.
5A93
INC E 1C
INCrement Register E to the second letter of the name.
5A94
LD A,(5B46H) 3A 46 5B
Fetch the second letter of the device from 5B46H into Register A.
5A97
EI FB
Enable the interrupts again (EI); the store below runs before any interrupt is taken.
5A98
LD (DE),A 12
Store Register A (the second letter) at Register Pair DE: the block carries the device's name.
5A99
POP DE D1
Restore Register Pair DE (the device's control block) from the stack.
5A9A
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (EX (SP),HL, the Stack Pointer's word): Register Pair HL = the rest of the command line, the transfer address goes on the stack.
5A9B
RET C9
RETurn to the loaded file's transfer address with Register Pair DE = the device's control block and Register Pair HL = its parameters; its RET goes through the supervisor dispatcher to the program that ran the command.
5A9C-5A9E
DEFM "DVR" 44 56 52
The extension @FEXT adds for SET (5A4BH): a driver file.
5A9F-5AA1
DEFM "FLT" 46 4C 54
The extension @FEXT adds for FILTER (5A50H): a filter file.

5AA2H - Find a Device Control Block by Name

Register Pair DE holds the two letters (Register E the first). The blocks of 8 bytes are searched, their names at +06H-+07H: KI, DO and PR at 4015H-402CH, then 43C0H-43FFH. Returns the Z FLAG and Register Pair HL at the block, or the NZ FLAG and Register A = 08H (device not available). Then the error exits and the messages.

5AA2
LD HL,4015H 21 15 40
Point Register Pair HL to 4015H, KIDCB$, the first device control block.
5AA5
PUSH HL E5
Save Register Pair HL (the block) to the stack.
5AA6
LD A,L 7D
Copy Register L (the low byte of the block) into Register A.
5AA7
ADD A,06H C6 06
ADD 06H to Register A: the low byte of the block's name at +06H.
5AA9
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the block's name (no block crosses a page).
5AAA
LD A,(HL) 7E
Fetch the first letter of the block's name at Register Pair HL into Register A.
5AAB
INC L 2C
INCrement Register L to the second letter of the name.
5AAC
CP E BB
Compare Register A against Register E, the first letter asked for.
5AAD
If the NZ FLAG is set (not the same), JUMP to 5AB6H for the next block.
5AAF
LD A,(HL) 7E
Fetch the second letter of the block's name at Register Pair HL into Register A.
5AB0
CP D BA
Compare Register A against Register D, the second letter asked for.
5AB1
If the NZ FLAG is set (not the same), JUMP to 5AB6H for the next block.
5AB3
POP HL E1
Restore Register Pair HL (the block found) from the stack.
5AB4
XOR A AF
Clear Register A (XOR A): Register A = 00H and the Z FLAG set, found.
5AB5
RET C9
RETurn to the caller with Register Pair HL at the device control block.
5AB6
POP AF F1
Restore Register Pair AF from the stack: the pushed block address is only dropped.
5AB7
INC L 2C
INCrement Register L from the block's +07H to the next block.
5AB8
If the NZ FLAG is set (Register L did not pass FFH), JUMP to 5ABEH.
5ABA
LD A,08H 3E 08
Register Pair HL passed 43FFH, the last block: load Register A with 08H, the error number of a device not available.
5ABC
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, not found.
5ABD
RET C9
RETurn to the caller with the NZ FLAG and Register A = 08H.
5ABE
LD A,L 7D
Copy Register L (the low byte of the next block) into Register A.
5ABF
CP 2DH FE 2D
Compare Register A against 2DH: the block after PRDCB$ (4025H) would be at 402DH, which is @EXIT.
5AC1
If the NZ FLAG is set (still among KI, DO and PR, or in 43C0H-43FFH), LOOP BACK to 5AA5H.
5AC3
LD HL,43C0H 21 C0 43
Point Register Pair HL to 43C0H, JLDCB$, the next device control block.
5AC6
LOOP BACK to 5AA5H to test the block at 43C0H and those after it.
5AC8
OR C0H F6 C0
OR C0H into Register A (the error number): bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
5ACA
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5ACD
JUMP to 5ADDH to end the command with Register Pair HL = FFFFH.
5ACF
LD HL,5B03H 21 03 5B
Point Register Pair HL to 5B03H, the message Device spec required! (from 5A2EH and 5A34H).
5AD2
LD IX,5B19H DD 21 19 5B
Load Index Register IX with 5B19H. The bytes DD 21 19 5B make this a dead load of Index Register IX on fall-through; entering at 5AD3H runs 21 19 5B as LD HL,5B19H, the message Can't -- Valid only at LDOS command level!.
5AD6
LD IX,5AEFH DD 21 EF 5A
Load Index Register IX with 5AEFH. Entering at 5AD7H runs 21 EF 5A as LD HL,5AEFH, the message File spec required!.
5ADA
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5ADD
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5AE0
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5A05H, the operand at 5AE1H-5AE2H (0000H in the file).
5AE3
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5AE4
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5AE5
RET Z C8
RETurn if the Z FLAG is set: not reached from the error exits, which load FFFFH.
5AE6
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5AE9
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5AEB
RET Z C8
RETurn if the Z FLAG is set (no JCL job) with Register Pair HL = FFFFH, the result of a command that failed.
5AEC
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.
5AEF-5B01
DEFM "File spec required!" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 5AD7H: no file to load was named, or a device was.
5B02
DEFB 0DH 0D
0DH, the end of the message File spec required!.
5B03-5B17
DEFM "Device spec required!" 44 65 76 69 63 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 5ACFH: no device, or not a device, was named first.
5B18
DEFB 0DH 0D
0DH, the end of the message Device spec required!.
5B19-5B42
DEFM "Can't -- Valid only at LDOS command level!" 43 61 6E 27 74 20 2D 2D 20 56 61 6C 69 64 20 6F 6E 6C 79 20 61 74 20 4C 44 4F 53 20 63 6F 6D 6D 61 6E 64 20 6C 65 76 65 6C 21
The message of 5AD3H: a program owns @EXIT, or a program ran the command.
5B43
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS command level!.
5B44-5B63
DEFS 32
The device's control block: @FSPEC writes its specification here (5A2BH); 5B45H-5B46H hold its letters. Not loaded from the file.
5B64-5B83
DEFS 32
The control block of the file to load: @FSPEC writes it (5A3AH), @FEXT completes it and @LOAD uses it. Not loaded from the file.

5200H - Member 15 (RUN, LOAD): Load a Program from Another Diskette

One member, loaded at 5200H-536FH, serves RUN (member 82H, entry 5200H) and LOAD (member 81H, entry 5203H): [RUN or LOAD] (X) filespec. The parameter X comes before the file; the file goes to CFCB$ (4480H) with the extension CMD when it has none, and SYS2/SYS is loaded first (request 84H). Without X, RUN hands the file to @RUN and LOAD to @LOAD (which returns through 4408H, the RET Z of @CMNDI, so that an error falls into @ERROR). With X the source diskette is asked for, the program is loaded with @LOAD, the system diskette is asked for again, and RUN then jumps to the program's transfer address with Register Pair HL at the rest of the command line.

5200
RUN (member 82H) enters here: JUMP to 527CH, the RUN command.
5203
LOAD: GOSUB to 5293H to read X and the file into CFCB$ (4480H) and load SYS2/SYS; with X the source diskette is asked for.
5206
LD A,(52BDH) 3A BD 52
Fetch the low byte of the X parameter from 52BDH into Register A.
5209
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for X.
520A
If the NZ FLAG is set (X was given), JUMP to 5216H to load with the diskette prompts.
520C
LD DE,4408H 11 08 44
Load Register Pair DE with 4408H, the RET Z at the end of @CMNDI, followed by @ERROR at 4409H.
520F
PUSH DE D5
Save Register Pair DE (4408H) to the stack: the return address of @LOAD.
5210
LD DE,4480H 11 80 44
Point Register Pair DE to 4480H, CFCB$, the program's control block.
5213
JUMP to 4430H (@LOAD) to load the program at Register Pair DE; it returns to 4408H, which RETurns on the Z FLAG and runs @ERROR with Register A otherwise.
5216
X: GOSUB to 52CCH to load the program with @LOAD; Register Pair HL returns its transfer address.
5219
PUSH HL E5
Save Register Pair HL to the stack. 5291H comes here with the transfer address on the stack and the command line in Register Pair HL.
521A
LD HL,5316H 21 16 53
Point Register Pair HL to 5316H, the prompt Insert SYSTEM disk <ENTER>.
521D
GOSUB to 5225H to flash the prompt at Register Pair HL until ENTER is pressed.
5220
POP HL E1
Restore Register Pair HL (the transfer address or the command line) from the stack.
5221
RET C9
RETurn: for LOAD to the supervisor dispatcher and the program that ran the command; for RUN (5291H) to the program's transfer address.

5222H - Flash a Prompt until ENTER

Waits until BREAK and ENTER are let go, then shows the prompt at Register Pair HL (it ends with 1DH, the cursor back to the start of the line) and erases it with 1EH, again and again, while KFLAG$ is watched: BREAK ends the command with Command aborted! through @ABORT, after asking for the system diskette; ENTER clears the keys and returns to the caller of 5225H.

5222
GOSUB to 5267H to clear bits 2-0 of KFLAG$ (ENTER, pause, BREAK), which the keyboard scan sets again while the key is held.
5225
LD BC,41FDH 01 FD 41
Load Register Pair BC with 41FDH, the count of the ROM's delay loop.
5228
GOSUB to the ROM at 0060H (@PAUSE) to wait Register Pair BC turns of its delay loop.
522B
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
522E
AND 05H E6 05
AND 05H into Register A: bit 0 (BREAK) and bit 2 (ENTER).
5230
If the NZ FLAG is set (still held), LOOP BACK to 5222H to wait.
5232
GOSUB to 5267H to clear bits 2-0 of KFLAG$ before the prompt is shown.
5235
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL; its 1DH puts the cursor back to the start of the line.
5238
LD BC,4000H 01 00 40
Load Register Pair BC with 4000H, the time the prompt is shown.
523B
GOSUB to 524BH to wait Register Pair BC turns while watching BREAK and ENTER.
523E
LD A,1EH 3E 1E
Load Register A with 1EH, the code that erases to the end of the line.
5240
GOSUB to the ROM at 0033H to display the character in Register A (1EH): the prompt goes off.
5243
LD BC,3333H 01 33 33
Load Register Pair BC with 3333H, the time the prompt is off.
5246
GOSUB to 524BH to wait Register Pair BC turns while watching BREAK and ENTER.
5249
LOOP BACK to 5235H to show the prompt again, until ENTER or BREAK.
524B
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
524E
RRCA 0F
Rotate Register A right (RRCA): bit 0 (BREAK) goes into the CARRY FLAG and bit 2 (ENTER) moves to bit 1.
524F
If the CARRY FLAG is set (BREAK), JUMP to 5270H to end with Command aborted!.
5251
BIT 1,A CB 4F
Test bit 1 of Register A, which is bit 2 of KFLAG$: ENTER was pressed.
5253
If the NZ FLAG is set (ENTER), JUMP to 525BH.
5255
DEC BC 0B
DECrement Register Pair BC, the turns of the wait left.
5256
LD A,B 78
Copy Register B (the high byte of the count) into Register A.
5257
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set at the end of the wait.
5258
If the NZ FLAG is set (turns left), LOOP BACK to 524BH.
525A
RET C9
RETurn to the flashing loop at the end of the wait.
525B
POP AF F1
Restore Register Pair AF from the stack: the return address into the flashing loop is dropped, so the RET below goes back to the caller of 5225H.
525C
GOSUB to the ROM at 002BH (@KBD) to take a key from the keyboard into Register A.
525F
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when no key is left.
5260
If the NZ FLAG is set (a key), LOOP BACK to 525CH to take the next one.
5262
LD A,1EH 3E 1E
Load Register A with 1EH, the code that erases to the end of the line.
5264
GOSUB to the ROM at 0033H to display the character in Register A (1EH): the prompt is erased.
5267
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
526A
AND F8H E6 F8
AND F8H into Register A: bits 2-0 (ENTER, pause, BREAK) cleared.
526C
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, with bits 2-0 cleared.
526F
RET C9
RETurn to the caller with the keys of KFLAG$ cleared.
5270
LD HL,5352H 21 52 53
Point Register Pair HL to 5352H, the message Command aborted!.
5273
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5276
GOSUB to 5219H to ask for the system diskette.
5279
JUMP to 4030H (@ABORT) to end the command and any JCL job.

527CH - RUN

Without X the file in CFCB$ is handed to @RUN, which loads and runs it. With X the program is loaded (52CCH), the system diskette is asked for, and the RET at 5221H goes to its transfer address with Register Pair HL at the rest of the command line.

527C
GOSUB to 5293H to read X and the file into CFCB$ (4480H) and load SYS2/SYS; with X the source diskette is asked for.
527F
LD A,(52BDH) 3A BD 52
Fetch the low byte of the X parameter from 52BDH into Register A.
5282
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when X was not given.
5283
LD DE,4480H 11 80 44
Point Register Pair DE to 4480H, CFCB$, the program's control block. LD does not change the flags.
5286
If the Z FLAG is set (no X), JUMP to 4433H (@RUN) to load and run the program at Register Pair DE.
5289
PUSH HL E5
Save Register Pair HL (the rest of the command line) to the stack.
528A
LD DE,4480H 11 80 44
Point Register Pair DE to 4480H, CFCB$, the program's control block.
528D
GOSUB to 52CCH to load the program with @LOAD; Register Pair HL returns its transfer address.
5290
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (EX (SP),HL, the Stack Pointer's word): Register Pair HL = the command line, the transfer address goes on the stack.
5291
JUMP BACK to 5219H to ask for the system diskette; its RET goes to the program.

5293H - Read X and the File

The parameters come first (table 5364H: X). A space is passed over, the file's specification goes to CFCB$ (4480H) and must not be a device; CMD is added when it has no extension. SYS2/SYS is loaded (request 84H) while the system diskette is in. With X the source diskette is asked for. The error exits put the Stack Pointer back to the depth of 5293H's own return address, so after a message they RETurn to the instruction after the CALL 5293H with Register Pair HL = FFFFH, or end a JCL job.

5293
LD (52F4H),SP ED 73 F4 52
Store the Stack Pointer at 52F4H, the operand of the LD SP at 52F3H: the depth of this routine's return address.
5297
LD DE,5364H 11 64 53
Point Register Pair DE to 5364H, the parameter table (X).
529A
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; with no bracket nothing is read.
529D
If the NZ FLAG is set (an unknown keyword or a bad value), JUMP to 52E1H to report error 2CH (parameter error).
529F
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52A0
CP 20H FE 20
Compare Register A against 20H, a space before the specification.
52A2
If the NZ FLAG is set (not a space), JUMP to 52A5H.
52A4
INC HL 23
INCrement Register Pair HL past the space before the specification.
52A5
LD DE,4480H 11 80 44
Point Register Pair DE to 4480H, CFCB$, the control block of the command's program.
52A8
GOSUB to 441CH (@FSPEC) to copy the specification at Register Pair HL to Register Pair DE (4480H); the NZ FLAG when there is none.
52AB
If the NZ FLAG is set (no file), JUMP to 52EAH to display File spec required!.
52AD
LD A,(DE) 1A
Fetch the first character of the specification at Register Pair DE into Register A.
52AE
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device.
52B0
If the Z FLAG is set (a device), JUMP to 52EAH to display File spec required!.
52B2
PUSH HL E5
Save Register Pair HL (the rest of the command line) to the stack.
52B3
LD HL,536DH 21 6D 53
Point Register Pair HL to 536DH, the extension CMD.
52B6
GOSUB to 4473H (@FEXT) to add the extension at Register Pair HL to the specification at Register Pair DE when it has none.
52B9
GOSUB to 52C9H to issue request 84H, which loads SYS2/SYS (the open of the load) while the system diskette is in.
52BC
LD DE,0000H 11 00 00
Load Register Pair DE with the X parameter, the operand at 52BDH-52BEH: 0000H in the file, FFFFH when X was given.
52BF
LD A,D 7A
Copy Register D (the high byte of X) into Register A.
52C0
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set when X was not given.
52C1
LD HL,5334H 21 34 53
Point Register Pair HL to 5334H, the prompt Insert SOURCE disk <ENTER>. LD does not change the flags.
52C4
If the NZ FLAG is set (X), GOSUB to 5225H to flash the prompt at Register Pair HL until ENTER is pressed.
52C7
POP HL E1
Restore Register Pair HL (the rest of the command line) from the stack.
52C8
RET C9
RETurn to the caller with the program's specification in CFCB$.
52C9
LD A,84H 3E 84
Load Register A with 84H, a request to SYS2/SYS with function 00H.
52CB
RST 28H EF
RST 28H: the supervisor loads SYS2/SYS and returns to the caller of 52C9H, the function doing nothing.

52CCH - Load the Program

Sets SFLAG$ bit 2 (a program load: @OPEN lets an execute only file be opened) and loads CFCB$ with @LOAD; Register Pair HL returns the transfer address. A failure asks for the system diskette and reports the error. Then the exits.

52CC
LD DE,4480H 11 80 44
Point Register Pair DE to 4480H, CFCB$, the program's control block.
52CF
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52D2
SET 2,A CB D7
Set bit 2 of Register A: a program is being loaded.
52D4
LD (430FH),A 32 0F 43
Store Register A at 430FH, SFLAG$, with bit 2 set.
52D7
GOSUB to 4430H (@LOAD) to load the program at Register Pair DE; Register Pair HL returns its transfer address.
52DA
RET Z C8
RETurn if the Z FLAG is set: the program is loaded.
52DB
PUSH AF F5
Save Register Pair AF (the error number) to the stack.
52DC
GOSUB to 5219H to ask for the system diskette, so that SYS4/SYS can be loaded for the message.
52DF
POP AF F1
Restore Register Pair AF (the error number) from the stack.
52E0
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH. On the way from 52DFH this only covers the bytes 3EH 2CH: a JR to 52E1H runs them as LD A,2CH, the error number of a parameter error. Register Pair BC is not used afterwards.
52E3
OR C0H F6 C0
OR C0H into Register A: bit 7 asks @ERROR to return to the caller and bit 6 for the short form of the message.
52E5
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
52E8
JUMP to 52F0H to end with Register Pair HL = FFFFH.
52EA
LD HL,5302H 21 02 53
Point Register Pair HL to 5302H, the message File spec required!.
52ED
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
52F0
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
52F3
LD SP,0000H 31 00 00
Load the Stack Pointer with the depth saved at 5293H, the operand at 52F4H-52F5H (0000H in the file): the top of the stack is the return address of the CALL 5293H.
52F6
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
52F7
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
52F8
RET Z C8
RETurn if the Z FLAG is set; Register Pair HL is FFFFH on every path here, so this does not return.
52F9
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52FC
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52FE
RET Z C8
RETurn if the Z FLAG is set (no JCL job), to the instruction after the CALL 5293H, with Register Pair HL = FFFFH.
52FF
A JCL job runs: JUMP to 4030H (@ABORT) to end the job, since the command failed.

5302H - RUN and LOAD Data

The message, the two prompts (they start with 1DH 1EH, the cursor to the start of the line and the line erased, and end with 1DH 03H, so that 1EH can erase them again), the abort message, the parameter table (one entry of eight bytes and 00H) and the default extension.

5302-5314
DEFM "File spec required!" 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 21
The message of 52EAH: no file, or a device, was named.
5315
DEFB 0DH 0D
0DH, the end of the message File spec required!.
5316-5317
DEFB 1DH, 1EH 1D 1E
The start of the prompt of 521AH: the cursor to the start of the line, the line erased.
5318-5331
DEFM "Insert SYSTEM disk <ENTER>" 49 6E 73 65 72 74 20 53 59 53 54 45 4D 20 64 69 73 6B 20 3C 45 4E 54 45 52 3E
The prompt for the system diskette, shown after an X load.
5332-5333
DEFB 1DH, 03H 1D 03
1DH, the cursor back to the start of the line, and 03H, the end of the prompt.
5334-5335
DEFB 1DH, 1EH 1D 1E
The start of the prompt of 52C1H: the cursor to the start of the line, the line erased.
5336-534F
DEFM "Insert SOURCE disk <ENTER>" 49 6E 73 65 72 74 20 53 4F 55 52 43 45 20 64 69 73 6B 20 3C 45 4E 54 45 52 3E
The prompt for the diskette that holds the program.
5350-5351
DEFB 1DH, 03H 1D 03
1DH, the cursor back to the start of the line, and 03H, the end of the prompt.
5352
DEFB 1DH 1D
1DH, the cursor to the start of the line, over the flashing prompt that BREAK ended (5270H).
5353-5362
DEFM "Command aborted!" 43 6F 6D 6D 61 6E 64 20 61 62 6F 72 74 65 64 21
The message of 5270H: BREAK at a diskette prompt.
5363
DEFB 0DH 0D
0DH, the end of the message Command aborted!.
5364-536B
DEFM "X " / DEFW 52BDH 58 20 20 20 20 20 BD 52
X: its value goes to 52BDH-52BEH, the operand of the LD DE at 52BCH.
536C
DEFB 00H 00
00H, the end of the parameter table: @PARAM stops searching here.
536D-536F
DEFM "CMD" 43 4D 44
The extension @FEXT adds to a program named without one (52B3H).