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

Page Customization

Introduction/Summary

LDOS 5.3.1 SYS7/SYS Disassembly: Library B (Model I)

SYS7/SYS is Library B of LDOS 5.3.1: thirteen 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). Fourteen commands are served: AUTO, TIME, DATE, CREATE, VERIFY, DEBUG, FREE, SYSTEM, BUILD, ATTRIB, DUMP, PURGE, FORMS and SETCOM; a fifteenth member header, 1CH, names SYSGEN, the member that SYSTEM (SYSGEN) runs. Every member loads at 5200H, directly above the overlay area 4E00H-51FFH. Only one member is in memory at a time, and the next library command loads its own member over it.

The file is 12823 bytes: a header record (05H) with the name sys7, a copyright record (1FH) with the text (C) 1982-4,6,90 MISOSYS, fifteen member headers (08H), a record 0AH that ends the headers, an empty member 0 (a record 04H alone), then the thirteen 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 commands have one header for each command, both pointing at the same place in the file with different entry addresses. The members hold 12389 loaded bytes.

How a Member Is Run

SYS1/SYS looks the command word up in its command table (4EBDH; bit 6 of an entry's flags byte marks a Library B command) and issues request 89H (Library B) 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
AUTO11H15200H
DATE15H25203H
TIME16H25200H
CREATE13H35200H
DEBUG14H45203H
VERIFY1BH45200H
SYSGEN (run by SYSTEM)1CH55200H
FREE22H65200H
SYSTEMA1H75200H
BUILD33H85200H
ATTRIB51H95200H
DUMP71H105200H
PURGE72H115200H
FORMSB1H125200H
SETCOMB2H135200H

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 value in the file (0000H, 0001H, 0100H or FFFFH) is how the member tells that a keyword was not given. 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 refuse to run unless they came from LDOS command level (DEBUG (EXT), SYSGEN, and the options of SYSTEM that put a module in high memory or change the drives): @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. In the same way an LD BC,2C3EH hides an LD A,2CH (error 44, a parameter error) one byte in.

SYSTEM, FORMS and SETCOM find modules in high memory by name through request BCH (SYS10/SYS): a module starts with a JR over its header, the word of the HIGH$ before it, the length of its name and the name. SYSTEM puts its own modules there: $UP (UPDATE), $BL (BLINK), $AL (ALIVE), $SVC (SVC) and $SR (SYSRES).

The Members

Member 1, AUTO (5200H-5351H): shows (AUTO ?), runs (AUTO =) or stores the command that the boot runs, kept in bytes E0H-FFH of a diskette's granule allocation table; AUTO alone stores an empty one.

Member 2, TIME and DATE (5200H-548DH): shows the date (as Tue, Jan 1, 1980) or sets it from MM/DD/YY (the years 1980-2011), with the day of the week and the day of the year; shows the time or sets it from HH:MM or HH:MM:SS; TIME (CLOCK) starts the clock display in task slot 6.

Member 3, CREATE (5200H-53D2H): makes a file of a given size ahead of time (SIZE in kilobytes, or REC records of LRL bytes), optionally filled with a byte (FILL), and marks it so that @CLOSE does not give its space back; SHRINK clears the mark.

Member 4, VERIFY and DEBUG (5200H-5349H): VERIFY points the @WRITE vector at the write with or without the read back of every sector; DEBUG turns DEBUG on or off, and with EXT loads the extended commands of SYS9/SYS (request 8BH) or gives their memory back.

Member 5, SYSGEN (5200H-552FH, loaded blocks with a gap at 53FEH-540CH): run by SYSTEM (SYSGEN); writes CONFIG/SYS, a load module of the memory above HIGH$, the resident cells and the drive code tables, which SYS0/SYS's reset loads, or deletes it with SYSGEN=OFF. A running JCL job is paused around the work.

Member 6, FREE (5200H-55A3H): one line for each ready drive (the diskette's name and date, cylinders, density, heads, free and total space and directory records), or with FREE :d that line and a map of the drive's granules; P prints the lines as well.

Member 7, SYSTEM (5200H-5EE6H): the thirty options of the system: SLOW, FAST, BASIC2, PRTIME, BREAK, UPDATE, DATE, TIME, TRACE, BSTEP, BLINK (LARGE, SMALL), TYPE, SMOOTH, GRAPHIC, ALIVE, SVC, SYSRES, the drive options DRIVE, WP, CYL, DISABLE, ENABLE, STEP and DELAY, DRIVER, SYSTEM, SWAP and SYSGEN, which runs member 5 through request 89H.

Member 8, BUILD (5200H-5402H): makes a file (default /JCL) from lines typed at the keyboard, or adds to it with APPEND; a /KSM file takes 26 lines with the prompts A=> to Z=>, and HEX takes each line as pairs of hexadecimal digits.

Member 9, ATTRIB (5200H-56D5H): changes a file's visibility, protection level and passwords, or a diskette's name and master password; LOCK gives every visible file without a password the master password, UNLOCK takes it off again.

Member 10, DUMP (5200H-5405H): writes memory from START to END to a file as a load module with a transfer address (TRA), or with ASCII as the bytes alone followed by an end byte.

Member 11, PURGE (5200H-577CH, a work area at 5711H-5733H not loaded): deletes the files of a drive that match a partspec, with a question for each file unless QUERY=N, limited by SYS, INV and a range of dates.

Member 12, FORMS (5200H-5525H): shows and changes the settings of the printer filter PR/FLT (the module $FF): page length, lines, characters, margin, indent, line feed, form feed, tab and a translated character.

Member 13, SETCOM (5200H-569CH): shows and changes the settings of the RS-232 driver RS232/DVR (the module $CL): baud rate, word length, stop bits, parity, break character and the handshake signals DTR, RTS, RI, DSR, CD and CTS.

About This Page

Every loaded byte of the file is shown, 12389 bytes, member by member in the order of the file. Since all thirteen 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 the buffers of BUILD and DUMP from 5500H) 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. SYSTEM's modules are shown at the addresses they are loaded at in the member; the comments give their offsets for the copy in high memory.

Parts of the file that no path reaches or uses: in SYSGEN the exit's LD SP keeps the 0000H of the file (the Stack Pointer is stored into the LD HL before it), so the exit returns through the bytes of the ROM at 0000H; FREE's routines at 54E1H and 5435H are not called; VERIFY's ON cell (52ADH) is read by no code; the message Start less than X'5500'! of DUMP is never shown, its test always borrows; the message New SYSTEM drive installed (5C9EH of SYSTEM) is not displayed; SYSTEM (TYPE) tests a bit of the message at 5C3DH where it means to test DFLAG$.

Memory Map

The Records of the File

The file is 12823 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 sys7 and two spaces.
0008HRecord 1FH, 23 bytes: the text (C) 1982-4,6,90 MISOSYS.
0021H-0098HFifteen member headers, record 08H of 6 bytes each: the member byte, the entry address, and the record and byte where the member begins.
0099HRecord 0AH, 1 byte (00H): the end of the member headers.
009CHRecord 04H, 1 byte (00H): the end of member 0, which has no load blocks.
009FH-01FBHMember 1 (AUTO): 2 load blocks, then record 04H.
01FCH-0498HMember 2 (TIME, DATE): 3 load blocks, then record 04H.
0499H-0676HMember 3 (CREATE): 2 load blocks, then record 04H.
0677H-07CBHMember 4 (VERIFY, DEBUG): 2 load blocks, then record 04H.
07CCH-0AFFHMember 5 (SYSGEN): 4 load blocks, then record 04H.
0B00H-0E7AHMember 6 (FREE): 5 load blocks, then record 04H.
0E7BH-1B98HMember 7 (SYSTEM): 13 load blocks, then record 04H.
1B99H-1DAAHMember 8 (BUILD): 3 load blocks, then record 04H.
1DABH-2297HMember 9 (ATTRIB): 5 load blocks, then record 04H.
2298H-24ACHMember 10 (DUMP): 3 load blocks, then record 04H.
24ADH-2A25HMember 11 (PURGE): 7 load blocks, then record 04H.
2A26H-2D5EHMember 12 (FORMS): 4 load blocks, then record 04H.
2D5FH-3212HMember 13 (SETCOM): 5 load blocks, then record 04H.
3213HRecord 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 and 11 leave gaps between their blocks: work areas whose bytes the file does not load.

MemberFile OffsetLoadedSizeCommands
1009FH5200H-5351H338 bytesAUTO
201FCH5200H-548DH654 bytesTIME, DATE
30499H5200H-53D2H467 bytesCREATE
40677H5200H-5349H330 bytesVERIFY, DEBUG
507CCH5200H-53FDH
540DH-552FH
801 bytesSYSGEN
60B00H5200H-5559H
559AH-55A3H
868 bytesFREE
70E7BH5200H-5EE6H3303 bytesSYSTEM
81B99H5200H-5402H515 bytesBUILD
91DABH5200H-56D5H1238 bytesATTRIB
102298H5200H-5405H518 bytesDUMP
1124ADH5200H-5710H
5734H-577CH
1370 bytesPURGE
122A26H5200H-5525H806 bytesFORMS
132D5FH5200H-569CH1181 bytesSETCOM

Sections of the Disassembly

MemberAddressContents
15200HMember 1 (AUTO): Entry and AUTO ?
1522EHAUTO =: Run the AUTO Command Now
15261HAUTO command: Store a New AUTO Command
152A1HCheck the Drive and Read Its Granule Allocation Table
152B4HTake an Optional Drive Specification
152D0HRead and Write the Granule Allocation Table
152FBHAUTO Data: Messages
25200HMember 2 (DATE and TIME): Entries and Name Tables
2524CHDATE: Set the Date from MM/DD/YY
2528DHDATE: Note the Date for the Reset, Then Show It
252CEHTIME: Parameters, Set the Time
25320HTIME (CLOCK): Start or Stop the Clock Display
2533BHDATE: The Day of the Year, the Day of the Week and the Display
253E2HTIME: Show the Time
253EBHCopy Name Number B from a Table of Three Letter Names
253FAHRead Three Fields of Two Digits
2541FHRead Two Decimal Digits
2543CHWrite a Number in Decimal, Right Justified
25455HDATE and TIME Data: Parameter Table, Template and Messages
35200HMember 3 (CREATE): Entry and the Parameters
35274HShow the Name and Extend the File
352D1HFILL: Write Every Record
35318HSHRINK and the Exit
35333HMark the Directory Record
35358HCREATE Data: Parameter Table and Messages
45200HMember 4 (DEBUG and VERIFY): Entries and DEBUG
4522BHDEBUG (OFF): Turn DEBUG Off
4525EHDEBUG (EXT): Load the Extended DEBUG Commands
45271HVERIFY: Point the @WRITE Vector
45292HRead the Parameters, Test OFF
452AFHMessages and Errors
452C6HDEBUG and VERIFY Data: Messages and Parameter Tables
55200HMember 5 (SYSGEN): Entry, the JCL Pause and the Checks
55229HBuild: The Name Record and the Banner
55262HBuild: The Memory above HIGH$
5529AHBuild: The Drive Code Tables, the End and the Flag
552EBHWrite a Block of Memory as Load Blocks
55324HWrite One Load Block from a Buffer
55346HDelete: SYSGEN=OFF
55366HThe Exit
5537BHRead the System Information Sector; Write One Byte
553A2HPause and Resume a JCL Job
553EDHSYSGEN Data: The File Control Block, Messages and the Table of Cells
65200HMember 6 (FREE): Entry and the Text
65228HFREE: One Line for Each Drive
6524BHFREE :d: The Granule Map
652C5HBuild and Show the Line of a Drive
653C6HThe Page: Count the Lines, Pause and Start Again
653F5HShow a Line, Then Print It or Count It
65409HGranules to Kilobytes
65435HWrite a Number in Decimal
65478HThe Map: Characters for One Cylinder
654B5HThe Map: The Label of the Next Line
654E1HRead the Granule Allocation Table (Not Called)
654F4HErrors and the Exit
65512HFREE Data: The Line Template, the Map Label, the Line Buffer and the Parameter Table
75200HMember 7 (SYSTEM): Entry, the Parameters, SLOW and FAST
75236HBASIC2: Leave LDOS for the ROM's BASIC
75256HPRTIME: The Printer Time Out of PR/FLT
75276HBREAK: Allow or Disable the BREAK Key
7528FHUPDATE: The Midnight Date Change
752FCHThe $UP Module: Move the Date On at Midnight
7536FHDATE and TIME: The Prompts at Boot
7539DHTRACE and BSTEP
753DDHBLINK: The Blinking Cursor Module
75469HThe $BL Module: The Blinking Cursor Task
754B4HTYPE: Type Ahead
754F1HSMOOTH and GRAPHIC
75517HALIVE: The Alive Indicator Module
75579HThe $AL Module: The Alive Indicator
75592HSVC: The Supervisor Calls below 80H
755E0HThe $SVC Module: The Table of Supervisor Calls
756E9HThe $SVC Module: The Dispatcher and SVC 100
75705HSYSRES: Keep a System File in Memory
757BFHThe $SR Module: System Files Kept in Memory
75825HThe Drive Options: DRIVE, WP, CYL, DISABLE, ENABLE, STEP, DELAY
7590DHDRIVER: Load a Disk Driver
759B3HSYSTEM and SWAP: Exchange Two Drives
75A2FHSYSGEN and the Exit
75A61HRead and Write Drive 0's System Information Sector; Errors
75A84HA System Diskette in the Drive Register A
75AC5HA JCL Job's File Follows the Swap
75AE7HFind a Module in High Memory; the Command Level Test; Messages
75B31HSYSTEM Data: Messages, the Default Extension and the Parameter Table
85200HMember 8 (BUILD): Entry, the File and the Mode
85299HThe Lines
852ECHWrite the File
8531DHThe Name of the File or Device
85330HOne Hexadecimal Digit
8536AHBUILD Data: Messages, the Default Extension and the Parameter Table
95200HMember 9 (ATTRIB): Entry and a File's Attributes
9527BHPROT=level
952D5HI, V, ACC and OWNER
95329HPasswords and Values
95375HChange the Directory Record
953C5HA Diskette: NAME, PW, LOCK and UNLOCK
9545CHLOCK and UNLOCK: Every File
954CBHThe Allocation Table and the Master Password
954FBHGet Eight Characters
9554EHRead or Write the Allocation Table at 5800H
95572HNot during a JCL Job; the Messages
9559CHATTRIB Data: Messages, the Protection Words, the Prompts and the Parameter Table
105200HMember 10 (DUMP): Entry, the Range and the File
1052D2HWrite the Memory
105342HWrite One Byte; Errors
10535DHDUMP Data: Messages, Extensions and the Parameter Table
115200HMember 11 (PURGE): Entry, the Partspec and the Drive
115263HDATE: The Range of Dates
1152BEHThe Walk through the Hash Index Table
11532EHThe Name, the Date, the Line
11546EHDelete the File
1154ACHThe Master Password
1154E6HGet Eight Characters
11553FHHelpers: The Allocation Table, the JCL Test, the Masks, a Record's Date
1155A1HRead a Date M/D/Y
1155D3HErrors and Messages
1155F4HRead and Pack a Date
115642HPURGE Data: Messages, the Month Table, the Masks and the Parameter Table
125200HMember 12 (FORMS): Entry and the Exit
12522DHFind the Filter and Copy Its Settings
125262HThe Parameters
1252F8HShow the Settings
12537BHHelpers: ON, Numbers, the Lookup
1253BBHFORMS Data: The Parameter Table, the Cells, the Factory Values and the Texts
135200HMember 13 (SETCOM): Entry and the Exit
13522DHFind the Driver; the Parameters
135263HThe Display: One Routine for Each Part
135364HThe List Walker; the Factory Settings
135394HChange the Settings
135498HHelpers: A Signal, a Bit Field, Capitals, the Baud Table, Numbers
135500HSETCOM Data: The Name, the Message, the Baud Rates, the Display List, the Texts and the Parameter Table

Routines Outside the File That SYS7/SYS Calls

The routines of the ROM and SYS0/SYS the members call or jump to, and which members use each. Requests through RST 28H: 8BH (SYS9/SYS, the extended DEBUG commands) in DEBUG, 89H (Library B member 1CH, SYSGEN) in SYSTEM, BCH (the module search of SYS10/SYS) in SYSTEM, FORMS and SETCOM, E4H (the password hash of SYS2/SYS) in ATTRIB and PURGE.

AddressRoutineMembers
001BHROM: @PUT, a byte to the file or device at Register Pair DE.5, 8, 10
0023HROM: @CTL, a control request to the device at Register Pair DE.5
0033HROM: display the character in Register A.3, 8, 11, 13
003BHROM: print the character in Register A.6
0040HROM: @KEYIN, read a line from the keyboard.7, 8, 9, 11
0049HROM: wait for a key.6
0075HROM: the rest of the power up start of Level II BASIC.7
01C9HROM: clear the screen.6
4030H@ABORT: end the command and a JCL job.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
4405H@CMNDI: carry out a command line and go on to LDOS Ready.5
4409H@ERROR: report the error in Register A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
4410H@ADTSK: put a task into a task slot.2, 7
4413H@RMTSK: empty a task slot.2, 7
4416H@RPTSK: end this run of a task; the next run goes on after the call.7
441CH@FSPEC: a file or device specification into a control block.3, 7, 8, 9, 10
4420H@INIT: open a file, making it when it is not there.3, 5, 8, 10
4424H@OPEN: open a file or device.5, 9
4428H@CLOSE: close a file.3, 5, 8, 10
442CH@KILL: delete a file.5, 11
4430H@LOAD: load a program file.7
4439H@WRITE: write a record.3
443FH@REW: back to the first record.3
4442H@POSN: position to a record.3
4448H@PEOF: position to the end of the file.8
4451HRun a command line through SYS1/SYS and return.1
445DH@LOF: the number of records of a file.3
4467H@DSPLY: display a line.3, 6, 7, 8, 9, 11, 12, 13
446AH@PRINT: print a line.6
446DH@TIME: the time as HH:MM:SS.2
4473H@FEXT: give a specification a default extension.7, 8, 10
4476H@PARAM: read the parameters in brackets.2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13
447BH@LOGOT: display a line and send it to the job log.1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13
44B8H@CKDRV: check that a drive is ready.1, 6, 7, 11
44BBH@FNAME: the name of a file from its directory record.3, 8, 10
44C1H@MULT: multiply Register Pair HL by Register A.6
44C4H@DIV: divide Register Pair HL by Register A.2, 12, 13
4763HWRSECT: write a sector.5, 7
4768HWRPROT: write a sector with the deleted data mark.1, 9
4772HVERSEC: read a sector back to verify it.1, 9
4777HRDSECT: read a sector.5, 7
478FHGETDCT: Index Register IY at a drive code table.6, 7
4B10HDIRRD: read the directory sector of a record.3, 9, 11
4B1FHDIRWR: write the directory sector back.3, 9
4B45HRDSSEC: read a directory sector.1, 6, 7, 9, 11
4B65HDIRCYL: the directory cylinder of a drive.1, 6, 9, 11
4BF5HThe overlay loader of SYS0/SYS.7
4D7BHWrite Register A as two hexadecimal digits.12, 13

Variables

Parameter Cells

The operands (and a few cells) that @PARAM fills from each member's parameter table. AUTO and SYSGEN have no parameter table; ATTRIB reads the options of a file itself, by their first letter.

Address
Size
MemberKeywordContents
5321H-5322H
2 bytes
2CLOCKThe clock display at the top right of the screen (CLOCK or CLOCK=N); the operand of the LD HL at 5320H.
5248H-5249H
2 bytes
3SIZE or SThe size in kilobytes; the operand of the LD HL at 5247H.
5241H-5242H
2 bytes
3REC or RThe number of records; the operand of the LD BC at 5240H.
5257H-5258H
2 bytes
3LRL or LThe record length; the operand of the LD BC at 5256H.
52D2H-52D3H
2 bytes
3FILL or FThe byte to write into every record; the operand of the LD BC at 52D1H.
5319H-531AH
2 bytes
3SHRINKTake the mark of CREATE off again; the operand of the LD DE at 5318H.
525CH-525DH
2 bytes
4EXT or ELoad the extended DEBUG commands (with OFF, take them out); the cell at 525CH-525DH.
52ADH-52AEH
2 bytes
4ON or YDEBUG or VERIFY on, read by no code; the cell at 52ADH-52AEH.
52A6H-52A7H
2 bytes
4OFF or NDEBUG or VERIFY off; the operand of the LD BC at 52A5H.
53FCH-53FDH
2 bytes
6PSend the lines to the printer too; the operand of the LD DE at 53FBH.
5518H-5519H
2 bytes
7ALIVEThe alive indicator at the top right of the screen (ON or OFF); the operand of the LD BC at 5517H.
5237H-5238H
2 bytes
7BASIC2Leave LDOS for the ROM's Level II BASIC; the operand of the LD BC at 5236H.
53B5H-53B6H
2 bytes
7BSTEPThe step rate the boot uses (0-3); the operand of the LD BC at 53B4H.
590EH-590FH
2 bytes
7DRIVERThe disk driver file to load (or asked for); the operand of the LD DE at 590DH.
5215H-5216H
2 bytes
7FASTThe fast clock speed (bit 0 of port FEH set); the operand of the LD BC at 5214H.
520EH-520FH
2 bytes
7SLOWThe normal clock speed (bit 0 of port FEH clear); the operand of the LD BC at 520DH.
5593H-5594H
2 bytes
7SVCInstall the table of supervisor calls; the operand of the LD BC at 5592H.
59C6H-59C7H
2 bytes
7SWAPThe drive to exchange with DRIVE; the operand of the LD BC at 59C5H.
5706H-5707H
2 bytes
7SYSRESThe system file to keep in memory (1-5 or 8-12); the operand of the LD BC at 5705H.
59B4H-59B5H
2 bytes
7SYSTEMThe drive to exchange with drive 0; the operand of the LD BC at 59B3H.
54B5H-54B6H
2 bytes
7TYPEType ahead (ON or OFF); the operand of the LD BC at 54B4H.
539EH-539FH
2 bytes
7TRACEThe program counter display (ON or OFF); the operand of the LD BC at 539DH.
585AH-585BH
2 bytes
7WPThe software write protect of the drive (ON or OFF); the operand of the LD BC at 5859H.
53DEH-53DFH
2 bytes
7BLINKThe blinking cursor (ON, OFF or the cursor character); the operand of the LD BC at 53DDH.
5277H-5278H
2 bytes
7BREAKThe BREAK key allowed (ON or OFF); the operand of the LD BC at 5276H.
586FH-5870H
2 bytes
7CYLThe cylinders of the drive for the boot; the operand of the LD BC at 586EH.
5370H-5371H
2 bytes
7DATEThe date prompt at boot (ON or OFF); the operand of the LD BC at 536FH.
58D5H-58D6H
2 bytes
7DELAYThe motor wait of the drive (ON or OFF); the operand of the LD BC at 58D4H.
589DH-589EH
2 bytes
7DISABLDISABLE, cut to six letters: a RET at the start of the drive's code table; the operand of the LD BC at 589CH.
582DH-582EH
2 bytes
7DRIVEThe drive the drive options, SWAP and SYSGEN work on; the operand of the LD BC at 582CH.
58AEH-58AFH
2 bytes
7ENABLEA JP at the start of the drive's code table again; the operand of the LD BC at 58ADH.
5504H-5505H
2 bytes
7GRAPHIGRAPHIC, cut to six letters: bit 7 of DFLAG$ (ON or OFF); the operand of the LD BC at 5503H.
5467H-5468H
2 bytes
7LARGEThe large cursor for BLINK; 540FH tests its low byte; the cell at 5467H-5468H.
541AH-541BH
2 bytes
7SMALLThe small cursor for BLINK; the operand of the LD BC at 5419H.
58BAH-58BBH
2 bytes
7STEPThe step rate of the drive (0-3); the operand of the LD BC at 58B9H.
54F2H-54F3H
2 bytes
7SMOOTHInterrupts off before a disk transfer (ON or OFF); the operand of the LD BC at 54F1H.
5A30H-5A31H
2 bytes
7SYSGENBuild CONFIG/SYS (or with OFF delete it) through member 5; the operand of the LD HL at 5A2FH.
5387H-5388H
2 bytes
7TIMEThe time prompt at boot (ON or OFF); the operand of the LD BC at 5386H.
5257H-5258H
2 bytes
7PRTIMEThe printer time out of PR/FLT (ON or OFF); the operand of the LD BC at 5256H.
5290H-5291H
2 bytes
7UPDATEThe date moved on at midnight (ON or OFF); the operand of the LD BC at 528FH.
52C5H-52C6H
2 bytes
8HEX or HLines of hexadecimal digit pairs; the operand of the LD DE at 52C4H.
527CH-527DH
2 bytes
8APPEND or AAdd to an existing file; the operand of the LD BC at 527BH.
540EH-540FH
2 bytes
9PWA new master password for the diskette; the operand of the LD DE at 540DH.
5431H-5432H
2 bytes
9LOCK or LThe master password for every file without one; the operand of the LD BC at 5430H.
543BH-543CH
2 bytes
9UNLOCK or UNo password for every file with the master password; the operand of the LD BC at 543AH.
53F6H-53F7H
2 bytes
9NAME or NA new name for the diskette; the operand of the LD DE at 53F5H.
54F9H-54FAH
2 bytes
9MPW or MThe diskette's master password; the cell at 54F9H-54FAH.
52D3H-52D4H
2 bytes
10START or SThe first address to write; the operand of the LD HL at 52D2H.
52D9H-52DAH
2 bytes
10END or EThe last address to write; the operand of the LD HL at 52D8H.
5321H-5322H
2 bytes
10TRA or TThe transfer address of the load module; the operand of the LD HL at 5320H.
5243H-5244H
2 bytes
10ASCII or AThe bytes alone; the operand of the LD BC at 5242H.
527EH-527FH
2 bytes
10LRL or LThe record length of the file; the operand of the LD BC at 527DH.
5315H-5316H
2 bytes
10ETXThe byte that ends an ASCII file; the operand of the LD BC at 5314H.
5327H-5328H
2 bytes
11I or INVInvisible files too; the operand of the LD DE at 5326H.
5319H-531AH
2 bytes
11S or SYSSystem files too; the operand of the LD DE at 5318H.
54BFH-54C0H
2 bytes
11MPWThe master password of the diskette; the operand of the LD DE at 54BEH.
53C0H-53C1H
2 bytes
11QUERY or QAsk about each file (on unless QUERY=N); the operand of the LD DE at 53BFH.
5264H-5265H
2 bytes
11DATE or DThe range of dates; the operand of the LD HL at 5263H.
545CH-545DH
2 bytes
12LINES or LThe lines printed on a page; the cell at 545CH-545DH.
545EH-545FH
2 bytes
12PAGE or PThe length of a page in lines; the cell at 545EH-545FH.
5460H-5461H
2 bytes
12CHARS or CThe characters on a line; the cell at 5460H-5461H.
5462H-5463H
2 bytes
12INDENT or IThe indent after a line is wrapped; the cell at 5462H-5463H.
5464H-5465H
2 bytes
12ADDLF or AA line feed after each carriage return; the cell at 5464H-5465H.
5466H-5467H
2 bytes
12FFHARD or FA hardware form feed; the cell at 5466H-5467H.
5468H-5469H
2 bytes
12TAB or TTabs expanded; the cell at 5468H-5469H.
546AH-546BH
2 bytes
12XLATE or XA character translated into another; the cell at 546AH-546BH.
546CH-546DH
2 bytes
12MARGIN or MThe left margin; the cell at 546CH-546DH.
526CH-526DH
2 bytes
12DEFAUL or DThe factory settings (DEFAULT, cut to six letters); the operand of the LD BC at 526BH.
5431H-5432H
2 bytes
13BREAKThe break character (ON, OFF or a character); the operand of the LD DE at 5430H.
5399H-539AH
2 bytes
13BAUD or BThe baud rate; the operand of the LD DE at 5398H.
53AAH-53ABH
2 bytes
13WORD or WThe bits of a word (5-8); the operand of the LD DE at 53A9H.
53C9H-53CAH
2 bytes
13STOP or SThe stop bits (1 or 2); the operand of the LD DE at 53C8H.
53E3H-53E4H
2 bytes
13PARITY or PThe parity (ON, OFF, "ODD" or "EVEN"); the operand of the LD DE at 53E2H.
5421H-5422H
2 bytes
13EVEN or EEven parity; the operand of the LD DE at 5420H.
5411H-5412H
2 bytes
13ODD or OOdd parity; the operand of the LD DE at 5410H.
5452H-5453H
2 bytes
13DTRThe output signal DTR (ON or OFF); the operand of the LD DE at 5451H.
5462H-5463H
2 bytes
13RTSThe output signal RTS (ON or OFF); the operand of the LD DE at 5461H.
5477H-5478H
2 bytes
13RIThe input signal RI (ON or OFF); the operand of the LD HL at 5476H.
5487H-5488H
2 bytes
13CDThe input signal CD (ON or OFF); the operand of the LD HL at 5486H.
547FH-5480H
2 bytes
13DSRThe input signal DSR (ON or OFF); the operand of the LD HL at 547EH.
548FH-5490H
2 bytes
13CTSThe input signal CTS (ON or OFF); the operand of the LD HL at 548EH.
5252H-5253H
2 bytes
13DEFAULDEFAULT (the first six letters), the factory settings; the operand of the LD DE at 5251H.

Cells Outside the File

Address
Size
Contents
3C3FH
1 byte
The top right corner of the screen: the character the ALIVE module changes (member 7).
3F96H-3FA7H
18 bytes
Row 14, column 22 of the screen: where CONFIG/SYS loads its banner CONFIGURING (member 5).
4000H-4035H
54 bytes
The restart vectors and the device control blocks: BASIC2 copies the ROM's table from 06D2H over them (member 7).
400FH-4011H
3 bytes
The RST 30H vector, which leads to DEBUG: the BREAK trap jumps here while DEBUG is on (member 4).
4012H-4014H
3 bytes
The RST 38H interrupt vector (member 5).
4015H-401CH
8 bytes
KIDCB$, the keyboard's device control block: its driver address at 4016H-4017H and three bytes for the driver at 4018H-401AH (member 5).
4020H-4022H
3 bytes
DODCB$ +03H-+05H: the cursor's screen address and the character under it (member 7).
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 4, 5, 7, 10); DUMP's TRA is 402DH when not given.
4041H-4043H
3 bytes
TIME$: the seconds, minutes and hours (member 2).
4044H-4048H
5 bytes
DATE$: the year at 4044H, the day 4045H, the month 4046H, the day of the year at 4047H with bit 0 of 4048H, the day of the week in bits 3-1 and a leap year in bit 7 of 4048H (members 2, 7).
4049H-404AH
2 bytes
HIGH$, the highest address free for programs (members 4, 5, 7).
4065H-406AH
6 bytes
The bytes of 402DH-4032H kept during a JCL job (members 5, 7).
406BH-4070H
6 bytes
The @EXIT and @ABORT stubs of a JCL job (member 5).
407DH
stack
The stack that BASIC2 sets before the ROM's start (member 7).
4152H-41A1H
80 bytes
Where CONFIG/SYS loads the drive code tables; the reset copies them to 4700H (member 5).
4200H-42FFH
256 bytes
The system buffer: directory sectors, the granule allocation table (42CDH the configuration byte, 42D0H the diskette's name, 42E0H-42FFH the AUTO command) and the system information sector (byte 01H the CONFIG/SYS flag, 4220H and 4270H the drive tables, 42C2H and 42C3H the date and time prompts) (members 1, 5, 6, 7, 9).
4306H-4307H
2 bytes
SVDAT1$ and SVDAT2$: the month (OR 50H) and the day kept over a reset (members 2, 7).
430EH
1 byte
OVRLY$, the system file in the overlay area (member 7).
430FH
1 byte
SFLAG$: bit 5 a JCL job (every member), bit 7 DEBUG, bit 3 FAST, bit 4 BREAK disabled, bit 0 SVC installed.
4310H-4311H
2 bytes
The address DEBUG calls for a command it does not know: 4876H, or the extended commands (member 4).
4315H-4317H
3 bytes
The BREAK trap: C3H and an address, or C9H (member 4).
4358H-4377H
32 bytes
JFCB$, the control block of a JCL job's file: its drive at 435EH (member 7).
43BEH-43BFH
2 bytes
KIJCL$, the keyboard driver a JCL job replaced (member 5).
441FH
1 byte
DFLAG$, the device flags: bit 0 the spooler, 1 TYPE, 3 PR/FLT, 4 KI/DVR, 7 GRAPHIC (member 7).
4423H
1 byte
KFLAG$: bit 0 BREAK (member 11).
4427H
1 byte
The last value written to port FEH (member 7).
442FH
1 byte
MFLAG$: bit 0 a boot through a disk driver (member 7).
443AH-443BH
2 bytes
The operand of the JP of @WRITE: 48CBH, or 48E6H with VERIFY (member 4).
4466H
1 byte
The year less 1980, for the reset (member 2, 7).
45DAH-45DCH
3 bytes
Where the clock task goes after midnight: C9H, or a JP to the $UP module (member 7).
46FDH
1 byte
The byte the floppy driver calls before a transfer: F3H with SMOOTH, else 00H (member 7).
4700H-474FH
80 bytes
DCT$, the eight drive code tables of 10 bytes (members 5, 7).
4758H
1 byte
The command interpreter's status: bit 1 a command line from a program (members 4, 5, 7), bit 3 set for DRIVER.
475DH
1 byte
The date stamping flags, bit n for drive n (members 9, 11).
4BC9H-4BCAH
2 bytes
The length of a system file's part at 4E00H (member 7).
4BCFH-4BD0H
2 bytes
The operand of the supervisor dispatcher's JP P for request codes below 80H: SVC points it at its module (member 7).
4BDFH-4BE0H
2 bytes
The operand of the dispatcher's CALL of the overlay loader (4BF5H): SYSRES points it at its module (member 7).
4BE5H-4BE6H
2 bytes
The entry address of a system file the dispatcher calls (member 7).
4BF0H
1 byte
The byte after the DEC A at 4BEFH: C8H with BREAK=OFF, 00H with BREAK=ON (member 7).
4D3AH
task block
SYS0/SYS's clock display task, put into slot 6 by TIME (CLOCK) (member 2).
4D6AH
task block
SYS0/SYS's program counter display task, put into slot 11 by TRACE (member 7).
4DF2H-4DF3H
2 bytes
KI/DVR's type ahead cell, 0000H without it (member 7).
4DF6H-4DF7H
2 bytes
The module address of PR/FLT (member 7).
4E00H
overlay area
Where SYSRES loads a system file before copying it (member 7).
51E2H-51F8H
cells
Cells of SYS2/SYS after the password hash: the value's letters (51E2H-51E4H) and the hashes kept at 51F5H-51F8H (member 9).

Disassembly

5200H - Member 1 (AUTO): Entry and AUTO ?

The AUTO command (library member 11H), loaded at 5200H-5351H. SYS1/SYS's command loop issues request 89H (Library B) with Register B = 11H; the overlay loader of SYS0/SYS (4BF5H) loads this member and the supervisor dispatcher calls 5200H with Register Pair HL at the text after AUTO. The AUTO command of a diskette is kept in its granule allocation table, bytes E0H-FFH of the sector (42E0H-42FFH once the sector is read into 4200H); SYS0/SYS's reset runs it after the boot. AUTO ? displays it, AUTO = runs it now (5232H), and AUTO followed by a command stores that command (5261H); AUTO alone stores an empty one (0DH). Each form may name the drive with :d first; drive 0 when not.

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, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
DEC HL 2B
DECrement Register Pair HL (the text after AUTO), so that the INC below starts at the current character.
5205
INC HL 23
INCrement Register Pair HL to the next character of the text.
5206
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5207
CP 20H FE 20
Compare Register A against 20H, a space between AUTO and its text.
5209
If the Z FLAG is set (a space), LOOP BACK to 5205H to pass over it.
520B
CP 3FH FE 3F
Compare Register A (the first character after the spaces) against 3FH, a question mark.
520D
If the NZ FLAG is set (not a question mark), JUMP to 522EH for AUTO = or a new AUTO command.
520F
INC HL 23
AUTO ?: INCrement Register Pair HL past the question mark.
5210
GOSUB to 52B4H to take an optional drive specification (:d) from the text at Register Pair HL into the operand at 52A2H.
5213
GOSUB to 52A1H to check that the drive is ready and read its granule allocation table into 4200H; it returns only when both succeeded.
5216
LD HL,42E0H 21 E0 42
Point Register Pair HL to 42E0H, byte E0H of the granule allocation table in the buffer at 4200H: the AUTO command, ended by 0DH.
5219
GOSUB to 447BH (@LOGOT) to display the AUTO command at Register Pair HL and send it to the job log (an empty command shows an empty line).
521C
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
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). 529EH 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 - AUTO =: Run the AUTO Command Now

With an equals sign the AUTO command of the diskette is read from its granule allocation table and run at once through 4451H, as the reset runs it after a boot. A leading asterisk (2AH) is passed over and turns BREAK off (bit 4 of SFLAG$), as the reset does for such a command. The command is copied out of the buffer at 4200H first, since loading SYS1/SYS uses that buffer.

522E
CP 3DH FE 3D
Compare Register A (the first character) against 3DH, an equals sign.
5230
If the NZ FLAG is set (no equals sign), JUMP to 5261H to store a new AUTO command.
5232
INC HL 23
INCrement Register Pair HL past the equals sign.
5233
GOSUB to 52B4H to take an optional drive specification (:d) from the text at Register Pair HL into the operand at 52A2H.
5236
GOSUB to 52A1H to check that the drive is ready and read its granule allocation table into 4200H; it returns only when both succeeded.
5239
LD HL,42E0H 21 E0 42
Point Register Pair HL to 42E0H, the AUTO command in the granule allocation table at 4200H.
523C
LD A,(HL) 7E
Fetch the first character of the AUTO command at Register Pair HL into Register A.
523D
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk that marks a command BREAK may not stop.
523F
If the NZ FLAG is set (no asterisk), JUMP to 524AH.
5241
INC HL 23
INCrement Register Pair HL past the asterisk, to the command itself.
5242
LD IY,430FH FD 21 0F 43
Point Index Register IY to 430FH, SFLAG$, the system flags.
5246
SET 4,(IY+00H) FD CB 00 E6
Set bit 4 of SFLAG$ at Index Register IY +00H (430FH): BREAK is disabled while the command runs.
524A
LD A,(HL) 7E
Fetch the first character of the command at Register Pair HL into Register A.
524B
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH (or 03H), an empty command.
524D
If the CARRY FLAG is set (no AUTO command), JUMP to 5285H, inside the LD IX at 5284H, where the bytes read LD HL,5337H: No AUTO command installed!
5250
LD DE,5261H 11 61 52
Point Register Pair DE to 5261H, where the command is copied, over this member's own code from 5261H on (that code is not needed any more).
5253
PUSH DE D5
Save Register Pair DE (5261H) to the stack, for the POP below.
5254
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, 64 bytes, more than the 32 byte AUTO field holds.
5257
LDIR ED B0
Copy the command: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 42E0H (or 42E1H) on go to 5261H-52A0H.
5259
POP HL E1
Restore Register Pair HL from the stack: 5261H, the copied command.
525A
LD SP,(5220H) ED 7B 20 52
Load the Stack Pointer with the value saved at entry from 5220H-5221H, so that the return address on the stack is the supervisor dispatcher's (4BE7H).
525E
JUMP to 4451H, request A3H: SYS1/SYS copies the command line at Register Pair HL to INBUF$ (4318H) and carries it out, then returns to the program that ran AUTO.

5261H - AUTO command: Store a New AUTO Command

Any other text after AUTO (after an optional :d) is stored as the new AUTO command in bytes E0H-FFH of the drive's granule allocation table, up to and with its 0DH; nothing but ENTER stores an empty command. The sector is then written back (52E3H). A command of 32 bytes or more is refused with Command line too long!, a write protected drive with Destination disk is write protected!.

5261
GOSUB to 52B4H to take an optional drive specification (:d) from the text at Register Pair HL into the operand at 52A2H.
5264
GOSUB to 52A1H to check that the drive is ready and read its granule allocation table into 4200H; it returns only when both succeeded.
5267
LD A,00H 3E 00
Load Register A with the write protect flag, the operand at 5268H: 00H in the file; 52A8H stores FFH when the drive is write protected, 00H when it is not.
5269
OR A B7
Set the flags from Register A (OR A): the NZ FLAG is set for a write protected drive.
526A
If the NZ FLAG is set (write protected), JUMP to 5281H, inside the LD IX at 5280H, where the bytes read LD HL,52FBH: Destination disk is write protected!
526C
LD DE,42E0H 11 E0 42
Point Register Pair DE to 42E0H, the AUTO field of the granule allocation table at 4200H.
526F
LD A,(HL) 7E
Fetch the next character of the new command at Register Pair HL into Register A.
5270
LD (DE),A 12
Store Register A at Register Pair DE in the AUTO field.
5271
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the command line.
5273
If the Z FLAG is set (the end, stored with the command), JUMP to 528DH to write the sector back.
5275
CP 03H FE 03
Compare Register A against 03H, the other end of text mark.
5277
If the Z FLAG is set (the end), JUMP to 528DH to write the sector back.
5279
INC HL 23
INCrement Register Pair HL to the next character of the command.
527A
INC E 1C
INCrement Register E, the low byte of the place in the AUTO field: from E0H up to FFH.
527B
If the NZ FLAG is set (Register E has not passed FFH: still inside the 32 bytes), LOOP BACK to 526FH.
527D
LD HL,5320H 21 20 53
The command filled all 32 bytes with no end: point Register Pair HL to 5320H, the message Command line too long!.
5280
LD IX,52FBH DD 21 FB 52
Load Index Register IX with 52FBH: no use when run from 527DH. Entered at 5281H (from 526AH) the bytes 21H FBH 52H are LD HL,52FBH, the message Destination disk is write protected!.
5284
LD IX,5337H DD 21 37 53
Load Index Register IX with 5337H: no use when run from above. Entered at 5285H (from 524DH) the bytes 21H 37H 53H are LD HL,5337H, the message No AUTO command installed!.
5288
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
528B
JUMP to 529BH to end the command with Register Pair HL = FFFFH.
528D
LD A,(52A2H) 3A A2 52
Fetch the drive number from 52A2H, the operand of the LD C at 52A1H, into Register A.
5290
LD C,A 4F
Copy Register A (the drive) into Register C, for 52E3H.
5291
GOSUB to 52E3H to write the granule allocation table at 4200H back to drive Register C and verify it: the Z FLAG is set on success, else Register A = 15H.
5294
If the Z FLAG is set (written), JUMP to 521CH to end the command with Register Pair HL = 0000H.
5296
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. 52B2H and 52CEH come here too.
5298
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
529B
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
529E
JUMP to 521FH to put the stack back and end the command.

52A1H - Check the Drive and Read Its Granule Allocation Table

Register C gets the drive from the operand at 52A2H. @CKDRV (44B8H) checks that the drive is there and ready and sets the CARRY FLAG when its diskette is write protected; that is kept at 5268H for 5267H. A drive that is not ready gives error 20H, a table that cannot be read error 14H; either is reported at 5296H, which ends the command, so a return from here means success.

52A1
LD C,00H 0E 00
Load Register C with the drive number, the operand at 52A2H: 00H in the file, the digit of a :d stored by 52C6H.
52A3
GOSUB to 44B8H (@CKDRV) to check drive Register C: the Z FLAG is set when it is ready, the CARRY FLAG when its diskette is write protected.
52A6
PUSH AF F5
Save Register Pair AF (the flags of @CKDRV) to the stack.
52A7
SBC A,A 9F
Subtract Register A from itself with the CARRY FLAG (SBC A,A): Register A = FFH when the diskette is write protected, else 00H.
52A8
LD (5268H),A 32 68 52
Store Register A (the write protect flag) at 5268H, the operand of the LD A at 5267H.
52AB
POP AF F1
Restore Register Pair AF (the flags of @CKDRV) from the stack.
52AC
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number), the error when the drive is not ready. LD does not change the flags.
52AE
If the Z FLAG is set (the drive is ready), GOSUB to 52D0H to read its granule allocation table into 4200H: the Z FLAG on success, else Register A = 14H.
52B1
RET Z C8
RETurn if the Z FLAG is set (ready and read).
52B2
JUMP to 5296H to report the error in Register A (20H or 14H) and end the command.

52B4H - Take an Optional Drive Specification

When the text at Register Pair HL starts with a colon, the character after it is the drive number: it is stored at 52A2H (the operand of LD C at 52A1H), and the spaces after it are passed over. A digit that is not 0-7 gives error 20H. Without a colon nothing is taken, so the drive stays 0.

52B4
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52B5
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH or 03H, the end of the text.
52B7
RET C D8
RETurn if the CARRY FLAG is set (nothing after the command word).
52B8
CP 3AH FE 3A
Compare Register A (the first character) against 3AH, the colon of a drive specification.
52BA
RET NZ C0
RETurn if the NZ FLAG is set (no drive specification), with Register Pair HL at the character.
52BB
INC HL 23
INCrement Register Pair HL past the colon, to the drive's digit.
52BC
LD B,(HL) 46
Fetch the drive character after the colon at Register Pair HL into Register B.
52BD
INC HL 23
INCrement Register Pair HL to the next character.
52BE
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52BF
CP 20H FE 20
Compare Register A against 20H, a space after the drive's digit.
52C1
If the Z FLAG is set (a space), LOOP BACK to 52BDH to pass over it: Register Pair HL ends at the first character after the spaces.
52C3
LD A,B 78
Copy Register B (the drive character) into Register A.
52C4
SUB 30H D6 30
SUBtract 30H from Register A: the digit's value, or a value of 08H or more (a borrow wraps a character below 30H to a high value) when it is not 0-7.
52C6
LD (52A2H),A 32 A2 52
Store Register A (the drive number) at 52A2H, the operand of the LD C at 52A1H.
52C9
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for drives 0-7.
52CB
RET C D8
RETurn if the CARRY FLAG is set (a good drive number).
52CC
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number).
52CE
JUMP to 5296H to report the error in Register A and end the command.

52D0H - Read and Write the Granule Allocation Table

52D0H reads sector 0 of the directory cylinder of drive Register C (the granule allocation table) into 4200H; 52E3H writes it back from 4200H with the deleted data mark that every directory sector carries and verifies it. Both return the Z FLAG on success; on failure 52D0H returns Register A = 14H (GAT read error) and 52E3H Register A = 15H (GAT write error), with the NZ FLAG. Register Pairs DE and HL are kept.

52D0
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
52D1
PUSH HL E5
Save Register Pair HL (the place in the text) to the stack, for the caller.
52D2
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C, byte +09H of its drive code table.
52D5
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder: the granule allocation table.
52D7
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, to receive the sector.
52DA
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL: the Z FLAG on success.
52DD
POP HL E1
Restore Register Pair HL (the place in the text) from the stack.
52DE
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
52DF
RET Z C8
RETurn if the Z FLAG is set (the table was read).
52E0
LD A,14H 3E 14
Load Register A with 14H, error 20 (GAT read error).
52E2
RET C9
RETurn with the NZ FLAG of RDSSEC and the error number in Register A.
52E3
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
52E4
PUSH HL E5
Save Register Pair HL to the stack, for the caller.
52E5
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
52E8
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the buffer that holds the granule allocation table.
52EB
LD E,L 5D
Copy Register L (00H) into Register E: sector 0, the granule allocation table.
52EC
GOSUB to 4768H (WRPROT) to write the buffer at Register Pair HL to cylinder Register D, sector Register E of drive Register C with the deleted data mark: the Z FLAG on success.
52EF
If the NZ FLAG is set (the write failed), JUMP to 52F6H with the NZ FLAG.
52F1
GOSUB to 4772H (VERSEC) to read the sector back without storing it: a sector with the deleted data mark returns Register A = 06H.
52F4
CP 06H FE 06
Compare Register A against 06H: the Z FLAG is set when the sector read back as a directory sector, so the write is good.
52F6
LD A,15H 3E 15
Load Register A with 15H, error 21 (GAT write error), for the NZ case. LD does not change the flags.
52F8
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
52F9
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
52FA
RET C9
RETurn: the Z FLAG when the table was written and verified, else the NZ FLAG with Register A = 15H.

52FBH - AUTO Data: Messages

The three messages, each ended by 0DH. The LD IX instructions at 5280H and 5284H hold the addresses of the first and the last.

52FB-531E
DEFM "Destination disk is write protected!" 44 65 73 74 69 6E 61 74 69 6F 6E 20 64 69 73 6B 20 69 73 20 77 72 69 74 65 20 70 72 6F 74 65 63 74 65 64 21
The message of 526AH (through 5281H): the drive's diskette is write protected, so a new AUTO command cannot be stored.
531F
DEFB 0DH 0D
0DH, the end of the message Destination disk is write protected!, displayed with it.
5320-5335
DEFM "Command line too long!" 43 6F 6D 6D 61 6E 64 20 6C 69 6E 65 20 74 6F 6F 20 6C 6F 6E 67 21
The message of 527DH: the new command did not end within the 32 bytes of the AUTO field.
5336
DEFB 0DH 0D
0DH, the end of the message Command line too long!, displayed with it.
5337-5350
DEFM "No AUTO command installed!" 4E 6F 20 41 55 54 4F 20 63 6F 6D 6D 61 6E 64 20 69 6E 73 74 61 6C 6C 65 64 21
The message of 524DH (through 5285H): AUTO = found an empty AUTO field.
5351
DEFB 0DH 0D
0DH, the end of the message No AUTO command installed!, displayed with it.

5200H - Member 2 (DATE and TIME): Entries and Name Tables

The DATE command (library member 15H, entry 5203H) and the TIME command (member 16H, entry 5200H), loaded at 5200H-548DH. The supervisor dispatcher calls the entry with Register Pair HL at the text after the command word. DATE shows the system date as, for example, Tue, Jan 1, 1980, or sets it from MM/DD/YY; TIME shows the time as HH:MM:SS, sets it from HH:MM or HH:MM:SS, and with (CLOCK) or (CLOCK=N) starts or stops the clock display at the top right of the screen. The date is kept in DATE$ (4044H-4048H), SVDAT1$ and SVDAT2$ (4306H, 4307H) and the year offset at 4466H; the time in TIME$ (4041H-4043H).

5200
TIME enters here (member byte 16H): JUMP to 52CEH.
5203
DATE enters here (member byte 15H): JUMP to 524CH.
5206-521A
DEFM "SunMonTueWedThuFriSat" 53 75 6E 4D 6F 6E 54 75 65 57 65 64 54 68 75 46 72 69 53 61 74
The names of the days, three letters each, Sunday first: 5392H picks entry Register B (the day of the week, 1 for Sunday) through 53EBH.
521B-523E
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 names of the months, three letters each: 53A2H picks entry Register B (the month, 1-12) through 53EBH.
523F
DEFB 00H 00
00H, the days before January: the first byte the day of the year sum (5352H) adds, so that month M adds the days of the months before it.
5240
DEFB 1FH 1F
1FH, 31 days in January. 5279H-5280H check the day against this table; 5352H-535CH add it for the months after January.
5241
DEFB 1CH 1C
1CH, 28 days in February. 5270H and 534BH add one in a leap year (a year offset from 1980 that is a multiple of 4), so the byte reads 29.
5242
DEFB 1FH 1F
1FH, 31 days in March, for the day check and the day of the year sum.
5243
DEFB 1EH 1E
1EH, 30 days in April, for the day check and the day of the year sum.
5244
DEFB 1FH 1F
1FH, 31 days in May, for the day check and the day of the year sum.
5245
DEFB 1EH 1E
1EH, 30 days in June, for the day check and the day of the year sum.
5246
DEFB 1FH 1F
1FH, 31 days in July, for the day check and the day of the year sum.
5247
DEFB 1FH 1F
1FH, 31 days in August, for the day check and the day of the year sum.
5248
DEFB 1EH 1E
1EH, 30 days in September, for the day check and the day of the year sum.
5249
DEFB 1FH 1F
1FH, 31 days in October, for the day check and the day of the year sum.
524A
DEFB 1EH 1E
1EH, 30 days in November, for the day check and the day of the year sum.
524B
DEFB 1FH 1F
1FH, 31 days in December, for the day check (the sum never needs it).

524CH - DATE: Set the Date from MM/DD/YY

Without text DATE goes straight to 528DH to show the date. With text the three fields are read by 53FAH into 52CDH (the month), 52CCH (the day) and 52CBH (the year); the year must be 80-99 (1980-1999) or 00-11 (2000-2011), the month 1-12 and the day within the month (29 days in February of a leap year). The three bytes are then copied into DATE$ at 4044H-4046H (year, day, month).

524C
LD A,(HL) 7E
Fetch the first character of the text at Register Pair HL into Register A.
524D
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG is set for 0DH or 03H, no date given.
524F
LD DE,4044H 11 44 40
Point Register Pair DE to 4044H, DATE$, the year of the system date. LD does not change the flags.
5252
If the CARRY FLAG is set (no date given), JUMP to 528DH to show the date in DATE$ at Register Pair DE.
5255
LD C,30H 0E 30
Load Register C with 30H: any character below 0 (30H) separates two fields of the date.
5257
GOSUB to 53FAH to read three fields of two digits from the text at Register Pair HL: the first into 52CDH, the second into 52CCH, the third into 52CBH. The NZ FLAG means a bad field; Register Pair DE comes back as 52CBH.
525A
If the NZ FLAG is set (bad format), JUMP to 52B9H, inside the LD IX at 52B8H, where the bytes read LD HL,5483H: Bad format.
525C
LD A,(DE) 1A
Fetch the year (the third field) from Register Pair DE (52CBH) into Register A.
525D
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for 12 and above, a year of the 1900s.
525F
If the NO CARRY FLAG is set (a year 12-99), JUMP to 5263H with Register A unchanged.
5261
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111, the years 2000-2011.
5263
SUB 50H D6 50
SUBtract 50H (80) from Register A: Register A = the year less 1980, 0-31 for a good year; a year 12-79 leaves a value of 20H or more (a borrow makes it large).
5265
CP 20H FE 20
Compare Register A (the year less 1980) against 20H: the NO CARRY FLAG is set for a year outside 1980-2011.
5267
If the NO CARRY FLAG is set (a year out of range), JUMP to 52B9H for Bad format.
5269
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the Z FLAG is set for a leap year (the year less 1980 a multiple of 4).
526B
LD HL,5241H 21 41 52
Point Register Pair HL to 5241H, the days of February. LD does not change the flags.
526E
If the NZ FLAG is set (not a leap year), JUMP to 5271H.
5270
INC (HL) 34
INCrement the days of February at Register Pair HL (5241H) from 1CH to 1DH, 29 days.
5271
LD A,(52CDH) 3A CD 52
Fetch the month (the first field) from 52CDH into Register A.
5274
DEC A 3D
DECrement Register A: the month less one, 0-11 for a good month (month 0 wraps to FFH).
5275
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for a month that is not 1-12.
5277
If the NO CARRY FLAG is set (a bad month), JUMP to 52B9H for Bad format.
5279
DEC HL 2B
DECrement Register Pair HL to 5240H, the days of January, the first entry of the table.
527A
ADD A,L 85
ADD Register L (40H) to Register A (the month less one): the low byte of the month's entry.
527B
LD L,A 6F
Copy Register A into Register L: Register Pair HL points at the month's number of days (5240H-524BH).
527C
LD A,(52CCH) 3A CC 52
Fetch the day (the second field) from 52CCH into Register A.
527F
DEC A 3D
DECrement Register A: the day less one (day 0 wraps to FFH).
5280
CP (HL) BE
Compare Register A against the month's days at Register Pair HL: the CARRY FLAG is set when the day is 1 to the number of days.
5281
If the NO CARRY FLAG is set (a day the month does not have), JUMP to 52B9H for Bad format.
5283
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 52CBH, the year, the first of the three fields in memory.
5284
LD DE,4044H 11 44 40
Point Register Pair DE to 4044H, DATE$: the year, then the day at 4045H and the month at 4046H.
5287
PUSH DE D5
Save Register Pair DE (4044H) to the stack, for the POP at 528CH.
5288
LD C,03H 0E 03
Load Register C with 03H: with Register B 00H from 53FAH, Register Pair BC = 0003H, three bytes.
528A
LDIR ED B0
Copy the date: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the year 52CBH to 4044H, the day 52CCH to 4045H, the month 52CDH to 4046H.
528C
POP DE D1
Restore Register Pair DE from the stack: 4044H, the year in DATE$.

528DH - DATE: Note the Date for the Reset, Then Show It

Reached with Register Pair DE = 4044H both after a new date and when DATE has no text. The year less 1980 goes to 4466H, bit 7 of 4048H is set for a leap year (it is not cleared otherwise), the day to SVDAT2$ (4307H) and the month OR 50H to SVDAT1$ (4306H), which SYS0/SYS's reset uses to keep the date over a reset. A month of 0 means no date was ever set: Date not in system.

528D
LD A,(DE) 1A
Fetch the year from Register Pair DE (4044H) into Register A.
528E
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for 12 and above, a year of the 1900s.
5290
If the NO CARRY FLAG is set (a year 12-99), JUMP to 5294H with Register A unchanged.
5292
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111.
5294
SUB 50H D6 50
SUBtract 50H (80) from Register A: Register A = the year less 1980.
5296
LD (4466H),A 32 66 44
Store Register A (the year less 1980) at 4466H, the year offset SYS0/SYS's reset works the leap year and the day of the week from.
5299
LD HL,4048H 21 48 40
Point Register Pair HL to 4048H: bit 7 a leap year, bits 3-1 the day of the week, bit 0 bit 8 of the day of the year.
529C
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the Z FLAG is set for a leap year.
529E
If the NZ FLAG is set (not a leap year), JUMP to 52A2H.
52A0
SET 7,(HL) CB FE
Set bit 7 of 4048H at Register Pair HL: the year is a leap year.
52A2
INC DE 13
INCrement Register Pair DE to 4045H, the day of the month.
52A3
LD A,(DE) 1A
Fetch the day from Register Pair DE (4045H) into Register A.
52A4
LD (4307H),A 32 07 43
Store Register A (the day) at 4307H, SVDAT2$, the day of the date kept over a reset.
52A7
INC DE 13
INCrement Register Pair DE to 4046H, the month.
52A8
LD A,(DE) 1A
Fetch the month from Register Pair DE (4046H) into Register A.
52A9
OR 50H F6 50
OR 50H into Register A: the month OR 50H, the mark of a date set.
52AB
LD (4306H),A 32 06 43
Store Register A at 4306H, SVDAT1$: SYS0/SYS's reset takes 51H-5CH as a month to keep (and 50H, a month of 0, as no prompts).
52AE
LD A,(4046H) 3A 46 40
Fetch the month of the system date from 4046H into Register A.
52B1
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for month 0, no date in the system.
52B2
If the NZ FLAG is set (a date), JUMP to 533BH to work out the day of the week and show the date.
52B5
LD HL,5470H 21 70 54
Point Register Pair HL to 5470H, the message Date not in system.
52B8
LD IX,5483H DD 21 83 54
Load Index Register IX with 5483H: no use when run from above. Entered at 52B9H (from 525AH and the checks of the date and the time) the bytes 21H 83H 54H are LD HL,5483H, the message Bad format.
52BC
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
52BF
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. 52EAH comes here after a parameter error.
52C2
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52C5
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52C7
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
52C8
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.
52CB
DEFB 00H 00
The third field read by 53FAH: the year of a date, the seconds of a time (52FCH stores 00H first, for a time typed without seconds).
52CC
DEFB 00H 00
The second field read by 53FAH: the day of a date, the minutes of a time.
52CD
DEFB 00H 00
The first field read by 53FAH: the month of a date, the hours of a time.

52CEH - TIME: Parameters, Set the Time

The text is searched for an opening bracket: when there is one, @PARAM (4476H) reads (CLOCK) or (CLOCK=N) into the operand at 5321H. Then the text is looked at from its start again: nothing shows the time (53E2H); a bracket alone goes to the clock (5320H); otherwise HH:MM or HH:MM:SS is read (hours 0-23, minutes and seconds 0-59) and stored in TIME$ (4041H-4043H: seconds, minutes, hours).

52CE
PUSH HL E5
Save Register Pair HL (the start of the text after TIME) to the stack, for the POP at 52EDH.
52CF
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
52D0
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
52D2
If the Z FLAG is set (a bracket), JUMP to 52DBH to read the parameters.
52D4
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the text.
52D6
If the Z FLAG is set (the end, no parameters), JUMP to 52EDH.
52D8
INC HL 23
INCrement Register Pair HL to the next character of the text.
52D9
LOOP BACK to 52CFH to look at the character at Register Pair HL.
52DB
LD DE,5455H 11 55 54
Point Register Pair DE to 5455H, the parameter table of TIME (CLOCK).
52DE
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE: CLOCK stores its value at 5321H. The Z FLAG on success.
52E1
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error). LD does not change the flags.
52E3
If the Z FLAG is set (the parameters were read), JUMP to 52EDH.
52E5
OR C0H F6 C0
OR C0H into Register A (2CH): bit 7 asks @ERROR to return and bit 6 for the short form of the message.
52E7
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
52EA
JUMP to 52BFH to end the command with Register Pair HL = FFFFH.
52ED
POP HL E1
Restore Register Pair HL from the stack: the start of the text after TIME.
52EE
LD A,(HL) 7E
Fetch the first character of the text at Register Pair HL into Register A.
52EF
CP 0DH FE 0D
Compare Register A against 0DH, ENTER: TIME with no text after it.
52F1
If the Z FLAG is set (TIME alone), JUMP to 53E2H to show the time.
52F4
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
52F6
If the Z FLAG is set (only parameters, no time), JUMP to 5320H to start or stop the clock display.
52F8
XOR A AF
Clear Register A (XOR A) for the two stores below.
52F9
LD (5417H),A 32 17 54
Store Register A (00H) at 5417H, the operand of the LD A at 5416H: in 53FAH ENTER after the second field is now accepted.
52FC
LD (52CBH),A 32 CB 52
Store Register A (00H) at 52CBH, the seconds: a time typed as HH:MM has 0 seconds.
52FF
LD C,30H 0E 30
Load Register C with 30H: any character below 0 (30H) separates two fields; 53FAH also takes the colon (3AH).
5301
GOSUB to 53FAH to read the fields from the text at Register Pair HL: the hours into 52CDH, the minutes into 52CCH, the seconds into 52CBH. The NZ FLAG means a bad field.
5304
If the NZ FLAG is set (bad format), JUMP to 52B9H for Bad format.
5306
LD HL,52CDH 21 CD 52
Point Register Pair HL to 52CDH, the hours, the first field read.
5309
LD A,17H 3E 17
Load Register A with 17H, 23, the highest hour.
530B
CP (HL) BE
Compare Register A (23) against the hours at Register Pair HL: the CARRY FLAG is set for an hour above 23.
530C
If the CARRY FLAG is set, JUMP to 52B9H for Bad format.
530E
DEC HL 2B
DECrement Register Pair HL to 52CCH, the minutes.
530F
LD A,3BH 3E 3B
Load Register A with 3BH, 59, the highest minute and second.
5311
CP (HL) BE
Compare Register A (59) against the minutes at Register Pair HL: the CARRY FLAG is set for a minute above 59.
5312
If the CARRY FLAG is set, JUMP to 52B9H for Bad format.
5314
DEC HL 2B
DECrement Register Pair HL to 52CBH, the seconds.
5315
CP (HL) BE
Compare Register A (59) against the seconds at Register Pair HL: the CARRY FLAG is set for a second above 59.
5316
If the CARRY FLAG is set, JUMP to 52B9H for Bad format.
5318
LD DE,4041H 11 41 40
Point Register Pair DE to 4041H, TIME$: the seconds, then the minutes at 4042H and the hours at 4043H.
531B
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, three bytes.
531E
LDIR ED B0
Copy the time: (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the seconds 52CBH to 4041H, the minutes 52CCH to 4042H, the hours 52CDH to 4043H.

5320H - TIME (CLOCK): Start or Stop the Clock Display

The CLOCK parameter is the operand at 5321H: 0001H when it was not given, FFFFH for CLOCK, 0000H for CLOCK=N. CLOCK puts SYS0/SYS's clock display task block (4D3AH) into task slot 6 through @ADTSK, so the time is written at the top right of the screen five times a second; CLOCK=N takes slot 6 out again through @RMTSK.

5320
LD HL,0001H 21 01 00
Load Register Pair HL with the CLOCK parameter, the operand at 5321H-5322H: 0001H in the file (not given), FFFFH for CLOCK, 0000H for CLOCK=N.
5323
LD A,L 7D
Copy Register L (the low byte of the parameter) into Register A.
5324
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
5325
OR H B4
OR Register H into Register A: the Z FLAG is set only for 0001H, CLOCK not given.
5326
If the Z FLAG is set (no CLOCK parameter), JUMP to 5337H to end the command.
5328
LD A,H 7C
Copy Register H (the high byte of the parameter) into Register A.
5329
OR L B5
OR Register L into Register A: the Z FLAG is set for 0000H (CLOCK=N), the NZ FLAG for FFFFH (CLOCK).
532A
LD A,06H 3E 06
Load Register A with 06H, task slot 6. LD does not change the flags.
532C
LD DE,4D3AH 11 3A 4D
Point Register Pair DE to 4D3AH, SYS0/SYS's task block of the clock display.
532F
PUSH AF F5
Save Register Pair AF (slot 6 and the flags of the test) to the stack.
5330
If the NZ FLAG is set (CLOCK), GOSUB to 4410H (@ADTSK) to put the task block at Register Pair DE into slot Register A (6).
5333
POP AF F1
Restore Register Pair AF (slot 6 and the flags of the test) from the stack.
5334
If the Z FLAG is set (CLOCK=N), GOSUB to 4413H (@RMTSK) to empty task slot Register A (6).
5337
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out. 53DFH comes here after a date or time was shown.
533A
RET C9
RETurn with Register Pair HL = 0000H, through the supervisor dispatcher to the program that ran the command.

533BH - DATE: The Day of the Year, the Day of the Week and the Display

Register A = the month (1-12) from 4046H. The day of the year is the day plus the days of the months before (523FH on, February 29 days in a leap year); it goes to 4047H and bit 0 of 4048H. The day of the week is (day of the year + y + (y + 3) / 4 + 1) mod 7 + 1, y the year less 1980 (1 for Sunday, 1 January 1980 a Tuesday); it goes to bits 3-1 of 4048H. Then the template at 545EH gets the day name, the month name, the day and the year, and the line is displayed.

533B
LD B,A 47
Copy Register A (the month, 1-12) into Register B, the count of the day of the year loop.
533C
LD HL,5241H 21 41 52
Point Register Pair HL to 5241H, the days of February.
533F
LD A,(HL) 7E
Fetch the days of February from Register Pair HL into Register A.
5340
SUB 1DH D6 1D
SUBtract 1DH from Register A: the Z FLAG is set when 5270H has already made it 29.
5342
If the Z FLAG is set (already 29), JUMP to 534CH.
5344
LD A,(4044H) 3A 44 40
Fetch the year from 4044H into Register A (80-99 or 0-11).
5347
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the Z FLAG is set for a leap year (both 80 and 100 are multiples of 4).
5349
If the NZ FLAG is set (not a leap year), JUMP to 534CH.
534B
INC (HL) 34
INCrement the days of February at Register Pair HL (5241H) to 29.
534C
LD A,(4045H) 3A 45 40
Fetch the day of the month from 4045H into Register A.
534F
LD L,A 6F
Copy Register A (the day of the month) into Register L.
5350
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the day, the start of the day of the year.
5352
LD DE,523FH 11 3F 52
Point Register Pair DE to 523FH, the 00H before the days of January.
5355
LD A,(DE) 1A
Fetch the days of the month at Register Pair DE into Register A.
5356
ADD A,L 85
ADD Register L to Register A: the low byte of the sum.
5357
LD L,A 6F
Copy Register A (the low byte of the sum) into Register L.
5358
ADC A,H 8C
ADD Register H and the CARRY FLAG to Register A (ADC A,H): the low byte plus the high byte plus the carry.
5359
SUB L 95
SUBtract Register L from Register A: Register A = Register H plus the carry, the high byte of the sum.
535A
LD H,A 67
Copy Register A into Register H: Register Pair HL = the sum so far.
535B
INC DE 13
INCrement Register Pair DE to the next month's days.
535C
DECrement Register B (the months left) and LOOP BACK to 5355H until it is 0: Register Pair HL = the day plus the days of the months before the month.
535E
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the day of the year (1-366).
535F
LD HL,4047H 21 47 40
Point Register Pair HL to 4047H, the low 8 bits of the day of the year.
5362
LD (HL),E 73
Store Register E (the low byte of the day of the year) at Register Pair HL, 4047H.
5363
INC HL 23
INCrement Register Pair HL to 4048H, the byte of the flags.
5364
LD A,D 7A
Copy Register D (bit 8 of the day of the year, 0 or 1) into Register A.
5365
OR (HL) B6
OR the byte at Register Pair HL (4048H) into Register A: bit 0 becomes bit 8 of the day of the year (a bit 0 already set is not cleared).
5366
LD (HL),A 77
Store Register A at Register Pair HL, 4048H, with bit 0 set for days 256-366.
5367
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the day of the year again.
5368
LD A,(4044H) 3A 44 40
Fetch the year of the system date from 4044H into Register A.
536B
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for a year of the 1900s.
536D
If the NO CARRY FLAG is set (a year 12-99), JUMP to 5371H with Register A unchanged.
536F
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111.
5371
SUB 50H D6 50
SUBtract 50H (80) from Register A: Register A = y, the year less 1980.
5373
LD E,A 5F
Copy Register A (y, the year less 1980) into Register E.
5374
ADD A,03H C6 03
ADD 03H to Register A: y + 3, for the leap days before this year.
5376
RRCA 0F
Rotate Register A right (RRCA): half of y + 3, its bit 0 going to bit 7.
5377
RRCA 0F
Rotate Register A right again (RRCA): a quarter, the two low bits now in bits 7-6.
5378
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): Register A = (y + 3) / 4, the leap days since 1980 before this year.
537A
ADD A,E 83
ADD Register E (y) to Register A: y + (y + 3) / 4.
537B
LD E,A 5F
Copy Register A (y + (y + 3) / 4) into Register E.
537C
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = y + (y + 3) / 4.
537E
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the day of the year + y + (y + 3) / 4.
537F
INC HL 23
INCrement Register Pair HL: + 1, so that 1 January 1980 gives a Tuesday.
5380
LD A,07H 3E 07
Load Register A with 07H, the days of a week, the divisor.
5382
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A: the quotient in Register Pair HL, the remainder (0-6) in Register A.
5385
INC A 3C
INCrement Register A: the day of the week, 1 for Sunday to 7 for Saturday.
5386
LD B,A 47
Copy Register A (the day of the week) into Register B, for the day name at 5399H.
5387
RLCA 07
Rotate Register A left (RLCA): the day of the week moved to bits 3-1.
5388
LD C,A 4F
Copy Register A (the day of the week in bits 3-1) into Register C.
5389
LD A,(4048H) 3A 48 40
Fetch the byte of the flags at 4048H into Register A.
538C
AND F1H E6 F1
Clear bits 3-1 of Register A (AND F1H): the old day of the week.
538E
OR C B1
OR Register C (the new day of the week in bits 3-1) into Register A.
538F
LD (4048H),A 32 48 40
Store Register A (the flags with the new day of the week) at 4048H.
5392
LD HL,5206H 21 06 52
Point Register Pair HL to 5206H, the names of the days.
5395
LD DE,545EH 11 5E 54
Point Register Pair DE to 545EH, the start of the date line template (Day, Mon xx, 19xx).
5398
PUSH DE D5
Save Register Pair DE (545EH) to the stack, for the display at 53DBH.
5399
GOSUB to 53EBH to copy the name number Register B (the day of the week) from the table at Register Pair HL to Register Pair DE: 545EH-5460H. Register Pair DE comes back at 5461H.
539C
INC DE 13
INCrement Register Pair DE past the comma after the day name.
539D
INC DE 13
INCrement Register Pair DE past the space, to 5463H.
539E
LD A,(4046H) 3A 46 40
Fetch the month of the system date from 4046H into Register A.
53A1
LD B,A 47
Copy Register A (the month) into Register B, the name number.
53A2
LD HL,521BH 21 1B 52
Point Register Pair HL to 521BH, the names of the months.
53A5
GOSUB to 53EBH to copy the name number Register B (the month) from the table at Register Pair HL to Register Pair DE: 5463H-5465H.
53A8
INC DE 13
INCrement Register Pair DE past the space, to 5467H.
53A9
LD A,(4045H) 3A 45 40
Fetch the day of the month from 4045H into Register A.
53AC
LD B,FFH 06 FF
Load Register B with FFH, so that the first INC makes it 0: Register B counts the tens.
53AE
INC B 04
INCrement Register B, the count of the tens of the day.
53AF
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A, the day or what is left of it.
53B1
If the NO CARRY FLAG is set (10 or more were left), LOOP BACK to 53AEH: Register B = the tens, Register A = the units less 10.
53B3
PUSH AF F5
Save Register Pair AF (the units less 10) to the stack.
53B4
LD A,B 78
Copy Register B (the tens of the day) into Register A.
53B5
ADD A,30H C6 30
ADD 30H to Register A: the character of the tens digit.
53B7
CP 30H FE 30
Compare Register A against 30H, the digit 0: a day below 10.
53B9
If the NZ FLAG is set (the tens are not 0), JUMP to 53BDH.
53BB
LD A,20H 3E 20
Load Register A with 20H, a space in place of a leading 0.
53BD
LD (DE),A 12
Store Register A (the tens digit or a space) at Register Pair DE (5467H).
53BE
INC DE 13
INCrement Register Pair DE to 5468H, the place of the units.
53BF
POP AF F1
Restore Register Pair AF (the units less 10) from the stack.
53C0
ADD A,3AH C6 3A
ADD 3AH to Register A: the units less 10 plus 10 plus 30H, the character of the units digit.
53C2
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE (5468H).
53C3
INC DE 13
INCrement Register Pair DE to 5469H, the comma after the day.
53C4
LD A,(4044H) 3A 44 40
Fetch the year of the system date from 4044H into Register A.
53C7
LD HL,076CH 21 6C 07
Load Register Pair HL with 076CH, 1900. LD does not change the flags.
53CA
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG is set for a year of the 1900s.
53CC
If the NO CARRY FLAG is set (a year 12-99), JUMP to 53D0H with Register A unchanged.
53CE
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111.
53D0
ADD A,L 85
ADD Register L (6CH) to Register A: the low byte of 1900 plus the year.
53D1
LD L,A 6F
Copy Register A (the low byte of the year) into Register L.
53D2
ADC A,H 8C
ADD Register H and the CARRY FLAG to Register A (ADC A,H): the low byte plus the high byte plus the carry.
53D3
SUB L 95
SUBtract Register L from Register A: Register A = Register H plus the carry.
53D4
LD H,A 67
Copy Register A into Register H: Register Pair HL = the year in full, 1980-2011.
53D5
LD DE,546AH 11 6A 54
Point Register Pair DE to 546AH, the space before 19xx in the template.
53D8
GOSUB to 543CH to write Register Pair HL (the year) in decimal, right justified, in the five places 546AH-546EH.
53DB
POP HL E1
Restore Register Pair HL from the stack: 545EH, the date line (or 5467H, the time, from 53E9H).
53DC
GOSUB to 447BH (@LOGOT) to display the line at Register Pair HL, ended by the 0DH at 546FH, and send it to the job log.
53DF
JUMP to 5337H to end the command with Register Pair HL = 0000H.

53E2H - TIME: Show the Time

@TIME writes the time as HH:MM:SS in the eight bytes 5467H-546EH of the template, which the 0DH at 546FH ends; 53DBH then displays it.

53E2
LD HL,5467H 21 67 54
Point Register Pair HL to 5467H, the place of the time in the template.
53E5
PUSH HL E5
Save Register Pair HL (5467H) to the stack, for the display at 53DBH.
53E6
GOSUB to 446DH (@TIME) to write the time from TIME$ (4041H-4043H) as HH:MM:SS at Register Pair HL (5467H-546EH).
53E9
JUMP to 53DBH to display the time at 5467H and end the command.

53EBH - Copy Name Number B from a Table of Three Letter Names

Register Pair HL = the table, Register B = the name number (1 for the first), Register Pair DE = the destination. The three letters of the name at HL + 3 x (B - 1) are copied to DE, which comes back after them. The tables do not cross a page, so only Register L is added to.

53EB
DEC B 05
DECrement Register B: the name number less one.
53EC
LD A,L 7D
Copy Register L (the low byte of the table) into Register A.
53ED
ADD A,B 80
ADD Register B (the name number less one) to Register A.
53EE
ADD A,B 80
ADD Register B (the name number less one) to Register A again.
53EF
ADD A,B 80
ADD Register B to Register A a third time: the low byte of the table plus 3 x (B - 1).
53F0
LD L,A 6F
Copy Register A into Register L: Register Pair HL points at the name.
53F1
LD B,03H 06 03
Load Register B with 03H, the three letters of a name.
53F3
LD A,(HL) 7E
Fetch the letter at Register Pair HL into Register A.
53F4
INC HL 23
INCrement Register Pair HL to the next letter.
53F5
LD (DE),A 12
Store Register A (the letter) at Register Pair DE.
53F6
INC DE 13
INCrement Register Pair DE to the next place.
53F7
DECrement Register B and LOOP BACK to 53F3H until the three letters are copied.
53F9
RET C9
RETurn with Register Pair DE at the byte after the copied name.

53FAH - Read Three Fields of Two Digits

Reads up to three fields from the text at Register Pair HL, each of exactly two digits, into 52CDH, 52CCH and 52CBH (the first typed at 52CDH). Between two fields one character is taken: a colon, or any character below the value of Register C (30H: a slash, a space, a dash or a period). ENTER after the second field is accepted only when the operand at 5417H is 00H (TIME, 52F9H); then the third field keeps its value. Returns the Z FLAG with Register B = 00H and Register Pair DE = 52CBH when the fields were read, else the NZ FLAG.

53FA
LD DE,52CDH 11 CD 52
Point Register Pair DE to 52CDH, where the first field goes.
53FD
LD B,03H 06 03
Load Register B with 03H, the fields to read.
53FF
PUSH DE D5
Save Register Pair DE (where this field goes) to the stack.
5400
GOSUB to 541FH to read two digits from Register Pair HL: Register A = their value with the Z FLAG, or the NZ FLAG for a character that is not a digit. Register E is changed, so Register Pair DE was saved.
5403
POP DE D1
Restore Register Pair DE (where this field goes) from the stack.
5404
RET NZ C0
RETurn if the NZ FLAG is set (the field is not two digits).
5405
LD (DE),A 12
Store Register A (the field's value) at Register Pair DE.
5406
DEC B 05
DECrement Register B, the count of the fields still to read.
5407
RET Z C8
RETurn if the Z FLAG is set (three fields read), with Register Pair DE = 52CBH.
5408
DEC DE 1B
DECrement Register Pair DE to the place of the next field.
5409
LD A,(HL) 7E
Fetch the character after the field at Register Pair HL into Register A.
540A
INC HL 23
INCrement Register Pair HL past the character after the field.
540B
CP 3AH FE 3A
Compare Register A against 3AH, a colon between two fields.
540D
If the Z FLAG is set (a colon), LOOP BACK to 53FFH to read the next field.
540F
CP C B9
Compare Register A against Register C (30H): the CARRY FLAG is set for a character below it.
5410
If the NO CARRY FLAG is set (not a separator), JUMP to 541DH to return the NZ FLAG.
5412
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the text.
5414
If the NZ FLAG is set (another separator), LOOP BACK to 53FFH to read the next field.
5416
LD A,FFH 3E FF
ENTER before all three fields: load Register A with the operand at 5417H, FFH in the file (DATE), 00H after 52F9H (TIME).
5418
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for FFH.
5419
RET NZ C0
RETurn if the NZ FLAG is set: ENTER is not accepted here (DATE needs three fields).
541A
LD A,B 78
Copy Register B (the fields not read: 2 after the first, 1 after the second) into Register A.
541B
DEC A 3D
DECrement Register A: the Z FLAG is set when only the third field is missing.
541C
RET Z C8
RETurn if the Z FLAG is set: HH:MM is accepted, the seconds keep the 00H of 52FCH.
541D
OR A B7
Set the flags from Register A (OR A): Register A is not 00H here, so the NZ FLAG is returned for a bad text.
541E
RET C9
RETurn with the NZ FLAG: the text is not a good date or time.

541FH - Read Two Decimal Digits

Reads two characters at Register Pair HL; both must be digits. Returns Register A = their value (0-99) with the Z FLAG, or the NZ FLAG when either is not a digit. Register Pair HL comes back after the characters read; Register E is changed.

541F
GOSUB to 5435H to take the character at Register Pair HL: Register A = its value less 30H, the CARRY FLAG set for a digit.
5422
If the NO CARRY FLAG is set (not a digit), JUMP to 5433H to return the NZ FLAG.
5424
LD E,A 5F
Copy Register A (the tens digit) into Register E.
5425
RLCA 07
Rotate Register A left (RLCA): twice the digit.
5426
RLCA 07
Rotate Register A left again (RLCA): four times the digit.
5427
ADD A,E 83
ADD Register E to Register A: five times the digit.
5428
RLCA 07
Rotate Register A left (RLCA): ten times the digit.
5429
LD E,A 5F
Copy Register A (ten times the tens digit) into Register E.
542A
GOSUB to 5435H to take the next character at Register Pair HL: Register A = its value less 30H, the CARRY FLAG for a digit.
542D
If the NO CARRY FLAG is set (not a digit), JUMP to 5433H to return the NZ FLAG.
542F
ADD A,E 83
ADD Register E (the tens) to Register A (the units): the value of the two digits.
5430
LD E,A 5F
Copy Register A (the value of the two digits) into Register E.
5431
CP A BF
Compare Register A with itself (CP A): the Z FLAG is set, a good field.
5432
RET C9
RETurn with the value in Register A and the Z FLAG.
5433
OR A B7
Set the flags from Register A (OR A): Register A holds a character that is not a digit less 30H, never 00H, so the NZ FLAG is set.
5434
RET C9
RETurn with the NZ FLAG: the character is not a digit.
5435
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5436
INC HL 23
INCrement Register Pair HL past the character just fetched.
5437
SUB 30H D6 30
SUBtract 30H from Register A: the value of a digit (a borrow wraps a character below 30H to a high value).
5439
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG is set for a digit (0-9).
543B
RET C9
RETurn with the value in Register A and the CARRY FLAG set for a digit.

543CH - Write a Number in Decimal, Right Justified

Register Pair HL = the number, Register Pair DE = the first of five places. The five places are filled with spaces, then the digits are written from the last place backwards until the number is 0. Register Pair DE comes back after the five places; Register Pair HL is 0000H.

543C
LD B,05H 06 05
Load Register B with 05H, the count of the five places to fill.
543E
LD A,20H 3E 20
Load Register A with 20H, a space, to clear the five places.
5440
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
5441
INC DE 13
INCrement Register Pair DE to the next place.
5442
DECrement Register B and LOOP BACK to 5440H until the five places are spaces.
5444
PUSH DE D5
Save Register Pair DE (the address after the five places) to the stack.
5445
DEC DE 1B
DECrement Register Pair DE to the last of the five places.
5446
LD A,0AH 3E 0A
Load Register A with 0AH (10), the divisor for the next digit.
5448
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A: the quotient in Register Pair HL, the remainder (the next digit from the right) in Register A.
544B
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit.
544D
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
544E
DEC DE 1B
DECrement Register Pair DE to the place on the left.
544F
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
5450
OR L B5
OR Register L into Register A: the Z FLAG is set when the quotient is 0.
5451
If the NZ FLAG is set (more digits), LOOP BACK to 5446H.
5453
POP DE D1
Restore Register Pair DE (the address after the five places) from the stack.
5454
RET C9
RETurn with Register Pair DE after the five places of the number.

5455H - DATE and TIME Data: Parameter Table, Template and Messages

The parameter table of TIME (one keyword), the line that DATE and TIME fill and display, and the two messages.

5455-545A
DEFM "CLOCK " 43 4C 4F 43 4B 20
The parameter table of TIME (52DBH), entry 1: the keyword CLOCK, six characters with a space.
545B-545C
DEFW 5321H 21 53
Entry 1: 5321H, where @PARAM stores the value of CLOCK: the operand of the LD HL at 5320H.
545D
DEFB 00H 00
00H, the end of the parameter table of TIME (one keyword only).
545E-5466
DEFM "Day, Mon " 44 61 79 2C 20 4D 6F 6E 20
The start of the date line: 5399H puts the day name over Day and 53A5H the month name over Mon.
5467-546E
DEFM "xx, 19xx" 78 78 2C 20 31 39 78 78
The day (5467H-5468H, from 53BDH and 53C2H) and the year (546BH-546EH, from 543CH, which writes spaces at 546AH-546EH first); for TIME, @TIME writes HH:MM:SS over all eight bytes.
546F
DEFB 0DH 0D
0DH, the end of the date or time line, displayed with it.
5470-5481
DEFM "Date not in system" 44 61 74 65 20 6E 6F 74 20 69 6E 20 73 79 73 74 65 6D
The message of 52B5H: DATE found month 0 in 4046H, no date was ever set.
5482
DEFB 0DH 0D
0DH, the end of the message Date not in system, displayed with it.
5483-548C
DEFM "Bad format" 42 61 64 20 66 6F 72 6D 61 74
The message of 52B9H: a date or a time that could not be read or is out of range.
548D
DEFB 0DH 0D
0DH, the end of the message Bad format, displayed with it.

5200H - Member 3 (CREATE): Entry and the Parameters

The CREATE command (library member 13H), loaded at 5200H-53D2H. It makes a file of a given size ahead of time: SIZE=K (kilobytes, four 256 byte sectors each) or REC=n (records, with LRL=l, 1-256, the record length). The file is opened or created with @INIT, its last record written so that all its space is allocated, and its directory record marked with bit 7 of +01H, which keeps @CLOSE from giving the space back. Without FILL the end of file is put back to what it was, so a new file stays empty; FILL=c writes every record full of the byte c. SHRINK clears the mark again. The file's control block is at 53E2H and its name for the message at 53D3H, above the member; the buffer is 5500H.

5200
LD (5325H),SP ED 73 25 53
Store the Stack Pointer at 5325H, the operand of the LD SP at 5324H: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the file control block of CREATE, just above the member (not in the file).
5207
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.
520A
If the NZ FLAG is set (no file specification), JUMP to 534CH to display File spec required!.
520D
LD A,(DE) 1A
Fetch the first byte of the specification at Register Pair DE (53E2H) into Register A.
520E
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device name.
5210
If the Z FLAG is set (a device, not a file), JUMP to 534CH to display File spec required!.
5213
LD DE,5358H 11 58 53
Point Register Pair DE to 5358H, the parameter table of CREATE (SIZE, S, REC, R, LRL, L, FILL, F, SHRINK).
5216
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value goes into the operand the table names. The NZ FLAG for a bad parameter.
5219
If the NZ FLAG is set (a bad parameter), JUMP to 523BH, which reports error 2CH while the NZ FLAG holds.
521B
LD IX,5256H DD 21 56 52
Point Index Register IX to 5256H, the LD BC whose operand is the LRL parameter.
521F
LD A,(IX+01H) DD 7E 01
Fetch the low byte of LRL from Index Register IX +01H (5257H) into Register A.
5222
OR (IX+02H) DD B6 02
OR the high byte of LRL from Index Register IX +02H (5258H) into Register A.
5225
LD IX,5240H DD 21 40 52
Point Index Register IX to 5240H, the LD BC whose operand is the REC parameter.
5229
OR (IX+01H) DD B6 01
OR the low byte of REC from Index Register IX +01H (5241H) into Register A.
522C
OR (IX+02H) DD B6 02
OR the high byte of REC from Index Register IX +02H (5242H) into Register A: the Z FLAG is set when neither LRL nor REC was given.
522F
If the Z FLAG is set (neither), JUMP to 5247H, where SIZE must be given.
5231
LD IX,5247H DD 21 47 52
Point Index Register IX to 5247H, the LD HL whose operand is the SIZE parameter.
5235
LD A,(IX+01H) DD 7E 01
Fetch the low byte of SIZE from Index Register IX +01H (5248H) into Register A.
5238
OR (IX+02H) DD B6 02
OR the high byte of SIZE from Index Register IX +02H (5249H) into Register A: the NZ FLAG when SIZE was given with REC or LRL.
523B
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error). LD does not change the flags.
523D
If the NZ FLAG is set (SIZE with REC or LRL, a bad parameter, or a bad LRL from 525EH and 5261H), JUMP to 52F7H to report error 2CH.
5240
LD BC,0000H 01 00 00
Load Register Pair BC with the REC parameter, the operand at 5241H-5242H: 0000H in the file, the number of records when REC (or R) was given, the records SIZE works out to after 5253H.
5243
LD A,B 78
Copy Register B (the high byte of REC) into Register A.
5244
OR C B1
OR Register C (the low byte) into Register A: the NZ FLAG when REC was given.
5245
If the NZ FLAG is set (REC given), JUMP to 5256H to check LRL.
5247
LD HL,0000H 21 00 00
Load Register Pair HL with the SIZE parameter, the operand at 5248H-5249H: 0000H in the file, the size in kilobytes when SIZE (or S) was given.
524A
LD A,H 7C
Copy Register H (the high byte of SIZE) into Register A.
524B
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG when SIZE was not given.
524C
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error). LD does not change the flags.
524E
If the Z FLAG is set (neither SIZE nor REC), JUMP to 52F7H to report error 2CH.
5251
ADD HL,HL 29
ADD Register Pair HL to itself: twice the kilobytes.
5252
ADD HL,HL 29
ADD Register Pair HL to itself again: four times the kilobytes, the number of 256 byte records.
5253
LD (5241H),HL 22 41 52
Store Register Pair HL (the records) at 5241H, the operand of the LD BC at 5240H, where 52A0H and 52E5H read the number of records.
5256
LD BC,0000H 01 00 00
Load Register Pair BC with the LRL parameter, the operand at 5257H-5258H: 0000H in the file (256 bytes), the record length when LRL (or L) was given.
5259
LD A,B 78
Copy Register B (the high byte of LRL) into Register A.
525A
OR A B7
Set the flags from Register A (OR A): the Z FLAG for an LRL of 0-255.
525B
If the Z FLAG is set (a record length of 0-255), JUMP to 5263H.
525D
DEC A 3D
DECrement Register A (the high byte): the Z FLAG only for a high byte of 01H.
525E
If the NZ FLAG is set (an LRL of 512 or more), JUMP to 523BH to report error 2CH.
5260
OR C B1
OR Register C (the low byte) into Register A (00H): the Z FLAG only for an LRL of exactly 256 (0100H).
5261
If the NZ FLAG is set (an LRL of 257-511), JUMP to 523BH to report error 2CH.
5263
OR C B1
OR Register C (the low byte of LRL) into Register A: Register A = the record length, 00H standing for 256.
5264
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the file control block.
5267
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the 256 byte buffer of the file.
526A
LD B,A 47
Copy Register A (the record length) into Register B, for @INIT.
526B
LD (5344H),A 32 44 53
Store Register A (the record length) at 5344H, the operand of the LD A at 5343H, which puts it into the directory record.
526E
GOSUB to 4420H (@INIT) to open the file whose control block is at Register Pair DE, or create it when it does not exist, with the buffer at Register Pair HL and record length Register B. The NZ FLAG and an error number in Register A on failure.
5271
If the NZ FLAG is set (the file could not be opened or created), JUMP to 52F7H to report the error in Register A.

5274H - Show the Name and Extend the File

The name is shown after Creating:. A file that already has as many records as asked for, or more, is refused with File exists larger! (it stays as it is). Otherwise the last record wanted is written with E5H bytes, which allocates the whole size, and the directory record gets bit 7 of +01H and the record length.

5274
LD DE,53D3H 11 D3 53
Point Register Pair DE to 53D3H, where @FNAME builds the file's name, just after the text Creating: at 53C9H-53D2H.
5277
LD BC,(53E8H) ED 4B E8 53
Load Register Pair BC from 53E8H-53E9H, bytes +06H and +07H of the control block: Register C = the drive, Register B = the file's directory record.
527B
GOSUB to 44BBH (@FNAME) to write the name of directory record Register B of drive Register C as NAME/EXT:d at Register Pair DE, ended by 03H.
527E
If the NZ FLAG is set (the directory could not be read), JUMP to 52F7H to report the error in Register A.
5281
LD HL,53C9H 21 C9 53
Point Register Pair HL to 53C9H, the text Creating: that runs on into the name at 53D3H.
5284
GOSUB to 4467H (@DSPLY) to display Creating: and the name, up to the 03H that ends the name.
5287
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line.
5289
GOSUB to the ROM at 0033H to display the character in Register A on the video.
528C
LD HL,(53EEH) 2A EE 53
Fetch the file's ending record number from 53EEH-53EFH, bytes +0CH and +0DH of the control block, into Register Pair HL.
528F
LD (5302H),HL 22 02 53
Store Register Pair HL (the ending record number before CREATE) at 5302H, the operand of the LD HL at 5301H, to put back when no FILL is given.
5292
LD A,(53EAH) 3A EA 53
Fetch the file's end of file byte from 53EAH, byte +08H of the control block, into Register A.
5295
LD (5308H),A 32 08 53
Store Register A (the end of file byte before CREATE) at 5308H, the operand of the LD A at 5307H.
5298
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the file control block.
529B
GOSUB to 445DH (@LOF) to get the number of records of the file at Register Pair DE into Register Pair BC.
529E
LD H,B 60
Copy Register B (the high byte of the file's records) into Register H.
529F
LD L,C 69
Copy Register C (the low byte) into Register L: Register Pair HL = the records the file has.
52A0
LD BC,(5241H) ED 4B 41 52
Load Register Pair BC from 5241H-5242H: the number of records wanted (REC, or SIZE x 4).
52A4
OR A B7
Clear the CARRY FLAG (OR A sets the flags from Register A and clears the carry) for the subtraction below.
52A5
PUSH HL E5
Save Register Pair HL (the records the file has) to the stack.
52A6
SBC HL,BC ED 42
SUBtract Register Pair BC (the records wanted) from Register Pair HL: the NO CARRY FLAG is set when the file has as many or more.
52A8
POP HL E1
Restore Register Pair HL (the records the file has) from the stack.
52A9
If the NO CARRY FLAG is set (the file is already as large), JUMP to 5350H, inside the LD IX at 534FH, where the bytes read LD HL,53B5H: File exists larger!
52AC
DEC BC 0B
DECrement Register Pair BC: the number of the last record wanted (records count from 0).
52AD
GOSUB to 4442H (@POSN) to position the file at Register Pair DE to record Register Pair BC.
52B0
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the file's buffer.
52B3
LD DE,5501H 11 01 55
Point Register Pair DE to 5501H, one byte above.
52B6
LD BC,00FFH 01 FF 00
Load Register Pair BC with 00FFH, the other 255 bytes of the buffer.
52B9
LD (HL),E5H 36 E5
Store E5H at Register Pair HL (5500H), the byte a freshly formatted sector holds.
52BB
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: each byte copies the one before, so 5500H-55FFH all become E5H. Register Pair HL ends at 55FFH.
52BD
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the file control block.
52C0
DEC H 25
DECrement Register H: Register Pair HL = 54FFH.
52C1
INC HL 23
INCrement Register Pair HL to 5500H, the record that @WRITE takes when the record length is below 256.
52C2
GOSUB to 4439H (@WRITE) to write the record at Register Pair HL (or the buffer, for 256 byte records) as the last record wanted: the file's space up to it is allocated.
52C5
If the NZ FLAG is set (the write failed), JUMP to 52F7H to report the error in Register A.
52C7
GOSUB to 443FH (@REW) to position the file at Register Pair DE back at its first record.
52CA
LD BC,(53E8H) ED 4B E8 53
Load Register Pair BC from 53E8H-53E9H: Register C = the drive, Register B = the file's directory record.
52CE
GOSUB to 5338H to set bit 7 of +01H of directory record Register B of drive Register C and store the record length in its +04H.

52D1H - FILL: Write Every Record

The FILL parameter is the operand at 52D2H-52D3H: 0100H in the file (not given). FILL=c stores the byte c in the low byte and 00H in the high byte; FILL alone stores FFFFH (records of FFH). Both 5500H-55FFH (the buffer) and 5600H-56FFH (the record @WRITE takes when the record length is below 256) are filled with the byte, and every record of the file is written. Without FILL the end of file is put back to what it was before (5301H), so the file keeps its space but not its records.

52D1
LD BC,0100H 01 00 01
Load Register Pair BC with the FILL parameter, the operand at 52D2H-52D3H: 0100H in the file (not given), else the fill byte in Register C.
52D4
DEC B 05
DECrement Register B (the high byte): the Z FLAG only for 01H, FILL not given.
52D5
If the Z FLAG is set (no FILL), JUMP to 5301H to put the end of file back.
52D7
PUSH DE D5
Save Register Pair DE (53E2H, the control block) to the stack.
52D8
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the file's buffer.
52DB
LD (HL),C 71
Store Register C (the fill byte) at Register Pair HL (5500H).
52DC
LD DE,5501H 11 01 55
Point Register Pair DE to 5501H, one byte above.
52DF
LD BC,01FFH 01 FF 01
Load Register Pair BC with 01FFH, the other 511 bytes of 5500H-56FFH.
52E2
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 5500H-56FFH all become the fill byte.
52E4
POP DE D1
Restore Register Pair DE from the stack: 53E2H, the control block.
52E5
LD BC,(5241H) ED 4B 41 52
Load Register Pair BC from 5241H-5242H: the number of records wanted.
52E9
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, the record @WRITE takes when the record length is below 256.
52EC
INC BC 03
INCrement Register Pair BC, so that the DEC below starts at the number of records.
52ED
DEC BC 0B
DECrement Register Pair BC, the records still to write.
52EE
LD A,B 78
Copy Register B (the high byte of the count) into Register A.
52EF
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when no record is left.
52F0
If the Z FLAG is set (all records written), JUMP to 530CH to close the file.
52F2
GOSUB to 4439H (@WRITE) to write the next record of the file at Register Pair DE from Register Pair HL (or from the buffer for 256 byte records).
52F5
If the Z FLAG is set (written), LOOP BACK to 52EDH.
52F7
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.
52F9
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
52FC
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. 5356H comes here after a message.
52FF
JUMP to 5324H to put the stack back and end the command.
5301
LD HL,0000H 21 00 00
Load Register Pair HL with the ending record number the file had before CREATE, the operand at 5302H-5303H stored by 528FH (0000H in the file).
5304
LD (53EEH),HL 22 EE 53
Store Register Pair HL at 53EEH-53EFH, bytes +0CH and +0DH of the control block: the file's ending record number is put back.
5307
LD A,00H 3E 00
Load Register A with the end of file byte the file had before CREATE, the operand at 5308H stored by 5295H (00H in the file).
5309
LD (53EAH),A 32 EA 53
Store Register A at 53EAH, byte +08H of the control block: the end of file byte is put back.
530C
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the file control block.
530F
LD BC,(53E8H) ED 4B E8 53
Load Register Pair BC from 53E8H-53E9H: Register C = the drive, Register B = the directory record, kept for SHRINK at 5333H.
5313
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE: its end of file goes into its directory record, and with bit 7 of +01H set the space beyond it is kept.
5316
If the NZ FLAG is set (the close failed), JUMP to 52F7H to report the error in Register A.

5318H - SHRINK and the Exit

The SHRINK parameter is the operand at 5319H-531AH: 0000H in the file, FFFFH when SHRINK is given. With SHRINK, 5333H turns the SET at 533EH into a RES, so that bit 7 of +01H of the directory record is cleared again: the next close of the file gives back the space beyond its end of file.

5318
LD DE,0000H 11 00 00
Load Register Pair DE with the SHRINK parameter, the operand at 5319H-531AH: 0000H in the file, FFFFH for SHRINK.
531B
LD A,D 7A
Copy Register D (the high byte of SHRINK) into Register A.
531C
AND E A3
AND Register E (the low byte) into Register A: FFH only for FFFFH.
531D
INC A 3C
INCrement Register A: the Z FLAG is set only for SHRINK (FFH + 1).
531E
If the Z FLAG is set (SHRINK), GOSUB to 5333H to clear bit 7 of +01H of directory record Register B of drive Register C.
5321
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5324
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5325H-5326H (0000H in the file, stored by 5200H). 52FFH comes here with Register Pair HL = FFFFH.
5327
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5328
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5329
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.
532A
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
532D
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
532F
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5330
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5333H - Mark the Directory Record

5333H (SHRINK) changes the second byte of the bit instruction at 533EH from FEH (SET 7,(HL)) to BEH (RES 7,(HL)) and goes on into 5338H. 5338H reads directory record Register B of drive Register C, sets (or clears) bit 7 of its +01H, stores the record length (the operand at 5344H) in its +04H and writes the sector back. An error ends the command at 52F7H.

5333
LD A,BEH 3E BE
Load Register A with BEH, the second byte of RES 7,(HL).
5335
LD (533FH),A 32 3F 53
Store Register A at 533FH, the second byte of the SET 7,(HL) at 533EH, which now reads RES 7,(HL).
5338
GOSUB to 4B10H (DIRRD) to read the directory sector that holds record Register B of drive Register C into 4200H: Register Pair HL points at the record, the NZ FLAG on failure (error 11H).
533B
If the NZ FLAG is set (the directory could not be read), JUMP to 52F7H to report the error in Register A.
533D
INC HL 23
INCrement Register Pair HL to byte +01H of the directory record.
533E
SET 7,(HL) CB FE
Set bit 7 of +01H at Register Pair HL: the file was made by CREATE and its space is kept on close. The second byte at 533FH is FEH in the file; SHRINK makes it BEH, RES 7,(HL), which clears the bit.
5340
INC L 2C
INCrement Register L to +02H of the directory record (a record does not cross a page).
5341
INC L 2C
INCrement Register L to +03H of the directory record.
5342
INC L 2C
INCrement Register L to +04H of the directory record, the record length.
5343
LD A,00H 3E 00
Load Register A with the record length, the operand at 5344H stored by 526BH (00H in the file: 256).
5345
LD (HL),A 77
Store Register A (the record length) at Register Pair HL, +04H of the directory record.
5346
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back to drive Register C and verify it: the NZ FLAG on failure.
5349
If the NZ FLAG is set (the write failed), JUMP to 52F7H to report the error in Register A.
534B
RET C9
RETurn to the caller with the directory record changed.
534C
LD HL,53A1H 21 A1 53
Point Register Pair HL to 53A1H, the message File spec required!.
534F
LD IX,53B5H DD 21 B5 53
Load Index Register IX with 53B5H: no use when run from 534CH. Entered at 5350H (from 52A9H) the bytes 21H B5H 53H are LD HL,53B5H, the message File exists larger!.
5353
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5356
JUMP to 52FCH to end the command with Register Pair HL = FFFFH.

5358H - CREATE Data: Parameter Table and Messages

Each entry of the parameter table is a keyword of six characters (padded with spaces) and the address where @PARAM stores its value: the operand of the instruction that uses it. The table ends with 00H. Then the three texts.

5358-535D
DEFM "SIZE " 53 49 5A 45 20 20
Parameter table entry 1: the keyword SIZE, the size in kilobytes.
535E-535F
DEFW 5248H 48 52
Entry 1: 5248H, the operand of the LD HL at 5247H, where SIZE is stored.
5360-5365
DEFM "S " 53 20 20 20 20 20
Parameter table entry 2: the keyword S, short for SIZE.
5366-5367
DEFW 5248H 48 52
Entry 2: 5248H, the operand of the LD HL at 5247H, where S is stored.
5368-536D
DEFM "REC " 52 45 43 20 20 20
Parameter table entry 3: the keyword REC, the number of records.
536E-536F
DEFW 5241H 41 52
Entry 3: 5241H, the operand of the LD BC at 5240H, where REC is stored.
5370-5375
DEFM "R " 52 20 20 20 20 20
Parameter table entry 4: the keyword R, short for REC.
5376-5377
DEFW 5241H 41 52
Entry 4: 5241H, the operand of the LD BC at 5240H, where R is stored.
5378-537D
DEFM "LRL " 4C 52 4C 20 20 20
Parameter table entry 5: the keyword LRL, the record length.
537E-537F
DEFW 5257H 57 52
Entry 5: 5257H, the operand of the LD BC at 5256H, where LRL is stored.
5380-5385
DEFM "L " 4C 20 20 20 20 20
Parameter table entry 6: the keyword L, short for LRL.
5386-5387
DEFW 5257H 57 52
Entry 6: 5257H, the operand of the LD BC at 5256H, where L is stored.
5388-538D
DEFM "FILL " 46 49 4C 4C 20 20
Parameter table entry 7: the keyword FILL, the byte to write into every record.
538E-538F
DEFW 52D2H D2 52
Entry 7: 52D2H, the operand of the LD BC at 52D1H, where FILL is stored.
5390-5395
DEFM "F " 46 20 20 20 20 20
Parameter table entry 8: the keyword F, short for FILL.
5396-5397
DEFW 52D2H D2 52
Entry 8: 52D2H, the operand of the LD BC at 52D1H, where F is stored.
5398-539D
DEFM "SHRINK" 53 48 52 49 4E 4B
Parameter table entry 9: the keyword SHRINK, which takes back the mark of CREATE.
539E-539F
DEFW 5319H 19 53
Entry 9: 5319H, the operand of the LD DE at 5318H, where SHRINK is stored.
53A0
DEFB 00H 00
00H, the end of the parameter table of CREATE (nine entries).
53A1-53B3
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 534CH: the text after CREATE is not a file specification, or names a device.
53B4
DEFB 0DH 0D
0DH, the end of the message File spec required!, displayed with it.
53B5-53C7
DEFM "File exists larger!" 46 69 6C 65 20 65 78 69 73 74 73 20 6C 61 72 67 65 72 21
The message of 52A9H (through 5350H): the file already has as many records as asked for, or more.
53C8
DEFB 0DH 0D
0DH, the end of the message File exists larger!, displayed with it.
53C9-53D2
DEFM "Creating: " 43 72 65 61 74 69 6E 67 3A 20
The start of the line of 5281H; @FNAME puts the file's name right after it at 53D3H, the first byte after the member, ended by 03H.

5200H - Member 4 (DEBUG and VERIFY): Entries and DEBUG

The VERIFY command (library member 1BH, entry 5200H) and the DEBUG command (member 14H, entry 5203H), loaded at 5200H-5349H. DEBUG turns DEBUG on (bit 7 of SFLAG$, so that @RUN enters DEBUG at a program's first instruction, and the BREAK trap at 4315H-4317H set to JP 400FH, so that BREAK enters it) or off with (OFF) or (N). DEBUG (EXT) also loads the extended DEBUG commands (request 8BH, SYS9/SYS) and DEBUG (OFF,EXT) gives their memory back when they are the lowest module above HIGH$. VERIFY (ON) or VERIFY (OFF) points the @WRITE vector at the write with or without the verify of every sector. Both read their parameters through 5292H or 5297H, which return the Z FLAG when OFF (or N) was given.

5200
VERIFY enters here (member byte 1BH): JUMP to 5271H.
5203
DEBUG enters here (member byte 14H): GOSUB to 5292H to read the parameters with the DEBUG table (EXT, E, ON, OFF, Y, N); the Z FLAG comes back when OFF or N was given.
5206
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags. LD does not change the flags.
5209
DI F3
Disable interrupts while SFLAG$ and the BREAK trap are changed.
520A
If the Z FLAG is set (OFF or N), JUMP to 522BH to turn DEBUG off.
520C
BIT 5,(HL) CB 6E
Test bit 5 of SFLAG$ at Register Pair HL: set while a JCL job runs.
520E
If the NZ FLAG is set (a JCL job runs), JUMP to 52AFH to display Invalid command during <DO> processing!.
5211
LD A,(525CH) 3A 5C 52
Fetch the low byte of the EXT parameter from 525CH into Register A: 00H when EXT was not given, FFH for EXT (or E).
5214
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for EXT.
5215
PUSH HL E5
Save Register Pair HL (430FH) to the stack, since the extended DEBUG load changes it.
5216
If the NZ FLAG is set (EXT), GOSUB to 525EH to check the command level and load the extended DEBUG commands through request 8BH.
5219
POP HL E1
Restore Register Pair HL (430FH, SFLAG$) from the stack.
521A
SET 7,(HL) CB FE
Set bit 7 of SFLAG$ at Register Pair HL: DEBUG is on, so @RUN starts each program in DEBUG.
521C
LD HL,400FH 21 0F 40
Point Register Pair HL to 400FH, the RST 30H vector, which leads to DEBUG.
521F
LD A,C3H 3E C3
Load Register A with C3H, the code of JP, for the BREAK trap switch.
5221
LD (4316H),HL 22 16 43
Store Register Pair HL (400FH) at 4316H-4317H, the address the BREAK trap jumps to.
5224
LD (4315H),A 32 15 43
Store Register A at 4315H, the BREAK trap switch: C3H (the trap is on: BREAK jumps to the address at 4316H), or C9H from 5258H (off).
5227
EI FB
Enable interrupts again, now that 4315H-4317H and SFLAG$ are set.
5228
JUMP to 527FH to end the command with Register Pair HL = 0000H.

522BH - DEBUG (OFF): Turn DEBUG Off

Bit 7 of SFLAG$ is cleared and the BREAK trap switch gets C9H. With EXT as well, the extended DEBUG commands are taken out: when 4310H-4311H no longer holds 4876H (the default, a plain return) and points at HIGH$ + 1 (the module is the lowest in high memory), HIGH$ is put back from the module's link word (its +02H-+03H) and 4310H-4311H gets 4876H again.

522B
RES 7,(HL) CB BE
Clear bit 7 of SFLAG$ at Register Pair HL (430FH): DEBUG is off.
522D
LD A,(525CH) 3A 5C 52
Fetch the low byte of the EXT parameter from 525CH into Register A.
5230
OR A B7
Set the flags from Register A (OR A): the Z FLAG when EXT was not given.
5231
If the Z FLAG is set (no EXT), JUMP to 5258H to turn the BREAK trap off.
5233
LD DE,(4310H) ED 5B 10 43
Fetch the word at 4310H-4311H into Register Pair DE: the address DEBUG calls for a command it does not know, 4876H unless the extended commands are installed.
5237
OR A B7
Clear the CARRY FLAG (OR A sets the flags from Register A and clears the carry) for the subtraction below.
5238
LD HL,4876H 21 76 48
Load Register Pair HL with 4876H, the default address (OR A / RET in SYS0/SYS).
523B
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when 4310H-4311H still holds 4876H.
523D
If the Z FLAG is set (no extended commands installed), JUMP to 5258H.
523F
LD HL,(4049H) 2A 49 40
Fetch HIGH$, the highest address free for programs, from 4049H-404AH into Register Pair HL.
5242
INC HL 23
INCrement Register Pair HL: HIGH$ + 1, the first byte of the lowest module in high memory.
5243
OR A B7
Clear the CARRY FLAG (OR A sets the flags from Register A and clears the carry) for the subtraction below.
5244
SBC HL,DE ED 52
SUBtract Register Pair DE (the extended commands' entry) from Register Pair HL: the Z FLAG when they start at HIGH$ + 1.
5246
If the NZ FLAG is set (another module lies below them), JUMP to 5258H: their memory cannot be given back.
5248
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the start of the module of the extended commands.
5249
INC HL 23
INCrement Register Pair HL to the module's +01H.
524A
INC HL 23
INCrement Register Pair HL to the module's +02H, its link word: the HIGH$ before the module was installed.
524B
LD E,(HL) 5E
Fetch the low byte of the link word at Register Pair HL into Register E.
524C
INC HL 23
INCrement Register Pair HL to the module's +03H.
524D
LD D,(HL) 56
Fetch the high byte of the link word at Register Pair HL into Register D: Register Pair DE = the old HIGH$.
524E
LD (4049H),DE ED 53 49 40
Store Register Pair DE (the old HIGH$) at 4049H-404AH: the module's memory is free again.
5252
LD HL,4876H 21 76 48
Load Register Pair HL with 4876H, the default address for an unknown DEBUG command.
5255
LD (4310H),HL 22 10 43
Store Register Pair HL (4876H) at 4310H-4311H: DEBUG no longer calls the extended commands.
5258
LD A,C9H 3E C9
Load Register A with C9H, the code of RET: the BREAK trap switch off.
525A
JUMP to 5224H to store Register A at 4315H, enable interrupts and end the command.
525C-525D
DEFB 00H, 00H 00 00
The EXT parameter, where @PARAM stores the value of EXT or E (table entries at 5319H and 5321H): 0000H in the file, FFFFH for EXT. 5211H and 522DH test its low byte.

525EH - DEBUG (EXT): Load the Extended DEBUG Commands

Only at LDOS command level: when @EXIT (402DH) holds a JP (a program has taken it over) or bit 1 of 4758H is set (a command line from a program), the command is refused with Can't -- Only valid at LDOS command level!. Request 8BH loads SYS9/SYS, which installs the extended commands in high memory; its RET comes back to the caller of 525EH.

525E
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A: C3H when a program has put a JP there.
5261
CP C3H FE C3
Compare Register A against C3H, the code of JP.
5263
If the Z FLAG is set (not at LDOS command level), JUMP to 52B4H, inside the LD IX at 52B3H, where the bytes read LD HL,52C6H: Can't -- Only valid at LDOS command level!
5266
LD A,(4758H) 3A 58 47
Fetch the status byte of the command interpreter from 4758H into Register A.
5269
BIT 1,A CB 4F
Test bit 1 of Register A: set when the command line came from a program (through 4451H).
526B
If the NZ FLAG is set (from a program), JUMP to 52B4H for Can't -- Only valid at LDOS command level!.
526E
LD A,8BH 3E 8B
Load Register A with 8BH, the request code of SYS9/SYS, function 0: install the extended DEBUG commands.
5270
RST 28H EF
Issue the request in Register A through RST 28H: the supervisor dispatcher drops this return address, so SYS9/SYS's RET goes back to 5219H, after the CALL NZ at 5216H.

5271H - VERIFY: Point the @WRITE Vector

VERIFY reads its parameters with the table at 5329H (ON, OFF, Y, N). With OFF or N the @WRITE vector (the JP at 4439H, operand 443AH-443BH) goes to 48CBH, the plain write; otherwise to 48E6H, the write that verifies each sector after writing it. Then the common exit.

5271
GOSUB to 5297H to read the parameters with the VERIFY table (ON, OFF, Y, N); the Z FLAG comes back when OFF or N was given.
5274
LD HL,48CBH 21 CB 48
Load Register Pair HL with 48CBH, SYS0/SYS's @WRITE without the verify. LD does not change the flags.
5277
If the Z FLAG is set (OFF or N), JUMP to 527CH with Register Pair HL = 48CBH.
5279
LD HL,48E6H 21 E6 48
Load Register Pair HL with 48E6H, SYS0/SYS's @WRITE with the verify switch on.
527C
LD (443AH),HL 22 3A 44
Store Register Pair HL at 443AH-443BH, the operand of the JP at 4439H (@WRITE): every program's writes now go there.
527F
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5282
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved by 529AH, the operand at 5283H-5284H (0000H in the file): the stack as it was inside the CALL to 5292H or 5297H. 52BDH comes here with Register Pair HL = FFFFH.
5285
POP AF F1
Restore Register Pair AF from the stack: this takes off the return address of that CALL, so the RET below goes to the supervisor dispatcher.
5286
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5287
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5288
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.
5289
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
528C
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
528E
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
528F
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5292H - Read the Parameters, Test OFF

5292H uses the DEBUG table (5319H), 5297H the VERIFY table (5329H). The Stack Pointer is saved for the exit (the return address of this CALL is on top, 5285H takes it off). A bad parameter reports error 2CH and ends the command. Returns the Z FLAG when OFF or N was given (FFFFH at 52A6H), the NZ FLAG otherwise: ON and Y are stored at 52ADH, which no code reads.

5292
LD DE,5319H 11 19 53
Point Register Pair DE to 5319H, the parameter table of DEBUG (EXT, E, ON, OFF, Y, N).
5295
JUMP to 529AH to read the parameters with the table at Register Pair DE.
5297
LD DE,5329H 11 29 53
Point Register Pair DE to 5329H, the parameter table of VERIFY (ON, OFF, Y, N), the last four entries of the DEBUG table.
529A
LD (5283H),SP ED 73 83 52
Store the Stack Pointer at 5283H, the operand of the LD SP at 5282H: the exit puts the stack back to this depth.
529E
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL (the text after the command word) against the table at Register Pair DE. The NZ FLAG for a bad parameter.
52A1
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error). LD does not change the flags.
52A3
If the NZ FLAG is set (a bad parameter), JUMP to 52BFH to report error 2CH.
52A5
LD BC,0000H 01 00 00
Load Register Pair BC with the OFF parameter, the operand at 52A6H-52A7H: 0000H in the file, FFFFH when OFF or N was given.
52A8
LD A,B 78
Copy Register B (the high byte of OFF) into Register A.
52A9
OR C B1
OR Register C (the low byte) into Register A: FFH for OFF, 00H when it was not given.
52AA
XOR FFH EE FF
Exclusive OR FFH into Register A: the Z FLAG is set for OFF.
52AC
RET C9
RETurn with the Z FLAG for OFF, the NZ FLAG otherwise.
52AD-52AE
DEFB 00H, 00H 00 00
The ON parameter, where @PARAM stores the value of ON or Y (table entries at 5329H and 5339H): 0000H in the file, FFFFH when given. No code reads it: anything but OFF means on.

52AFH - Messages and Errors

52AFH (DEBUG during a JCL job) and 52B4H (EXT not at LDOS command level) display a message; 52BFH reports an error number through @ERROR. All three end the command with Register Pair HL = FFFFH.

52AF
EI FB
Enable interrupts again (520AH disabled them).
52B0
LD HL,52F1H 21 F1 52
Point Register Pair HL to 52F1H, the message Invalid command during <DO> processing!.
52B3
LD IX,52C6H DD 21 C6 52
Load Index Register IX with 52C6H: no use when run from 52B0H. Entered at 52B4H (from 5263H and 526BH) the bytes 21H C6H 52H are LD HL,52C6H, the message Can't -- Only valid at LDOS command level!.
52B7
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
52BA
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
52BD
JUMP to 5282H to put the stack back and end the command.
52BF
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.
52C1
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
52C4
JUMP to 52BAH to end the command with Register Pair HL = FFFFH.

52C6H - DEBUG and VERIFY Data: Messages and Parameter Tables

The two messages, then the parameter table of DEBUG; its last four entries (from 5329H) are the parameter table of VERIFY. Each entry is a keyword of six characters and the address where @PARAM stores the value.

52C6-52EF
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 21
The message of 52B4H: EXT was given while a program owns @EXIT or ran the command.
52F0
DEFB 0DH 0D
0DH, the end of the message Can't -- Only valid at LDOS command level!, displayed with it.
52F1-5317
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 21
The message of 52AFH: DEBUG was given (without OFF) during a JCL job.
5318
DEFB 0DH 0D
0DH, the end of the message Invalid command during <DO> processing!, displayed with it.
5319-531E
DEFM "EXT " 45 58 54 20 20 20
DEBUG table entry 1: the keyword EXT, load the extended DEBUG commands.
531F-5320
DEFW 525CH 5C 52
Entry 1: 525CH, the cell where EXT is stored.
5321-5326
DEFM "E " 45 20 20 20 20 20
DEBUG table entry 2: the keyword E, short for EXT.
5327-5328
DEFW 525CH 5C 52
Entry 2: 525CH, the cell where E (the same as EXT) is stored.
5329-532E
DEFM "ON " 4F 4E 20 20 20 20
DEBUG table entry 3 and VERIFY table entry 1: the keyword ON.
532F-5330
DEFW 52ADH AD 52
52ADH, the cell where ON is stored (read by no code).
5331-5336
DEFM "OFF " 4F 46 46 20 20 20
DEBUG table entry 4 and VERIFY table entry 2: the keyword OFF.
5337-5338
DEFW 52A6H A6 52
52A6H, the operand of the LD BC at 52A5H, where OFF is stored.
5339-533E
DEFM "Y " 59 20 20 20 20 20
DEBUG table entry 5 and VERIFY table entry 3: the keyword Y, the same as ON.
533F-5340
DEFW 52ADH AD 52
52ADH, the cell where Y is stored (read by no code).
5341-5346
DEFM "N " 4E 20 20 20 20 20
DEBUG table entry 6 and VERIFY table entry 4: the keyword N, the same as OFF.
5347-5348
DEFW 52A6H A6 52
52A6H, the operand of the LD BC at 52A5H, where N is stored.
5349
DEFB 00H 00
00H, the end of both parameter tables, the last byte of the member.

5200H - Member 5 (SYSGEN): Entry, the JCL Pause and the Checks

The SYSGEN member (library member 1CH), loaded at 5200H-552FH. No command word leads here: SYSTEM (SYSGEN) (member 7, its 5A4AH-5A4EH) issues request 89H with Register B = 1CH, Register H = the drive and Register L = FFH to build or 00H to delete. Building writes CONFIG/SYS.CCC:d, a load module that holds the memory above HIGH$ and the resident cells that SYSTEM, SET, ROUTE, LINK and the drivers change, and sets byte 01H of the drive's system information sector to 00H so that SYS0/SYS's reset loads it; deleting sets that byte to C9H and kills the file. A running JCL job is paused first (53A2H) and resumed at the end (53D6H). Only at LDOS command level.

5200
LD (5367H),SP ED 73 67 53
Store the Stack Pointer at 5367H-5368H, the operand of the LD HL at 5366H. The LD SP at 5369H keeps its 0000H, so every exit through 5369H sets the Stack Pointer to 0000H.
5204
GOSUB to 53A2H to pause a running JCL job: SFLAG$ is kept at 53D7H, bit 5 cleared, @EXIT and @ABORT and the keyboard driver put back as they are outside the job.
5207
NOP 00
No operation: a byte with no use between the CALL and the test below.
5208
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A: C3H when a program has put a JP there.
520B
CP C3H FE C3
Compare Register A against C3H, the code of JP.
520D
If the Z FLAG is set (not at LDOS command level), JUMP to 539AH, inside the LD IX at 5399H, where the bytes read LD HL,547EH: Can't -- Valid only at LDOS command level.
5210
LD A,(4758H) 3A 58 47
Fetch the status byte of the command interpreter from 4758H into Register A.
5213
BIT 1,A CB 4F
Test bit 1 of Register A: set when the command line came from a program (through 4451H).
5215
If the NZ FLAG is set (from a program), JUMP to 539AH for Can't -- Valid only at LDOS command level.
5218
LD A,H 7C
Copy Register H (the drive, from SYSTEM) into Register A.
5219
LD (5382H),A 32 82 53
Store Register A (the drive) at 5382H, the operand of the LD C at 5381H, the drive of the system information sector.
521C
ADD A,30H C6 30
ADD 30H to Register A: the character of the drive's digit.
521E
LD (53FCH),A 32 FC 53
Store Register A (the digit) at 53FCH, the d of CONFIG/SYS.CCC:d in the file control block.
5221
LD (543CH),A 32 3C 54
Store Register A (the digit) at 543CH, the d of the command Attrib CONFIG/SYS.CCC:d (I,P=RE).
5224
LD A,L 7D
Copy Register L (the switch from SYSTEM: FFH build, 00H delete) into Register A.
5225
OR A B7
Set the flags from Register A (OR A): the Z FLAG for SYSGEN=OFF.
5226
If the Z FLAG is set (delete), JUMP to 5346H.

5229H - Build: The Name Record and the Banner

CONFIG/SYS is created with @INIT (records of 256 bytes, buffer 5600H) and written byte by byte through the ROM's @PUT (538BH) as a load module: a name record (05H) with CONFIG, a load block that writes the banner CONFIGURING (with three asterisks each side) on the screen at 3F96H while the file loads, and a load block of one C9H (RET) for 4012H, the interrupt vector, so that no interrupt is served while the file loads (the reset puts the C3H back afterwards).

5229
LD DE,53EDH 11 ED 53
Point Register Pair DE to 53EDH, the file control block that holds CONFIG/SYS.CCC:d.
522C
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, the 256 byte buffer of the file, above the member.
522F
LD B,L 45
Copy Register L (00H) into Register B: the record length, 00H for 256.
5230
GOSUB to 4420H (@INIT) to open the file at Register Pair DE, or create it, with the buffer at Register Pair HL and record length Register B. The NZ FLAG and an error number in Register A on failure.
5233
If the NZ FLAG is set (the file could not be made), JUMP to 538FH to report the error in Register A.
5236
LD A,05H 3E 05
Load Register A with 05H, the type of a name record.
5238
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
523B
LD A,06H 3E 06
Load Register A with 06H, the length of the name.
523D
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
5240
LD B,06H 06 06
Load Register B with 06H, the six letters of the name.
5242
LD HL,542DH 21 2D 54
Point Register Pair HL to 542DH, CONFIG, the start of the file name in the Attrib command text.
5245
LD A,(HL) 7E
Fetch the next letter of the name at Register Pair HL into Register A.
5246
INC HL 23
INCrement Register Pair HL to the letter after it.
5247
GOSUB to 538BH to write the letter in Register A to the file at Register Pair DE.
524A
DECrement Register B and LOOP BACK to 5245H until the six letters CONFIG are written.
524C
LD B,13H 06 13
Load Register B with 13H, the 19 bytes of the banner.
524E
LD DE,3F96H 11 96 3F
Point Register Pair DE to 3F96H, the place in video memory (row 14, column 22) where the banner loads.
5251
LD HL,54A8H 21 A8 54
Point Register Pair HL to 54A8H, the banner CONFIGURING with three asterisks each side.
5254
GOSUB to 5324H to write a load block of Register B bytes from Register Pair HL, to be loaded at Register Pair DE.
5257
LD B,01H 06 01
Load Register B with 01H, the one byte of the next load block.
5259
LD DE,4012H 11 12 40
Point Register Pair DE to 4012H, the first byte of the RST 38H interrupt vector (a JP to the interrupt service routine).
525C
LD HL,5323H 21 23 53
Point Register Pair HL to 5323H, the RET (C9H) at the end of 5324H's routine, the byte to load there.
525F
GOSUB to 5324H to write a load block of Register B bytes from Register Pair HL, to be loaded at Register Pair DE.

5262H - Build: The Memory above HIGH$

The top of memory is found by changing a byte and reading it back, from FFFFH down in steps of 4000H (16K). Everything from HIGH$ + 1 to the top is written as load blocks (52EBH): the modules that have installed themselves in high memory. Then 4018H is cleared and the table at 54CEH names the resident cells that are written next, each as load blocks of its current contents.

5262
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the highest address there can be.
5265
LD A,(HL) 7E
Fetch the byte at Register Pair HL into Register A.
5266
LD B,A 47
Copy Register A (the byte) into Register B, to put back.
5267
CPL 2F
Complement Register A (CPL): every bit turned over.
5268
LD (HL),A 77
Store Register A (the changed byte) at Register Pair HL.
5269
CP (HL) BE
Compare Register A against the byte at Register Pair HL: the Z FLAG is set when memory there kept it.
526A
LD (HL),B 70
Store Register B (the old byte) at Register Pair HL again.
526B
If the Z FLAG is set (memory at Register Pair HL), JUMP to 5273H with Register Pair HL = the top of memory.
526D
LD A,H 7C
Copy Register H (the high byte of the address) into Register A.
526E
SUB 40H D6 40
SUBtract 40H from Register A: the high byte of an address 16K lower.
5270
LD H,A 67
Copy Register A into Register H: Register Pair HL = the address 4000H lower.
5271
LOOP BACK to 5265H to test memory at the lower address.
5273
LD DE,(4049H) ED 5B 49 40
Fetch HIGH$, the highest address free for programs, from 4049H-404AH into Register Pair DE.
5277
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
5278
SBC HL,DE ED 52
SUBtract Register Pair DE (HIGH$) from Register Pair HL (the top of memory): the bytes above HIGH$, the Z FLAG when there are none.
527A
LD B,H 44
Copy Register H (the high byte of the count) into Register B.
527B
LD C,L 4D
Copy Register L (the low byte of the count) into Register C: Register Pair BC = the bytes above HIGH$.
527C
INC DE 13
INCrement Register Pair DE: HIGH$ + 1, the first byte above HIGH$. INC of a pair does not change the flags.
527D
If the NZ FLAG is set (memory above HIGH$ is in use), GOSUB to 52EBH to write Register Pair BC bytes from Register Pair DE as load blocks.
5280
XOR A AF
Clear Register A (XOR A) for the store at 4018H below.
5281
LD (4018H),A 32 18 40
Store Register A (00H) at 4018H, KIDCB$ +03H, the first of the keyboard driver's three bytes, before the device control blocks are saved.
5284
LD HL,54CEH 21 CE 54
Point Register Pair HL to 54CEH, the table of resident cells to save: entries of a byte count and an address, 0000H at the end.
5287
LD C,(HL) 4E
Fetch the low byte of the entry's count at Register Pair HL into Register C.
5288
INC HL 23
INCrement Register Pair HL to the high byte of the count.
5289
LD B,(HL) 46
Fetch the high byte of the count at Register Pair HL into Register B: Register Pair BC = the bytes to save.
528A
INC HL 23
INCrement Register Pair HL to the entry's address.
528B
LD A,B 78
Copy Register B (the high byte of the count) into Register A.
528C
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG for a count of 0000H, the end of the table.
528D
If the Z FLAG is set (the end of the table), JUMP to 529AH.
528F
LD E,(HL) 5E
Fetch the low byte of the address at Register Pair HL into Register E.
5290
INC HL 23
INCrement Register Pair HL to the high byte of the address.
5291
LD D,(HL) 56
Fetch the high byte of the address at Register Pair HL into Register D: Register Pair DE = the first cell to save.
5292
INC HL 23
INCrement Register Pair HL to the next entry of the table.
5293
PUSH HL E5
Save Register Pair HL (the next entry) to the stack.
5294
GOSUB to 52EBH to write Register Pair BC bytes from Register Pair DE as load blocks.
5297
POP HL E1
Restore Register Pair HL (the next entry of the table) from the stack.
5298
LOOP BACK to 5287H for the next entry of the table of cells.

529AH - Build: The Drive Code Tables, the End and the Flag

The 80 bytes of the drive code tables (DCT$, 4700H-474FH) are written as a load block for 4152H: SYS0/SYS's reset copies them from 4152H to 4700H after loading the file. Two loads of Register Pair HL stand where a load block for 4012H would be written; no block is written there. A load block of 19 spaces then clears the banner, the transfer record (02H 02H, address 0000H) ends the module, and the file is closed. Byte 01H of the drive's system information sector (cylinder 0, sector 2) is set to 00H: the reset loads CONFIG/SYS. Finally the file is made invisible and protected through @CMNDI.

529A
LD B,50H 06 50
Load Register B with 50H, the 80 bytes of the eight drive code tables.
529C
LD DE,4152H 11 52 41
Point Register Pair DE to 4152H, where the block is loaded; the reset copies it to 4700H afterwards.
529F
LD HL,4700H 21 00 47
Point Register Pair HL to 4700H, DCT$, the drive code tables as they are now.
52A2
GOSUB to 5324H to write a load block of Register B bytes from Register Pair HL, to be loaded at Register Pair DE.
52A5
LD B,01H 06 01
Load Register B with 01H, the one byte of a load block for 4012H.
52A7
LD DE,4012H 11 12 40
Point Register Pair DE to 4012H, the RST 38H interrupt vector.
52AA
LD HL,5391H 21 91 53
Point Register Pair HL to 5391H, the byte CDH at the start of the CALL 4409H there.
52AD
LD HL,5324H 21 24 53
Load Register Pair HL with 5324H, the address of the load block writer, in place of the CALL to it: no load block is written for 4012H here, and Register Pair HL is loaded again below.
52B0
LD B,13H 06 13
Load Register B with 13H, the 19 bytes of the banner.
52B2
LD DE,3F96H 11 96 3F
Point Register Pair DE to 3F96H, the place of the banner in video memory.
52B5
LD HL,54BBH 21 BB 54
Point Register Pair HL to 54BBH, 19 spaces that clear the banner.
52B8
GOSUB to 5324H to write a load block of Register B bytes from Register Pair HL, to be loaded at Register Pair DE: the banner is cleared when the load ends.
52BB
GOSUB to 5389H to write 02H, the type of the transfer record.
52BE
GOSUB to 5389H to write 02H, the length of the transfer record.
52C1
XOR A AF
Clear Register A (XOR A): 00H, the low byte of the transfer address.
52C2
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
52C5
XOR A AF
Clear Register A (XOR A): 00H, the high byte of the transfer address.
52C6
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
52C9
GOSUB to 4428H (@CLOSE) to close CONFIG/SYS, the file at Register Pair DE.
52CC
If the NZ FLAG is set (the close failed), JUMP to 538FH to report the error in Register A.
52CF
GOSUB to 537BH to read the system information sector (cylinder 0, sector 2) of the drive into 4200H.
52D2
XOR A AF
Clear Register A (XOR A): 00H, the flag that makes the reset load CONFIG/SYS.
52D3
LD (4201H),A 32 01 42
Store Register A (00H) at 4201H, byte 01H of the system information sector: the reset loads CONFIG/SYS.
52D6
GOSUB to 4763H (WRSECT) to write the sector at Register Pair HL (4200H) back to cylinder Register D, sector Register E of drive Register C, as 537BH set them.
52D9
If the NZ FLAG is set (the write failed), JUMP to 538FH to report the error in Register A.
52DC
LD HL,540DH 21 0D 54
Point Register Pair HL to 540DH, the message User configuration built.
52DF
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
52E2
GOSUB to 53D6H to resume the JCL job paused at 5204H, if one was running.
52E5
LD HL,5426H 21 26 54
Point Register Pair HL to 5426H, the command Attrib CONFIG/SYS.CCC:d (I,P=RE).
52E8
JUMP to 4405H (@CMNDI): SYS1/SYS carries out the command at Register Pair HL (the file becomes invisible with READ protection) and goes on to LDOS Ready; it does not return here.

52EBH - Write a Block of Memory as Load Blocks

Register Pair DE = the first byte, Register Pair BC = the number of bytes (not 0). The bytes are written to CONFIG/SYS as load blocks (type 01H, length = count + 2, address low, address high, the bytes) of at most 254 bytes each.

52EB
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the first byte to write.
52EC
LD DE,53EDH 11 ED 53
Point Register Pair DE to 53EDH, the file control block of CONFIG/SYS.
52EF
PUSH HL E5
Save Register Pair HL (the first byte of this block) to the stack.
52F0
PUSH BC C5
Save Register Pair BC (the bytes still to write) to the stack.
52F1
LD H,B 60
Copy Register B (the high byte of the bytes left) into Register H.
52F2
LD L,C 69
Copy Register C (the low byte) into Register L: Register Pair HL = the bytes left.
52F3
LD BC,00FEH 01 FE 00
Load Register Pair BC with 00FEH, 254, the most bytes a load block takes here.
52F6
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
52F7
SBC HL,BC ED 42
SUBtract Register Pair BC (254) from Register Pair HL (the bytes left): the NO CARRY FLAG when 254 or more are left; Register Pair HL = the bytes left after a full block.
52F9
If the NO CARRY FLAG is set (a full block of 254), JUMP to 5301H.
52FB
POP BC C1
Restore Register Pair BC (the bytes left, fewer than 254) from the stack: this block takes them all.
52FC
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the bytes left after this block.
52FF
JUMP to 5302H to swap the address of the block onto Register Pair HL.
5301
POP AF F1
Restore Register Pair AF from the stack: this takes off the count pushed at 52F0H (Register Pair BC stays 00FEH).
5302
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): Register Pair HL = the first byte of this block, the bytes left after it go on the stack.
5303
LD B,C 41
Copy Register C (the bytes of this block: 254, or all that were left) into Register B, the count of the loop below.
5304
LD A,01H 3E 01
Load Register A with 01H, the type of a load block.
5306
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
5309
LD A,B 78
Copy Register B (the bytes of the block) into Register A.
530A
ADD A,02H C6 02
ADD 02H to Register A: the length byte counts the two address bytes too.
530C
GOSUB to 538BH to write the length in Register A.
530F
LD A,L 7D
Copy Register L (the low byte of the block's address) into Register A.
5310
GOSUB to 538BH to write the low byte of the load address in Register A.
5313
LD A,H 7C
Copy Register H (the high byte of the block's address) into Register A.
5314
GOSUB to 538BH to write the high byte of the load address in Register A.
5317
LD A,(HL) 7E
Fetch the next byte of memory at Register Pair HL into Register A.
5318
INC HL 23
INCrement Register Pair HL to the byte after it.
5319
GOSUB to 538BH to write the byte in Register A to the file.
531C
DECrement Register B and LOOP BACK to 5317H until the bytes of the block are written.
531E
POP BC C1
Restore Register Pair BC from the stack: the bytes left after this block.
531F
LD A,B 78
Copy Register B (the high byte of the bytes left) into Register A.
5320
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when none are left.
5321
If the NZ FLAG is set (more bytes), LOOP BACK to 52EFH with Register Pair HL at the next byte.
5323
RET C9
RETurn. This C9H is also the byte 525CH writes as the load block for 4012H.

5324H - Write One Load Block from a Buffer

Register Pair HL = the bytes, Register Pair DE = the address they are to be loaded at, Register B = the count (1-254). Writes the type 01H, the length (count + 2), the address and the bytes to CONFIG/SYS. Register Pair DE comes back as 53EDH, the file control block.

5324
PUSH HL E5
Save Register Pair HL (the bytes to write) to the stack.
5325
LD H,D 62
Copy Register D (the high byte of the load address) into Register H.
5326
LD L,E 6B
Copy Register E (the low byte of the load address) into Register L: Register Pair HL = the load address.
5327
LD DE,53EDH 11 ED 53
Point Register Pair DE to 53EDH, the file control block of CONFIG/SYS.
532A
LD A,01H 3E 01
Load Register A with 01H, the type of a load block.
532C
GOSUB to 538BH to write the byte in Register A to the file at Register Pair DE.
532F
LD A,B 78
Copy Register B (the count of bytes in the block) into Register A.
5330
ADD A,02H C6 02
ADD 02H to Register A: the length byte counts the two address bytes too.
5332
GOSUB to 538BH to write the length in Register A.
5335
LD A,L 7D
Copy Register L (the low byte of the load address) into Register A.
5336
GOSUB to 538BH to write the low byte of the load address in Register A.
5339
LD A,H 7C
Copy Register H (the high byte of the load address) into Register A.
533A
GOSUB to 538BH to write the high byte of the load address in Register A.
533D
POP HL E1
Restore Register Pair HL (the bytes to write) from the stack.
533E
LD A,(HL) 7E
Fetch the next byte at Register Pair HL into Register A.
533F
INC HL 23
INCrement Register Pair HL to the byte after it.
5340
GOSUB to 538BH to write the byte in Register A to the file.
5343
DECrement Register B and LOOP BACK to 533EH until the bytes are written.
5345
RET C9
RETurn with Register Pair DE = 53EDH, the file control block.

5346H - Delete: SYSGEN=OFF

Byte 01H of the drive's system information sector is set to C9H (no configuration file), the sector written back, and CONFIG/SYS.CCC:d killed. When the file is not there, No user configuration found is displayed (the sector has been changed all the same).

5346
GOSUB to 537BH to read the system information sector (cylinder 0, sector 2) of the drive into 4200H.
5349
LD A,C9H 3E C9
Load Register A with C9H, the value that means no configuration file.
534B
LD (4201H),A 32 01 42
Store Register A (C9H) at 4201H, byte 01H of the system information sector.
534E
GOSUB to 4763H (WRSECT) to write the sector at Register Pair HL (4200H) back to cylinder Register D, sector Register E of drive Register C.
5351
If the NZ FLAG is set (the write failed), JUMP to 538FH to report the error in Register A.
5353
LD DE,53EDH 11 ED 53
Point Register Pair DE to 53EDH, the file control block that holds CONFIG/SYS.CCC:d.
5356
GOSUB to 4424H (@OPEN) to open the file at Register Pair DE: the NZ FLAG when it is not there. No record of the file is read.
5359
If the NZ FLAG is set (no CONFIG/SYS), JUMP to 5396H to display No user configuration found.
535B
GOSUB to 442CH (@KILL) to delete the open file at Register Pair DE.
535E
If the NZ FLAG is set (it could not be deleted), JUMP to 538FH to report the error in Register A.
5360
LD HL,5447H 21 47 54
Point Register Pair HL to 5447H, the message User configuration deleted.
5363
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.

5366H - The Exit

5366H loads Register Pair HL with the Stack Pointer that 5200H stored in its operand, and 5369H loads the Stack Pointer with 0000H, the operand that nothing changes: the CALL at 536CH and the RETs below use the stack at 0000H, so their return address is read from 0000H-0001H, the first bytes of the ROM (F3H AFH). The error paths (538FH, 5396H, 539AH) come to 5369H with Register Pair HL = their own value.

5366
LD HL,0000H 21 00 00
Load Register Pair HL with the operand at 5367H-5368H: the Stack Pointer at entry, stored there by 5200H (0000H in the file).
5369
LD SP,0000H 31 00 00
Load the Stack Pointer with the operand at 536AH-536BH, 0000H: no instruction of the member stores into it.
536C
GOSUB to 53D6H to resume the JCL job paused at 5204H, if one was running.
536F
LD A,H 7C
Copy Register H into Register A, for the test of Register Pair HL.
5370
OR L B5
OR Register L into Register A: the Z FLAG only when Register Pair HL is 0000H.
5371
RET Z C8
RETurn if the Z FLAG is set, to the address taken from the stack.
5372
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5375
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs (53D6H has put it back).
5377
RET Z C8
RETurn if the Z FLAG is set (no JCL job), to the address taken from the stack.
5378
A JCL job runs: JUMP to 4030H (@ABORT) so that the job ends.

537BH - Read the System Information Sector; Write One Byte

537BH reads cylinder 0, sector 2 of the drive (the operand at 5382H) into 4200H. 5389H writes 02H and 538BH the byte in Register A to the file at Register Pair DE through the ROM's @PUT (001BH). An error is reported through @ERROR (538FH) and ends the command at 5369H.

537B
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, to receive the sector.
537E
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2, the system information sector.
5381
LD C,00H 0E 00
Load Register C with the drive, the operand at 5382H stored by 5219H (00H in the file).
5383
GOSUB to 4777H (RDSECT) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL: the NZ FLAG on failure.
5386
If the NZ FLAG is set (the sector could not be read), JUMP to 538FH to report the error in Register A.
5388
RET C9
RETurn with the sector at 4200H and Register Pairs DE and HL and Register C set for the write back.
5389
LD A,02H 3E 02
Load Register A with 02H, the type and the length of the transfer record (52BBH, 52BEH).
538B
GOSUB to the ROM at 001BH (@PUT) to send the byte in Register A to the file whose control block is at Register Pair DE: the Z FLAG on success.
538E
RET Z C8
RETurn if the Z FLAG is set (the byte was written).
538F
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.
5391
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5394
JUMP to 5369H to end the command (Register Pair HL holds no set value here).
5396
LD HL,5462H 21 62 54
Point Register Pair HL to 5462H, the message No user configuration found.
5399
LD IX,547EH DD 21 7E 54
Load Index Register IX with 547EH: no use when run from 5396H. Entered at 539AH (from 520DH and 5215H) the bytes 21H 7EH 54H are LD HL,547EH, the message Can't -- Valid only at LDOS command level.
539D
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
53A0
JUMP to 5369H to end the command with Register Pair HL at the message.

53A2H - Pause and Resume a JCL Job

53A2H keeps SFLAG$ (430FH) in the operand at 53D7H. When bit 5 is set (a JCL job runs) it clears it, copies the six bytes saved at 4065H-406AH (the @EXIT and @ABORT that were in force before the job) back to 402DH-4032H, puts the keyboard driver saved at 43BEH-43BFH (KIJCL$) back into the keyboard's device control block (keeping the job's driver at 53E6H) and sends the keyboard driver a control request. 53D6H undoes this when the kept SFLAG$ had bit 5 set: SFLAG$ back, the six bytes at 406BH-4070H (the job's own stubs, which SYS11/SYS copies from there too, its 4E33H) to 402DH-4032H, and the job's keyboard driver back to 4016H-4017H.

53A2
PUSH HL E5
Save Register Pair HL (the drive and the switch) to the stack.
53A3
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
53A6
LD A,(HL) 7E
Fetch SFLAG$ at Register Pair HL into Register A.
53A7
LD (53D7H),A 32 D7 53
Store Register A (SFLAG$ as it is now) at 53D7H, the operand of the LD A at 53D6H.
53AA
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
53AC
If the Z FLAG is set (no JCL job), JUMP to 53CBH to return.
53AE
RES 5,(HL) CB AE
Clear bit 5 of SFLAG$ at Register Pair HL: no JCL job while SYSGEN runs.
53B0
LD HL,4065H 21 65 40
Point Register Pair HL to 4065H, where the @EXIT and @ABORT in force before the job were saved.
53B3
GOSUB to 53CDH to copy the six bytes at Register Pair HL to 402DH-4032H.
53B6
LD HL,(43BEH) 2A BE 43
Fetch KIJCL$ from 43BEH-43BFH into Register Pair HL: the keyboard driver the job replaced.
53B9
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = that keyboard driver.
53BA
LD HL,(4016H) 2A 16 40
Fetch the keyboard's driver address now in force from 4016H-4017H (KIDCB$ +01H-+02H) into Register Pair HL: the job's driver.
53BD
LD (53E6H),HL 22 E6 53
Store Register Pair HL (the job's keyboard driver) at 53E6H, the operand of the LD HL at 53E5H, for the resume.
53C0
LD (4016H),DE ED 53 16 40
Store Register Pair DE (the keyboard driver before the job) at 4016H-4017H.
53C4
LD DE,4015H 11 15 40
Point Register Pair DE to 4015H, KIDCB$, the keyboard's device control block.
53C7
XOR A AF
Clear Register A (XOR A): the byte of the control request.
53C8
GOSUB to the ROM at 0023H (@CTL) to send a control request with the byte in Register A (00H) to the device at Register Pair DE, the keyboard.
53CB
POP HL E1
Restore Register Pair HL (the drive and the switch) from the stack.
53CC
RET C9
RETurn to the caller with the JCL job paused (or nothing changed).
53CD
LD DE,402DH 11 2D 40
Point Register Pair DE to 402DH, @EXIT, followed by @ABORT at 4030H.
53D0
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six bytes of @EXIT and @ABORT.
53D3
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: six bytes from Register Pair HL to 402DH-4032H.
53D5
RET C9
RETurn to the caller with the six bytes copied.
53D6
LD A,00H 3E 00
Load Register A with SFLAG$ as 53A7H kept it, the operand at 53D7H (00H in the file).
53D8
BIT 5,A CB 6F
Test bit 5 of Register A: set when a JCL job was running at entry.
53DA
RET Z C8
RETurn if the Z FLAG is set (no job was paused).
53DB
LD (430FH),A 32 0F 43
Store Register A at 430FH: SFLAG$ is put back, bit 5 set again.
53DE
PUSH HL E5
Save Register Pair HL (the result) to the stack.
53DF
LD HL,406BH 21 6B 40
Point Register Pair HL to 406BH, the six bytes of the job's @EXIT and @ABORT stubs.
53E2
GOSUB to 53CDH to copy the six bytes at Register Pair HL to 402DH-4032H.
53E5
LD HL,0000H 21 00 00
Load Register Pair HL with the job's keyboard driver, the operand at 53E6H-53E7H stored by 53BDH (0000H in the file).
53E8
LD (4016H),HL 22 16 40
Store Register Pair HL at 4016H-4017H: the job's keyboard driver is back in KIDCB$.
53EB
POP HL E1
Restore Register Pair HL (the result) from the stack.
53EC
RET C9
RETurn to the caller with the JCL job resumed.

53EDH - SYSGEN Data: The File Control Block, Messages and the Table of Cells

The file control block of CONFIG/SYS (32 bytes, only its first 17 in the file), the messages, the Attrib command, the banner and its blank, and the table of resident cells that 5284H saves into the file.

53ED-53FB
DEFM "CONFIG/SYS.CCC:" 43 4F 4E 46 49 47 2F 53 59 53 2E 43 43 43 3A
The file control block of CONFIG/SYS, +00H-+0EH: the file specification CONFIG/SYS with the password CCC, then the colon of the drive.
53FC
DEFM "0" 30
+0FH: the drive's digit, 0 in the file, the digit of Register H stored by 521EH.
53FD
DEFB 00H 00
+10H: 00H, the end of the file specification.
53FE-540C
DEFS 15
Not in the file: +11H-+1FH of the file control block, filled by @INIT.
540D-5424
DEFM "User configuration built" 55 73 65 72 20 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 62 75 69 6C 74
The message of 52DCH: CONFIG/SYS was written and the boot flag set.
5425
DEFB 0DH 0D
0DH, the end of the message User configuration built, displayed with it.
5426-542C
DEFM "Attrib " 41 74 74 72 69 62 20
The command run through @CMNDI at 52E8H; 5242H also takes the six letters CONFIG at 542DH as the name of the name record.
542D-543B
DEFM "CONFIG/SYS.CCC:" 43 4F 4E 46 49 47 2F 53 59 53 2E 43 43 43 3A
The file specification in the Attrib command, up to the colon.
543C
DEFM "0" 30
The drive's digit in the Attrib command, 0 in the file, stored by 5221H.
543D-5445
DEFM " (I,P=RE)" 20 28 49 2C 50 3D 52 45 29
The parameters of the Attrib command: I, invisible, and P=RE, protection level READ.
5446
DEFB 0DH 0D
0DH, the end of the Attrib command line run at 52E8H.
5447-5460
DEFM "User configuration deleted" 55 73 65 72 20 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 64 65 6C 65 74 65 64
The message of 5360H: the file CONFIG/SYS was killed.
5461
DEFB 0DH 0D
0DH, the end of the message User configuration deleted, displayed with it.
5462-547C
DEFM "No user configuration found" 4E 6F 20 75 73 65 72 20 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 66 6F 75 6E 64
The message of 5396H: SYSGEN=OFF found no CONFIG/SYS to kill.
547D
DEFB 0DH 0D
0DH, the end of the message No user configuration found, displayed with it.
547E-54A6
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
The message of 539AH: a program owns @EXIT or ran the command.
54A7
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS command level, displayed with it.
54A8-54BA
DEFM "*** CONFIGURING ***" 2A 2A 2A 20 43 4F 4E 46 49 47 55 52 49 4E 47 20 2A 2A 2A
The banner of 5251H, loaded to 3F96H at the start of the file: CONFIGURING with three asterisks each side.
54BB-54CD
DEFM " " 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19 spaces, loaded to 3F96H at the end of the file (52B5H) to clear the banner.
54CE-54D1
DEFW 0002H, 4049H 02 00 49 40
Table entry 1: 2 bytes at 4049H, HIGH$, the top of free memory.
54D2-54D5
DEFW 0018H, 4015H 18 00 15 40
Table entry 2: 24 bytes at 4015H, the device control blocks of the keyboard, the video and the printer (4015H-402CH).
54D6-54D9
DEFW 0003H, 4439H 03 00 39 44
Table entry 3: 3 bytes at 4439H, the JP of @WRITE and its address (VERIFY).
54DA-54DD
DEFW 0018H, 4500H 18 00 00 45
Table entry 4: 24 bytes at 4500H, the task table, slots 0-11.
54DE-54E1
DEFW 0003H, 4300H 03 00 00 43
Table entry 5: 3 bytes at 4300H, the @KITSK hook.
54E2-54E5
DEFW 0003H, 430FH 03 00 0F 43
Table entry 6: 3 bytes at 430FH, SFLAG$ and the word at 4310H-4311H.
54E6-54E9
DEFW 0008H, 43B8H 08 00 B8 43
Table entry 7: 8 bytes at 43B8H, KISV$, DOSV$, PRSV$ and KIJCL$.
54EA-54ED
DEFW 0003H, 4315H 03 00 15 43
Table entry 8: 3 bytes at 4315H, the BREAK trap switch and its address.
54EE-54F1
DEFW 0001H, 441FH 01 00 1F 44
Table entry 9: 1 byte at 441FH, DFLAG$, the device flags.
54F2-54F5
DEFW 0003H, 4303H 03 00 03 43
Table entry 10: 3 bytes at 4303H, the @ICNFG hook.
54F6-54F9
DEFW 0002H, 4310H 02 00 10 43
Table entry 11: 2 bytes at 4310H, the address DEBUG calls for an unknown command (also in entry 6).
54FA-54FD
DEFW 001AH, 404BH 1A 00 4B 40
Table entry 12: 26 bytes at 404BH, INTIM$, INTMSK$ and the eight interrupt vectors (404BH-4064H).
54FE-5501
DEFW 0002H, 4BCFH 02 00 CF 4B
Table entry 13: 2 bytes at 4BCFH, the operand of the jump the supervisor dispatcher takes for a request below 80H.
5502-5505
DEFW 0003H, 4BDEH 03 00 DE 4B
Table entry 14: 3 bytes at 4BDEH, the dispatcher's CALL of the overlay loader and its address (4BDFH-4BE0H).
5506-5509
DEFW 0010H, 4DF0H 10 00 F0 4D
Table entry 15: 16 bytes at 4DF0H, the base cells of the resident modules (4DF0H-4DFFH).
550A-550D
DEFW 0008H, 43B0H 08 00 B0 43
Table entry 16: 8 bytes at 43B0H-43B7H, eight bytes before KISV$.
550E-5511
DEFW 0001H, 4423H 01 00 23 44
Table entry 17: 1 byte at 4423H, KFLAG$, the keyboard flags.
5512-5515
DEFW 0040H, 43C0H 40 00 C0 43
Table entry 18: 64 bytes at 43C0H, the device control blocks JL, SI, SO and the five spare blocks (43C0H-43FFH).
5516-5519
DEFW 0003H, 45DAH 03 00 DA 45
Table entry 19: 3 bytes at 45DAH, the clock task's return after midnight and the two bytes after it.
551A-551D
DEFW 0001H, 46FDH 01 00 FD 46
Table entry 20: 1 byte at 46FDH, the byte the floppy driver calls (SMOOTH).
551E-551F
DEFW 0000H 00 00
0000H, the end of the table of cells that 5284H walks.
5520-552F
DEFB 00H x 16 00 x 16
16 bytes of 00H after the table, the end of the member; no code reads them.

5200H - Member 6 (FREE): Entry and the Text

The FREE command (library member 22H), loaded at 5200H-55A3H. FREE alone shows one line for each drive that is ready: Drive :d, the diskette's name and date, the cylinders, density and heads, the free and the total space in kilobytes and the free and the total directory records (template at 5512H). FREE :d clears the screen and shows that drive's line followed by a map of its granules, six cylinders to a line: x a granule in use, a period a free one, an asterisk one locked out, D the directory cylinder. (P) sends every line to the printer as well, with no pause at the end of a page. The line is built in the 64 byte buffer at 555AH-5599H (not in the file), which the 03H at 559AH ends.

5200
LD (5504H),SP ED 73 04 55
Store the Stack Pointer at 5504H, the operand of the LD SP at 5503H: the exit puts the stack back to this depth. 520CH comes back here for every space, which stores it again.
5204
LD A,(HL) 7E
Fetch the character at Register Pair HL (the text after FREE) into Register A.
5205
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the text.
5207
If the Z FLAG is set (FREE alone), JUMP to 5228H to show the line of every drive.
5209
INC HL 23
INCrement Register Pair HL past the character.
520A
CP 20H FE 20
Compare Register A against 20H, a space between FREE and its text.
520C
If the Z FLAG is set (a space), JUMP to 5200H to look at the next character.
520E
CP 3AH FE 3A
Compare Register A against 3AH, the colon of a drive specification.
5210
PUSH AF F5
Save Register Pair AF to the stack: the Z FLAG says whether a drive was given, for 5225H.
5211
If the NZ FLAG is set (no colon), JUMP to 521BH.
5213
LD A,(HL) 7E
Fetch the drive's digit after the colon at Register Pair HL into Register A.
5214
SUB 30H D6 30
SUBtract 30H from Register A: the drive number (a character that is not a digit gives a value that 524FH refuses).
5216
INC HL 23
INCrement Register Pair HL past the drive's digit.
5217
INC HL 23
INCrement Register Pair HL past the character after the digit (the DEC below steps back onto it).
5218
LD (52C6H),A 32 C6 52
Store Register A (the drive number) at 52C6H, the operand of the LD C at 52C5H.
521B
DEC HL 2B
DECrement Register Pair HL back to the character the parameters start from.
521C
LD DE,559BH 11 9B 55
Point Register Pair DE to 559BH, the parameter table of FREE (P).
521F
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE: P stores FFFFH at 53FCH. The NZ FLAG for a bad parameter.
5222
If the NZ FLAG is set (a bad parameter), JUMP to 54F4H to report error 2CH.
5225
POP AF F1
Restore Register Pair AF from the stack: the Z FLAG when a drive was given.
5226
If the Z FLAG is set (FREE :d), JUMP to 524BH for the map of that drive.

5228H - FREE: One Line for Each Drive

Drives 0 to 7 are checked with @CKDRV in turn and the line of each one that is ready is shown (52C7H). With P a space and ENTER go to the printer first.

5228
LD C,00H 0E 00
Load Register C with 00H, drive 0, the first drive.
522A
LD A,(53FCH) 3A FC 53
Fetch the low byte of the P parameter from 53FCH into Register A: FFH when P was given, else 00H.
522D
OR A B7
Set the flags from Register A (OR A): the Z FLAG when P was not given.
522E
If the Z FLAG is set (no P), JUMP to 523AH to start with drive 0.
5230
LD A,20H 3E 20
Load Register A with 20H, a space for the printer.
5232
GOSUB to the ROM at 003BH (@PRT) to send the character in Register A to the printer.
5235
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to start the printer on a new line.
5237
GOSUB to the ROM at 003BH (@PRT) to send the character in Register A to the printer.
523A
PUSH BC C5
Save Register Pair BC (Register C, the drive) to the stack.
523B
GOSUB to 44B8H (@CKDRV) to check drive Register C: the Z FLAG when it is there and ready.
523E
If the Z FLAG is set (ready), GOSUB to 52C7H to build and show the line of drive Register C.
5241
POP BC C1
Restore Register Pair BC (Register C, the drive) from the stack.
5242
INC C 0C
INCrement Register C to the next drive to be checked.
5243
LD A,C 79
Copy Register C (the next drive) into Register A.
5244
CP 08H FE 08
Compare Register A against 08H: the Z FLAG after drive 7.
5246
If the NZ FLAG is set (drives left), LOOP BACK to 523AH.
5248
JUMP to 5500H to end the command with Register Pair HL = 0000H.

524BH - FREE :d: The Granule Map

The drive must be 0-7 and ready, else error 20H. 53DBH clears the screen and shows the drive's line and a line of dashes; then each line of the map gets its cylinders' label (the first from the template " 0- 5" at 5553H) and, for each of six cylinders, one character per granule in a column of nine (D for every granule of the directory cylinder).

524B
LD A,(52C6H) 3A C6 52
Fetch the drive number from 52C6H (stored by 5218H) into Register A.
524E
LD C,A 4F
Copy Register A (the drive number) into Register C for @CKDRV.
524F
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG for a drive number of 8 or more.
5251
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number). LD does not change the flags.
5253
If the NO CARRY FLAG is set (no such drive), JUMP to 54F6H to report error 20H.
5256
GOSUB to 44B8H (@CKDRV) to check drive Register C: the Z FLAG when it is there and ready.
5259
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number). LD does not change the flags.
525B
If the NZ FLAG is set (not ready), JUMP to 54F6H to report error 20H.
525E
GOSUB to 53DBH to clear the screen, show the drive's line and a line of dashes, and fill the line buffer with spaces.
5261
LD HL,5553H 21 53 55
Point Register Pair HL to 5553H, the label of the first map line, " 0- 5" (cylinders 0 to 5).
5264
LD DE,555AH 11 5A 55
Point Register Pair DE to 555AH, the line buffer.
5267
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the seven characters of the label.
526A
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the label goes to 555AH-5560H.
526C
LD IX,5564H DD 21 64 55
Point Index Register IX to 5564H, the first column of the map in the line buffer (after the label and three spaces).
5270
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, byte 00H of the granule allocation table that 52C7H read: the byte of cylinder 0.
5273
LD B,06H 06 06
Load Register B with 06H, the cylinders on a line of the map.
5275
LD C,FFH 0E FF
Load Register C with FFH, so that the first INC makes it cylinder 0.
5277
INC C 0C
INCrement Register C, the cylinder now put on the line.
5278
LD A,C 79
Copy Register C (the cylinder) into Register A.
5279
CP (IY+09H) FD BE 09
Compare Register A against the directory cylinder at Index Register IY +09H (the drive code table): the Z FLAG for the directory cylinder.
527C
LD A,00H 3E 00
Load Register A with the granules on a cylinder, the operand at 527DH stored by 534BH (00H in the file). LD does not change the flags.
527E
PUSH AF F5
Save Register Pair AF (the granules and the flags) to the stack.
527F
If the Z FLAG is set (the directory cylinder), GOSUB to 54A9H to write Register A characters D at Index Register IX.
5282
POP AF F1
Restore Register Pair AF (the granules and the flags) from the stack.
5283
If the NZ FLAG is set (any other cylinder), GOSUB to 5478H to write a character for each of Register A granules from the table byte at Register Pair HL.
5286
INC HL 23
INCrement Register Pair HL to the table byte of the next cylinder.
5287
LD A,(IY+06H) FD 7E 06
Fetch the highest cylinder from Index Register IY +06H into Register A.
528A
CP C B9
Compare Register A against Register C (the cylinder just shown): the Z FLAG when it was the last.
528B
If the Z FLAG is set (the last cylinder), JUMP to 52B0H to show the last line.
528D
LD A,(527DH) 3A 7D 52
Fetch the granules on a cylinder from 527DH into Register A.
5290
NEG ED 44
Negate Register A (NEG): Register A = minus the granules on a cylinder.
5292
ADD A,09H C6 09
ADD 09H to Register A: 9 less the granules, the spaces after them in the column of nine.
5294
LD D,00H 16 00
Load Register D with 00H, the high byte of the step.
5296
LD E,A 5F
Copy Register A (the spaces) into Register E: Register Pair DE = the step to the next column.
5297
ADD IX,DE DD 19
ADD Register Pair DE to Index Register IX: the start of the next cylinder's column.
5299
DECrement Register B and LOOP BACK to 5277H until six cylinders are on the line.
529B
PUSH HL E5
Save Register Pair HL (the next table byte) to the stack.
529C
PUSH BC C5
Save Register Pair BC (Register C, the last cylinder shown) to the stack.
529D
GOSUB to 53F5H to show the line buffer (and print it, or count the line on the page).
52A0
GOSUB to 53E9H to fill the line buffer with spaces again.
52A3
POP BC C1
Restore Register Pair BC (Register C, the last cylinder shown) from the stack.
52A4
LD IX,5564H DD 21 64 55
Point Index Register IX to 5564H, the first column of the map.
52A8
GOSUB to 54B5H to write the label of the next line (the cylinders after Register C) at 555AH.
52AB
POP HL E1
Restore Register Pair HL (the next table byte) from the stack.
52AC
LD B,06H 06 06
Load Register B with 06H, the cylinders on a line.
52AE
LOOP BACK to 5277H for the next line of the map.
52B0
GOSUB to 53F5H to show the last line of the map.
52B3
LD A,(53C7H) 3A C7 53
Fetch the lines left on the page, the operand at 53C7H, into Register A.
52B6
CP 02H FE 02
Compare Register A against 02H: the CARRY FLAG when fewer than two lines are left.
52B8
If the NO CARRY FLAG is set (two lines or more left), JUMP to 52BDH.
52BA
GOSUB to the ROM at 0049H (@KEY) to wait for a key: the page is full.
52BD
LD (HL),0DH 36 0D
Store 0DH, ENTER, at Register Pair HL (555AH, where 53F5H left it): the line buffer becomes an empty line.
52BF
GOSUB to 4467H (@DSPLY) to display the empty line at Register Pair HL.
52C2
JUMP to 5500H to end the command with Register Pair HL = 0000H.

52C5H - Build and Show the Line of a Drive

52C5H takes the drive from its operand (the drive of FREE :d), 52C7H from Register C. The granule allocation table is read into 4200H and the template at 5512H filled: the drive's digit, the free granules as kilobytes (5409H), the cylinders, the density (S, D, or H for a rigid drive) and the heads, the total size, the free and the total directory records (from the hash index table, read into 5600H), and the diskette's name and date from the table (42D0H-42DFH). Index Register IY is left at the drive's code table.

52C5
LD C,FFH 0E FF
Load Register C with the drive of FREE :d, the operand at 52C6H stored by 5218H (FFH in the file).
52C7
LD A,C 79
Copy Register C (the drive number) into Register A.
52C8
ADD A,30H C6 30
ADD 30H to Register A: the character of the drive's digit.
52CA
PUSH BC C5
Save Register Pair BC (Register C, the drive) to the stack, for the POP at 5391H.
52CB
LD (5519H),A 32 19 55
Store Register A (the digit) at 5519H, the d of Drive :d in the template.
52CE
GOSUB to 478FH (GETDCT) to point Index Register IY at the drive code table of drive Register C.
52D1
LD D,(IY+09H) FD 56 09
Load Register D with the directory cylinder from Index Register IY +09H.
52D4
LD E,00H 1E 00
Load Register E with 00H, sector 0: the granule allocation table.
52D6
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, to receive the sector.
52D9
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
52DC
If the NZ FLAG is set (it could not be read), JUMP to 54F6H to report the error in Register A.
52DF
LD A,(IY+08H) FD 7E 08
Fetch byte +08H of the drive code table at Index Register IY +08H into Register A: bits 4-0 the sectors in a granule less one.
52E2
AND 1FH E6 1F
Keep bits 4-0 of Register A (AND 1FH): the sectors in a granule less one.
52E4
INC A 3C
INCrement Register A: the sectors in a granule.
52E5
LD (540EH),A 32 0E 54
Store Register A (the sectors in a granule) at 540EH, the operand of the LD A at 540DH.
52E8
LD D,L 55
Copy Register L (00H, from 4200H) into Register D.
52E9
LD E,L 5D
Copy Register L (00H) into Register E: Register Pair DE = 0000H, the count of free granules.
52EA
LD B,(IY+06H) FD 46 06
Load Register B with the highest cylinder from Index Register IY +06H.
52ED
INC B 04
INCrement Register B: the number of cylinders, the count of the loop.
52EE
PUSH BC C5
Save Register Pair BC (Register B, the cylinders; Register C, the drive) to the stack, for the POP at 5305H.
52EF
LD A,(HL) 7E
Fetch the table byte of the cylinder at Register Pair HL into Register A: a bit set for each granule in use (and for granules the cylinder does not have).
52F0
SCF 37
Set the CARRY FLAG (SCF), so that the rotate brings a 1 into bit 7.
52F1
RRA 1F
Rotate Register A right through the CARRY FLAG (RRA): bit 0, the next granule's bit, goes to the CARRY FLAG and a 1 comes in at the top.
52F2
If the CARRY FLAG is set (the granule is in use), JUMP to 52F5H.
52F4
INC DE 13
INCrement Register Pair DE, the count of free granules.
52F5
CP FFH FE FF
Compare Register A against FFH: the Z FLAG when no 0 bit is left in the byte.
52F7
If the NZ FLAG is set (more 0 bits), LOOP BACK to 52F0H.
52F9
INC L 2C
INCrement Register L to the table byte of the next cylinder.
52FA
DECrement Register B and LOOP BACK to 52EFH until every cylinder is counted.
52FC
LD HL,5538H 21 38 55
Point Register Pair HL to 5538H, the sssss of Free= in the template.
52FF
GOSUB to 5409H to write Register Pair DE granules as kilobytes in five places at Register Pair HL; Register A comes back as the digit of the tenths.
5302
LD (553EH),A 32 3E 55
Store Register A (the tenths) at 553EH, after the point of the free space.
5305
POP AF F1
Restore Register Pair AF from the stack: Register A = the number of cylinders pushed in Register B at 52EEH.
5306
LD L,A 6F
Copy Register A (the cylinders) into Register L.
5307
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the number of cylinders.
5309
PUSH HL E5
Save Register Pair HL (the cylinders) to the stack, for the total size at 533AH.
530A
LD DE,552DH 11 2D 55
Point Register Pair DE to 552DH, the cyl of the template.
530D
GOSUB to 5439H to write Register Pair HL (the cylinders) in three places at Register Pair DE.
5310
LD HL,3148H 21 48 31
Load Register Pair HL with 3148H: Register L = 48H (H, a rigid drive) and Register H = 31H (the digit 1, one head).
5313
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of byte +03H of the drive code table at Index Register IY +03H: set for a rigid drive.
5317
If the Z FLAG is set (a floppy drive), JUMP to 5326H.
5319
LD A,(IY+07H) FD 7E 07
Fetch byte +07H of the drive code table from Index Register IY +07H into Register A: bits 7-5 the heads less one.
531C
RLCA 07
Rotate Register A left (RLCA): bit 7 to bit 0.
531D
RLCA 07
Rotate Register A left again (RLCA): bits 7-5 move on towards bits 2-0.
531E
RLCA 07
Rotate Register A left a third time (RLCA): bits 7-5 are now bits 2-0.
531F
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the heads less one.
5321
ADD A,31H C6 31
ADD 31H to Register A: the digit of the number of heads.
5323
LD H,A 67
Copy Register A (the heads' digit) into Register H.
5324
JUMP to 5337H to store the density and the heads.
5326
LD L,44H 2E 44
Load Register L with 44H, the letter D, double density.
5328
BIT 6,(IY+03H) FD CB 03 76
Test bit 6 of byte +03H at Index Register IY +03H: set for double density.
532C
If the NZ FLAG is set (double density), JUMP to 5330H.
532E
LD L,53H 2E 53
Load Register L with 53H, the letter S, single density.
5330
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of byte +04H at Index Register IY +04H: set for a diskette with two sides.
5334
If the Z FLAG is set (one side), JUMP to 5337H.
5336
INC H 24
INCrement Register H: the digit 2, two heads.
5337
LD (5530H),HL 22 30 55
Store Register Pair HL at 5530H-5531H: Register L (S, D or H) at 5530H and Register H (the heads' digit) at 5531H.
533A
POP HL E1
Restore Register Pair HL from the stack: the number of cylinders.
533B
LD A,(IY+08H) FD 7E 08
Fetch byte +08H of the drive code table from Index Register IY +08H into Register A: bits 7-5 the granules on a track less one.
533E
AND E0H E6 E0
Keep bits 7-5 of Register A (AND E0H): the granules on a track less one.
5340
RLCA 07
Rotate Register A left (RLCA): bit 7 goes round to bit 0.
5341
RLCA 07
Rotate Register A left again (RLCA): bits 7-5 move on towards bits 2-0.
5342
RLCA 07
Rotate Register A left a third time (RLCA): the granules on a track less one, in bits 2-0.
5343
INC A 3C
INCrement Register A: the granules on a track.
5344
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of byte +04H at Index Register IY +04H: set for two sides.
5348
If the Z FLAG is set (one side), JUMP to 534BH.
534A
ADD A,A 87
ADD Register A to itself: two tracks to a cylinder, twice the granules.
534B
LD (527DH),A 32 7D 52
Store Register A (the granules on a cylinder) at 527DH, the operand of the LD A at 527CH, for the map.
534E
PUSH AF F5
Save Register Pair AF (Register A, the granules on a cylinder) to the stack, for the POP at 535DH.
534F
GOSUB to 44C1H (@MULT) to multiply Register Pair HL (the cylinders) by Register A (the granules on a cylinder): the product's high 16 bits in Register Pair HL, its low 8 bits in Register A.
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.
5354
LD HL,5540H 21 40 55
Point Register Pair HL to 5540H, the sssss of the total space in the template.
5357
GOSUB to 5409H to write Register Pair DE granules as kilobytes in five places at Register Pair HL; Register A comes back as the digit of the tenths.
535A
LD (5546H),A 32 46 55
Store Register A (the tenths) at 5546H, after the point of the total space.
535D
POP BC C1
Restore Register Pair BC from the stack: Register B = the granules on a cylinder.
535E
LD A,(540EH) 3A 0E 54
Fetch the sectors in a granule from 540EH 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), the sum of the sectors on 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.
5366
LD HL,0100H 21 00 01
Load Register Pair HL with 0100H, 256 directory records, the most there can be.
5369
SUB 02H D6 02
SUBtract 02H from Register A: the sectors of the directory cylinder less the allocation table and the hash index table.
536B
CP 20H FE 20
Compare Register A against 20H: the NO CARRY FLAG for 32 directory sectors or more (256 records).
536D
If the NO CARRY FLAG is set, JUMP to 5378H with Register Pair HL = 256.
536F
SLA A CB 27
Shift Register A left (SLA): twice the directory sectors.
5371
SLA A CB 27
Shift Register A left (SLA): four times the directory sectors.
5373
SLA A CB 27
Shift Register A left (SLA): eight times, eight records of 32 bytes to a sector.
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 (53A3H),HL 22 A3 53
Store Register Pair HL (the directory records) at 53A3H, the operand of the LD DE at 53A2H.
537B
LD DE,554FH 11 4F 55
Point Register Pair DE to 554FH, the total of Fi=nnn/nnn in the template.
537E
GOSUB to 5439H to write Register Pair HL (the directory records) in three places at Register Pair DE.
5381
LD HL,42D0H 21 D0 42
Point Register Pair HL to 42D0H, byte D0H of the granule allocation table: the diskette's name.
5384
LD DE,551BH 11 1B 55
Point Register Pair DE to 551BH, packname in the template.
5387
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name.
538A
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the name to 551BH-5522H.
538C
INC DE 13
INCrement Register Pair DE past the space at 5523H.
538D
LD C,08H 0E 08
Load Register C with 08H: Register Pair BC = 0008H (Register B is 00H after the LDIR), the eight characters of the date.
538F
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the date (42D8H-42DFH) to 5524H-552BH.
5391
POP BC C1
Restore Register Pair BC from the stack: Register C = the drive (pushed at 52CAH).
5392
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
5395
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder: the hash index table.
5397
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, above the member, to receive the sector.
539A
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
539D
LD A,16H 3E 16
Load Register A with 16H, error 22 (HIT read error). LD does not change the flags.
539F
If the NZ FLAG is set (it could not be read), JUMP to 54F6H to report error 16H.
53A2
LD DE,0000H 11 00 00
Load Register Pair DE with the number of directory records, the operand at 53A3H-53A4H stored by 5378H (0000H in the file).
53A5
DEC DE 1B
DECrement Register Pair DE for this slot of the hash index table; a free slot gives it back below.
53A6
LD A,(42CDH) 3A CD 42
Fetch the configuration byte of the diskette from 42CDH (allocation table byte CDH) into Register A.
53A9
RLCA 07
Rotate Register A left (RLCA): bit 7 goes to the CARRY FLAG.
53AA
If the CARRY FLAG is set (bit 7 set), JUMP to 53B1H: every slot may be free.
53AC
LD A,L 7D
Copy Register L (the slot number) into Register A.
53AD
AND D8H E6 D8
Keep bits 7, 6, 4 and 3 of Register A (AND D8H): the Z FLAG for slots 00H-07H and 20H-27H, the records of the system files.
53AF
If the Z FLAG is set (a system file's slot), JUMP to 53B6H: it is not counted as free.
53B1
LD A,(HL) 7E
Fetch the slot of the hash index table at Register Pair HL into Register A: 00H for a free record.
53B2
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for a record in use.
53B3
If the NZ FLAG is set (in use), JUMP to 53B6H.
53B5
INC DE 13
INCrement Register Pair DE: the free slot is given back.
53B6
INC L 2C
INCrement Register L to the next slot of the hash index table.
53B7
If the NZ FLAG is set (Register L has not passed FFH), LOOP BACK to 53A5H: 256 slots in all. Register Pair DE ends as the records less the slots in use (a slot beyond the directory's sectors holds 00H and evens out its DEC).
53B9
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the free directory records.
53BA
LD DE,554BH 11 4B 55
Point Register Pair DE to 554BH, the first nnn of Fi=nnn/nnn in the template.
53BD
GOSUB to 5439H to write Register Pair HL (the free records) in three places at Register Pair DE.
53C0
LD HL,5512H 21 12 55
Point Register Pair HL to 5512H, the line of the drive, ended by the 03H at 5552H.
53C3
JUMP to 53F8H to show the line (and print it, or count it on the page).

53C6H - The Page: Count the Lines, Pause and Start Again

53C6H is reached after a line has been shown on the screen without P. The operand at 53C7H counts the lines left on a page (15). When it runs out it is set to 15 again and, unless a JCL job runs, the program waits for a key (0049H), clears the screen and shows the drive's line and a line of dashes again (53DBH) before the next line of the map.

53C6
LD A,0FH 3E 0F
Load Register A with the lines left on the page, the operand at 53C7H (0FH, 15, in the file).
53C8
DEC A 3D
DECrement Register A: one line less is left on the page.
53C9
LD (53C7H),A 32 C7 53
Store Register A at 53C7H, the operand above.
53CC
RET NZ C0
RETurn if the NZ FLAG is set: lines are left on the page.
53CD
LD A,0FH 3E 0F
Load Register A with 0FH, 15 lines, a new page.
53CF
LD (53C7H),A 32 C7 53
Store Register A (15 lines) at 53C7H, the operand of the LD A at 53C6H.
53D2
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
53D5
AND 20H E6 20
Keep bit 5 of Register A (AND 20H): set while a JCL job runs.
53D7
RET NZ C0
RETurn if the NZ FLAG is set (a JCL job runs): no pause.
53D8
GOSUB to the ROM at 0049H (@KEY) to wait for a key before the screen is cleared.
53DB
GOSUB to the ROM at 01C9H to clear the screen and put the cursor at the top left. 525EH comes here at the start of the map.
53DE
GOSUB to 52C5H to build and show the line of the drive of FREE :d.
53E1
LD A,2DH 3E 2D
Load Register A with 2DH, a dash, for the line under the drive line.
53E3
GOSUB to 53EBH to fill the line buffer with dashes.
53E6
GOSUB to 53F5H to show the line of dashes from the line buffer.
53E9
LD A,20H 3E 20
Load Register A with 20H, a space, to clear the line buffer.
53EB
LD HL,555AH 21 5A 55
Point Register Pair HL to 555AH, the line buffer.
53EE
LD B,40H 06 40
Load Register B with 40H, the 64 bytes of the buffer.
53F0
LD (HL),A 77
Store Register A (a dash or a space) at Register Pair HL.
53F1
INC HL 23
INCrement Register Pair HL to the next byte of the buffer.
53F2
DECrement Register B and LOOP BACK to 53F0H until the 64 bytes are filled.
53F4
RET C9
RETurn with Register Pair HL = 559AH, the 03H after the buffer.

53F5H - Show a Line, Then Print It or Count It

53F5H shows the line buffer, 53F8H the text at Register Pair HL (ended by 03H) on the video through @DSPLY. With P (FFFFH at 53FCH) the same text and an ENTER go to the printer; without P the line is counted on the page (53C6H).

53F5
LD HL,555AH 21 5A 55
Point Register Pair HL to 555AH, the line buffer.
53F8
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, up to the 03H that ends it; Register Pair HL comes back unchanged.
53FB
LD DE,0000H 11 00 00
Load Register Pair DE with the P parameter, the operand at 53FCH-53FDH: 0000H in the file, FFFFH when P was given.
53FE
INC E 1C
INCrement Register E: 00H, with the Z FLAG, only for P.
53FF
If the NZ FLAG is set (no P), JUMP to 53C6H to count the line on the page.
5401
GOSUB to 446AH (@PRINT) to send the same text at Register Pair HL to the printer.
5404
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the printed line.
5406
JUMP to the ROM at 003BH (@PRT) to send the character in Register A to the printer; its RET returns to the caller.

5409H - Granules to Kilobytes

Register Pair DE = a number of granules, Register Pair HL = where to write. The granules times the sectors in a granule (the operand at 540EH) give the sectors; a quarter of them are the kilobytes, written in five places; the two bits left over give the digit of the tenths in Register A: 0, 2, 5 or 8.

5409
LD (541EH),HL 22 1E 54
Store Register Pair HL (where to write) at 541EH, the operand of the LD DE at 541DH.
540C
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the granules.
540D
LD A,00H 3E 00
Load Register A with the sectors in a granule, the operand at 540EH stored by 52E5H (00H in the file).
540F
GOSUB to 44C1H (@MULT) to multiply Register Pair HL by Register A: the product's high 16 bits in Register Pair HL, its low 8 bits in Register A.
5412
PUSH AF F5
Save Register Pair AF (Register A, the low byte of the sectors) to the stack.
5413
LD H,L 65
Copy Register L (the middle byte of the product) into Register H.
5414
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the sectors.
5415
SRL H CB 3C
Shift Register H right (SRL): bit 0 goes to the CARRY FLAG.
5417
RR L CB 1D
Rotate Register L right through the CARRY FLAG (RR): Register Pair HL = half the sectors.
5419
SRL H CB 3C
Shift Register H right (SRL) again: bit 0 goes to the CARRY FLAG.
541B
RR L CB 1D
Rotate Register L right through the CARRY FLAG (RR): Register Pair HL = a quarter of the sectors, the kilobytes.
541D
LD DE,0000H 11 00 00
Load Register Pair DE with where to write, the operand at 541EH-541FH stored by 5409H (0000H in the file).
5420
GOSUB to 543DH to write Register Pair HL (the kilobytes) in five places at Register Pair DE.
5423
POP AF F1
Restore Register Pair AF from the stack: Register A = the low byte of the sectors.
5424
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the sectors over whole kilobytes, 0-3.
5426
LD B,A 47
Copy Register A (the quarters) into Register B.
5427
LD A,30H 3E 30
Load Register A with 30H, the digit 0. LD does not change the flags.
5429
RET Z C8
RETurn if the Z FLAG is set (no quarter), with Register A = 0.
542A
DEC B 05
DECrement Register B: the Z FLAG for one quarter.
542B
LD A,32H 3E 32
Load Register A with 32H, the digit 2. LD does not change the flags.
542D
RET Z C8
RETurn if the Z FLAG is set (one quarter), with Register A = 2.
542E
DEC B 05
DECrement Register B: the Z FLAG for two quarters.
542F
LD A,35H 3E 35
Load Register A with 35H, the digit 5. LD does not change the flags.
5431
RET Z C8
RETurn if the Z FLAG is set (two quarters), with Register A = 5.
5432
LD A,38H 3E 38
Load Register A with 38H, the digit 8, for three quarters.
5434
RET C9
RETurn with Register A = 8, the digit of three quarters.

5435H - Write a Number in Decimal

Register Pair HL = the number, Register Pair DE = where to write. 543DH writes five places, 5439H three (hundreds, tens, units) and 5435H two; leading zeros become spaces, the units are always a digit. Register A carries the character for a zero place from one call of 545DH to the next: a space until the first digit that is not 0, then 30H. No code of the member calls 5435H.

5435
LD A,20H 3E 20
Load Register A with 20H, a space for leading zeros: the entry for two places (not called).
5437
JUMP to 5451H to write the tens and the units of Register Pair HL.
5439
LD A,20H 3E 20
Load Register A with 20H, a space for leading zeros: the entry for three places.
543B
JUMP to 544BH for the hundreds, tens and units.
543D
LD A,20H 3E 20
Load Register A with 20H, a space for leading zeros: the entry for five places.
543F
LD BC,2710H 01 10 27
Load Register Pair BC with 2710H, 10000, the place value of the first place.
5442
GOSUB to 545DH to write the digit of the ten thousands at Register Pair DE.
5445
LD BC,03E8H 01 E8 03
Load Register Pair BC with 03E8H, 1000, the place value of the thousands.
5448
GOSUB to 545DH to write the digit of the thousands at Register Pair DE.
544B
LD BC,0064H 01 64 00
Load Register Pair BC with 0064H, 100, the place value of the hundreds.
544E
GOSUB to 545DH to write the digit of the hundreds at Register Pair DE.
5451
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, 10, the place value of the tens.
5454
GOSUB to 545DH to write the digit of the tens at Register Pair DE.
5457
LD A,L 7D
Copy Register L (the units left) into Register A.
5458
ADD A,30H C6 30
ADD 30H to Register A: the character of the units digit.
545A
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE.
545B
INC DE 13
INCrement Register Pair DE past the units, the end of the number.
545C
RET C9
RETurn with Register Pair DE after the number.
545D
PUSH DE D5
Save Register Pair DE (where the digit goes) to the stack.
545E
LD E,A 5F
Copy Register A (the character for a zero place) into Register E.
545F
LD D,FFH 16 FF
Load Register D with FFH, so that the first INC makes it 0: Register D counts the subtractions.
5461
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtractions.
5462
INC D 14
INCrement Register D, the digit of this place so far.
5463
SBC HL,BC ED 42
SUBtract Register Pair BC (the place value) from Register Pair HL.
5465
If the NO CARRY FLAG is set (it went), LOOP BACK to 5462H.
5467
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the last subtraction is undone, Register Pair HL = the rest.
5468
LD A,E 7B
Copy Register E (the character for a zero place) into Register A.
5469
LD B,D 42
Copy Register D (the digit of this place) into Register B.
546A
POP DE D1
Restore Register Pair DE (where the digit goes) from the stack.
546B
LD (DE),A 12
Store Register A (the character for a zero place) at Register Pair DE.
546C
INC B 04
INCrement Register B, then DECrement it below: a test of Register B for 0.
546D
DEC B 05
DECrement Register B: the Z FLAG is set when the digit is 0.
546E
If the Z FLAG is set (a 0), JUMP to 5476H: the space (or 0) stays, Register A is unchanged.
5470
LD A,B 78
Copy Register B (the digit of this place) into Register A.
5471
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit.
5473
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
5474
LD A,30H 3E 30
Load Register A with 30H: from now on a zero place is written as 0.
5476
INC DE 13
INCrement Register Pair DE to the next place.
5477
RET C9
RETurn with Register A = the character for the next zero place.

5478H - The Map: Characters for One Cylinder

5478H writes Register A characters at Index Register IX, one for each granule of the cylinder whose allocation table byte is at Register Pair HL: x for a bit set (in use), a period for a bit clear. Then, on a floppy drive (bit 3 of +03H clear), an asterisk replaces the character of each granule whose bit is set in the lock out table (the byte at HL + 60H). The table bytes are rotated in place. 54A9H writes Register A characters D for the directory cylinder. Both leave Index Register IX after the characters; Register Pairs BC and HL are kept.

5478
PUSH BC C5
Save Register Pair BC (Register B, the cylinders left on the line; Register C, the cylinder) to the stack.
5479
PUSH IX DD E5
Save Index Register IX (the column of the cylinder) to the stack.
547B
LD B,A 47
Copy Register A (the granules on a cylinder) into Register B.
547C
PUSH BC C5
Save Register Pair BC (Register B, the granules) to the stack, for the second loop.
547D
RRC (HL) CB 0E
Rotate the table byte at Register Pair HL right (RRC): the bit of the next granule goes to the CARRY FLAG.
547F
LD A,78H 3E 78
Load Register A with 78H, x, a granule in use. LD does not change the flags.
5481
If the CARRY FLAG is set (in use), JUMP to 5485H.
5483
LD A,2EH 3E 2E
Load Register A with 2EH, a period, a free granule.
5485
LD (IX+00H),A DD 77 00
Store Register A (x or a period) at Index Register IX +00H.
5488
INC IX DD 23
INCrement Index Register IX to the next column.
548A
DECrement Register B and LOOP BACK to 547DH until every granule of the cylinder is written.
548C
LD DE,0060H 11 60 00
Load Register Pair DE with 0060H, the distance from a cylinder's byte to its byte in the lock out table.
548F
POP BC C1
Restore Register Pair BC from the stack: Register B = the granules.
5490
POP IX DD E1
Restore Index Register IX from the stack: the column of the cylinder again.
5492
PUSH HL E5
Save Register Pair HL (the allocation table byte) to the stack.
5493
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the cylinder's byte in the lock out table (4260H and up).
5494
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of byte +03H of the drive code table at Index Register IY +03H: set for a rigid drive.
5498
If the NZ FLAG is set (a rigid drive), JUMP to 54A2H: no lock out marks.
549A
RRC (HL) CB 0E
Rotate the lock out byte at Register Pair HL right (RRC): the granule's bit goes to the CARRY FLAG.
549C
If the NO CARRY FLAG is set (not locked out), JUMP to 54A2H.
549E
LD (IX+00H),2AH DD 36 00 2A
Store 2AH, an asterisk, at Index Register IX +00H: the granule is locked out.
54A2
INC IX DD 23
INCrement Index Register IX to the next column.
54A4
DECrement Register B and LOOP BACK to 5494H until every granule is looked at.
54A6
POP HL E1
Restore Register Pair HL (the allocation table byte) from the stack.
54A7
POP BC C1
Restore Register Pair BC (the cylinders left and the cylinder) from the stack.
54A8
RET C9
RETurn with Index Register IX after the cylinder's characters.
54A9
PUSH BC C5
Save Register Pair BC (Register B, the cylinders left; Register C, the cylinder) to the stack.
54AA
LD B,A 47
Copy Register A (the granules on a cylinder) into Register B.
54AB
LD (IX+00H),44H DD 36 00 44
Store 44H, D, at Index Register IX +00H: a granule of the directory cylinder.
54AF
INC IX DD 23
INCrement Index Register IX to the next column.
54B1
DECrement Register B and LOOP BACK to 54ABH until every granule is written.
54B3
POP BC C1
Restore Register Pair BC (the cylinders left and the cylinder) from the stack.
54B4
RET C9
RETurn with Index Register IX after the characters.

54B5H - The Map: The Label of the Next Line

Register C = the last cylinder shown. The label of the next line is written at 555AH: the first cylinder (C + 1) in three places, then, unless it is the highest cylinder, a dash and the last cylinder of the line (up to five more, not past the highest). Register Pairs BC and DE are kept.

54B5
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
54B6
PUSH BC C5
Save Register Pair BC (Register C, the last cylinder shown) to the stack.
54B7
LD DE,555AH 11 5A 55
Point Register Pair DE to 555AH, the start of the line buffer.
54BA
INC C 0C
INCrement Register C: the first cylinder of the next line.
54BB
GOSUB to 54D8H to write Register C in three places at Register Pair DE (555AH-555CH).
54BE
LD A,(IY+06H) FD 7E 06
Fetch the highest cylinder from Index Register IY +06H into Register A.
54C1
CP C B9
Compare Register A against Register C: the Z FLAG when the next line has only the highest cylinder.
54C2
If the Z FLAG is set, JUMP to 54D5H: the label is the one number.
54C4
PUSH AF F5
Save Register Pair AF (Register A, the highest cylinder) to the stack.
54C5
LD A,2DH 3E 2D
Load Register A with 2DH, a dash between the two cylinders of the label.
54C7
LD (DE),A 12
Store Register A (the dash) at Register Pair DE (555DH).
54C8
POP AF F1
Restore Register Pair AF (Register A, the highest cylinder) from the stack.
54C9
INC DE 13
INCrement Register Pair DE past the dash, to 555EH.
54CA
LD B,05H 06 05
Load Register B with 05H: up to five cylinders after the first.
54CC
INC C 0C
INCrement Register C, the last cylinder of the line.
54CD
CP C B9
Compare Register A (the highest cylinder) against Register C: the Z FLAG when it is reached.
54CE
If the Z FLAG is set (the highest cylinder reached), JUMP to 54D2H.
54D0
DECrement Register B and LOOP BACK to 54CCH for one more cylinder.
54D2
GOSUB to 54D8H to write Register C (the last cylinder of the line) in three places at Register Pair DE (555EH-5560H).
54D5
POP BC C1
Restore Register Pair BC (as it was at the call) from the stack.
54D6
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
54D7
RET C9
RETurn with the label of the next line written at 555AH.
54D8
LD L,C 69
Copy Register C (the cylinder) into Register L.
54D9
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the cylinder.
54DB
PUSH BC C5
Save Register Pair BC to the stack: 545DH changes Register B.
54DC
GOSUB to 5439H to write Register Pair HL in three places at Register Pair DE.
54DF
POP BC C1
Restore Register Pair BC (Register C, the cylinder) from the stack.
54E0
RET C9
RETurn with Register Pair DE after the number.

54E1H - Read the Granule Allocation Table (Not Called)

Reads sector 0 of the directory cylinder of drive Register C into 4200H; returns the Z FLAG, or Register A = 14H (GAT read error) with the NZ FLAG. No code of the member calls it: 52D1H-52D9H read the table themselves.

54E1
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
54E2
PUSH HL E5
Save Register Pair HL to the stack, for the caller.
54E3
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
54E6
LD E,00H 1E 00
Load Register E with 00H, sector 0: the granule allocation table.
54E8
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, to receive the sector.
54EB
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
54EE
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
54EF
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
54F0
RET Z C8
RETurn if the Z FLAG is set (the table was read).
54F1
LD A,14H 3E 14
Load Register A with 14H, error 20 (GAT read error).
54F3
RET C9
RETurn with the NZ FLAG and the error number in Register A.

54F4H - Errors and the Exit

54F4H reports error 2CH, 54F6H the error in Register A, through @ERROR; 5500H is the end of a command carried out.

54F4
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error).
54F6
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.
54F8
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
54FB
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
54FE
JUMP to 5503H to put the stack back and end the command.
5500
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5503
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5504H-5505H (0000H in the file, stored by 5200H).
5506
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5507
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5508
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.
5509
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
550C
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
550E
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
550F
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5512H - FREE Data: The Line Template, the Map Label, the Line Buffer and the Parameter Table

The line of a drive is built over the template at 5512H-5552H; the map's lines in the buffer at 555AH-5599H, which the file does not load.

5512-5518
DEFM "Drive :" 44 72 69 76 65 20 3A
The start of the drive line, displayed and printed by 53C0H.
5519
DEFM "d" 64
The drive's digit, stored by 52CBH (d in the file).
551A
DEFM " " 20
A space after the drive's digit in the drive line.
551B-5522
DEFM "packname" 70 61 63 6B 6E 61 6D 65
The diskette's name, eight characters copied from 42D0H by 538AH.
5523
DEFM " " 20
A space after the diskette's name in the drive line.
5524-552B
DEFM "packdate" 70 61 63 6B 64 61 74 65
The diskette's date, eight characters copied from 42D8H by 538FH.
552C
DEFM " " 20
A space after the diskette's date in the drive line.
552D-552F
DEFM "cyl" 63 79 6C
The number of cylinders in three places, written by 530DH.
5530
DEFM "d" 64
The density: S, D, or H for a rigid drive (5337H).
5531
DEFM "h" 68
The number of heads as a digit, stored by 5337H.
5532-5537
DEFM " Free=" 20 46 72 65 65 3D
The label of the free space, with a space before it.
5538-553C
DEFM "sssss" 73 73 73 73 73
The free kilobytes in five places, written by 52FFH.
553D
DEFM "." 2E
The point between the kilobytes and the tenths of the free space.
553E
DEFM "s" 73
The tenths of the free space (0, 2, 5 or 8), stored by 5302H.
553F
DEFM "/" 2F
The slash between the free and the total space.
5540-5544
DEFM "sssss" 73 73 73 73 73
The total kilobytes in five places, written by 5357H.
5545
DEFM "." 2E
The point between the kilobytes and the tenths of the total space.
5546
DEFM "s" 73
The tenths of the total space, stored by 535AH.
5547-554A
DEFM " Fi=" 20 46 69 3D
The label of the directory records (Fi for files), with a space before it.
554B-554D
DEFM "nnn" 6E 6E 6E
The free directory records in three places, written by 53BDH.
554E
DEFM "/" 2F
The slash between the free and the total records.
554F-5551
DEFM "nnn" 6E 6E 6E
The total directory records in three places, written by 537EH.
5552
DEFB 03H 03
03H, the end of the drive line for @DSPLY and @PRINT (not sent).
5553-5559
DEFM " 0- 5" 20 20 30 2D 20 20 35
The label of the first line of the map, cylinders 0 to 5, copied to 555AH by 526AH.
555A-5599
DEFS 64
Not in the file: the 64 byte line buffer of the map, the line of dashes and the empty line.
559A
DEFB 03H 03
03H, the end of the line buffer for @DSPLY and @PRINT (not sent).
559B-55A0
DEFM "P " 50 20 20 20 20 20
The parameter table of FREE (521CH), entry 1: the keyword P, send the lines to the printer too.
55A1-55A2
DEFW 53FCH FC 53
Entry 1: 53FCH, the operand of the LD DE at 53FBH, where P is stored.
55A3
DEFB 00H 00
00H, the end of the parameter table, the last byte of the member.

5200H - Member 7 (SYSTEM): Entry, the Parameters, SLOW and FAST

The SYSTEM command (library member A1H), loaded at 5200H-5EE6H, the largest member. One call of @PARAM reads every parameter in the brackets against the table at 5DF6H (30 keywords), and each value goes straight into the operand of the LD BC (or LD HL, LD DE) that tests it. The options are then taken one after the other in a fixed order, each skipped when its keyword was not given: SLOW, FAST, BASIC2, PRTIME, BREAK, UPDATE, DATE, TIME, TRACE, BSTEP, BLINK (LARGE, SMALL), TYPE, SMOOTH, GRAPHIC, ALIVE, SVC, SYSRES, the drive options (DRIVE, WP, CYL, DISABLE, ENABLE, STEP, DELAY), DRIVER, SYSTEM, SWAP and SYSGEN. A keyword alone stores FFFFH, KEY=N 0000H, KEY=value the value; the value in the file (0000H, 0001H or FFFFH) means not given.

5200
LD (5A53H),SP ED 73 53 5A
Store the Stack Pointer at 5A53H, the operand of the LD SP at 5A52H: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,5DF6H 11 F6 5D
Point Register Pair DE to 5DF6H, the parameter table of SYSTEM.
5207
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL (the text after SYSTEM) against the table at Register Pair DE; each value goes into the operand the table names. The NZ FLAG for a bad parameter.
520A
If the NZ FLAG is set (a bad parameter), JUMP to 5A7AH, inside the LD BC at 5A79H, where the bytes read LD A,2CH: error 2CH.
520D
LD BC,0000H 01 00 00
Load Register Pair BC with the SLOW parameter, the operand at 520EH-520FH: 0000H in the file, FFFFH for SLOW.
5210
LD A,B 78
Copy Register B (the high byte of SLOW) into Register A.
5211
OR C B1
OR Register C (the low byte) into Register A: the NZ FLAG when SLOW was given.
5212
If the NZ FLAG is set (SLOW was given), JUMP to 5227H.
5214
LD BC,0000H 01 00 00
Load Register Pair BC with the FAST parameter, the operand at 5215H-5216H: 0000H in the file, FFFFH for FAST.
5217
LD A,B 78
Copy Register B (the high byte of FAST) into Register A.
5218
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when FAST was not given.
5219
If the Z FLAG is set (neither SLOW nor FAST), JUMP to 5236H for BASIC2.
521B
LD HL,430FH 21 0F 43
FAST: point Register Pair HL to 430FH, SFLAG$, the system flags.
521E
SET 3,(HL) CB DE
Set bit 3 of SFLAG$ at Register Pair HL: the computer runs fast (the drive motor wait is doubled, 4399H).
5220
LD A,(4427H) 3A 27 44
Fetch the last value written to port FEH from 4427H into Register A.
5223
OR 01H F6 01
OR 01H into Register A: bit 0 of port FEH selects the fast clock.
5225
JUMP to 5231H to store the value and write it to the port.
5227
LD HL,430FH 21 0F 43
SLOW: point Register Pair HL to 430FH, SFLAG$, the system flags.
522A
RES 3,(HL) CB 9E
Clear bit 3 of SFLAG$ at Register Pair HL: the normal speed.
522C
LD A,(4427H) 3A 27 44
Fetch the last value written to port FEH from 4427H into Register A.
522F
AND FEH E6 FE
Clear bit 0 of Register A (AND FEH): the normal clock.
5231
LD (4427H),A 32 27 44
Store Register A (the new port value) at 4427H, the copy SYS0/SYS's reset uses.
5234
OUT (FEH),A D3 FE
Write Register A to port FEH, the speed control.

5236H - BASIC2: Leave LDOS for the ROM's BASIC

BASIC2 starts the Level II BASIC of the ROM without the disk system: the ROM's table of 54 bytes at 06D2H is copied to 4000H-4035H (the restart vectors and the device control blocks as at power up), 39 bytes from 4036H are cleared, and the ROM's own start continues at 0075H. It does not return.

5236
LD BC,0000H 01 00 00
Load Register Pair BC with the BASIC2 parameter, the operand at 5237H-5238H: 0000H in the file, FFFFH for BASIC2.
5239
LD A,B 78
Copy Register B (the high byte of BASIC2) into Register A.
523A
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when BASIC2 was not given.
523B
If the Z FLAG is set (no BASIC2), JUMP to 5256H for PRTIME.
523D
DI F3
Disable interrupts: the interrupt vectors are about to be replaced.
523E
LD SP,407DH 31 7D 40
Load the Stack Pointer with 407DH, a stack in the RAM the ROM uses for its own start.
5241
LD HL,06D2H 21 D2 06
Point Register Pair HL to 06D2H, the ROM's table of the restart vectors and device control blocks.
5244
LD DE,4000H 11 00 40
Point Register Pair DE to 4000H, where the ROM keeps them.
5247
LD BC,0036H 01 36 00
Load Register Pair BC with 0036H, the 54 bytes of the table.
524A
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 06D2H-0707H to 4000H-4035H, the ROM's values in place of LDOS's.
524C
XOR A AF
Clear Register A (XOR A), the byte to store from 4036H up.
524D
LD B,27H 06 27
Load Register B with 27H, the count of 39 bytes to clear.
524F
LD (DE),A 12
Store Register A (00H) at Register Pair DE (4036H and up).
5250
INC DE 13
INCrement Register Pair DE to the next byte to clear.
5251
DECrement Register B and LOOP BACK to 524FH until 4036H-405CH are 00H.
5253
JUMP to the ROM at 0075H, the rest of its power up start: Level II BASIC runs without LDOS.

5256H - PRTIME: The Printer Time Out of PR/FLT

The printer filter PR/FLT keeps its module address at 4DF6H-4DF7H (0000H when it is not installed: Printer filter not resident!). Byte +19H of the module is taken as the offset of the filter's time out byte; PRTIME=ON stores 1BH there, PRTIME=OFF 00H. In PR/FLT that byte is 38H, the code of a JR C, so the store lands on the POP DE at module +38H (553DH on the PR/FLT page), and the next byte the filter prints returns to a wrong address.

5256
LD BC,0001H 01 01 00
Load Register Pair BC with the PRTIME parameter, the operand at 5257H-5258H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5259
LD A,C 79
Copy Register C (the low byte of PRTIME) into Register A.
525A
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
525B
OR B B0
OR Register B into Register A: the Z FLAG only for 0001H, PRTIME not given.
525C
If the Z FLAG is set (no PRTIME), JUMP to 5276H for BREAK.
525E
LD HL,(4DF6H) 2A F6 4D
Fetch the address of PR/FLT's module from 4DF6H-4DF7H into Register Pair HL.
5261
LD A,H 7C
Copy Register H (the high byte of the address) into Register A.
5262
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG for 0000H, no printer filter.
5263
If the Z FLAG is set (no PR/FLT), JUMP to 5B11H, inside the LD IX at 5B10H, where the bytes read LD HL,5DD6H: Printer filter not resident!.
5266
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the filter's module.
5267
LD HL,0019H 21 19 00
Load Register Pair HL with 0019H, the offset of the byte that locates the time out byte.
526A
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL = the module +19H.
526B
LD L,(HL) 6E
Fetch the byte at module +19H (Register Pair HL) into Register L: the offset of the time out byte.
526C
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = that offset.
526E
ADD HL,DE 19
ADD Register Pair DE (the module) to Register Pair HL: the address of the time out byte.
526F
LD A,B 78
Copy Register B (the high byte of PRTIME) into Register A.
5270
OR C B1
OR Register C (the low byte) into Register A: 00H for PRTIME=OFF, FFH for ON.
5271
If the Z FLAG is set (OFF), JUMP to 5275H with Register A = 00H.
5273
LD A,1BH 3E 1B
Load Register A with 1BH, the value for PRTIME=ON.
5275
LD (HL),A 77
Store Register A (1BH or 00H) at Register Pair HL, taken as the filter's time out byte: in PR/FLT, module +38H, the POP DE of the routine that sends a byte on.

5276H - BREAK: Allow or Disable the BREAK Key

BREAK=ON clears bit 4 of SFLAG$ and stores 00H (NOP) at 4BF0H; BREAK=OFF sets bit 4 (the interrupt's keyboard scan then ignores BREAK) and stores C8H (RET Z) at 4BF0H, so that request code 01H returns at once with Register A = 00H.

5276
LD BC,0001H 01 01 00
Load Register Pair BC with the BREAK parameter, the operand at 5277H-5278H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5279
LD A,B 78
Copy Register B (the high byte of BREAK) into Register A.
527A
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
527B
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags. LD does not change the flags.
527E
If the Z FLAG is set (BREAK=OFF), JUMP to 5288H.
5280
INC A 3C
INCrement Register A: 00H, with the Z FLAG, only for ON.
5281
If the NZ FLAG is set (BREAK not given), JUMP to 528FH for UPDATE.
5283
RES 4,(HL) CB A6
BREAK=ON: clear bit 4 of SFLAG$ at Register Pair HL: BREAK is allowed.
5285
XOR A AF
Clear Register A (XOR A): 00H, the code of NOP, for 4BF0H.
5286
JUMP to 528CH to store Register A (00H) at 4BF0H.
5288
SET 4,(HL) CB E6
BREAK=OFF: set bit 4 of SFLAG$ at Register Pair HL: BREAK is disabled.
528A
LD A,C8H 3E C8
Load Register A with C8H, the code of RET Z, for 4BF0H.
528C
LD (4BF0H),A 32 F0 4B
Store Register A at 4BF0H, the byte after the DEC A at 4BEFH in the supervisor dispatcher's path for request codes below 80H.

528FH - UPDATE: The Midnight Date Change

UPDATE=ON puts the module $UP (52FCH-536EH, 115 bytes) below HIGH$ (or uses the one already there, found through request BCH, 5AE7H) and a JP to it at 45DAH, where SYS0/SYS's clock task arrives after the hours wrap at midnight: the module then moves the date on by one day. UPDATE=OFF puts the RET (C9H) back at 45DAH and gives the module's memory back when it is the lowest in high memory.

528F
LD BC,0001H 01 01 00
Load Register Pair BC with the UPDATE parameter, the operand at 5290H-5291H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5292
LD A,B 78
Copy Register B (the high byte of UPDATE) into Register A.
5293
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
5294
DEC A 3D
DECrement Register A: the Z FLAG for 01H, not given.
5295
If the Z FLAG is set (no UPDATE), JUMP to 536FH for DATE.
5298
INC A 3C
INCrement Register A back: the NZ FLAG for ON.
5299
If the NZ FLAG is set (UPDATE=ON), JUMP to 52B8H.
529B
LD DE,52F8H 11 F8 52
UPDATE=OFF: point Register Pair DE to 52F8H, the name $UP.
529E
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module and Register Pair DE = its link word (the HIGH$ before it).
52A1
If the NZ FLAG is set (no $UP module), JUMP to 52B0H.
52A3
LD BC,(4049H) ED 4B 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair BC.
52A7
INC BC 03
INCrement Register Pair BC: HIGH$ + 1, the first byte above HIGH$.
52A8
SBC HL,BC ED 42
SUBtract Register Pair BC and the CARRY FLAG from Register Pair HL (the module): the Z FLAG when the module starts at HIGH$ + 1.
52AA
If the NZ FLAG is set (another module lies below it), JUMP to 52B0H: its memory is kept.
52AC
LD (4049H),DE ED 53 49 40
Store Register Pair DE (the module's link word) at 4049H-404AH: HIGH$ as it was before the module.
52B0
LD A,C9H 3E C9
Load Register A with C9H, the code of RET, for 45DAH.
52B2
LD (45DAH),A 32 DA 45
Store Register A (C9H) at 45DAH: the clock task returns at midnight again, the date is not changed.
52B5
JUMP to 536FH to go on with the next option, DATE.
52B8
LD DE,52F8H 11 F8 52
UPDATE=ON: point Register Pair DE to 52F8H, the name $UP.
52BB
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module.
52BE
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the module found. LD and EX do not change the flags.
52BF
If the Z FLAG is set (already installed), JUMP to 52ECH with Register Pair HL = the module.
52C1
LD BC,0073H 01 73 00
Load Register Pair BC with 0073H, the 115 bytes of the module.
52C4
LD HL,5364H 21 64 53
Point Register Pair HL to 5364H, the days of February in the module's month table.
52C7
LD A,(4048H) 3A 48 40
Fetch the byte at 4048H into Register A: bit 7 set for a leap year.
52CA
RLCA 07
Rotate Register A left (RLCA): bit 7 goes to the CARRY FLAG.
52CB
If the NO CARRY FLAG is set (not a leap year), JUMP to 52CEH.
52CD
INC (HL) 34
INCrement the days of February at Register Pair HL (5364H) to 29.
52CE
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
52D1
LD (52FEH),HL 22 FE 52
Store Register Pair HL (HIGH$) at 52FEH, the module's link word.
52D4
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
52D5
SBC HL,BC ED 42
SUBtract Register Pair BC (115) from Register Pair HL: the new HIGH$.
52D7
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is lowered below the module.
52DA
INC HL 23
INCrement Register Pair HL: the address of the module, HIGH$ + 1.
52DB
PUSH HL E5
Save Register Pair HL (the module's address) to the stack.
52DC
LD DE,0067H 11 67 00
Load Register Pair DE with 0067H, the offset of the month table in the module.
52DF
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the month table in the copy.
52E0
LD (5329H),HL 22 29 53
Store Register Pair HL at 5329H, the operand of the module's LD HL at 5328H, so that the copy finds its own table.
52E3
POP HL E1
Restore Register Pair HL (the module's address) from the stack.
52E4
PUSH HL E5
Save Register Pair HL (the module's address) to the stack again.
52E5
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the module's address, the destination.
52E6
LD HL,52FCH 21 FC 52
Point Register Pair HL to 52FCH, the module in this member.
52E9
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the 115 bytes of the module to high memory.
52EB
POP HL E1
Restore Register Pair HL from the stack: the module's address.
52EC
DI F3
Disable interrupts while the jump at 45DAH is written.
52ED
LD (45DBH),HL 22 DB 45
Store Register Pair HL (the module) at 45DBH-45DCH, the address of the jump.
52F0
LD A,C3H 3E C3
Load Register A with C3H, the code of JP, for 45DAH.
52F2
LD (45DAH),A 32 DA 45
Store Register A (C3H) at 45DAH: the clock task now jumps to the module at midnight.
52F5
EI FB
Enable interrupts again: the jump at 45DAH-45DCH is complete.
52F6
JUMP to 536FH to go on with the next option, DATE.
52F8-52FA
DEFM "$UP" 24 55 50
The name of the module, for the lookup at 529EH and 52BBH.
52FB
DEFB 00H 00
00H, the end of the name $UP for the lookup by request BCH.

52FCH - The $UP Module: Move the Date On at Midnight

Copied to high memory by 52E9H; the addresses in the comments are those of this member (the copy runs at HIGH$ + 1 and up). SYS0/SYS's clock task jumps to its first byte at midnight, with Register Pair HL = 4044H (the field after the hours): the day is counted up, the day of the week, the day of the year and the SVDAT cells follow, and at the end of a month (or a year) the month (and the year) move on. The day of the year is not set back at a new year, and February's 29 days are decided when the module is installed.

52FC
JUMP over the module's header to 5304H, the code.
52FE-52FF
DEFW 0000H 00 00
The module's link word: HIGH$ before the module was installed, stored by 52D1H.
5300
DEFB 03H 03
03H, the length of the module's name, three characters.
5301-5303
DEFM "$UP" 24 55 50
The module's name, by which request BCH finds the module.
5304
INC L 2C
INCrement Register L: Register Pair HL = 4045H, the day of the month.
5305
INC (HL) 34
INCrement the day at Register Pair HL (4045H).
5306
INC L 2C
INCrement Register L: Register Pair HL = 4046H, the month.
5307
LD A,(HL) 7E
Fetch the month at Register Pair HL into Register A.
5308
DEC L 2D
DECrement Register L: Register Pair HL = 4045H, the day.
5309
DEC A 3D
DECrement Register A: the month less one, the index into the month table.
530A
PUSH HL E5
Save Register Pair HL (4045H, the day) to the stack.
530B
LD C,A 4F
Copy Register A (the month less one) into Register C.
530C
LD HL,4048H 21 48 40
Point Register Pair HL to 4048H: bits 3-1 the day of the week.
530F
LD A,(HL) 7E
Fetch the byte at Register Pair HL (4048H) into Register A.
5310
RRCA 0F
Rotate Register A right (RRCA): the day of the week moves to bits 2-0.
5311
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the day of the week, 1-7.
5313
INC A 3C
INCrement Register A: the day of the week after it.
5314
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): 8 (after Saturday) becomes 0.
5316
If the NZ FLAG is set (a day 1-7), JUMP to 5319H.
5318
INC A 3C
INCrement Register A: 0 becomes 1, Sunday after Saturday.
5319
RLCA 07
Rotate Register A left (RLCA): the day of the week back in bits 3-1.
531A
LD B,A 47
Copy Register A (the new day of the week in bits 3-1) into Register B.
531B
LD A,(HL) 7E
Fetch the byte at Register Pair HL (4048H) into Register A.
531C
AND F1H E6 F1
Clear bits 3-1 of Register A (AND F1H): the old day of the week.
531E
OR B B0
OR Register B (the new day of the week) into Register A.
531F
LD (HL),A 77
Store Register A at Register Pair HL (4048H).
5320
DEC HL 2B
DECrement Register Pair HL to 4047H, the low 8 bits of the day of the year.
5321
INC (HL) 34
INCrement the day of the year at Register Pair HL (4047H).
5322
INC HL 23
INCrement Register Pair HL to 4048H. INC of a pair does not change the flags.
5323
If the NZ FLAG is set (the low byte did not pass FFH), JUMP to 5326H.
5325
INC (HL) 34
INCrement the byte at Register Pair HL (4048H): bit 0, bit 8 of the day of the year, becomes 1.
5326
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the month less one.
5328
LD HL,5363H 21 63 53
Load Register Pair HL with 5363H, the month table (the operand at 5329H is set by 52E0H to the table of the copy).
532B
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the days of this month.
532C
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the days of this month.
532D
POP HL E1
Restore Register Pair HL from the stack: 4045H, the day.
532E
LD A,(DE) 1A
Fetch the days of this month at Register Pair DE into Register A.
532F
CP (HL) BE
Compare Register A against the new day at Register Pair HL: the NO CARRY FLAG when the month has that day.
5330
If the NO CARRY FLAG is set (still in the month), JUMP to 5347H.
5332
LD (HL),01H 36 01
Store 01H at Register Pair HL (4045H): the first day of the next month.
5334
INC L 2C
INCrement Register L: Register Pair HL = 4046H, the month.
5335
INC (HL) 34
INCrement the month at Register Pair HL (4046H).
5336
LD A,(HL) 7E
Fetch the month at Register Pair HL into Register A.
5337
SUB 0DH D6 0D
SUBtract 0DH from Register A: the CARRY FLAG for months 1-12.
5339
If the CARRY FLAG is set (still in the year), JUMP to 5347H.
533B
LD (HL),01H 36 01
Store 01H at Register Pair HL (4046H): January.
533D
DEC L 2D
DECrement Register L: Register Pair HL = 4045H on the way to 4044H.
533E
DEC L 2D
DECrement Register L: Register Pair HL = 4044H, the year.
533F
INC (HL) 34
INCrement the year at Register Pair HL (4044H).
5340
LD A,(HL) 7E
Fetch the year at Register Pair HL into Register A.
5341
CP 64H FE 64
Compare Register A against 64H (100): the Z FLAG after 99.
5343
If the NZ FLAG is set (not past 99), JUMP to 5347H.
5345
LD (HL),00H 36 00
Store 00H at Register Pair HL (4044H): the year 2000.
5347
LD DE,4044H 11 44 40
Point Register Pair DE to 4044H, the year of the system date.
534A
LD A,(DE) 1A
Fetch the year at Register Pair DE into Register A.
534B
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG for a year of the 1900s.
534D
If the NO CARRY FLAG is set (a year 12-99), JUMP to 5351H.
534F
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111.
5351
SUB 50H D6 50
SUBtract 50H (80) from Register A: the year less 1980.
5353
LD (4466H),A 32 66 44
Store Register A (the year less 1980) at 4466H, the year offset.
5356
INC DE 13
INCrement Register Pair DE to 4045H, the day.
5357
LD A,(DE) 1A
Fetch the day at Register Pair DE into Register A.
5358
LD (4307H),A 32 07 43
Store Register A (the day) at 4307H, SVDAT2$.
535B
INC DE 13
INCrement Register Pair DE to 4046H, the month.
535C
LD A,(DE) 1A
Fetch the month at Register Pair DE into Register A.
535D
OR 50H F6 50
OR 50H into Register A: the month OR 50H, the mark of a date set.
535F
LD (4306H),A 32 06 43
Store Register A at 4306H, SVDAT1$, the month kept over a reset.
5362
RET C9
RETurn to the clock task of SYS0/SYS, which goes on to its task loop.
5363
DEFB 1FH 1F
The module's month table: 31 days in January (5328H adds the month less one to its address).
5364
DEFB 1CH 1C
28 days in February; 52CDH makes it 29 in the copy when the year is a leap year (bit 7 of 4048H).
5365-536E
DEFB 1FH, 1EH, 1FH, 1EH, 1FH, 1FH, 1EH, 1FH, 1EH, 1FH 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
The days of March to December: 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.

536FH - DATE and TIME: The Prompts at Boot

DATE=OFF and TIME=OFF store FFH in byte C2H or C3H of drive 0's system information sector, so that the boot does not ask for the date or the time; DATE=ON and TIME=ON store 00H, so that it asks. The sector is read and written through 5A61H and 5A6EH.

536F
LD BC,0001H 01 01 00
Load Register Pair BC with the DATE parameter, the operand at 5370H-5371H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5372
LD A,B 78
Copy Register B (the high byte of DATE) into Register A.
5373
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
5374
LD B,FFH 06 FF
Load Register B with FFH, the value for OFF (no prompt). LD does not change the flags.
5376
If the Z FLAG is set (DATE=OFF), JUMP to 537CH with Register B = FFH.
5378
INC A 3C
INCrement Register A: 00H, with the Z FLAG, only for ON.
5379
If the NZ FLAG is set (DATE not given), JUMP to 5386H for TIME.
537B
LD B,A 47
Copy Register A (00H) into Register B, the value for ON (ask).
537C
GOSUB to 5A61H to read the system information sector of drive 0 (cylinder 0, sector 2) into 4200H.
537F
LD A,B 78
Copy Register B (FFH or 00H) into Register A.
5380
LD (42C2H),A 32 C2 42
Store Register A at 42C2H, the date prompt switch of the system information sector.
5383
GOSUB to 5A6EH to write the sector at 4200H back to drive 0.
5386
LD BC,0001H 01 01 00
Load Register Pair BC with the TIME parameter, the operand at 5387H-5388H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5389
LD A,B 78
Copy Register B (the high byte of TIME) into Register A.
538A
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
538B
LD B,FFH 06 FF
Load Register B with FFH, the value for OFF (no prompt). LD does not change the flags.
538D
If the Z FLAG is set (TIME=OFF), JUMP to 5393H with Register B = FFH.
538F
INC A 3C
INCrement Register A: 00H, with the Z FLAG, only for ON.
5390
If the NZ FLAG is set (TIME not given), JUMP to 539DH for TRACE.
5392
LD B,A 47
Copy Register A (00H) into Register B, the value for ON (ask).
5393
GOSUB to 5A61H to read the system information sector of drive 0 into 4200H.
5396
LD A,B 78
Copy Register B (FFH or 00H) into Register A.
5397
LD (42C3H),A 32 C3 42
Store Register A at 42C3H, the time prompt switch of the system information sector.
539A
GOSUB to 5A6EH to write the sector at 4200H back to drive 0.

539DH - TRACE and BSTEP

TRACE=ON puts SYS0/SYS's task block 4D6AH into task slot 11, which shows the address the program is at in the top right of the screen on every tick; TRACE=OFF empties slot 11. BSTEP=n (0-3) stores the step rate the boot uses in bits 1-0 of byte +03H of drive 0's table in the system information sector (the block at 4220H after a boot through a driver, else 4270H); a larger value shows Boot step out of range.

539D
LD BC,0001H 01 01 00
Load Register Pair BC with the TRACE parameter, the operand at 539EH-539FH: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
53A0
LD A,C 79
Copy Register C (the low byte of TRACE) into Register A.
53A1
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
53A2
OR B B0
OR Register B into Register A: the Z FLAG only for 0001H, TRACE not given.
53A3
If the Z FLAG is set (no TRACE), JUMP to 53B4H for BSTEP.
53A5
LD A,B 78
Copy Register B (the high byte of TRACE) into Register A.
53A6
OR C B1
OR Register C into Register A: the Z FLAG for OFF, the NZ FLAG for ON.
53A7
LD DE,4D6AH 11 6A 4D
Point Register Pair DE to 4D6AH, SYS0/SYS's task block of the program counter display.
53AA
LD A,0BH 3E 0B
Load Register A with 0BH, task slot 11. LD does not change the flags.
53AC
PUSH AF F5
Save Register Pair AF (slot 11 and the flags) to the stack.
53AD
If the NZ FLAG is set (ON), GOSUB to 4410H (@ADTSK) to put the task block at Register Pair DE into slot Register A.
53B0
POP AF F1
Restore Register Pair AF (slot 11 and the flags) from the stack.
53B1
If the Z FLAG is set (OFF), GOSUB to 4413H (@RMTSK) to empty task slot Register A.
53B4
LD BC,FFFFH 01 FF FF
Load Register Pair BC with the BSTEP parameter, the operand at 53B5H-53B6H: FFFFH in the file (not given), else the step rate.
53B7
INC B 04
INCrement Register B: the Z FLAG only for a high byte of FFH, BSTEP not given.
53B8
If the Z FLAG is set (no BSTEP), JUMP to 53DDH for BLINK.
53BA
LD A,C 79
Copy Register C (the step rate) into Register A.
53BB
CP 04H FE 04
Compare Register A against 04H: the CARRY FLAG for 0-3.
53BD
If the CARRY FLAG is set (a good rate), JUMP to 53C7H.
53BF
LD HL,5DB8H 21 B8 5D
Point Register Pair HL to 5DB8H, the message Boot step out of range <0-3>!.
53C2
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
53C5
JUMP to 53DDH: the other options are still carried out.
53C7
LD B,A 47
Copy Register A (the step rate) into Register B.
53C8
GOSUB to 5A61H to read the system information sector of drive 0 into 4200H.
53CB
LD L,73H 2E 73
Load Register L with 73H: Register Pair HL = 4273H, byte +03H of drive 0 in the second block of drive tables (a boot by sector 0).
53CD
LD A,(442FH) 3A 2F 44
Fetch MFLAG$ from 442FH into Register A: bit 0 set after a boot through a disk driver.
53D0
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
53D1
If the NO CARRY FLAG is set (a boot by sector 0), JUMP to 53D5H.
53D3
LD L,23H 2E 23
Load Register L with 23H: Register Pair HL = 4223H, byte +03H of drive 0 in the first block.
53D5
LD A,(HL) 7E
Fetch byte +03H of drive 0's table at Register Pair HL into Register A.
53D6
AND FCH E6 FC
Clear bits 1-0 of Register A (AND FCH): the old step rate.
53D8
OR B B0
OR Register B (the new step rate) into Register A.
53D9
LD (HL),A 77
Store Register A (the new byte +03H) at Register Pair HL in the sector.
53DA
GOSUB to 5A6EH to write the sector at 4200H back to drive 0.

53DDH - BLINK: The Blinking Cursor Module

BLINK=OFF takes task slot 5 out and gives the memory of the module $BL back when it is the lowest in high memory. BLINK (or BLINK=ON, or BLINK=c) is allowed only at LDOS command level (5AF7H): the cursor character is c, or 88H with SMALL, 8FH with LARGE, B0H otherwise; it is stored into three places of the module (5469H-54B3H, 75 bytes), which is copied below HIGH$ (or over the one already there) and put into task slot 5.

53DD
LD BC,0001H 01 01 00
Load Register Pair BC with the BLINK parameter, the operand at 53DEH-53DFH: 0001H in the file (not given), FFFFH for ON, 0000H for OFF, else the cursor character.
53E0
LD A,B 78
Copy Register B (the high byte of BLINK) into Register A.
53E1
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, 01H when not given.
53E2
DEC A 3D
DECrement Register A: the Z FLAG for 01H, BLINK not given.
53E3
If the Z FLAG is set (no BLINK), JUMP to 54B4H for TYPE.
53E6
INC A 3C
INCrement Register A back: the Z FLAG only for OFF.
53E7
If the NZ FLAG is set (ON or a character), JUMP to 5406H.
53E9
LD DE,546EH 11 6E 54
BLINK=OFF: point Register Pair DE to 546EH, the name $BL in the module.
53EC
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module and Register Pair DE = its link word.
53EF
If the NZ FLAG is set (no $BL module), JUMP to 5403H.
53F1
LD BC,(4049H) ED 4B 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair BC.
53F5
INC BC 03
INCrement Register Pair BC: HIGH$ + 1, the lowest byte of high memory.
53F6
SBC HL,BC ED 42
SUBtract Register Pair BC and the CARRY FLAG from Register Pair HL (the module): the Z FLAG when the module starts at HIGH$ + 1.
53F8
If the NZ FLAG is set (another module lies below it), JUMP to 53FEH: its memory is kept.
53FA
LD (4049H),DE ED 53 49 40
Store Register Pair DE (the module's link word) at 4049H-404AH: HIGH$ as it was before the module.
53FE
LD A,05H 3E 05
Load Register A with 05H, task slot 5, the blinking cursor's slot.
5400
GOSUB to 4413H (@RMTSK) to empty task slot Register A: the cursor stops blinking.
5403
JUMP to 54B4H to go on with the next option, TYPE.
5406
PUSH AF F5
BLINK=ON or BLINK=c: save Register Pair AF (Register A, FFH for ON or the character c) to the stack.
5407
GOSUB to 5AF7H, which returns only when the command may change memory (LDOS command level); otherwise it reports Can't -- Valid only at LDOS command level and ends the command.
540A
POP AF F1
Restore Register Pair AF (Register A, FFH for ON or the character c) from the stack.
540B
CP FFH FE FF
Compare Register A against FFH: the Z FLAG for BLINK or BLINK=ON, the NZ FLAG for a character.
540D
If the NZ FLAG is set (BLINK=c), JUMP to 5421H with the character in Register A.
540F
LD A,(5467H) 3A 67 54
Fetch the low byte of the LARGE parameter from 5467H into Register A: FFH when LARGE was given.
5412
INC A 3C
INCrement Register A: the Z FLAG only for LARGE.
5413
LD A,B0H 3E B0
Load Register A with B0H, the normal cursor character (a graphics block). LD does not change the flags.
5415
If the NZ FLAG is set (no LARGE), JUMP to 5419H with Register A = B0H.
5417
LD A,8FH 3E 8F
Load Register A with 8FH, the large cursor character (the full graphics block).
5419
LD BC,0000H 01 00 00
Load Register Pair BC with the SMALL parameter, the operand at 541AH-541BH: 0000H in the file, FFFFH for SMALL.
541C
INC C 0C
INCrement Register C: the Z FLAG only for a low byte of FFH, SMALL.
541D
If the NZ FLAG is set (no SMALL), JUMP to 5421H.
541F
LD A,88H 3E 88
Load Register A with 88H, the small cursor character.
5421
LD (548DH),A 32 8D 54
Store Register A (the cursor character) at 548DH, the operand of the module's LD A at 548CH.
5424
LD (549AH),A 32 9A 54
Store Register A (the cursor character) at 549AH, the operand of the module's CP at 5499H.
5427
LD (54ABH),A 32 AB 54
Store Register A (the cursor character) at 54ABH, the operand of the module's CP at 54AAH.
542A
LD DE,546EH 11 6E 54
Point Register Pair DE to 546EH, the name $BL in the module.
542D
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module and Register Pair DE = its link word.
5430
LD BC,004BH 01 4B 00
Load Register Pair BC with 004BH, the 75 bytes of the module. LD does not change the flags.
5433
If the NZ FLAG is set (no $BL module yet), JUMP to 543BH to make room for it.
5435
LD (546BH),DE ED 53 6B 54
Store Register Pair DE (the link word of the module found) at 546BH, the link word of the copy, which goes over it.
5439
JUMP to 5448H to copy the module over the one found at Register Pair HL.
543B
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
543E
OR A B7
Clear the CARRY FLAG (OR A sets the flags from Register A and clears the carry) for the subtraction below.
543F
LD (546BH),HL 22 6B 54
Store Register Pair HL (HIGH$) at 546BH, the module's link word.
5442
SBC HL,BC ED 42
SUBtract Register Pair BC (75) from Register Pair HL: the new HIGH$.
5444
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is lowered below the module.
5447
INC HL 23
INCrement Register Pair HL: the address of the module, HIGH$ + 1.
5448
PUSH HL E5
Save Register Pair HL (the module's address) to the stack.
5449
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the module's address, the destination.
544A
LD HL,5469H 21 69 54
Point Register Pair HL to 5469H, the module in this member.
544D
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the 75 bytes of the module to high memory.
544F
POP DE D1
Restore Register Pair DE from the stack: the module's address.
5450
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the offset of the task block in the module.
5453
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the module's task block.
5454
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the task block, Register Pair HL = the module.
5455
PUSH DE D5
Save Register Pair DE (the task block) to the stack, for @ADTSK.
5456
LD HL,0005H 21 05 00
Load Register Pair HL with 0005H, the distance from the task block to the module's routine.
5459
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the routine (module +0DH).
545A
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the routine, Register Pair HL = the task block.
545B
LD (HL),E 73
Store Register E (the low byte of the routine) at Register Pair HL, the task block's first word.
545C
INC HL 23
INCrement Register Pair HL to the high byte of the first word.
545D
LD (HL),D 72
Store Register D (the high byte of the routine) at Register Pair HL: the task block names its routine.
545E
LD A,05H 3E 05
Load Register A with 05H, task slot 5, the blinking cursor's slot.
5460
POP DE D1
Restore Register Pair DE from the stack: the task block.
5461
GOSUB to 4410H (@ADTSK) to put the task block at Register Pair DE into slot Register A (5): the cursor blinks from now on.
5464
JUMP to 54B4H to go on with the next option, TYPE.
5467-5468
DEFB 00H, 00H 00 00
The LARGE parameter, where @PARAM stores the value of LARGE: 0000H in the file, FFFFH for LARGE. 540FH tests its low byte.

5469H - The $BL Module: The Blinking Cursor Task

Copied to high memory by 544DH; the addresses in the comments are those of this member. The module's task block is at its +08H; SYS0/SYS runs the task in slot 5 five times a second with Index Register IX at the block. The task works through @RPTSK (4416H): each call ends the run and the next run goes on after the call. One run puts the cursor character over the character at the cursor (DODCB$ +03H-+04H, 4020H-4021H) and keeps the place and the character in the block (+02H-+04H); the next run puts the character back, looking up the screen 64 bytes at a time when the screen has scrolled. Nothing is done while the cursor is off (4022H holds 00H).

5469
JUMP to 5469H, this instruction itself: the module is not run from its first byte (its task routine is at 5476H).
546B-546C
DEFW 0000H 00 00
The module's link word: HIGH$ before the module was installed, stored by 543FH or 5435H.
546D
DEFB 03H 03
03H, the length of the module's name, three characters.
546E-5470
DEFM "$BL" 24 42 4C
The module's name, by which request BCH finds the module (542AH, 53E9H).
5471-5472
DEFW 0000H 00 00
The task block, +00H-+01H: the address of the task's routine, set by 545BH and changed by every @RPTSK.
5473-5475
DEFB 00H, 00H, 00H 00 00 00
The task block, +02H-+04H: the screen address of the cursor (+02H-+03H) and the character the cursor character covers (+04H), stored by 5482H-5489H.
5476
GOSUB to 4416H (@RPTSK): this run ends here, and the next run of the task goes on at 5479H.
5479
LD A,(4022H) 3A 22 40
Fetch the byte at 4022H (DODCB$ +05H) into Register A: the character under the cursor, 00H when the cursor is off.
547C
OR A B7
Set the flags from Register A (OR A): the Z FLAG when the cursor is off.
547D
RET Z C8
RETurn if the Z FLAG is set (no cursor): the next run starts at 5479H again.
547E
LD BC,(4020H) ED 4B 20 40
Fetch the cursor's screen address from 4020H-4021H (DODCB$ +03H-+04H) into Register Pair BC.
5482
LD (IX+02H),C DD 71 02
Store Register C (the low byte of the cursor's address) at Index Register IX +02H in the task block.
5485
LD (IX+03H),B DD 70 03
Store Register B (the high byte of the cursor's address) at Index Register IX +03H in the task block.
5488
LD A,(BC) 0A
Fetch the character on the screen at Register Pair BC into Register A.
5489
LD (IX+04H),A DD 77 04
Store Register A (that character) at Index Register IX +04H in the task block.
548C
LD A,8FH 3E 8F
Load Register A with the cursor character, the operand at 548DH stored by 5421H (8FH in the file).
548E
LD (BC),A 02
Store Register A (the cursor character) on the screen at Register Pair BC.
548F
GOSUB to 4416H (@RPTSK): this run ends here, and the next run of the task goes on at 5492H.
5492
LD C,(IX+02H) DD 4E 02
Fetch the low byte of the saved screen address from Index Register IX +02H into Register C.
5495
LD B,(IX+03H) DD 46 03
Fetch the high byte of the saved screen address from Index Register IX +03H into Register B.
5498
LD A,(BC) 0A
Fetch the character on the screen at Register Pair BC into Register A.
5499
CP 8FH FE 8F
Compare Register A against the cursor character, the operand at 549AH stored by 5424H: the Z FLAG when it is still there.
549B
If the Z FLAG is set (the cursor character is where it was put), JUMP to 54AEH to put the character back.
549D
LD A,C 79
Copy Register C (the low byte of the screen address) into Register A.
549E
SUB 40H D6 40
SUBtract 40H from Register A: one line of 64 characters higher.
54A0
LD C,A 4F
Copy Register A (the new low byte of the address) into Register C.
54A1
If the NO CARRY FLAG is set (no borrow), JUMP to 54A4H.
54A3
DEC B 05
DECrement Register B: the borrow into the high byte of the address.
54A4
LD A,3BH 3E 3B
Load Register A with 3BH, the high byte of the address above video memory (3C00H).
54A6
CP B B8
Compare Register A against Register B: the Z FLAG when the search has gone above the screen.
54A7
If the Z FLAG is set (the cursor character was not found), JUMP to 5476H to start again.
54A9
LD A,(BC) 0A
Fetch the character on the screen at Register Pair BC into Register A.
54AA
CP 8FH FE 8F
Compare Register A against the cursor character, the operand at 54ABH stored by 5427H.
54AC
If the NZ FLAG is set (not there), LOOP BACK to 549DH to look one line higher.
54AE
LD A,(IX+04H) DD 7E 04
Fetch the saved character from Index Register IX +04H into Register A.
54B1
LD (BC),A 02
Store Register A (the saved character) on the screen at Register Pair BC, over the cursor character.
54B2
JUMP to 5476H: the next run puts the cursor character up again.

54B4H - TYPE: Type Ahead

TYPE=OFF clears bit 1 of DFLAG$ (441FH). TYPE=ON needs KI/DVR (bit 4 of DFLAG$, else TYPE requires KI to be active) and its type ahead buffer (the word at 4DF2H not 0000H, else Type-ahead not resident); then bit 1 is set. The test meant to find type ahead already on reads bit 1 of the message text at 5C3DH, whose bit is clear, so it never finds it.

54B4
LD BC,0001H 01 01 00
Load Register Pair BC with the TYPE parameter, the operand at 54B5H-54B6H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
54B7
LD A,B 78
Copy Register B (the high byte of TYPE) into Register A.
54B8
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
54B9
DEC A 3D
DECrement Register A: the Z FLAG for 01H, TYPE not given.
54BA
If the Z FLAG is set (no TYPE), JUMP to 54F1H for SMOOTH.
54BD
INC A 3C
INCrement Register A back: the Z FLAG only for OFF.
54BE
If the NZ FLAG is set (TYPE=ON), JUMP to 54CAH.
54C0
LD HL,441FH 21 1F 44
TYPE=OFF: point Register Pair HL to 441FH, DFLAG$, the device flags.
54C3
RES 1,(HL) CB 8E
Clear bit 1 of DFLAG$ at Register Pair HL: type ahead is off.
54C5
LD HL,5C70H 21 70 5C
Point Register Pair HL to 5C70H, the message Type-ahead is now off.
54C8
JUMP to 54EEH to display the message at Register Pair HL.
54CA
LD HL,441FH 21 1F 44
TYPE=ON: point Register Pair HL to 441FH, DFLAG$, the device flags.
54CD
BIT 4,(HL) CB 66
Test bit 4 of DFLAG$ at Register Pair HL: set while KI/DVR is installed.
54CF
LD HL,5C3DH 21 3D 5C
Point Register Pair HL to 5C3DH, the message TYPE requires KI to be active. LD does not change the flags.
54D2
If the Z FLAG is set (no KI/DVR), JUMP to 54EEH to display the message at Register Pair HL.
54D4
BIT 1,(HL) CB 4E
Test bit 1 of the byte at Register Pair HL: Register Pair HL holds 5C3DH here, the letter T (54H) of the message, whose bit 1 is clear, so the Z FLAG is always set.
54D6
LD HL,5C5BH 21 5B 5C
Point Register Pair HL to 5C5BH, the message Type-ahead is now on. LD does not change the flags.
54D9
If the NZ FLAG is set (never, see 54D4H), JUMP to 54EEH.
54DB
LD DE,(4DF2H) ED 5B F2 4D
Fetch the word at 4DF2H-4DF3H into Register Pair DE: KI/DVR's base cell, 0000H when its type ahead is not in memory.
54DF
LD A,D 7A
Copy Register D (the high byte) into Register A.
54E0
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for 0000H.
54E1
LD HL,5C86H 21 86 5C
Point Register Pair HL to 5C86H, the message Type-ahead not resident. LD does not change the flags.
54E4
If the Z FLAG is set (no type ahead in memory), JUMP to 54EEH to display the message at Register Pair HL.
54E6
LD HL,441FH 21 1F 44
Point Register Pair HL to 441FH, DFLAG$, the device flags.
54E9
SET 1,(HL) CB CE
Set bit 1 of DFLAG$ at Register Pair HL: type ahead is on.
54EB
LD HL,5C5BH 21 5B 5C
Point Register Pair HL to 5C5BH, the message Type-ahead is now on.
54EE
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.

54F1H - SMOOTH and GRAPHIC

SMOOTH=ON stores F3H (DI) and SMOOTH=OFF 00H (NOP) at 46FDH, the byte the floppy driver calls before a transfer. GRAPHIC=ON sets and GRAPHIC=OFF clears bit 7 of DFLAG$.

54F1
LD BC,0001H 01 01 00
Load Register Pair BC with the SMOOTH parameter, the operand at 54F2H-54F3H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
54F4
LD A,B 78
Copy Register B (the high byte of SMOOTH) into Register A.
54F5
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
54F6
DEC A 3D
DECrement Register A: the Z FLAG for 01H, SMOOTH not given.
54F7
If the Z FLAG is set (no SMOOTH), JUMP to 5503H for GRAPHIC.
54FA
INC A 3C
INCrement Register A back: 00H for OFF, FFH for ON.
54FB
If the NZ FLAG is set (SMOOTH=ON), JUMP to 54FEH, inside the LD BC at 54FDH, where the bytes 3EH F3H read LD A,F3H.
54FD
LD BC,F33EH 01 3E F3
Load Register Pair BC with F33EH: no use, Register A stays 00H for OFF. Entered at 54FEH the bytes are LD A,F3H, the code of DI, for ON.
5500
LD (46FDH),A 32 FD 46
Store Register A (F3H or 00H) at 46FDH, the byte the floppy driver of SYS0/SYS calls before each transfer.
5503
LD BC,0001H 01 01 00
Load Register Pair BC with the GRAPHIC parameter, the operand at 5504H-5505H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5506
LD A,B 78
Copy Register B (the high byte of GRAPHIC) into Register A.
5507
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
5508
LD HL,441FH 21 1F 44
Point Register Pair HL to 441FH, DFLAG$, the device flags. LD does not change the flags.
550B
DEC A 3D
DECrement Register A: the Z FLAG for 01H, GRAPHIC not given.
550C
If the Z FLAG is set (no GRAPHIC), JUMP to 5517H for ALIVE.
550E
INC A 3C
INCrement Register A back: the Z FLAG for OFF.
550F
If the Z FLAG is set (GRAPHIC=OFF), JUMP to 5515H.
5511
SET 7,(HL) CB FE
Set bit 7 of DFLAG$ at Register Pair HL: GRAPHIC is on.
5513
JUMP to 5517H to go on with the next option, ALIVE.
5515
RES 7,(HL) CB BE
Clear bit 7 of DFLAG$ at Register Pair HL: GRAPHIC is off.

5517H - ALIVE: The Alive Indicator Module

ALIVE=ON puts the module $AL (5579H-5591H, 25 bytes) below HIGH$ (or uses the one already there) and its task block into task slot 3: five times a second it changes the character at the top right of the screen (3C3FH) between the graphics characters 86H and 89H. ALIVE=OFF empties slot 3 and gives the memory back when the module is the lowest in high memory.

5517
LD BC,0001H 01 01 00
Load Register Pair BC with the ALIVE parameter, the operand at 5518H-5519H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
551A
LD A,B 78
Copy Register B (the high byte of ALIVE) into Register A.
551B
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
551C
DEC A 3D
DECrement Register A: the Z FLAG for 01H, ALIVE not given.
551D
If the Z FLAG is set (no ALIVE), JUMP to 5592H for SVC.
551F
INC A 3C
INCrement Register A back: the Z FLAG for OFF.
5520
If the NZ FLAG is set (ALIVE=ON), JUMP to 553EH.
5522
LD DE,557EH 11 7E 55
ALIVE=OFF: point Register Pair DE to 557EH, the name $AL in the module.
5525
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module and Register Pair DE = its link word.
5528
If the NZ FLAG is set (no $AL module), JUMP to 5537H.
552A
LD BC,(4049H) ED 4B 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair BC.
552E
INC BC 03
INCrement Register Pair BC: HIGH$ + 1, the lowest byte of high memory.
552F
SBC HL,BC ED 42
SUBtract Register Pair BC and the CARRY FLAG from Register Pair HL (the module): the Z FLAG when the module starts at HIGH$ + 1.
5531
If the NZ FLAG is set (another module lies below it), JUMP to 5537H: its memory is kept.
5533
LD (4049H),DE ED 53 49 40
Store Register Pair DE (the module's link word) at 4049H-404AH: HIGH$ as it was before the module.
5537
LD A,03H 3E 03
Load Register A with 03H, task slot 3, the alive indicator's slot.
5539
GOSUB to 4413H (@RMTSK) to empty task slot Register A.
553C
JUMP to 5592H to go on with the next option, SVC.
553E
LD DE,557EH 11 7E 55
ALIVE=ON: point Register Pair DE to 557EH, the name $AL in the module.
5541
GOSUB to 5AE7H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module and Register Pair DE = its link word.
5544
LD (557BH),DE ED 53 7B 55
Store Register Pair DE (the link word of a module found) at 557BH, the link word of the copy. LD does not change the flags.
5548
If the Z FLAG is set (already installed), JUMP to 555DH to copy the module over the one at Register Pair HL; Register Pair BC then holds what the lookup through RST 28H left in it.
554A
GOSUB to 5AF7H, which returns only when the command may change memory (LDOS command level).
554D
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5550
LD (557BH),HL 22 7B 55
Store Register Pair HL (HIGH$) at 557BH, the module's link word.
5553
LD BC,0019H 01 19 00
Load Register Pair BC with 0019H, the 25 bytes of the module.
5556
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
5557
SBC HL,BC ED 42
SUBtract Register Pair BC (25) from Register Pair HL: the new HIGH$.
5559
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is lowered below the module.
555C
INC HL 23
INCrement Register Pair HL: the address of the module, HIGH$ + 1.
555D
PUSH HL E5
Save Register Pair HL (the module's address) to the stack.
555E
LD DE,000AH 11 0A 00
Load Register Pair DE with 000AH, the offset of the module's routine.
5561
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the routine in the copy.
5562
LD (5581H),HL 22 81 55
Store Register Pair HL at 5581H, the task block's first word in the module: the routine.
5565
POP DE D1
Restore Register Pair DE from the stack: the module's address, the destination.
5566
PUSH DE D5
Save Register Pair DE (the module's address) to the stack again.
5567
LD HL,5579H 21 79 55
Point Register Pair HL to 5579H, the module in this member.
556A
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the module to high memory.
556C
POP DE D1
Restore Register Pair DE from the stack: the module's address.
556D
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the offset of the task block in the module.
5570
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the module's task block.
5571
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the task block.
5572
LD A,03H 3E 03
Load Register A with 03H, task slot 3, the alive indicator's slot.
5574
GOSUB to 4410H (@ADTSK) to put the task block at Register Pair DE into slot Register A (3).
5577
JUMP to 5592H to go on with the next option, SVC.

5579H - The $AL Module: The Alive Indicator

Copied to high memory by 556AH; the addresses in the comments are those of this member. Its task block (+08H) names the routine at +0AH, which SYS0/SYS runs in slot 3 five times a second.

5579
JUMP over the module's header to 5583H, the routine.
557B-557C
DEFW 0000H 00 00
The module's link word: HIGH$ before the module was installed, stored by 5550H or 5544H.
557D
DEFB 03H 03
03H, the length of the module's name, three characters.
557E-5580
DEFM "$AL" 24 41 4C
The module's name, by which request BCH finds the module (5522H, 553EH).
5581-5582
DEFW 0000H 00 00
The task block, +00H-+01H: the address of the routine, stored by 5562H.
5583
LD A,(3C3FH) 3A 3F 3C
Fetch the character at the top right of the screen from 3C3FH into Register A.
5586
CP 86H FE 86
Compare Register A against 86H, one of the two graphics characters.
5588
LD A,89H 3E 89
Load Register A with 89H, the other graphics character. LD does not change the flags.
558A
If the Z FLAG is set (86H was there), JUMP to 558EH to put 89H there.
558C
LD A,86H 3E 86
Load Register A with 86H, the first graphics character.
558E
LD (3C3FH),A 32 3F 3C
Store Register A (86H or 89H) at 3C3FH, the top right of the screen.
5591
RET C9
RETurn to the task loop of SYS0/SYS until the next run.

5592H - SVC: The Supervisor Calls below 80H

SVC copies the module $SVC (55E0H-5704H, 293 bytes) below HIGH$ and points the supervisor dispatcher's jump for request codes below 80H (the operand at 4BCFH-4BD0H) at the module's dispatcher (+109H): a program then calls a system routine by its number with LD A,n and RST 28H. Bit 0 of SFLAG$ notes that it is installed (a second SVC shows SVC table already implemented).

5592
LD BC,0000H 01 00 00
Load Register Pair BC with the SVC parameter, the operand at 5593H-5594H: 0000H in the file, FFFFH for SVC.
5595
LD A,B 78
Copy Register B (the high byte of SVC) into Register A.
5596
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when SVC was not given.
5597
If the Z FLAG is set (no SVC), JUMP to 5705H for SYSRES.
559A
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
559D
BIT 0,(HL) CB 46
Test bit 0 of SFLAG$ at Register Pair HL: set when the SVC table is installed.
559F
SET 0,(HL) CB C6
Set bit 0 of SFLAG$ at Register Pair HL: the SVC table is installed. SET does not change the flags.
55A1
LD HL,5D82H 21 82 5D
Point Register Pair HL to 5D82H, the message SVC table already implemented. LD does not change the flags.
55A4
If the NZ FLAG is set (already installed), JUMP to 55DAH to display the message at Register Pair HL.
55A6
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
55A9
LD (55E2H),HL 22 E2 55
Store Register Pair HL (HIGH$) at 55E2H, the module's link word.
55AC
LD BC,0125H 01 25 01
Load Register Pair BC with 0125H, the 293 bytes of the module.
55AF
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
55B0
SBC HL,BC ED 42
SUBtract Register Pair BC (293) from Register Pair HL: the new HIGH$.
55B2
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is lowered below the module.
55B5
INC HL 23
INCrement Register Pair HL: the address of the module, HIGH$ + 1.
55B6
PUSH HL E5
Save Register Pair HL (the module's address) to the stack.
55B7
LD DE,011AH 11 1A 01
Load Register Pair DE with 011AH, the offset of the module's routine for SVC 100.
55BA
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of that routine in the copy.
55BB
LD (56B1H),HL 22 B1 56
Store Register Pair HL at 56B1H, the table entry for SVC 100 (64H) in the module.
55BE
POP HL E1
Restore Register Pair HL from the stack: the module's address.
55BF
PUSH HL E5
Save Register Pair HL (the module's address) to the stack again.
55C0
LD DE,0009H 11 09 00
Load Register Pair DE with 0009H, the offset of the module's table of routines.
55C3
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the table in the copy.
55C4
LD (56EBH),HL 22 EB 56
Store Register Pair HL at 56EBH, the operand of the dispatcher's LD HL at 56EAH.
55C7
POP HL E1
Restore Register Pair HL from the stack: the module's address.
55C8
PUSH HL E5
Save Register Pair HL (the module's address) to the stack again.
55C9
LD DE,55E0H 11 E0 55
Point Register Pair DE to 55E0H, the module in this member.
55CC
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the module here, Register Pair DE = the copy's address.
55CD
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the 293 bytes of the module to high memory.
55CF
POP HL E1
Restore Register Pair HL from the stack: the module's address.
55D0
LD DE,0109H 11 09 01
Load Register Pair DE with 0109H, the offset of the module's dispatcher.
55D3
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the dispatcher in the copy.
55D4
LD (4BCFH),HL 22 CF 4B
Store Register Pair HL at 4BCFH-4BD0H, the operand of the supervisor dispatcher's JP P: request codes below 80H now go to the module.
55D7
LD HL,5DA0H 21 A0 5D
Point Register Pair HL to 5DA0H, the message SVC table now installed.
55DA
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
55DD
JUMP to 5705H to go on with the next option, SYSRES.

55E0H - The $SVC Module: The Table of Supervisor Calls

Copied to high memory by 55CDH; the addresses in the comments are those of this member. After its header comes the table of 128 routine addresses for the supervisor call numbers 0-127 (from +09H), then the dispatcher (+109H) and the routine for number 100 (+11AH). The supervisor dispatcher of SYS0/SYS jumps to the dispatcher for any request code below 80H with the RST 28H's return address still on the stack, so the routine's RET goes back to the program.

55E0
JUMP to 55E0H, this instruction itself: the module is not run from its first byte (the dispatcher is at 56E9H).
55E2-55E3
DEFW 0000H 00 00
The module's link word: HIGH$ before the module was installed, stored by 55A9H.
55E4
DEFB 04H 04
04H, the length of the module's name, four characters.
55E5-55E8
DEFM "$SVC" 24 53 56 43
The module's name $SVC, kept with its length in the module header.
55E9-55EA
DEFW 4C4BH 4B 4C
SVC 0 (00H): 4C4BH, (the two bytes read KL as text after the name) SYS0/SYS's display of SYS Error and abort: no routine has this number.
55EB-55EC
DEFW 0049H 49 00
SVC 1 (01H): 0049H, @KEY, the ROM's wait for a key.
55ED-55EE
DEFW 0033H 33 00
SVC 2 (02H): 0033H, @DSP, the ROM's display of the character in Register A.
55EF-55F0
DEFW 0013H 13 00
SVC 3 (03H): 0013H, @GET, the ROM's input of a byte from the device at Register Pair DE.
55F1-55F2
DEFW 001BH 1B 00
SVC 4 (04H): 001BH, @PUT, the ROM's output of a byte to the device at Register Pair DE.
55F3-55F4
DEFW 0023H 23 00
SVC 5 (05H): 0023H, @CTL, the ROM's control request to the device at Register Pair DE.
55F5-55F6
DEFW 003BH 3B 00
SVC 6 (06H): 003BH, @PRT, the ROM's output of a character to the printer.
55F7-55F8
DEFW 000BH 0B 00
SVC 7 (07H): 000BH, @WHERE, the ROM's routine that returns the caller's address.
55F9-55FA
DEFW 002BH 2B 00
SVC 8 (08H): 002BH, @KBD, the ROM's single look at the keyboard.
55FB-55FC
DEFW 0040H 40 00
SVC 9 (09H): 0040H, @KEYIN, the ROM's input of a line.
55FD-55FE
DEFW 4467H 67 44
SVC 10 (0AH): 4467H, @DSPLY, display a text (a vector of SYS0/SYS).
55FF-5600
DEFW 447EH 7E 44
SVC 11 (0BH): 447EH, @LOGER, send a text to the job log.
5601-5602
DEFW 447BH 7B 44
SVC 12 (0CH): 447BH, @LOGOT, display a text and send it to the job log.
5603-5604
DEFW 4479H 79 44
SVC 13 (0DH): 4479H, @MSG, send a text to a device.
5605-5606
DEFW 446AH 6A 44
SVC 14 (0EH): 446AH, @PRINT, print a text (a vector of SYS0/SYS).
5607-5608
DEFW 4C4BH 4B 4C
SVC 15 (0FH): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
5609-560A
DEFW 0060H 60 00
SVC 16 (10H): 0060H, @PAUSE, the ROM's delay of Register Pair BC counts.
560B-560C
DEFW 4476H 76 44
SVC 17 (11H): 4476H, @PARAM, read parameters against a table.
560D-560E
DEFW 4470H 70 44
SVC 18 (12H): 4470H, @DATE, write the date as MM/DD/YY.
560F-5610
DEFW 446DH 6D 44
SVC 19 (13H): 446DH, @TIME, write the time as HH:MM:SS.
5611-5612
DEFW 4D7BH 7B 4D
SVC 20 (14H): 4D7BH, SYS0/SYS's routine that writes Register A as two hex digits at Register Pair HL.
5613-5614
DEFW 4030H 30 40
SVC 21 (15H): 4030H, @ABORT, end a program on an error.
5615-5616
DEFW 402DH 2D 40
SVC 22 (16H): 402DH, @EXIT, end a program (a vector of SYS0/SYS).
5617-5618
DEFW 4400H 00 44
SVC 23 (17H): 4400H, @CMD, go to LDOS Ready (a vector of SYS0/SYS).
5619-561A
DEFW 4405H 05 44
SVC 24 (18H): 4405H, @CMNDI, carry out a command line, then LDOS Ready.
561B-561C
DEFW 4451H 51 44
SVC 25 (19H): 4451H, the request stub A3H, a command line carried out with a return to the caller.
561D-561E
DEFW 4409H 09 44
SVC 26 (1AH): 4409H, @ERROR, report an error number.
561F-5620
DEFW 440DH 0D 44
SVC 27 (1BH): 440DH, @DEBUG, enter DEBUG (a vector of SYS0/SYS).
5621-5622
DEFW 4C4BH 4B 4C
SVC 28 (1CH): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
5623-5624
DEFW 4410H 10 44
SVC 29 (1DH): 4410H, @ADTSK, put a task into a slot.
5625-5626
DEFW 4413H 13 44
SVC 30 (1EH): 4413H, @RMTSK, empty a task slot.
5627-5628
DEFW 4416H 16 44
SVC 31 (1FH): 4416H, @RPTSK, end a task's run, go on after the call next time.
5629-562A
DEFW 4419H 19 44
SVC 32 (20H): 4419H, @KLTSK, remove the running task.
562B-562C
DEFW 44B8H B8 44
SVC 33 (21H): 44B8H, @CKDRV, check that a drive is ready.
562D-562E
DEFW 4463H 63 44
SVC 34 (22H): 4463H, @DODIR, directory display.
562F-563A
DEFW 4C4BH x 6 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C
SVC 35-40 (23H-28H): 4C4BH each, SYS0/SYS's display of SYS Error and abort: no routine has these numbers.
563B-563C
DEFW 4754H 54 47
SVC 41 (29H): 4754H, SELECT, select a drive (a vector of SYS0/SYS).
563D-5644
DEFW 4C4BH x 4 4B 4C 4B 4C 4B 4C 4B 4C
SVC 42-45 (2AH-2DH): 4C4BH each, SYS0/SYS's display of SYS Error and abort: no routine has these numbers.
5645-5646
DEFW 475EH 5E 47
SVC 46 (2EH): 475EH, SEEK, seek a cylinder (a vector of SYS0/SYS).
5647-5648
DEFW 4759H 59 47
SVC 47 (2FH): 4759H, RSELCT, select a drive and return its status.
5649-564A
DEFW 4C4BH 4B 4C
SVC 48 (30H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
564B-564C
DEFW 4777H 77 47
SVC 49 (31H): 4777H, RDSECT, read a sector (a vector of SYS0/SYS).
564D-564E
DEFW 4772H 72 47
SVC 50 (32H): 4772H, VERSEC, verify a sector.
564F-5652
DEFW 4C4BH x 2 4B 4C 4B 4C
SVC 51-52 (33H-34H): 4C4BH each, SYS0/SYS's display of SYS Error and abort: no routine has these numbers.
5653-5654
DEFW 4763H 63 47
SVC 53 (35H): 4763H, WRSECT, write a sector (a vector of SYS0/SYS).
5655-5656
DEFW 4768H 68 47
SVC 54 (36H): 4768H, WRPROT, write a sector with the deleted data mark.
5657-5658
DEFW 476DH 6D 47
SVC 55 (37H): 476DH, WRTRK, write a track (a vector of SYS0/SYS).
5659-565A
DEFW 4C4BH 4B 4C
SVC 56 (38H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
565B-565C
DEFW 442CH 2C 44
SVC 57 (39H): 442CH, @KILL, delete a file (a vector of SYS0/SYS).
565D-565E
DEFW 4420H 20 44
SVC 58 (3AH): 4420H, @INIT, open or create a file.
565F-5660
DEFW 4424H 24 44
SVC 59 (3BH): 4424H, @OPEN, open a file (a vector of SYS0/SYS).
5661-5662
DEFW 4428H 28 44
SVC 60 (3CH): 4428H, @CLOSE, close a file (a vector of SYS0/SYS).
5663-5664
DEFW 4445H 45 44
SVC 61 (3DH): 4445H, @BKSP, back up one record.
5665-5666
DEFW 444BH 4B 44
SVC 62 (3EH): 444BH, @CKEOF, test the end of file.
5667-5668
DEFW 445AH 5A 44
SVC 63 (3FH): 445AH, @LOC, the current record number.
5669-566A
DEFW 445DH 5D 44
SVC 64 (40H): 445DH, @LOF, the number of records.
566B-566C
DEFW 4448H 48 44
SVC 65 (41H): 4448H, @PEOF, position to the end of file.
566D-566E
DEFW 4442H 42 44
SVC 66 (42H): 4442H, @POSN, position to a record.
566F-5670
DEFW 4436H 36 44
SVC 67 (43H): 4436H, @READ, read a record (a vector of SYS0/SYS).
5671-5672
DEFW 443FH 3F 44
SVC 68 (44H): 443FH, @REW, position to the first record.
5673-5674
DEFW 4454H 54 44
SVC 69 (45H): 4454H, @RREAD, read the current sector again.
5675-5676
DEFW 4457H 57 44
SVC 70 (46H): 4457H, @RWRIT, write the current sector again.
5677-5678
DEFW 4C4BH 4B 4C
SVC 71 (47H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
5679-567A
DEFW 4460H 60 44
SVC 72 (48H): 4460H, @SKIP, skip a record (a vector of SYS0/SYS).
567B-567C
DEFW 443CH 3C 44
SVC 73 (49H): 443CH, @VER, write a record and verify it.
567D-567E
DEFW 444EH 4E 44
SVC 74 (4AH): 444EH, @WEOF, write the end of file to the directory.
567F-5680
DEFW 4439H 39 44
SVC 75 (4BH): 4439H, @WRITE, write a record (a vector of SYS0/SYS).
5681-5682
DEFW 4430H 30 44
SVC 76 (4CH): 4430H, @LOAD, load a program file.
5683-5684
DEFW 4433H 33 44
SVC 77 (4DH): 4433H, @RUN, load and run a program file.
5685-5686
DEFW 441CH 1C 44
SVC 78 (4EH): 441CH, @FSPEC, take a file specification from a text.
5687-5688
DEFW 4473H 73 44
SVC 79 (4FH): 4473H, @FEXT, add a default extension.
5689-568A
DEFW 44BBH BB 44
SVC 80 (50H): 44BBH, @FNAME, the name of a directory record.
568B-568C
DEFW 478FH 8F 47
SVC 81 (51H): 478FH, GETDCT, point Index Register IY at a drive code table.
568D-568E
DEFW 4C4BH 4B 4C
SVC 82 (52H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
568F-5690
DEFW 4B65H 65 4B
SVC 83 (53H): 4B65H, DIRCYL, the directory cylinder of a drive.
5691-5692
DEFW 4C4BH 4B 4C
SVC 84 (54H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
5693-5694
DEFW 4B45H 45 4B
SVC 85 (55H): 4B45H, RDSSEC, read a directory sector.
5695-5696
DEFW 4C4BH 4B 4C
SVC 86 (56H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
5697-5698
DEFW 4B10H 10 4B
SVC 87 (57H): 4B10H, DIRRD, read the sector of a directory record.
5699-569A
DEFW 4B1FH 1F 4B
SVC 88 (58H): 4B1FH, DIRWR, write a directory sector back.
569B-569C
DEFW 4C4BH 4B 4C
SVC 89 (59H): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
569D-569E
DEFW 4B6CH 6C 4B
SVC 90 (5AH): 4B6CH, MULTEA, multiply Register A by Register E.
569F-56A0
DEFW 44C1H C1 44
SVC 91 (5BH): 44C1H, @MULT, multiply Register Pair HL by Register A.
56A1-56A2
DEFW 4C4BH 4B 4C
SVC 92 (5CH): 4C4BH, SYS0/SYS's display of SYS Error and abort: no routine has this number.
56A3-56A4
DEFW 4B7BH 7B 4B
SVC 93 (5DH): 4B7BH, DIVEA, divide Register E by Register A.
56A5-56A6
DEFW 44C4H C4 44
SVC 94 (5EH): 44C4H, @DIV, divide Register Pair HL by Register A.
56A7-56B0
DEFW 4C4BH x 5 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C
SVC 95-99 (5FH-63H): 4C4BH each, SYS0/SYS's display of SYS Error and abort: no routine has these numbers.
56B1-56B2
DEFW 56FAH FA 56
SVC 100 (64H): 56FAH, the module's own routine at 56FAH that sets or returns HIGH$ (the operand stored by 55BBH for the copy).
56B3-56E8
DEFW 4C4BH x 27 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C 4B 4C
SVC 101-127 (65H-7FH): 4C4BH each, SYS0/SYS's display of SYS Error and abort: no routine has these numbers.

56E9H - The $SVC Module: The Dispatcher and SVC 100

56E9H is entered from 4BCEH with Register A = the supervisor call number (0-127) and the program's registers. It looks the number up in the table and goes to the routine with Register A = the value of Register C (the call's argument) and Register Pair HL as it was. 56FAH is supervisor call 100: with Register Pair HL not 0000H it stores HL as HIGH$; in either case it returns HIGH$ in Register Pair HL.

56E9
PUSH HL E5
Save Register Pair HL (the program's value) to the stack.
56EA
LD HL,0000H 21 00 00
Load Register Pair HL with the table's address, the operand at 56EBH-56ECH: 0000H in the file, module +09H in the copy (stored by 55C4H).
56ED
ADD A,A 87
ADD Register A to itself: the number times two, the offset of its word in the table.
56EE
ADD A,L 85
ADD Register L (the low byte of the table) to Register A.
56EF
LD L,A 6F
Copy Register A (the low byte of the entry's address) into Register L.
56F0
ADC A,H 8C
ADD Register H and the CARRY FLAG to Register A (ADC A,H): the low byte plus the high byte plus the carry.
56F1
SUB L 95
SUBtract Register L from Register A: Register A = Register H plus the carry.
56F2
LD H,A 67
Copy Register A into Register H: Register Pair HL = the entry of the number in the table.
56F3
LD A,(HL) 7E
Fetch the low byte of the routine's address at Register Pair HL into Register A.
56F4
INC HL 23
INCrement Register Pair HL to the high byte of the entry.
56F5
LD H,(HL) 66
Fetch the high byte of the routine's address at Register Pair HL into Register H.
56F6
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the routine.
56F7
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): the routine's address goes on the stack, the program's Register Pair HL comes back.
56F8
LD A,C 79
Copy Register C (the call's argument) into Register A.
56F9
RET C9
RETurn: the address on the stack is the routine, which runs with Register A = the argument and returns to the program.
56FA
LD A,H 7C
SVC 100: copy Register H (the high byte of the new HIGH$) into Register A.
56FB
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG when Register Pair HL is 0000H, a request to read HIGH$.
56FC
If the Z FLAG is set (read only), JUMP to 5701H.
56FE
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: the new HIGH$.
5701
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5704
RET C9
RETurn to the program with HIGH$ in Register Pair HL.

5705H - SYSRES: Keep a System File in Memory

SYSRES=n (1-5 or 8-12) keeps SYSn/SYS in high memory, so that its requests no longer read the diskette. The first SYSRES puts the module $SR (57BFH-5824H) below HIGH$ and points the supervisor dispatcher's CALL (operand 4BDFH-4BE0H) at its hook (+28H). Then the file is loaded through the overlay loader (4BF5H), copied below HIGH$ with its length in front and an 8 byte header named $Sn, and its address noted in the $SR module's table. SYSRES=0, 6, 7 or 13 and up shows Can't SYSRES requested module, a file already kept System module already resident.

5705
LD BC,FFFFH 01 FF FF
Load Register Pair BC with the SYSRES parameter, the operand at 5706H-5707H: FFFFH in the file (not given), else the number of the system file.
5708
INC B 04
INCrement Register B: the Z FLAG only for a high byte of FFH, SYSRES not given.
5709
If the Z FLAG is set (no SYSRES), JUMP to 5825H for the drive options.
570C
LD A,C 79
Copy Register C (the number of the system file) into Register A.
570D
OR A B7
Set the flags from Register A (OR A): the Z FLAG for SYS0.
570E
If the Z FLAG is set (SYS0, which is always in memory), JUMP to 573FH, inside the LD IX at 573EH, where the bytes read LD HL,5BDCH: Can't SYSRES requested module.
5710
CP 06H FE 06
Compare Register A against 06H: the CARRY FLAG for files 1-5.
5712
If the CARRY FLAG is set (1-5), JUMP to 571CH.
5714
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG for 6 and 7, the two libraries.
5716
If the CARRY FLAG is set (SYS6 or SYS7), JUMP to 573FH for Can't SYSRES requested module.
5718
CP 0DH FE 0D
Compare Register A against 0DH: the NO CARRY FLAG for 13 and up.
571A
If the NO CARRY FLAG is set (no such system file), JUMP to 573FH for Can't SYSRES requested module.
571C
PUSH AF F5
Save Register Pair AF (Register A, the number of the file) to the stack.
571D
LD HL,4BDFH 21 DF 4B
Point Register Pair HL to 4BDFH, the operand of the supervisor dispatcher's CALL of the overlay loader.
5720
LD E,(HL) 5E
Fetch the low byte of the CALL's address at Register Pair HL into Register E.
5721
INC HL 23
INCrement Register Pair HL to the high byte of the CALL's address.
5722
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the routine the dispatcher calls.
5723
LD HL,4BF5H 21 F5 4B
Load Register Pair HL with 4BF5H, the overlay loader of SYS0/SYS.
5726
OR A B7
Clear the CARRY FLAG (OR A sets the flags from Register A and clears the carry) for the subtraction below.
5727
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the dispatcher still calls 4BF5H, no $SR module yet.
5729
If the Z FLAG is set (no $SR module), JUMP to 5794H to install it first.
572B
LD HL,FFE0H 21 E0 FF
Load Register Pair HL with FFE0H, minus 20H, the distance back from the hook.
572E
ADD HL,DE 19
ADD Register Pair DE (the $SR module's hook, module +28H) to Register Pair HL: the module +08H, its table for file 0.
572F
RLCA 07
Rotate Register A left (RLCA): the number of the file times two, the offset of its entry.
5730
ADD A,L 85
ADD Register L to Register A: the low byte of the file's entry.
5731
LD L,A 6F
Copy Register A (the low byte of the entry) into Register L.
5732
If the NO CARRY FLAG is set (no carry), JUMP to 5735H.
5734
INC H 24
INCrement Register H: the carry into the high byte.
5735
INC HL 23
INCrement Register Pair HL to the high byte of the file's entry.
5736
LD A,(HL) 7E
Fetch the high byte of the entry at Register Pair HL into Register A: 00H when the file is not kept in memory.
5737
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 00H.
5738
If the Z FLAG is set (not yet kept), JUMP to 5750H to load it.
573A
POP AF F1
Restore Register Pair AF (the number of the file) from the stack.
573B
LD HL,5BFAH 21 FA 5B
Point Register Pair HL to 5BFAH, the message System module already resident.
573E
LD IX,5BDCH DD 21 DC 5B
Load Index Register IX with 5BDCH: no use when run from above. Entered at 573FH (from 570EH, 5716H and 571AH) the bytes 21H DCH 5BH are LD HL,5BDCH, the message Can't SYSRES requested module.
5742
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5745
JUMP to 5825H: the drive options are still carried out.
5748
JUMP to itself: the first two bytes of the 8 byte header (5748H-574FH) that 578BH copies in front of each file kept in memory; it is not run here.
574A-574B
DEFW 0000H 00 00
The header's link word: HIGH$ before the file was put below it, stored by 5760H.
574C
DEFB 03H 03
03H, the length of the header's name, three characters.
574D-574E
DEFM "$S" 24 53
The start of the name $Sn of a file kept in memory.
574F
DEFM " " 20
The n of the name: a space in the file, the file's number as a hexadecimal digit stored by 5786H.
5750
LD (430EH),A 32 0E 43
Store Register A (00H) at 430EH, OVRLY$: no system file counts as loaded, so the overlay loader reads the file.
5753
POP AF F1
Restore Register Pair AF from the stack: Register A = the number of the file.
5754
PUSH AF F5
Save Register Pair AF (the number of the file) to the stack again.
5755
ADD A,02H C6 02
ADD 02H to Register A: the file's number plus 2, the low four bits of its request code.
5757
OR 80H F6 80
OR 80H into Register A: the request code with function 0, which loads the file.
5759
PUSH HL E5
Save Register Pair HL (the file's entry in the $SR table, its high byte) to the stack.
575A
GOSUB to 4BF5H, the overlay loader of SYS0/SYS, to load the system file of request Register A into 4E00H; its length goes to 4BC9H-4BCAH.
575D
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5760
LD (574AH),HL 22 4A 57
Store Register Pair HL (HIGH$) at 574AH, the header's link word.
5763
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = HIGH$, the top of the copy.
5764
LD BC,(4BC9H) ED 4B C9 4B
Fetch the length of the file's part at 4E00H from 4BC9H-4BCAH into Register Pair BC.
5768
LD HL,4E00H 21 00 4E
Load Register Pair HL with 4E00H, the start of the overlay area.
576B
ADD HL,BC 09
ADD Register Pair BC (the length) to Register Pair HL.
576C
DEC HL 2B
DECrement Register Pair HL: the last byte of the file in the overlay area.
576D
PUSH BC C5
Save Register Pair BC (the length) to the stack.
576E
LDDR ED B8
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting down (LDDR): the file is copied to just below HIGH$ + 1.
5770
POP BC C1
Restore Register Pair BC (the length) from the stack.
5771
LD A,B 78
Copy Register B (the high byte of the length) into Register A.
5772
LD (DE),A 12
Store Register A at Register Pair DE, just below the copy.
5773
DEC DE 1B
DECrement Register Pair DE to the byte below.
5774
LD A,C 79
Copy Register C (the low byte of the length) into Register A.
5775
LD (DE),A 12
Store Register A at Register Pair DE: the length word sits in front of the copy, low byte first.
5776
POP HL E1
Restore Register Pair HL from the stack: the high byte of the file's entry in the $SR table.
5777
LD (HL),D 72
Store Register D (the high byte of the length word's address) at Register Pair HL.
5778
DEC HL 2B
DECrement Register Pair HL to the low byte of the entry.
5779
LD (HL),E 73
Store Register E (the low byte) at Register Pair HL: the entry now points at the length word.
577A
POP AF F1
Restore Register Pair AF from the stack: Register A = the number of the file.
577B
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG for 0-9.
577D
If the CARRY FLAG is set (a file number 0-9), JUMP to 5781H.
577F
ADD A,07H C6 07
ADD 07H to Register A: 10-12 become the letters A-C after the next ADD.
5781
ADD A,30H C6 30
ADD 30H to Register A: the file's number as a hexadecimal digit.
5783
LD HL,574FH 21 4F 57
Point Register Pair HL to 574FH, the n of the header's name $Sn.
5786
LD (HL),A 77
Store Register A (the digit) at Register Pair HL.
5787
DEC DE 1B
DECrement Register Pair DE to the byte below the length word.
5788
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight bytes of the header.
578B
LDDR ED B8
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting down (LDDR): the header 5748H-574FH goes in front of the length word.
578D
LD (4049H),DE ED 53 49 40
Store Register Pair DE (one below the header) at 4049H-404AH: the new HIGH$.
5791
JUMP to 5825H to go on with the drive options.
5794
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H-404AH into Register Pair HL.
5797
LD (57C1H),HL 22 C1 57
Store Register Pair HL (HIGH$) at 57C1H, the $SR module's link word.
579A
LD BC,0066H 01 66 00
Load Register Pair BC with 0066H, the 102 bytes of the module.
579D
SBC HL,BC ED 42
SUBtract Register Pair BC (102) and the CARRY FLAG (clear after 5727H) from Register Pair HL: the new HIGH$.
579F
LD (4049H),HL 22 49 40
Store Register Pair HL at 4049H-404AH: HIGH$ is lowered below the module.
57A2
PUSH HL E5
Save Register Pair HL (the new HIGH$) to the stack.
57A3
LD DE,0006H 11 06 00
Load Register Pair DE with 0006H, the distance to the table's base.
57A6
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the new HIGH$ + 6, the module +05H, the base its hook adds twice the file's request code to.
57A7
LD (57F3H),HL 22 F3 57
Store Register Pair HL at 57F3H, the operand of the hook's LD HL at 57F2H.
57AA
POP HL E1
Restore Register Pair HL from the stack: the new HIGH$.
57AB
INC HL 23
INCrement Register Pair HL: the address of the module, HIGH$ + 1.
57AC
PUSH HL E5
Save Register Pair HL (the module's address) to the stack.
57AD
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the module's address, the destination.
57AE
LD HL,57BFH 21 BF 57
Point Register Pair HL to 57BFH, the module in this member.
57B1
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the 102 bytes of the module to high memory.
57B3
POP HL E1
Restore Register Pair HL from the stack: the module's address.
57B4
LD DE,0028H 11 28 00
Load Register Pair DE with 0028H, the offset of the module's hook.
57B7
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address of the hook in the copy.
57B8
LD (4BDFH),HL 22 DF 4B
Store Register Pair HL at 4BDFH-4BE0H: the supervisor dispatcher now calls the hook instead of the overlay loader.
57BB
POP AF F1
Restore Register Pair AF from the stack: Register A = the number of the file (pushed at 571CH).
57BC
JUMP to 571CH to keep the file now that the module is in place.

57BFH - The $SR Module: System Files Kept in Memory

Copied to high memory by 57B1H; the addresses in the comments are those of this member. Its table holds one word for each request code's low four bits: the address of the length word in front of a file kept in memory, or a high byte of 00H. The supervisor dispatcher calls the hook (+28H, 57E7H) with Register A = the request code (Register B = the library member): a file kept in memory and not already at 4E00H is copied there (its length to 4BC9H, 4E00H as the entry at 4BE5H, the code to OVRLY$); any other request goes on to the overlay loader at 4BF5H.

57BF
JUMP to 57BFH, this instruction itself: the module is not run from its first byte (the hook is at 57E7H).
57C1-57C2
DEFW 0000H 00 00
The module's link word: HIGH$ before the module was installed, stored by 5797H.
57C3
DEFB 03H 03
03H, the length of the module's name, three characters.
57C4-57C6
DEFM "$SR" 24 53 52
The module's name $SR, kept with its length in the module header.
57C7-57C8
DEFB 01H, 00H 01 00
The entry of request code 2 (SYS0/SYS): 01H 00H; the high byte 00H means not kept (the 01H is a low byte no code tests).
57C9-57D2
DEFB 00H x 10 00 00 00 00 00 00 00 00 00 00
The entries of request codes 3-7 (SYS1/SYS-SYS5/SYS): 0000H, not kept until SYSRES stores an address.
57D3-57D4
DEFB 01H, 00H 01 00
The entry of request code 8 (SYS6/SYS, Library A): 01H 00H, never kept (the high byte is 00H).
57D5-57D6
DEFB 01H, 00H 01 00
The entry of request code 9 (SYS7/SYS, Library B): 01H 00H, never kept (the high byte is 00H).
57D7-57E2
DEFB 00H x 12 00 00 00 00 00 00 00 00 00 00 00 00
The entries of request codes 10-15 (SYS8/SYS-SYS13): 0000H, not kept until SYSRES stores an address.
57E3-57E6
DEFB 00H x 4 00 00 00 00
Two more words of 00H after the table; no request code reaches them.
57E7
PUSH HL E5
The hook: save Register Pair HL (the program's value) to the stack.
57E8
PUSH AF F5
Save Register Pair AF (Register A, the request code) to the stack.
57E9
LD HL,430EH 21 0E 43
Point Register Pair HL to 430EH, OVRLY$, the code of the system file now at 4E00H.
57EC
XOR (HL) AE
Exclusive OR the code at Register Pair HL into Register A (the request code).
57ED
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): the Z FLAG when the file of the request is already at 4E00H.
57EF
If the Z FLAG is set (already loaded), JUMP to 5820H to let the overlay loader handle it.
57F1
POP AF F1
Restore Register Pair AF from the stack: Register A = the request code.
57F2
LD HL,57C8H 21 C8 57
Load Register Pair HL with the base of the table, the operand at 57F3H-57F4H: 57C8H in the file, the module +05H in the copy (stored by 57A7H).
57F5
PUSH AF F5
Save Register Pair AF (the request code) to the stack again.
57F6
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): the file's number plus 2.
57F8
RLCA 07
Rotate Register A left (RLCA): twice that, the offset of the entry's high byte from the base.
57F9
ADD A,L 85
ADD Register L to Register A: the low byte of the entry's high byte.
57FA
LD L,A 6F
Copy Register A (the low byte of the entry) into Register L.
57FB
If the NO CARRY FLAG is set (no carry), JUMP to 57FEH.
57FD
INC H 24
INCrement Register H: the carry into the high byte.
57FE
LD A,(HL) 7E
Fetch the high byte of the entry at Register Pair HL into Register A: 00H when the file is not kept.
57FF
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 00H.
5800
If the Z FLAG is set (not kept), JUMP to 5820H to let the overlay loader read it.
5802
DEC HL 2B
DECrement Register Pair HL to the low byte of the entry.
5803
LD L,(HL) 6E
Fetch the low byte of the entry at Register Pair HL into Register L.
5804
LD H,A 67
Copy Register A (the high byte) into Register H: Register Pair HL = the length word of the kept file.
5805
PUSH DE D5
Save Register Pair DE (the program's value) to the stack.
5806
PUSH BC C5
Save Register Pair BC (Register B, the library member) to the stack.
5807
LD C,(HL) 4E
Fetch the low byte of the length at Register Pair HL into Register C.
5808
INC HL 23
INCrement Register Pair HL to the high byte of the length word.
5809
LD B,(HL) 46
Fetch the high byte of the length at Register Pair HL into Register B: Register Pair BC = the file's length.
580A
INC HL 23
INCrement Register Pair HL to the first byte of the kept file.
580B
LD DE,4E00H 11 00 4E
Point Register Pair DE to 4E00H, the overlay area.
580E
LD (4BE5H),DE ED 53 E5 4B
Store Register Pair DE (4E00H) at 4BE5H-4BE6H, where the supervisor dispatcher takes the entry of the file.
5812
LD (4BC9H),BC ED 43 C9 4B
Store Register Pair BC (the length) at 4BC9H-4BCAH, the length of the file at 4E00H.
5816
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the kept file to 4E00H.
5818
POP BC C1
Restore Register Pair BC (Register B, the library member) from the stack.
5819
POP DE D1
Restore Register Pair DE (the program's value) from the stack.
581A
POP AF F1
Restore Register Pair AF from the stack: Register A = the request code.
581B
LD (430EH),A 32 0E 43
Store Register A at 430EH, OVRLY$: the file is now at 4E00H.
581E
POP HL E1
Restore Register Pair HL (the program's value) from the stack.
581F
RET C9
RETurn to the supervisor dispatcher, which calls the file at 4E00H.
5820
POP AF F1
Restore Register Pair AF (the request code) from the stack.
5821
POP HL E1
Restore Register Pair HL (the program's value) from the stack.
5822
JUMP to 4BF5H, the overlay loader of SYS0/SYS, which returns to the supervisor dispatcher.

5825H - The Drive Options: DRIVE, WP, CYL, DISABLE, ENABLE, STEP, DELAY

With DRIVE=d the options apply to drive d only; without it WP, CYL, ENABLE, STEP and DELAY apply to every drive in turn (DISABLE needs DRIVE). Index Register IY points at the drive's code table in DCT$ (4700H + d x 10), Index Register IX at the same drive's table in drive 0's system information sector at 4200H (the block at 4220H after a boot through a driver, else 4270H), which is read first and written back afterwards when CYL is given: CYL changes only the copy the boot uses. WP sets the software write protect (bit 7 of +03H), DISABLE puts a RET (C9H) and ENABLE a JP (C3H) at +00H, STEP=n the step rate (bits 1-0 of +03H, unless bit 4 of +04H is set), DELAY=ON clears and DELAY=OFF sets bit 2 of +03H (one motor wait less).

5825
LD A,(586FH) 3A 6F 58
Fetch the low byte of the CYL parameter from 586FH into Register A: 00H when CYL was not given.
5828
OR A B7
Set the flags from Register A (OR A): the NZ FLAG when CYL was given.
5829
If the NZ FLAG is set (CYL), GOSUB to 5A61H to read the system information sector of drive 0 into 4200H.
582C
LD BC,FF00H 01 00 FF
Load Register Pair BC with the DRIVE parameter, the operand at 582DH-582EH: FF00H in the file (not given), else the drive number.
582F
LD IX,4270H DD 21 70 42
Point Index Register IX to 4270H, drive 0's table in the second block of the system information sector at 4200H.
5833
LD IY,4700H FD 21 00 47
Point Index Register IY to 4700H, drive 0's code table in DCT$.
5837
INC B 04
INCrement Register B: the Z FLAG only for a high byte of FFH, DRIVE not given.
5838
If the Z FLAG is set (no DRIVE), JUMP to 5845H to start with drive 0.
583A
LD A,C 79
Copy Register C (the drive number) into Register A.
583B
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG for a drive of 8 or more.
583D
If the NO CARRY FLAG is set (no such drive), JUMP to 5A7AH, inside the LD BC at 5A79H, where the bytes read LD A,2CH: error 2CH.
5840
GOSUB to 478FH (GETDCT) to point Index Register IY at the code table of drive Register C.
5843
PUSH IY FD E5
Save Index Register IY (the drive's code table) to the stack, for DRIVER (595EH, 59A5H).
5845
LD A,(442FH) 3A 2F 44
Fetch MFLAG$ from 442FH into Register A: bit 0 set after a boot through a disk driver.
5848
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
5849
If the NO CARRY FLAG is set (a boot by sector 0), JUMP to 584FH with Index Register IX at the second block.
584B
LD IX,4220H DD 21 20 42
Point Index Register IX to 4220H, drive 0's table in the first block of the system information sector.
584F
PUSH IY FD E5
Save Index Register IY (the drive's code table) to the stack.
5851
POP HL E1
Restore it into Register Pair HL: the drive's code table.
5852
LD DE,B900H 11 00 B9
Load Register Pair DE with B900H, minus 4700H.
5855
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the drive's table less 4700H, the drive number times 10.
5856
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the drive number times 10.
5857
ADD IX,DE DD 19
ADD Register Pair DE to Index Register IX: the drive's table in the system information sector.
5859
LD BC,0001H 01 01 00
Load Register Pair BC with the WP parameter, the operand at 585AH-585BH: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
585C
LD A,B 78
Copy Register B (the high byte of WP) into Register A.
585D
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
585E
DEC A 3D
DECrement Register A: the Z FLAG for 01H, WP not given.
585F
If the Z FLAG is set (no WP), JUMP to 586EH for CYL.
5861
INC A 3C
INCrement Register A back: the Z FLAG for OFF.
5862
If the Z FLAG is set (WP=OFF), JUMP to 586AH.
5864
SET 7,(IY+03H) FD CB 03 FE
Set bit 7 of byte +03H of the drive code table at Index Register IY +03H: the drive is write protected (a write returns error 0FH).
5868
JUMP to 586EH to go on with the next option, CYL.
586A
RES 7,(IY+03H) FD CB 03 BE
Clear bit 7 of byte +03H at Index Register IY +03H: the drive may be written.
586E
LD BC,0000H 01 00 00
Load Register Pair BC with the CYL parameter, the operand at 586FH-5870H: 0000H in the file (not given), else the number of cylinders.
5871
LD A,B 78
Copy Register B (the high byte of CYL) into Register A.
5872
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when CYL was not given.
5873
If the Z FLAG is set (no CYL), JUMP to 589CH for DISABLE.
5875
BIT 5,(IX+03H) DD CB 03 6E
Test bit 5 of byte +03H of the drive's table in the sector at Index Register IX +03H: set for an 8 inch drive.
5879
If the Z FLAG is set (a 5 inch drive), JUMP to 5887H.
587B
LD A,(582EH) 3A 2E 58
Fetch the high byte of the DRIVE parameter from 582EH into Register A: FFH when DRIVE was not given.
587E
INC A 3C
INCrement Register A: the Z FLAG when DRIVE was not given.
587F
LD HL,5B7CH 21 7C 5B
Point Register Pair HL to 5B7CH, the message CYL=c invalid on 8 inch drive. LD does not change the flags.
5882
If the NZ FLAG is set (a DRIVE was named), GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL; for every drive in turn the 8 inch drives are passed over silently.
5885
JUMP to 589CH to go on with the next option, DISABLE.
5887
LD A,C 79
Copy Register C (the number of cylinders) into Register A.
5888
DEC A 3D
DECrement Register A: the highest cylinder, the value the table keeps.
5889
CP 22H FE 22
Compare Register A against 22H: the CARRY FLAG for fewer than 35 cylinders.
588B
If the CARRY FLAG is set (too few), JUMP to 5891H to show the message.
588D
CP 60H FE 60
Compare Register A against 60H: the CARRY FLAG for 96 cylinders or fewer.
588F
If the CARRY FLAG is set (35-96), JUMP to 5899H to store it.
5891
LD HL,5B96H 21 96 5B
Point Register Pair HL to 5B96H, the message Cylinder count out of range <35-96>.
5894
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5897
JUMP to 589CH to go on with the next option, DISABLE.
5899
LD (IX+06H),A DD 77 06
Store Register A (the highest cylinder) at Index Register IX +06H, in the drive's table of the system information sector.
589C
LD BC,0000H 01 00 00
Load Register Pair BC with the DISABLE parameter, the operand at 589DH-589EH: 0000H in the file, FFFFH for DISABLE.
589F
LD A,B 78
Copy Register B (the high byte of DISABLE) into Register A.
58A0
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when DISABLE was not given.
58A1
If the Z FLAG is set (no DISABLE), JUMP to 58ADH for ENABLE.
58A3
LD A,(582EH) 3A 2E 58
Fetch the high byte of the DRIVE parameter from 582EH into Register A: FFH when DRIVE was not given.
58A6
INC A 3C
INCrement Register A: the Z FLAG when DRIVE was not given.
58A7
If the Z FLAG is set (DISABLE without DRIVE), JUMP to 58B9H: no drive is disabled.
58A9
LD A,C9H 3E C9
Load Register A with C9H, the code of RET: the drive is not there.
58AB
JUMP to 58B6H to store it at +00H of the drive's code table.
58AD
LD BC,0000H 01 00 00
Load Register Pair BC with the ENABLE parameter, the operand at 58AEH-58AFH: 0000H in the file, FFFFH for ENABLE.
58B0
LD A,B 78
Copy Register B (the high byte of ENABLE) into Register A.
58B1
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when ENABLE was not given.
58B2
If the Z FLAG is set (no ENABLE), JUMP to 58B9H for STEP.
58B4
LD A,C3H 3E C3
Load Register A with C3H, the code of JP: the drive is there.
58B6
LD (IY+00H),A FD 77 00
Store Register A (C9H or C3H) at Index Register IY +00H, the first byte of the drive's code table.
58B9
LD BC,FFFFH 01 FF FF
Load Register Pair BC with the STEP parameter, the operand at 58BAH-58BBH: FFFFH in the file (not given), else the step rate.
58BC
INC B 04
INCrement Register B: the Z FLAG only for a high byte of FFH, STEP not given.
58BD
If the Z FLAG is set (no STEP), JUMP to 58D4H for DELAY.
58BF
LD A,C 79
Copy Register C (the step rate) into Register A.
58C0
CP 04H FE 04
Compare Register A against 04H: the NO CARRY FLAG for a step rate of 4 or more.
58C2
If the NO CARRY FLAG is set (out of range), JUMP to 5A7AH to report error 2CH.
58C5
BIT 4,(IY+04H) FD CB 04 66
Test bit 4 of byte +04H of the drive code table at Index Register IY +04H.
58C9
If the NZ FLAG is set, JUMP to 58ECH: neither STEP nor DELAY is changed for this drive.
58CB
LD A,(IY+03H) FD 7E 03
Fetch byte +03H of the drive code table from Index Register IY +03H into Register A.
58CE
AND FCH E6 FC
Clear bits 1-0 of Register A (AND FCH): the old step rate.
58D0
OR C B1
OR Register C (the new step rate) into Register A.
58D1
LD (IY+03H),A FD 77 03
Store Register A at Index Register IY +03H: the drive steps at the new rate.
58D4
LD BC,0001H 01 01 00
Load Register Pair BC with the DELAY parameter, the operand at 58D5H-58D6H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
58D7
LD A,B 78
Copy Register B (the high byte of DELAY) into Register A.
58D8
OR C B1
OR Register C (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
58D9
DEC A 3D
DECrement Register A: the Z FLAG for 01H, DELAY not given.
58DA
If the Z FLAG is set (no DELAY), JUMP to 58ECH.
58DC
INC A 3C
INCrement Register A back: the Z FLAG for OFF.
58DD
LD B,00H 06 00
Load Register B with 00H, bit 2 clear, for DELAY=ON. LD does not change the flags.
58DF
If the NZ FLAG is set (DELAY=ON), JUMP to 58E3H with Register B = 00H.
58E1
LD B,04H 06 04
Load Register B with 04H, bit 2 set, for DELAY=OFF.
58E3
LD A,(IY+03H) FD 7E 03
Fetch byte +03H of the drive code table from Index Register IY +03H into Register A.
58E6
AND FBH E6 FB
Clear bit 2 of Register A (AND FBH): the old DELAY setting.
58E8
OR B B0
OR Register B (00H or 04H) into Register A: the new DELAY setting.
58E9
LD (IY+03H),A FD 77 03
Store Register A at Index Register IY +03H: bit 2 set means one wait for the motor less (4399H).
58EC
LD A,(582EH) 3A 2E 58
Fetch the high byte of the DRIVE parameter from 582EH into Register A: FFH when DRIVE was not given.
58EF
INC A 3C
INCrement Register A: the Z FLAG when DRIVE was not given.
58F0
If the NZ FLAG is set (one drive was named), JUMP to 5906H: the drive is done.
58F2
LD DE,000AH 11 0A 00
Load Register Pair DE with 000AH, the size of a drive's table.
58F5
ADD IX,DE DD 19
ADD Register Pair DE to Index Register IX: the next drive's table in the system information sector.
58F7
ADD IY,DE FD 19
ADD Register Pair DE to Index Register IY: the next drive's code table.
58F9
PUSH IY FD E5
Save Index Register IY (the next drive's code table) to the stack.
58FB
POP HL E1
Restore it into Register Pair HL: the next drive's code table.
58FC
LD A,L 7D
Copy Register L (the low byte of the table's address) into Register A.
58FD
CP 50H FE 50
Compare Register A against 50H: the CARRY FLAG while the address is below 4750H, a drive 0-7.
58FF
If the CARRY FLAG is set (drives left), JUMP to 5859H for the next drive.
5902
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H: no single drive was named.
5905
PUSH HL E5
Save Register Pair HL (0000H) to the stack, in place of the drive's code table, for DRIVER.
5906
LD A,(586FH) 3A 6F 58
Fetch the low byte of the CYL parameter from 586FH into Register A.
5909
OR A B7
Set the flags from Register A (OR A): the NZ FLAG when CYL was given.
590A
If the NZ FLAG is set (CYL), GOSUB to 5A6EH to write the sector at 4200H back to drive 0.

590DH - DRIVER: Load a Disk Driver

DRIVER="filespec" loads the driver file (default extension /DCT) with @LOAD and runs it at its transfer address with Register Pair DE = the code table of the drive named by DRIVE (0000H for none) and bit 3 of 4758H set. DRIVER alone asks Enter DCT driver <BREAK=default> : ; BREAK there puts the drive table that the boot uses (from the system information sector) back into the code table, from byte +03H on, for the drive of DRIVE or drive 0.

590D
LD DE,0000H 11 00 00
Load Register Pair DE with the DRIVER parameter, the operand at 590EH-590FH: 0000H in the file (not given), FFFFH for DRIVER alone, else the address of the quoted file specification.
5910
LD A,D 7A
Copy Register D (the high byte of DRIVER) into Register A.
5911
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when DRIVER was not given.
5912
If the Z FLAG is set (no DRIVER), JUMP to 59B3H for SYSTEM.
5915
INC A 3C
INCrement Register A: the Z FLAG when Register A was FFH, DRIVER given without a file.
5916
If the Z FLAG is set (DRIVER alone), JUMP to 593BH to ask for the file.
5918
LD HL,5EE8H 21 E8 5E
Point Register Pair HL to 5EE8H, a buffer above the member for the file specification.
591B
PUSH HL E5
Save Register Pair HL (5EE8H) to the stack, for the POP at 5938H.
591C
LD A,(DE) 1A
Fetch the next character of the quoted text at Register Pair DE into Register A.
591D
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
591F
If the Z FLAG is set, JUMP to 5936H to end the specification.
5921
CP 2CH FE 2C
Compare Register A against 2CH, a comma before the next parameter.
5923
If the Z FLAG is set, JUMP to 5936H to end the specification.
5925
CP 22H FE 22
Compare Register A against 22H, the closing quote.
5927
If the Z FLAG is set, JUMP to 5936H to end the specification.
5929
CP 29H FE 29
Compare Register A against 29H, the closing bracket.
592B
If the Z FLAG is set, JUMP to 5936H to end the specification.
592D
CP 03H FE 03
Compare Register A against 03H, the end of text mark.
592F
If the Z FLAG is set, JUMP to 5936H to end the specification.
5931
LD (HL),A 77
Store Register A (a character of the specification) at Register Pair HL in the buffer.
5932
INC DE 13
INCrement Register Pair DE to the next character of the text.
5933
INC HL 23
INCrement Register Pair HL to the next place in the buffer.
5934
LOOP BACK to 591CH for the next character of the specification.
5936
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL: the specification in the buffer ends with ENTER.
5938
POP HL E1
Restore Register Pair HL from the stack: 5EE8H, the specification.
5939
JUMP to 5988H to load the driver named at Register Pair HL.
593B
LD HL,5C19H 21 19 5C
Point Register Pair HL to 5C19H, the prompt Enter DCT driver <BREAK=default> : .
593E
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL, up to its 03H.
5941
LD HL,5EE8H 21 E8 5E
Point Register Pair HL to 5EE8H, the buffer for the answer.
5944
LD B,18H 06 18
Load Register B with 18H, at most 24 characters.
5946
GOSUB to the ROM at 0040H (@KEYIN) to read a line of up to Register B characters into Register Pair HL: the CARRY FLAG when BREAK ends it.
5949
If the NO CARRY FLAG is set (a line was typed), JUMP to 5988H to load the driver it names.
594B
BREAK: GOSUB to 5A61H to read the system information sector of drive 0 into 4200H.
594E
LD HL,FB70H 21 70 FB
Load Register Pair HL with FB70H, the distance from 4700H back to 4270H (the second block of drive tables).
5951
LD A,(442FH) 3A 2F 44
Fetch MFLAG$ from 442FH into Register A: bit 0 set after a boot through a disk driver.
5954
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
5955
If the NO CARRY FLAG is set (a boot by sector 0), JUMP to 595AH.
5957
LD HL,FB20H 21 20 FB
Load Register Pair HL with FB20H, the distance from 4700H back to 4220H (the first block).
595A
LD A,(582EH) 3A 2E 58
Fetch the high byte of the DRIVE parameter from 582EH into Register A: FFH when DRIVE was not given.
595D
INC A 3C
INCrement Register A: the Z FLAG when DRIVE was not given.
595E
POP DE D1
Restore Register Pair DE from the stack: the code table of the drive named (0000H for none).
595F
PUSH DE D5
Save Register Pair DE (the code table or 0000H) to the stack again.
5960
If the NZ FLAG is set (a DRIVE was named), JUMP to 5965H.
5962
LD DE,4700H 11 00 47
Point Register Pair DE to 4700H, drive 0's code table.
5965
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the same drive's table in the sector at 4200H.
5966
LD A,C9H 3E C9
Load Register A with C9H; the next instruction loads Register A again.
5968
LD A,E 7B
Copy Register E (the low byte of the code table's address) into Register A.
5969
CP 28H FE 28
Compare Register A against 28H: the CARRY FLAG for drives 0-3 (4700H-4727H).
596B
If the NO CARRY FLAG is set (drive 4 or above), JUMP to 596FH with Register A = Register E.
596D
LD A,C3H 3E C3
Load Register A with C3H, the code of JP, for drives 0-3.
596F
LD (HL),A 77
Store Register A at Register Pair HL, byte +00H of the drive's table in the sector at 4200H; that sector is not written back here.
5970
INC L 2C
INCrement Register L to +01H of the table in the sector.
5971
INC L 2C
INCrement Register L to +02H of the table in the sector.
5972
INC L 2C
INCrement Register L to +03H, the first byte that is copied.
5973
INC E 1C
INCrement Register E to +01H of the drive code table.
5974
INC E 1C
INCrement Register E to +02H of the drive code table.
5975
INC E 1C
INCrement Register E to +03H, the first byte that is copied into.
5976
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, bytes +03H-+09H of the table.
5979
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the boot's values of +03H-+09H into the drive code table.
597B
LD A,(582EH) 3A 2E 58
Fetch the high byte of the DRIVE parameter from 582EH into Register A: FFH when DRIVE was not given.
597E
INC A 3C
INCrement Register A: the Z FLAG when DRIVE was not given.
597F
If the NZ FLAG is set (one drive named), JUMP to 59B3H for SYSTEM.
5981
LD A,E 7B
Copy Register E (the low byte of the next code table's address) into Register A.
5982
CP 50H FE 50
Compare Register A against 50H: the NO CARRY FLAG at 4750H or above.
5984
If the NO CARRY FLAG is set, LOOP BACK to 5966H; after drive 0 Register E is 0AH, so the loop ends here with drive 0 only.
5986
JUMP to 59B3H to go on with the next option, SYSTEM.
5988
LD A,(HL) 7E
Fetch the first character of the specification at Register Pair HL into Register A.
5989
CP 0DH FE 0D
Compare Register A against 0DH, ENTER: an empty answer.
598B
If the Z FLAG is set (nothing typed), JUMP to 59B2H.
598D
LD DE,5EE7H 11 E7 5E
Point Register Pair DE to 5EE7H, the control block for the driver file, one byte below the text at 5EE8H.
5990
GOSUB to 441CH (@FSPEC) to take the file specification from Register Pair HL into the control block at Register Pair DE (each character moves down one byte).
5993
LD HL,5DF3H 21 F3 5D
Point Register Pair HL to 5DF3H, DCT, the default extension.
5996
GOSUB to 4473H (@FEXT) to add /DCT to the specification at Register Pair DE when it has no extension.
5999
GOSUB to 4430H (@LOAD) to load the driver file named in the control block at Register Pair DE: the Z FLAG and its transfer address in Register Pair HL.
599C
If the Z FLAG is set (loaded), JUMP to 59A5H to run it.
599E
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.
59A0
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
59A3
JUMP to 59B3H to go on with the next option, SYSTEM.
59A5
POP DE D1
Restore Register Pair DE from the stack: the code table of the drive named (0000H for none).
59A6
PUSH DE D5
Save Register Pair DE to the stack again, for 59B2H.
59A7
PUSH HL E5
Save Register Pair HL (the driver's transfer address) to the stack.
59A8
LD HL,4758H 21 58 47
Point Register Pair HL to 4758H, the status byte of the command interpreter.
59AB
SET 3,(HL) CB DE
Set bit 3 of 4758H at Register Pair HL, as FILTER and SET (SYS6/SYS) do before they run a loaded driver.
59AD
LD HL,59B2H 21 B2 59
Point Register Pair HL to 59B2H, where the driver is to return.
59B0
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): 59B2H goes on the stack and Register Pair HL = the driver's transfer address.
59B1
JP (HL) E9
JUMP to the driver at Register Pair HL, with Register Pair DE = the drive code table; its RET comes back to 59B2H.
59B2
POP DE D1
Restore Register Pair DE from the stack: the word pushed for DRIVER is taken off.

59B3H - SYSTEM and SWAP: Exchange Two Drives

SWAP=d exchanges the code tables of drive d and the drive of DRIVE (drive 0 when DRIVE is not given); SYSTEM=d is SWAP=d with drive 0. Both drives must be 0-7 and different. A drive that becomes drive 0 must hold a system diskette (5A84H). The JCL file of a running job follows its drive (5AC5H). The ten bytes of each table are exchanged through 4200H.

59B3
LD BC,FFFFH 01 FF FF
Load Register Pair BC with the SYSTEM parameter, the operand at 59B4H-59B5H: FFFFH in the file (not given), else the drive.
59B6
LD A,B 78
Copy Register B (the high byte of SYSTEM) into Register A.
59B7
AND C A1
AND Register C (the low byte) into Register A: FFH only for FFFFH.
59B8
INC A 3C
INCrement Register A: the Z FLAG for FFFFH, SYSTEM not given.
59B9
If the Z FLAG is set (no SYSTEM), JUMP to 59C5H for SWAP.
59BB
LD (59C6H),BC ED 43 C6 59
Store Register Pair BC (the drive of SYSTEM) at 59C6H, the operand of SWAP's LD BC at 59C5H.
59BF
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, drive 0, the other drive of SYSTEM.
59C2
LD (582DH),HL 22 2D 58
Store Register Pair HL (0000H) at 582DH, the DRIVE parameter: the drive is exchanged with drive 0.
59C5
LD BC,FFFFH 01 FF FF
Load Register Pair BC with the SWAP parameter, the operand at 59C6H-59C7H: FFFFH in the file (not given), else the drive.
59C8
LD A,B 78
Copy Register B (the high byte of SWAP) into Register A.
59C9
AND C A1
AND Register C (the low byte) into Register A: FFH only for FFFFH.
59CA
INC A 3C
INCrement Register A: the Z FLAG for FFFFH, SWAP not given.
59CB
If the Z FLAG is set (no SWAP), JUMP to 5A2FH for SYSGEN.
59CD
LD A,C 79
Copy Register C (the drive of SWAP) into Register A.
59CE
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG for 8 and above.
59D0
If the NO CARRY FLAG is set (no such drive), JUMP to 5B1DH, inside the LD IX at 5B1CH, where the bytes read LD HL,5D1BH: Drive specification error <0-7>!.
59D3
LD (5A04H),A 32 04 5A
Store Register A (the drive of SWAP) at 5A04H, the operand of the LD C at 5A03H.
59D6
ADD A,30H C6 30
ADD 30H to Register A: the digit of the drive of SWAP.
59D8
LD (5D44H),A 32 44 5D
Store Register A (the digit) at 5D44H, the S of the message Drives :S and :D now swapped.
59DB
LD A,(582DH) 3A 2D 58
Fetch the drive of DRIVE from 582DH into Register A (00H when DRIVE was not given).
59DE
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG for 8 and above.
59E0
If the NO CARRY FLAG is set (no such drive), JUMP to 5B1DH for Drive specification error <0-7>!.
59E3
LD (5A0BH),A 32 0B 5A
Store Register A (the other drive) at 5A0BH, the operand of the LD C at 5A0AH.
59E6
LD B,A 47
Copy Register A (the other drive) into Register B.
59E7
ADD A,30H C6 30
ADD 30H to Register A: the digit of the other drive.
59E9
LD (5D4BH),A 32 4B 5D
Store Register A (the digit) at 5D4BH, the D of the message.
59EC
LD A,B 78
Copy Register B (the other drive) into Register A.
59ED
XOR C A9
Exclusive OR Register C (the drive of SWAP) into Register A: the Z FLAG when they are the same drive.
59EE
If the Z FLAG is set (the same drive), JUMP to 5B21H, inside the LD IX at 5B20H, where the bytes read LD HL,5D59H: Source & Destination are the same drive!.
59F1
XOR C A9
Exclusive OR Register C into Register A again: Register A = the other drive, the Z FLAG when it is drive 0.
59F2
LD A,C 79
Copy Register C (the drive of SWAP) into Register A. LD does not change the flags.
59F3
If the Z FLAG is set (the other drive is 0), GOSUB to 5A84H to make sure drive Register A, which becomes drive 0, holds a system diskette.
59F6
LD A,(5A04H) 3A 04 5A
Fetch the drive of SWAP from 5A04H into Register A.
59F9
OR A B7
Set the flags from Register A (OR A): the Z FLAG when it is drive 0.
59FA
LD A,(5A0BH) 3A 0B 5A
Fetch the other drive from 5A0BH into Register A. LD does not change the flags.
59FD
If the Z FLAG is set (SWAP names drive 0), GOSUB to 5A84H to make sure drive Register A, which becomes drive 0, holds a system diskette.
5A00
GOSUB to 5AC5H to move a running JCL job's file to the drive its diskette goes to.
5A03
LD C,00H 0E 00
Load Register C with the drive of SWAP, the operand at 5A04H stored by 59D3H (00H in the file).
5A05
GOSUB to 478FH (GETDCT) to point Index Register IY at the code table of drive Register C.
5A08
PUSH IY FD E5
Save Index Register IY (the first drive's code table) to the stack.
5A0A
LD C,00H 0E 00
Load Register C with the other drive, the operand at 5A0BH stored by 59E3H (00H in the file).
5A0C
GOSUB to 478FH (GETDCT) to point Index Register IY at the code table of drive Register C.
5A0F
POP HL E1
Restore Register Pair HL from the stack: the first drive's code table.
5A10
LD DE,4200H 11 00 42
Point Register Pair DE to 4200H, the system buffer, as a place to keep ten bytes.
5A13
PUSH DE D5
Save Register Pair DE (4200H, the place for the first table) to the stack.
5A14
PUSH HL E5
Save Register Pair HL (the first drive's code table) to the stack.
5A15
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a code table.
5A18
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the first drive's table to 4200H.
5A1A
PUSH IY FD E5
Save Index Register IY (the other drive's code table) to the stack.
5A1C
POP HL E1
Restore it into Register Pair HL: the other drive's code table.
5A1D
POP DE D1
Restore Register Pair DE from the stack: the first drive's code table.
5A1E
PUSH HL E5
Save Register Pair HL (the other drive's code table) to the stack.
5A1F
LD C,0AH 0E 0A
Load Register C with 0AH: Register Pair BC = 000AH, ten bytes (Register B is 00H after the LDIR).
5A21
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the other drive's table into the first drive's.
5A23
POP DE D1
Restore Register Pair DE from the stack: the other drive's code table.
5A24
POP HL E1
Restore Register Pair HL from the stack: 4200H, the first drive's old table.
5A25
LD C,0AH 0E 0A
Load Register C with 0AH: Register Pair BC = 000AH, ten bytes.
5A27
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the first drive's old table into the other drive's.
5A29
LD HL,5D3CH 21 3C 5D
Point Register Pair HL to 5D3CH, the message Drives :S and :D now swapped.
5A2C
GOSUB to 4467H (@DSPLY) to display the message at Register Pair HL.

5A2FH - SYSGEN and the Exit

SYSGEN (or SYSGEN=OFF) is refused while the spooler is installed (bit 0 of DFLAG$). Otherwise Preparing to alter configuration is shown and Library B member 1CH (SYSGEN, member 5) is run through request 89H with Register H = the drive (DRIVE, 0 when not given) and Register L = FFH to build or 00H to delete; it loads over this member and does not come back here. 5A4FH and 5A52H are the exit of every option.

5A2F
LD HL,0001H 21 01 00
Load Register Pair HL with the SYSGEN parameter, the operand at 5A30H-5A31H: 0001H in the file (not given), FFFFH for SYSGEN, 0000H for SYSGEN=OFF.
5A32
LD A,H 7C
Copy Register H (the high byte of SYSGEN) into Register A.
5A33
OR L B5
OR Register L (the low byte) into Register A: 00H for OFF, FFH for ON, 01H when not given.
5A34
DEC A 3D
DECrement Register A: the Z FLAG for 01H, SYSGEN not given.
5A35
If the Z FLAG is set (no SYSGEN), JUMP to 5A4FH to end the command.
5A37
LD A,(441FH) 3A 1F 44
Fetch DFLAG$ from 441FH into Register A: bit 0 set while the spooler is installed.
5A3A
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
5A3B
If the CARRY FLAG is set (a spooler), JUMP to 5B25H, inside the LD IX at 5B24H, where the bytes read LD HL,5BBAH: Can't SYSGEN with active SPOOLER!.
5A3E
LD A,(582DH) 3A 2D 58
Fetch the drive of DRIVE from 582DH into Register A (00H when DRIVE was not given).
5A41
LD H,A 67
Copy Register A (the drive) into Register H: Register L keeps FFH or 00H.
5A42
PUSH HL E5
Save Register Pair HL (the drive and the switch) to the stack.
5A43
LD HL,5B5BH 21 5B 5B
Point Register Pair HL to 5B5BH, the message Preparing to alter configuration.
5A46
GOSUB to 4467H (@DSPLY) to display the message at Register Pair HL.
5A49
POP HL E1
Restore Register Pair HL (the drive and the switch) from the stack.
5A4A
LD B,1CH 06 1C
Load Register B with 1CH, the member byte of SYSGEN.
5A4C
LD A,89H 3E 89
Load Register A with 89H, the request code of Library B (SYS7/SYS).
5A4E
RST 28H EF
Issue the request in Register A through RST 28H: member 1CH loads at 5200H over this member and runs; the dispatcher drops this return address.
5A4F
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5A52
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5A53H-5A54H (0000H in the file, stored by 5200H). 5B2EH comes here with Register Pair HL = FFFFH.
5A55
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5A56
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5A57
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.
5A58
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5A5B
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5A5D
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5A5E
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5A61H - Read and Write Drive 0's System Information Sector; Errors

5A61H reads cylinder 0, sector 2 of drive 0 into 4200H, 5A6EH writes it back; either reports a failure through @ERROR and ends the command. 5A7AH (inside the LD BC at 5A79H) reports error 2CH, a parameter error.

5A61
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer.
5A64
LD C,L 4D
Copy Register L (00H) into Register C: drive 0.
5A65
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2, the system information sector.
5A68
GOSUB to 4777H (RDSECT) to read cylinder Register D, sector Register E of drive Register C into the buffer at Register Pair HL: the Z FLAG on success.
5A6B
RET Z C8
RETurn if the Z FLAG is set (the sector is at 4200H).
5A6C
JUMP to 5A7CH to report the error in Register A.
5A6E
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the buffer that holds the sector.
5A71
LD C,L 4D
Copy Register L (00H) into Register C: drive 0.
5A72
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: cylinder 0, sector 2.
5A75
GOSUB to 4763H (WRSECT) to write the buffer at Register Pair HL to cylinder Register D, sector Register E of drive Register C: the Z FLAG on success.
5A78
RET Z C8
RETurn if the Z FLAG is set: the sector is written back.
5A79
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH: no use when run from 5A78H (Register A keeps the error number). Entered at 5A7AH (from 520AH, 583DH and 58C2H) the bytes 3EH 2CH are LD A,2CH, error 44 (parameter error).
5A7C
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.
5A7E
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5A81
JUMP to 5B2BH to end the command with Register Pair HL = FFFFH.

5A84H - A System Diskette in the Drive Register A

The drive must hold a system diskette when it is to become drive 0: it must be ready and directory record 03H (the first record of directory sector 5, SYS1/SYS's) must be in use. Otherwise Insert SYSTEM diskette in drive X! is shown and ENTER makes it look again; BREAK ends the command with Manual <BREAK> abort!. During a JCL job no prompt is possible: Can't prompt for SYSTEM disk during JCL!.

5A84
LD (5A8DH),A 32 8D 5A
Store Register A (the drive) at 5A8DH, the operand of the LD C at 5A8CH.
5A87
ADD A,30H C6 30
ADD 30H to Register A: the digit of the drive for the prompt.
5A89
LD (5CD9H),A 32 D9 5C
Store Register A (the digit) at 5CD9H, the X of the prompt Insert SYSTEM diskette in drive X!.
5A8C
LD C,00H 0E 00
Load Register C with the drive, the operand at 5A8DH (00H in the file). 5AC0H comes back here after ENTER.
5A8E
GOSUB to 44B8H (@CKDRV) to check drive Register C: the Z FLAG when it is ready.
5A91
If the NZ FLAG is set (not ready), JUMP to 5AA9H to ask for the diskette.
5A93
GOSUB to 478FH (GETDCT) to point Index Register IY at the code table of drive Register C.
5A96
LD D,(IY+09H) FD 56 09
Load Register D with the directory cylinder from Index Register IY +09H.
5A99
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, to receive the sector.
5A9C
LD E,05H 1E 05
Load Register E with 05H, directory sector 5, which holds records 03H, 23H and so on.
5A9E
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
5AA1
If the NZ FLAG is set (it could not be read), JUMP to 5A7CH to report the error in Register A.
5AA3
LD A,(4200H) 3A 00 42
Fetch byte +00H of directory record 03H from 4200H into Register A: bit 4 set when the record is in use.
5AA6
AND 10H E6 10
Keep bit 4 of Register A (AND 10H), the in use bit of the record.
5AA8
RET NZ C0
RETurn if the NZ FLAG is set: the record of SYS1/SYS is in use, a system diskette.
5AA9
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
5AAC
BIT 5,(HL) CB 6E
Test bit 5 of SFLAG$ at Register Pair HL: set while a JCL job runs.
5AAE
If the NZ FLAG is set (a JCL job), JUMP to 5B19H, inside the LD IX at 5B18H, where the bytes read LD HL,5CF2H: Can't prompt for SYSTEM disk during JCL!.
5AB1
LD HL,5CB9H 21 B9 5C
Point Register Pair HL to 5CB9H, the prompt Insert SYSTEM diskette in drive X!.
5AB4
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL.
5AB7
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, a buffer for the answer.
5ABA
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H: Register B = 0, no characters are taken, only ENTER or BREAK.
5ABD
GOSUB to the ROM at 0040H (@KEYIN) to wait for ENTER or BREAK: the CARRY FLAG for BREAK.
5AC0
If the NO CARRY FLAG is set (ENTER), JUMP to 5A8CH to look at the drive again.
5AC2
JUMP to 5B15H, inside the LD IX at 5B14H, where the bytes read LD HL,5CDCH: Manual <BREAK> abort!.

5AC5H - A JCL Job's File Follows the Swap

During a JCL job the drive in byte +06H of JFCB$ (435EH, the job file's control block at 4358H) is changed to the other drive of the swap when it is one of the two drives exchanged, so that the job reads its file from where its diskette now is.

5AC5
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
5AC8
BIT 5,(HL) CB 6E
Test bit 5 of SFLAG$ at Register Pair HL: set while a JCL job runs.
5ACA
RET Z C8
RETurn if the Z FLAG is set (no JCL job): nothing to move.
5ACB
LD HL,435EH 21 5E 43
Point Register Pair HL to 435EH, byte +06H of JFCB$: the drive of the job's file.
5ACE
LD A,(5A04H) 3A 04 5A
Fetch the drive of SWAP from 5A04H into Register A.
5AD1
LD B,A 47
Copy Register A (the drive of SWAP) into Register B.
5AD2
XOR (HL) AE
Exclusive OR the byte at Register Pair HL into Register A.
5AD3
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the Z FLAG when the job's file is on the drive of SWAP.
5AD5
LD A,(5A0BH) 3A 0B 5A
Fetch the other drive from 5A0BH into Register A. LD does not change the flags.
5AD8
If the NZ FLAG is set (not on the drive of SWAP), JUMP to 5AE1H.
5ADA
LD B,A 47
Copy Register A (the other drive) into Register B: the file goes there.
5ADB
LD A,(HL) 7E
Fetch byte +06H of JFCB$ at Register Pair HL into Register A.
5ADC
AND F8H E6 F8
Clear bits 2-0 of Register A (AND F8H): the old drive.
5ADE
OR B B0
OR Register B (the new drive) into Register A.
5ADF
LD (HL),A 77
Store Register A at Register Pair HL (435EH): the job's file is on the new drive.
5AE0
RET C9
RETurn with the drive of the job's file changed.
5AE1
XOR (HL) AE
Exclusive OR the byte at Register Pair HL into Register A (the other drive).
5AE2
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the Z FLAG when the job's file is on the other drive.
5AE4
If the Z FLAG is set, JUMP to 5ADBH with Register B = the drive of SWAP.
5AE6
RET C9
RETurn: the job's file is on neither drive, nothing is changed.

5AE7H - Find a Module in High Memory; the Command Level Test; Messages

5AE7H finds the module whose name is at Register Pair DE through request BCH (SYS10/SYS) and returns the Z FLAG with Register Pair HL = the module and Register Pair DE = its link word (+02H-+03H). 5AF7H refuses a change of memory when a program owns @EXIT (402DH, or its copy at 4065H during a JCL job, holds a JP) and the command line came from a program (bit 1 of 4758H). 5B0DH-5B28H is a chain of LD IX instructions: each entry after the first is the LD HL hidden after the DDH prefix, so a jump into the chain picks one message for @LOGOT.

5AE7
GOSUB to 5AF4H to look for the module named at Register Pair DE: the Z FLAG when found, with Register Pair HL = the module.
5AEA
PUSH HL E5
Save Register Pair HL (the module) to the stack.
5AEB
POP IX DD E1
Restore it into Index Register IX: Index Register IX = the module.
5AED
LD E,(IX+02H) DD 5E 02
Fetch the low byte of the module's link word from Index Register IX +02H into Register E.
5AF0
LD D,(IX+03H) DD 56 03
Fetch the high byte of the link word from Index Register IX +03H into Register D: Register Pair DE = the HIGH$ before the module.
5AF3
RET C9
RETurn with the flags of the lookup and the link word in Register Pair DE.
5AF4
LD A,BCH 3E BC
Load Register A with BCH, the request code that looks a module up by its name.
5AF6
RST 28H EF
Issue the request in Register A through RST 28H: the supervisor dispatcher drops this return address, so SYS10/SYS's RET goes back to the caller of 5AF4H.
5AF7
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5AFA
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5AFC
LD A,(402DH) 3A 2D 40
Fetch the first byte of @EXIT from 402DH into Register A. LD does not change the flags.
5AFF
If the Z FLAG is set (no JCL job), JUMP to 5B04H.
5B01
LD A,(4065H) 3A 65 40
Fetch the first byte of the @EXIT saved at 4065H (the one in force before the job) into Register A.
5B04
CP C3H FE C3
Compare Register A against C3H, the code of JP.
5B06
RET NZ C0
RETurn if the NZ FLAG is set: no program owns @EXIT, the change is allowed.
5B07
LD A,(4758H) 3A 58 47
Fetch the status byte of the command interpreter from 4758H into Register A.
5B0A
BIT 1,A CB 4F
Test bit 1 of Register A: set when the command line came from a program.
5B0C
RET Z C8
RETurn if the Z FLAG is set (typed at the keyboard): the change is allowed.
5B0D
LD HL,5B31H 21 31 5B
Point Register Pair HL to 5B31H, the message Can't -- Valid only at LDOS command level.
5B10
LD IX,5DD6H DD 21 D6 5D
Load Index Register IX with 5DD6H: no use when run from above. Entered at 5B11H (from 5263H) the bytes 21H D6H 5DH are LD HL,5DD6H: Printer filter not resident!.
5B14
LD IX,5CDCH DD 21 DC 5C
Load Index Register IX with 5CDCH: no use when run from above. Entered at 5B15H (from 5AC2H) the bytes 21H DCH 5CH are LD HL,5CDCH: Manual <BREAK> abort!.
5B18
LD IX,5CF2H DD 21 F2 5C
Load Index Register IX with 5CF2H: no use when run from above. Entered at 5B19H (from 5AAEH) the bytes 21H F2H 5CH are LD HL,5CF2H: Can't prompt for SYSTEM disk during JCL!.
5B1C
LD IX,5D1BH DD 21 1B 5D
Load Index Register IX with 5D1BH: no use when run from above. Entered at 5B1DH (from 59D0H and 59E0H) the bytes 21H 1BH 5DH are LD HL,5D1BH: Drive specification error <0-7>!.
5B20
LD IX,5D59H DD 21 59 5D
Load Index Register IX with 5D59H: no use when run from above. Entered at 5B21H (from 59EEH) the bytes 21H 59H 5DH are LD HL,5D59H: Source & Destination are the same drive!.
5B24
LD IX,5BBAH DD 21 BA 5B
Load Index Register IX with 5BBAH: no use when run from above. Entered at 5B25H (from 5A3BH) the bytes 21H BAH 5BH are LD HL,5BBAH: Can't SYSGEN with active SPOOLER!.
5B28
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5B2B
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. 5A81H comes here after an error.
5B2E
JUMP to 5A52H to put the stack back and end the command.

5B31H - SYSTEM Data: Messages, the Default Extension and the Parameter Table

The messages, each ended by 0DH (the prompt for the driver by 03H), the extension DCT for DRIVER, and the 30 entries of the parameter table: a keyword of six characters (padded with spaces) and the address where @PARAM stores its value, the operand of the instruction that tests it. The text New SYSTEM drive installed (5C9EH) is in the file but no code uses it.

5B31-5B59
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
The message of 5B0DH: a program owns @EXIT and ran SYSTEM with BLINK or ALIVE.
5B5A
DEFB 0DH 0D
0DH, the end of the message Can't -- Valid only at LDOS command level.
5B5B-5B7A
DEFM "Preparing to alter configuration" 50 72 65 70 61 72 69 6E 67 20 74 6F 20 61 6C 74 65 72 20 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E
The message of 5A43H, shown before SYSGEN (member 5) is run.
5B7B
DEFB 0DH 0D
0DH, the end of the message Preparing to alter configuration.
5B7C-5B8D
DEFM "CYL=c invalid on 8" 43 59 4C 3D 63 20 69 6E 76 61 6C 69 64 20 6F 6E 20 38
The start of the message of 587FH: CYL was given for an 8 inch drive named by DRIVE.
5B8E
DEFB 22H 22
22H, the double quote that stands for inch in the message CYL=c invalid on 8 inch drive.
5B8F-5B94
DEFM " drive" 20 64 72 69 76 65
The end of the text of the message CYL=c invalid on 8 inch drive.
5B95
DEFB 0DH 0D
0DH, the end of the message CYL=c invalid on 8 inch drive, displayed with it.
5B96-5BB8
DEFM "Cylinder count out of range <35-96>" 43 79 6C 69 6E 64 65 72 20 63 6F 75 6E 74 20 6F 75 74 20 6F 66 20 72 61 6E 67 65 20 3C 33 35 2D 39 36 3E
The message of 5891H: CYL was a number outside 35-96.
5BB9
DEFB 0DH 0D
0DH, the end of the message Cylinder count out of range <35-96>.
5BBA-5BDA
DEFM "Can't SYSGEN with active SPOOLER!" 43 61 6E 27 74 20 53 59 53 47 45 4E 20 77 69 74 68 20 61 63 74 69 76 65 20 53 50 4F 4F 4C 45 52 21
The message of 5B25H: SYSGEN while the spooler is installed.
5BDB
DEFB 0DH 0D
0DH, the end of the message Can't SYSGEN with active SPOOLER!.
5BDC-5BF8
DEFM "Can't SYSRES requested module" 43 61 6E 27 74 20 53 59 53 52 45 53 20 72 65 71 75 65 73 74 65 64 20 6D 6F 64 75 6C 65
The message of 573FH: SYSRES named SYS0, SYS6, SYS7 or a file above SYS12.
5BF9
DEFB 0DH 0D
0DH, the end of the message Can't SYSRES requested module.
5BFA-5C17
DEFM "System module already resident" 53 79 73 74 65 6D 20 6D 6F 64 75 6C 65 20 61 6C 72 65 61 64 79 20 72 65 73 69 64 65 6E 74
The message of 573BH: SYSRES named a file already kept in memory.
5C18
DEFB 0DH 0D
0DH, the end of the message System module already resident.
5C19-5C3B
DEFM "Enter DCT driver <BREAK=default> : " 45 6E 74 65 72 20 44 43 54 20 64 72 69 76 65 72 20 3C 42 52 45 41 4B 3D 64 65 66 61 75 6C 74 3E 20 3A 20
The prompt of 593BH for DRIVER without a file specification.
5C3C
DEFB 03H 03
03H, the end of the prompt: the cursor stays on the line for the answer.
5C3D-5C59
DEFM "TYPE requires KI to be active" 54 59 50 45 20 72 65 71 75 69 72 65 73 20 4B 49 20 74 6F 20 62 65 20 61 63 74 69 76 65
The message of 54CFH: TYPE=ON without KI/DVR installed.
5C5A
DEFB 0DH 0D
0DH, the end of the message TYPE requires KI to be active.
5C5B-5C6E
DEFM "Type-ahead is now on" 54 79 70 65 2D 61 68 65 61 64 20 69 73 20 6E 6F 77 20 6F 6E
The message of 54D6H and 54EBH: TYPE=ON was carried out.
5C6F
DEFB 0DH 0D
0DH, the end of the message Type-ahead is now on.
5C70-5C84
DEFM "Type-ahead is now off" 54 79 70 65 2D 61 68 65 61 64 20 69 73 20 6E 6F 77 20 6F 66 66
The message of 54C5H: TYPE=OFF was carried out.
5C85
DEFB 0DH 0D
0DH, the end of the message Type-ahead is now off.
5C86-5C9C
DEFM "Type-ahead not resident" 54 79 70 65 2D 61 68 65 61 64 20 6E 6F 74 20 72 65 73 69 64 65 6E 74
The message of 54E1H: KI/DVR is installed without its type ahead (4DF2H holds 0000H).
5C9D
DEFB 0DH 0D
0DH, the end of the message Type-ahead not resident.
5C9E-5CB7
DEFM "New SYSTEM drive installed" 4E 65 77 20 53 59 53 54 45 4D 20 64 72 69 76 65 20 69 6E 73 74 61 6C 6C 65 64
A message that no code of the member displays (nothing points at 5C9EH).
5CB8
DEFB 0DH 0D
0DH, the end of the unused message New SYSTEM drive installed.
5CB9-5CD8
DEFM "Insert SYSTEM diskette in drive " 49 6E 73 65 72 74 20 53 59 53 54 45 4D 20 64 69 73 6B 65 74 74 65 20 69 6E 20 64 72 69 76 65 20
The prompt of 5AB1H for a system diskette in a drive.
5CD9
DEFM "X" 58
The drive's digit in the prompt, stored by 5A89H (X in the file).
5CDA
DEFM "!" 21
The exclamation mark at the end of the prompt.
5CDB
DEFB 0DH 0D
0DH, the end of the prompt Insert SYSTEM diskette in drive X!.
5CDC-5CF0
DEFM "Manual <BREAK> abort!" 4D 61 6E 75 61 6C 20 3C 42 52 45 41 4B 3E 20 61 62 6F 72 74 21
The message of 5B15H: BREAK was pressed at the prompt for a system diskette.
5CF1
DEFB 0DH 0D
0DH, the end of the message Manual <BREAK> abort!.
5CF2-5D19
DEFM "Can't prompt for SYSTEM disk during JCL!" 43 61 6E 27 74 20 70 72 6F 6D 70 74 20 66 6F 72 20 53 59 53 54 45 4D 20 64 69 73 6B 20 64 75 72 69 6E 67 20 4A 43 4C 21
The message of 5B19H: a system diskette is missing during a JCL job.
5D1A
DEFB 0DH 0D
0DH, the end of the message Can't prompt for SYSTEM disk during JCL!.
5D1B-5D3A
DEFM "Drive specification error <0-7>!" 44 72 69 76 65 20 73 70 65 63 69 66 69 63 61 74 69 6F 6E 20 65 72 72 6F 72 20 3C 30 2D 37 3E 21
The message of 5B1DH: SWAP, SYSTEM or DRIVE named a drive of 8 or more.
5D3B
DEFB 0DH 0D
0DH, the end of the message Drive specification error <0-7>!.
5D3C-5D43
DEFM "Drives :" 44 72 69 76 65 73 20 3A
The start of the message of 5A29H after a swap.
5D44
DEFM "S" 53
The drive of SWAP as a digit, stored by 59D8H (S in the file).
5D45-5D4A
DEFM " and :" 20 61 6E 64 20 3A
The middle of the message Drives :S and :D now swapped.
5D4B
DEFM "D" 44
The other drive as a digit, stored by 59E9H (D in the file).
5D4C-5D57
DEFM " now swapped" 20 6E 6F 77 20 73 77 61 70 70 65 64
The end of the message Drives :S and :D now swapped.
5D58
DEFB 0DH 0D
0DH, the end of the message Drives :S and :D now swapped.
5D59-5D80
DEFM "Source & Destination are the same drive!" 53 6F 75 72 63 65 20 26 20 44 65 73 74 69 6E 61 74 69 6F 6E 20 61 72 65 20 74 68 65 20 73 61 6D 65 20 64 72 69 76 65 21
The message of 5B21H: SWAP named the same drive twice.
5D81
DEFB 0DH 0D
0DH, the end of the message Source & Destination are the same drive!.
5D82-5D9E
DEFM "SVC table already implemented" 53 56 43 20 74 61 62 6C 65 20 61 6C 72 65 61 64 79 20 69 6D 70 6C 65 6D 65 6E 74 65 64
The message of 55A1H: bit 0 of SFLAG$ says the SVC module is installed.
5D9F
DEFB 0DH 0D
0DH, the end of the message SVC table already implemented.
5DA0-5DB6
DEFM "SVC table now installed" 53 56 43 20 74 61 62 6C 65 20 6E 6F 77 20 69 6E 73 74 61 6C 6C 65 64
The message of 55D7H after the SVC module was put in high memory.
5DB7
DEFB 0DH 0D
0DH, the end of the message SVC table now installed.
5DB8-5DD4
DEFM "Boot step out of range <0-3>!" 42 6F 6F 74 20 73 74 65 70 20 6F 75 74 20 6F 66 20 72 61 6E 67 65 20 3C 30 2D 33 3E 21
The message of 53BFH: BSTEP was a step rate of 4 or more.
5DD5
DEFB 0DH 0D
0DH, the end of the message Boot step out of range <0-3>!.
5DD6-5DF1
DEFM "Printer filter not resident!" 50 72 69 6E 74 65 72 20 66 69 6C 74 65 72 20 6E 6F 74 20 72 65 73 69 64 65 6E 74 21
The message of 5B11H: PRTIME without PR/FLT (4DF6H holds 0000H).
5DF2
DEFB 0DH 0D
0DH, the end of the message Printer filter not resident!.
5DF3-5DF5
DEFM "DCT" 44 43 54
The default extension of a driver file, added by @FEXT at 5996H.
5DF6-5DFB
DEFM "ALIVE " 41 4C 49 56 45 20
Parameter table entry 1: the keyword ALIVE, an option of SYSTEM.
5DFC-5DFD
DEFW 5518H 18 55
Entry 1: 5518H, the operand of the LD BC at 5517H (ALIVE), where @PARAM stores the value.
5DFE-5E03
DEFM "BASIC2" 42 41 53 49 43 32
Parameter table entry 2: the keyword BASIC2, an option of SYSTEM.
5E04-5E05
DEFW 5237H 37 52
Entry 2: 5237H, the operand of the LD BC at 5236H (BASIC2), where @PARAM stores the value.
5E06-5E0B
DEFM "BSTEP " 42 53 54 45 50 20
Parameter table entry 3: the keyword BSTEP, an option of SYSTEM.
5E0C-5E0D
DEFW 53B5H B5 53
Entry 3: 53B5H, the operand of the LD BC at 53B4H (BSTEP), where @PARAM stores the value.
5E0E-5E13
DEFM "DRIVER" 44 52 49 56 45 52
Parameter table entry 4: the keyword DRIVER, an option of SYSTEM.
5E14-5E15
DEFW 590EH 0E 59
Entry 4: 590EH, the operand of the LD DE at 590DH (DRIVER), where @PARAM stores the value.
5E16-5E1B
DEFM "FAST " 46 41 53 54 20 20
Parameter table entry 5: the keyword FAST, an option of SYSTEM.
5E1C-5E1D
DEFW 5215H 15 52
Entry 5: 5215H, the operand of the LD BC at 5214H (FAST), where @PARAM stores the value.
5E1E-5E23
DEFM "SLOW " 53 4C 4F 57 20 20
Parameter table entry 6: the keyword SLOW, an option of SYSTEM.
5E24-5E25
DEFW 520EH 0E 52
Entry 6: 520EH, the operand of the LD BC at 520DH (SLOW), where @PARAM stores the value.
5E26-5E2B
DEFM "SVC " 53 56 43 20 20 20
Parameter table entry 7: the keyword SVC, an option of SYSTEM.
5E2C-5E2D
DEFW 5593H 93 55
Entry 7: 5593H, the operand of the LD BC at 5592H (SVC), where @PARAM stores the value.
5E2E-5E33
DEFM "SWAP " 53 57 41 50 20 20
Parameter table entry 8: the keyword SWAP, an option of SYSTEM.
5E34-5E35
DEFW 59C6H C6 59
Entry 8: 59C6H, the operand of the LD BC at 59C5H (SWAP), where @PARAM stores the value.
5E36-5E3B
DEFM "SYSRES" 53 59 53 52 45 53
Parameter table entry 9: the keyword SYSRES, an option of SYSTEM.
5E3C-5E3D
DEFW 5706H 06 57
Entry 9: 5706H, the operand of the LD BC at 5705H (SYSRES), where @PARAM stores the value.
5E3E-5E43
DEFM "SYSTEM" 53 59 53 54 45 4D
Parameter table entry 10: the keyword SYSTEM, an option of SYSTEM.
5E44-5E45
DEFW 59B4H B4 59
Entry 10: 59B4H, the operand of the LD BC at 59B3H (SYSTEM), where @PARAM stores the value.
5E46-5E4B
DEFM "TYPE " 54 59 50 45 20 20
Parameter table entry 11: the keyword TYPE, an option of SYSTEM.
5E4C-5E4D
DEFW 54B5H B5 54
Entry 11: 54B5H, the operand of the LD BC at 54B4H (TYPE), where @PARAM stores the value.
5E4E-5E53
DEFM "TRACE " 54 52 41 43 45 20
Parameter table entry 12: the keyword TRACE, an option of SYSTEM.
5E54-5E55
DEFW 539EH 9E 53
Entry 12: 539EH, the operand of the LD BC at 539DH (TRACE), where @PARAM stores the value.
5E56-5E5B
DEFM "WP " 57 50 20 20 20 20
Parameter table entry 13: the keyword WP, an option of SYSTEM.
5E5C-5E5D
DEFW 585AH 5A 58
Entry 13: 585AH, the operand of the LD BC at 5859H (WP), where @PARAM stores the value.
5E5E-5E63
DEFM "BLINK " 42 4C 49 4E 4B 20
Parameter table entry 14: the keyword BLINK, an option of SYSTEM.
5E64-5E65
DEFW 53DEH DE 53
Entry 14: 53DEH, the operand of the LD BC at 53DDH (BLINK), where @PARAM stores the value.
5E66-5E6B
DEFM "BREAK " 42 52 45 41 4B 20
Parameter table entry 15: the keyword BREAK, an option of SYSTEM.
5E6C-5E6D
DEFW 5277H 77 52
Entry 15: 5277H, the operand of the LD BC at 5276H (BREAK), where @PARAM stores the value.
5E6E-5E73
DEFM "CYL " 43 59 4C 20 20 20
Parameter table entry 16: the keyword CYL, an option of SYSTEM.
5E74-5E75
DEFW 586FH 6F 58
Entry 16: 586FH, the operand of the LD BC at 586EH (CYL), where @PARAM stores the value.
5E76-5E7B
DEFM "DATE " 44 41 54 45 20 20
Parameter table entry 17: the keyword DATE, an option of SYSTEM.
5E7C-5E7D
DEFW 5370H 70 53
Entry 17: 5370H, the operand of the LD BC at 536FH (DATE), where @PARAM stores the value.
5E7E-5E83
DEFM "DELAY " 44 45 4C 41 59 20
Parameter table entry 18: the keyword DELAY, an option of SYSTEM.
5E84-5E85
DEFW 58D5H D5 58
Entry 18: 58D5H, the operand of the LD BC at 58D4H (DELAY), where @PARAM stores the value.
5E86-5E8B
DEFM "DISABL" 44 49 53 41 42 4C
Parameter table entry 19: the keyword DISABL (DISABLE, cut to six letters).
5E8C-5E8D
DEFW 589DH 9D 58
Entry 19: 589DH, the operand of the LD BC at 589CH (DISABLE), where @PARAM stores the value.
5E8E-5E93
DEFM "DRIVE " 44 52 49 56 45 20
Parameter table entry 20: the keyword DRIVE, an option of SYSTEM.
5E94-5E95
DEFW 582DH 2D 58
Entry 20: 582DH, the operand of the LD BC at 582CH (DRIVE), where @PARAM stores the value.
5E96-5E9B
DEFM "ENABLE" 45 4E 41 42 4C 45
Parameter table entry 21: the keyword ENABLE, an option of SYSTEM.
5E9C-5E9D
DEFW 58AEH AE 58
Entry 21: 58AEH, the operand of the LD BC at 58ADH (ENABLE), where @PARAM stores the value.
5E9E-5EA3
DEFM "GRAPHI" 47 52 41 50 48 49
Parameter table entry 22: the keyword GRAPHI (GRAPHIC, cut to six letters).
5EA4-5EA5
DEFW 5504H 04 55
Entry 22: 5504H, the operand of the LD BC at 5503H (GRAPHIC), where @PARAM stores the value.
5EA6-5EAB
DEFM "LARGE " 4C 41 52 47 45 20
Parameter table entry 23: the keyword LARGE, an option of SYSTEM.
5EAC-5EAD
DEFW 5467H 67 54
Entry 23: 5467H, the cell at 5467H-5468H (LARGE), where @PARAM stores the value.
5EAE-5EB3
DEFM "SMALL " 53 4D 41 4C 4C 20
Parameter table entry 24: the keyword SMALL, an option of SYSTEM.
5EB4-5EB5
DEFW 541AH 1A 54
Entry 24: 541AH, the operand of the LD BC at 5419H (SMALL), where @PARAM stores the value.
5EB6-5EBB
DEFM "STEP " 53 54 45 50 20 20
Parameter table entry 25: the keyword STEP, an option of SYSTEM.
5EBC-5EBD
DEFW 58BAH BA 58
Entry 25: 58BAH, the operand of the LD BC at 58B9H (STEP), where @PARAM stores the value.
5EBE-5EC3
DEFM "SMOOTH" 53 4D 4F 4F 54 48
Parameter table entry 26: the keyword SMOOTH, an option of SYSTEM.
5EC4-5EC5
DEFW 54F2H F2 54
Entry 26: 54F2H, the operand of the LD BC at 54F1H (SMOOTH), where @PARAM stores the value.
5EC6-5ECB
DEFM "SYSGEN" 53 59 53 47 45 4E
Parameter table entry 27: the keyword SYSGEN, an option of SYSTEM.
5ECC-5ECD
DEFW 5A30H 30 5A
Entry 27: 5A30H, the operand of the LD HL at 5A2FH (SYSGEN), where @PARAM stores the value.
5ECE-5ED3
DEFM "TIME " 54 49 4D 45 20 20
Parameter table entry 28: the keyword TIME, an option of SYSTEM.
5ED4-5ED5
DEFW 5387H 87 53
Entry 28: 5387H, the operand of the LD BC at 5386H (TIME), where @PARAM stores the value.
5ED6-5EDB
DEFM "PRTIME" 50 52 54 49 4D 45
Parameter table entry 29: the keyword PRTIME, an option of SYSTEM.
5EDC-5EDD
DEFW 5257H 57 52
Entry 29: 5257H, the operand of the LD BC at 5256H (PRTIME), where @PARAM stores the value.
5EDE-5EE3
DEFM "UPDATE" 55 50 44 41 54 45
Parameter table entry 30: the keyword UPDATE, an option of SYSTEM.
5EE4-5EE5
DEFW 5290H 90 52
Entry 30: 5290H, the operand of the LD BC at 528FH (UPDATE), where @PARAM stores the value.
5EE6
DEFB 00H 00
00H, the end of the parameter table of SYSTEM (30 entries), the last byte of the member.

5200H - Member 8 (BUILD): Entry, the File and the Mode

The BUILD command (library member 33H), loaded at 5200H-5402H. It makes a file from lines typed at the keyboard: the default extension is /JCL. The file is opened with @INIT (control block at 5403H, buffer 5500H, both above the member); a new file shows Building: and its name, an existing one is refused with File already exists unless APPEND is given, which goes to its end and shows Appending:, the keyboard's device name, to and the name. A file with the extension KSM (a keystroke file) prompts A=> to Z=> for 26 lines; a /JCL file takes lines of up to 63 characters (255 otherwise); with HEX each line is taken as pairs of hexadecimal digits. The lines are kept from 5600H on and written to the file when BREAK is pressed on an empty line.

5200
LD (535CH),SP ED 73 5C 53
Store the Stack Pointer at 535CH, the operand of the LD SP at 535BH: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,5403H 11 03 54
Point Register Pair DE to 5403H, the file control block of BUILD, just above the member (not in the file).
5207
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.
520A
If the NZ FLAG is set (no file specification), JUMP to 5349H, inside the LD IX at 5348H, where the bytes read LD HL,539AH: File spec required.
520D
PUSH HL E5
Save Register Pair HL (the text after the specification) to the stack.
520E
LD HL,53DFH 21 DF 53
Point Register Pair HL to 53DFH, JCL, the default extension.
5211
GOSUB to 4473H (@FEXT) to add /JCL to the specification at Register Pair DE when it has no extension.
5214
POP HL E1
Restore Register Pair HL (the text after the specification) from the stack.
5215
LD DE,53E2H 11 E2 53
Point Register Pair DE to 53E2H, the parameter table of BUILD (HEX, H, APPEND, A).
5218
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE: HEX and APPEND store FFFFH at 52C5H and 527CH. The NZ FLAG for a bad parameter.
521B
If the NZ FLAG is set (a bad parameter), JUMP to 5314H, inside the LD BC at 5313H, where the bytes read LD A,2CH: error 2CH.
521E
LD HL,5403H 21 03 54
Point Register Pair HL to 5403H, the specification in the control block.
5221
LD A,(HL) 7E
Fetch the next character of the specification at Register Pair HL into Register A.
5222
INC HL 23
INCrement Register Pair HL past the character just fetched.
5223
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5225
If the Z FLAG is set (the end), JUMP to 5240H.
5227
CP 2FH FE 2F
Compare Register A against 2FH, the slash before the extension.
5229
If the NZ FLAG is set (not the slash), LOOP BACK to 5221H; @FEXT has made sure there is one.
522B
PUSH HL E5
Save Register Pair HL (the first letter of the extension) to the stack.
522C
LD A,(HL) 7E
Fetch the first letter of the extension at Register Pair HL into Register A.
522D
INC HL 23
INCrement Register Pair HL to the second letter.
522E
CP 4BH FE 4B
Compare Register A against 4BH, the letter K.
5230
If the NZ FLAG is set (not K), JUMP to 5240H.
5232
LD A,(HL) 7E
Fetch the second letter of the extension at Register Pair HL into Register A.
5233
INC HL 23
INCrement Register Pair HL to the third letter.
5234
CP 53H FE 53
Compare Register A against 53H, the letter S.
5236
If the NZ FLAG is set (not S), JUMP to 5240H.
5238
LD A,(HL) 7E
Fetch the third letter of the extension at Register Pair HL into Register A.
5239
CP 4DH FE 4D
Compare Register A against 4DH, the letter M.
523B
If the NZ FLAG is set (not M), JUMP to 5240H.
523D
LD (529DH),A 32 9D 52
The extension is KSM: store Register A (4DH) at 529DH, the operand of the LD A at 529CH, which turns on the prompts A=> to Z=>.
5240
POP HL E1
Restore Register Pair HL from the stack: the first letter of the extension.
5241
LD A,(HL) 7E
Fetch the first letter of the extension at Register Pair HL into Register A.
5242
INC HL 23
INCrement Register Pair HL to the second letter.
5243
CP 4AH FE 4A
Compare Register A against 4AH, the letter J.
5245
If the NZ FLAG is set (not J), JUMP to 5257H.
5247
LD A,(HL) 7E
Fetch the second letter of the extension at Register Pair HL into Register A.
5248
INC HL 23
INCrement Register Pair HL to the third letter.
5249
CP 43H FE 43
Compare Register A against 43H, the letter C.
524B
If the NZ FLAG is set (not C), JUMP to 5257H.
524D
LD A,(HL) 7E
Fetch the third letter of the extension at Register Pair HL into Register A.
524E
CP 4CH FE 4C
Compare Register A against 4CH, the letter L.
5250
If the NZ FLAG is set (not L), JUMP to 5257H.
5252
LD A,3FH 3E 3F
The extension is JCL: load Register A with 3FH, 63 characters, the longest line of a JCL file.
5254
LD (52BEH),A 32 BE 52
Store Register A (3FH) at 52BEH, the operand of the LD B at 52BDH, the most characters @KEYIN takes.
5257
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the 256 byte buffer of the file, above the member.
525A
LD DE,5403H 11 03 54
Point Register Pair DE to 5403H, the file control block.
525D
LD B,L 45
Copy Register L (00H) into Register B: the record length, 00H for 256.
525E
GOSUB to 4420H (@INIT) to open the file at Register Pair DE, or create it, with the buffer at Register Pair HL and record length Register B: the Z FLAG on success, with the CARRY FLAG set when the file was created.
5261
If the NZ FLAG is set (it could not be opened or created), JUMP to 5316H to report the error in Register A.
5264
PUSH AF F5
Save Register Pair AF (the CARRY FLAG of @INIT) to the stack.
5265
LD DE,5423H 11 23 54
Point Register Pair DE to 5423H, where the name of the file is built, after the control block.
5268
LD BC,(5409H) ED 4B 09 54
Load Register Pair BC from 5409H-540AH, bytes +06H and +07H of the control block: the drive and the directory record, or the two letters of a device.
526C
LD A,(5403H) 3A 03 54
Fetch byte +00H of the control block from 5403H into Register A: bit 7 set for an open file.
526F
GOSUB to 531DH to write the name of the file (or the device's name for a device) at Register Pair DE, ended by 03H.
5272
If the NZ FLAG is set (the directory could not be read), JUMP to 5316H to report the error in Register A.
5275
POP AF F1
Restore Register Pair AF from the stack: the CARRY FLAG of @INIT.
5276
LD HL,53C1H 21 C1 53
Point Register Pair HL to 53C1H, the text Building: . LD does not change the flags.
5279
If the CARRY FLAG is set (a new file), JUMP to 528BH to show Building:.
527B
LD BC,0000H 01 00 00
Load Register Pair BC with the APPEND parameter, the operand at 527CH-527DH: 0000H in the file, FFFFH for APPEND.
527E
LD DE,5403H 11 03 54
Point Register Pair DE to 5403H, the file control block.
5281
INC C 0C
INCrement Register C: the Z FLAG only for a low byte of FFH, APPEND.
5282
If the NZ FLAG is set (no APPEND), JUMP to 534DH, inside the LD IX at 534CH, where the bytes read LD HL,53ADH: File already exists.
5285
GOSUB to 4448H (@PEOF) to position the file at Register Pair DE at its end of file.
5288
LD HL,53CCH 21 CC 53
Point Register Pair HL to 53CCH, the text Appending: followed by the keyboard's device name and to.
528B
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, up to its 03H.
528E
LD HL,5423H 21 23 54
Point Register Pair HL to 5423H, the name of the file.
5291
GOSUB to 4467H (@DSPLY) to display the name at Register Pair HL, up to its 03H.
5294
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the line.
5296
GOSUB to the ROM at 0033H to display the character in Register A on the video.

5299H - The Lines

Each line is read with @KEYIN (0040H) into the memory at Register Pair HL, from 5600H on: the line and the 0DH after it stay there (or, with HEX, the bytes its digit pairs give). A KSM file gets the prompt letter=> before each line, A to Z, and ends after Z. BREAK with characters typed takes the line as it is; BREAK on an empty line ends the input.

5299
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, where the lines are kept, above the member.
529C
LD A,00H 3E 00
Load Register A with the KSM switch, the operand at 529DH: 00H in the file, 4DH for a KSM file (523DH).
529E
OR A B7
Set the flags from Register A (OR A): the Z FLAG when the file is not a KSM file.
529F
If the Z FLAG is set (no prompts), JUMP to 52BDH to read a line.
52A1
LD A,40H 3E 40
Load Register A with the last prompt letter, the operand at 52A2H: 40H in the file, the letter before A.
52A3
INC A 3C
INCrement Register A: the next prompt letter, A first.
52A4
LD (52A2H),A 32 A2 52
Store Register A (the letter) at 52A2H, the operand above.
52A7
CP 5BH FE 5B
Compare Register A against 5BH, the character after Z.
52A9
If the Z FLAG is set (the 26 lines are done), JUMP to 52ECH to write the file.
52AB
GOSUB to the ROM at 0033H to display the letter in Register A.
52AE
LD A,3DH 3E 3D
Load Register A with 3DH, an equals sign for the prompt.
52B0
GOSUB to the ROM at 0033H to display the character in Register A.
52B3
LD A,3EH 3E 3E
Load Register A with 3EH, a greater than sign.
52B5
GOSUB to the ROM at 0033H to display the character in Register A.
52B8
LD A,20H 3E 20
Load Register A with 20H, a space after the prompt.
52BA
GOSUB to the ROM at 0033H to display the character in Register A.
52BD
LD B,FFH 06 FF
Load Register B with the most characters of a line, the operand at 52BEH: FFH in the file, 3FH for a JCL file (5254H).
52BF
GOSUB to the ROM at 0040H (@KEYIN) to read a line of up to Register B characters into Register Pair HL: Register B = the characters typed, the CARRY FLAG for BREAK.
52C2
If the CARRY FLAG is set (BREAK), JUMP to 52E8H.
52C4
LD DE,0000H 11 00 00
Load Register Pair DE with the HEX parameter, the operand at 52C5H-52C6H: 0000H in the file, FFFFH for HEX.
52C7
INC E 1C
INCrement Register E: the Z FLAG only for a low byte of FFH, HEX.
52C8
If the NZ FLAG is set (no HEX), JUMP to 52E1H to keep the line as typed.
52CA
LD D,H 54
Copy Register H into Register D, the high byte of the line's address.
52CB
LD E,L 5D
Copy Register L into Register E: Register Pair DE = the line, read from while Register Pair HL writes the bytes over it.
52CC
GOSUB to 5330H to take a hexadecimal digit from Register Pair DE into Register A (a bad character ends the command with Bad hex digit encountered!).
52CF
DEC B 05
DECrement Register B, the characters left: the Z FLAG when the digit was the last one.
52D0
If the Z FLAG is set (an odd number of digits), JUMP to 5345H, inside the LD IX at 5344H, where the bytes read LD HL,536AH: Odd # of hex digits!.
52D2
RLCA 07
Rotate Register A left (RLCA): the digit moves up one bit.
52D3
RLCA 07
Rotate Register A left (RLCA) again: the second bit up.
52D4
RLCA 07
Rotate Register A left (RLCA) a third time: the third bit up.
52D5
RLCA 07
Rotate Register A left (RLCA) a fourth time: the digit is in bits 7-4.
52D6
LD C,A 4F
Copy Register A (the high digit) into Register C.
52D7
GOSUB to 5330H to take the second hexadecimal digit from Register Pair DE into Register A.
52DA
OR C B1
OR Register C (the high digit) into Register A: the byte of the pair.
52DB
LD (HL),A 77
Store Register A (the byte) at Register Pair HL.
52DC
INC HL 23
INCrement Register Pair HL to the place of the next byte.
52DD
DECrement Register B and LOOP BACK to 52CCH while digits are left.
52DF
JUMP to 529CH to read the next line of the file.
52E1
LD C,B 48
Copy Register B (the characters typed) into Register C.
52E2
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the characters typed.
52E4
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: past the line.
52E5
INC HL 23
INCrement Register Pair HL past the 0DH that @KEYIN stored after the line: it stays in the file.
52E6
JUMP to 529CH to read the next line of the file.
52E8
LD A,B 78
BREAK: copy Register B (the characters typed before BREAK) into Register A.
52E9
OR A B7
Set the flags from Register A (OR A): the Z FLAG for an empty line.
52EA
If the NZ FLAG is set (characters were typed), JUMP to 52C4H to take the line.

52ECH - Write the File

The bytes from 5600H up to Register Pair HL are written to the file one at a time through the ROM's @PUT (001BH), then the file is closed. A failure is reported through @ERROR.

52EC
LD (52F3H),HL 22 F3 52
Store Register Pair HL (the end of the lines) at 52F3H, the operand of the LD DE at 52F2H.
52EF
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, the first byte to write.
52F2
LD DE,0000H 11 00 00
Load Register Pair DE with the end of the lines, the operand at 52F3H-52F4H stored by 52ECH (0000H in the file).
52F5
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the end, Register Pair DE = the next byte.
52F6
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
52F7
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the next byte is the end.
52F9
If the Z FLAG is set (all written), JUMP to 5306H to close the file.
52FB
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the next byte.
52FC
LD DE,5403H 11 03 54
Point Register Pair DE to 5403H, the file control block.
52FF
LD A,(HL) 7E
Fetch the next byte at Register Pair HL into Register A.
5300
INC HL 23
INCrement Register Pair HL to the byte after it.
5301
GOSUB to the ROM at 001BH (@PUT) to send the byte in Register A to the file at Register Pair DE: the Z FLAG on success.
5304
If the Z FLAG is set (written), LOOP BACK to 52F2H for the next byte.
5306
PUSH AF F5
Save Register Pair AF (the result of the writing) to the stack.
5307
LD DE,5403H 11 03 54
Point Register Pair DE to 5403H, the file control block.
530A
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE.
530D
If the NZ FLAG is set (the close failed), JUMP to 5316H to report the error in Register A.
530F
POP AF F1
Restore Register Pair AF from the stack: the result of the writing.
5310
If the Z FLAG is set (every byte written), JUMP to 5358H to end the command with Register Pair HL = 0000H.
5313
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH: no use when run from 5310H (Register A keeps the error of @PUT). Entered at 5314H (from 521BH) the bytes 3EH 2CH are LD A,2CH, error 44 (parameter error).
5316
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.
5318
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
531B
JUMP to 5353H to end the command with Register Pair HL = FFFFH.

531DH - The Name of the File or Device

Register A = byte +00H of the control block: with bit 7 set (a file) @FNAME writes NAME/EXT:d at Register Pair DE from Register C (the drive) and Register B (the directory record); for a device the name is an asterisk and the two letters in Register C and Register B. The name ends with 03H.

531D
BIT 7,A CB 7F
Test bit 7 of Register A: set for an open file.
531F
If the NZ FLAG is set (a file), JUMP to 44BBH (@FNAME) to write the name of directory record Register B of drive Register C at Register Pair DE; its RET returns to the caller.
5322
LD A,2AH 3E 2A
Load Register A with 2AH, the asterisk of a device name.
5324
LD (DE),A 12
Store Register A (the asterisk) at Register Pair DE.
5325
INC DE 13
INCrement Register Pair DE to the next place.
5326
LD A,C 79
Copy Register C (the first letter of the device) into Register A.
5327
LD (DE),A 12
Store Register A (the first letter) at Register Pair DE.
5328
INC DE 13
INCrement Register Pair DE to the next place.
5329
LD A,B 78
Copy Register B (the second letter of the device) into Register A.
532A
LD (DE),A 12
Store Register A (the second letter) at Register Pair DE.
532B
INC DE 13
INCrement Register Pair DE to the next place.
532C
LD A,03H 3E 03
Load Register A with 03H, the end of text mark.
532E
LD (DE),A 12
Store Register A (03H) at Register Pair DE: the name ends.
532F
RET C9
RETurn with the Z FLAG of the BIT test (a device).

5330H - One Hexadecimal Digit

Takes the character at Register Pair DE (and moves on): 0-9, A-F or a-f return its value in Register A. Any other character drops the return address and displays Bad hex digit encountered!, ending the command.

5330
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
5331
INC DE 13
INCrement Register Pair DE past the character just fetched.
5332
SUB 30H D6 30
SUBtract 30H from Register A: the CARRY FLAG for a character below 0.
5334
If the CARRY FLAG is set (not a digit), JUMP to 5340H for the error.
5336
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG for 0-9.
5338
RET C D8
RETurn if the CARRY FLAG is set, with the value 0-9 in Register A.
5339
RES 5,A CB AF
Clear bit 5 of Register A: a small letter counts as a capital.
533B
SUB 07H D6 07
SUBtract 07H from Register A: A-F become 0AH-0FH.
533D
CP 10H FE 10
Compare Register A against 10H: the CARRY FLAG for 0AH-0FH.
533F
RET C D8
RETurn if the CARRY FLAG is set, with the value 0AH-0FH in Register A.
5340
POP AF F1
Restore Register Pair AF from the stack: this takes off the return address of the CALL to 5330H.
5341
LD HL,537FH 21 7F 53
Point Register Pair HL to 537FH, the message Bad hex digit encountered!.
5344
LD IX,536AH DD 21 6A 53
Load Index Register IX with 536AH: no use when run from above. Entered at 5345H (from 52D0H) the bytes 21H 6AH 53H are LD HL,536AH: Odd # of hex digits!.
5348
LD IX,539AH DD 21 9A 53
Load Index Register IX with 539AH: no use when run from above. Entered at 5349H (from 520AH) the bytes 21H 9AH 53H are LD HL,539AH: File spec required.
534C
LD IX,53ADH DD 21 AD 53
Load Index Register IX with 53ADH: no use when run from above. Entered at 534DH (from 5282H) the bytes 21H ADH 53H are LD HL,53ADH: File already exists.
5350
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5353
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5356
JUMP to 535BH to put the stack back and end the command.
5358
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
535B
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 535CH-535DH (0000H in the file, stored by 5200H).
535E
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
535F
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5360
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.
5361
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5364
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5366
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5367
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

536AH - BUILD Data: Messages, the Default Extension and the Parameter Table

The messages, the texts Building: and Appending: with the keyboard's device name (ended by 03H so that the name follows on the line), the extension JCL and the parameter table.

536A-537D
DEFM "Odd # of hex digits!" 4F 64 64 20 23 20 6F 66 20 68 65 78 20 64 69 67 69 74 73 21
The message of 5345H: a HEX line ended after one digit of a pair.
537E
DEFB 0DH 0D
0DH, the end of the message Odd # of hex digits!, displayed with it.
537F-5398
DEFM "Bad hex digit encountered!" 42 61 64 20 68 65 78 20 64 69 67 69 74 20 65 6E 63 6F 75 6E 74 65 72 65 64 21
The message of 5341H: a HEX line holds a character that is not a hexadecimal digit.
5399
DEFB 0DH 0D
0DH, the end of the message Bad hex digit encountered!, displayed with it.
539A-53AB
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 5349H: the text after BUILD is not a file specification.
53AC
DEFB 0DH 0D
0DH, the end of the message File spec required, displayed with it.
53AD-53BF
DEFM "File already exists" 46 69 6C 65 20 61 6C 72 65 61 64 79 20 65 78 69 73 74 73
The message of 534DH: the file is there and APPEND was not given.
53C0
DEFB 0DH 0D
0DH, the end of the message File already exists, displayed with it.
53C1-53CA
DEFM "Building: " 42 75 69 6C 64 69 6E 67 3A 20
The text of 5276H for a new file; the name follows on the line.
53CB
DEFB 03H 03
03H, the end of the text Building: (not displayed, the line goes on).
53CC-53DD
DEFM "Appending: *KI to " 41 70 70 65 6E 64 69 6E 67 3A 20 2A 4B 49 20 74 6F 20
The text of 5288H for APPEND: the keyboard's lines go to the end of the file named after it.
53DE
DEFB 03H 03
03H, the end of the text Appending: (not displayed, the line goes on).
53DF-53E1
DEFM "JCL" 4A 43 4C
The default extension added by @FEXT at 5211H.
53E2-53E7
DEFM "HEX " 48 45 58 20 20 20
Parameter table entry 1: the keyword HEX, lines of hexadecimal digit pairs.
53E8-53E9
DEFW 52C5H C5 52
Entry 1: 52C5H, the operand of the LD DE at 52C4H, where HEX is stored.
53EA-53EF
DEFM "H " 48 20 20 20 20 20
Parameter table entry 2: the keyword H, short for HEX.
53F0-53F1
DEFW 52C5H C5 52
Entry 2: 52C5H, the operand of the LD DE at 52C4H, where H is stored.
53F2-53F7
DEFM "APPEND" 41 50 50 45 4E 44
Parameter table entry 3: the keyword APPEND, add to an existing file.
53F8-53F9
DEFW 527CH 7C 52
Entry 3: 527CH, the operand of the LD BC at 527BH, where APPEND is stored.
53FA-53FF
DEFM "A " 41 20 20 20 20 20
Parameter table entry 4: the keyword A, short for APPEND.
5400-5401
DEFW 527CH 7C 52
Entry 4: 527CH, the operand of the LD BC at 527BH, where A is stored.
5402
DEFB 00H 00
00H, the end of the parameter table of BUILD, the last byte of the member.

5200H - Member 9 (ATTRIB): Entry and a File's Attributes

The ATTRIB command (library member 51H), loaded at 5200H-56D5H. With a file specification it changes the file's directory record: I (invisible), V (visible), PROT=level, ACC=password and OWNER (or UPDATE)=password; the file is opened first (control block 56D6H, buffer 4200H) and must allow full access (level 0). Without a file specification it works on a diskette (53C5H): NAME, PW (the master password), LOCK and UNLOCK. The options of a file are read here by the member itself, by their first letter; a bad one gives Attribute specification error!.

5200
LD (54BDH),SP ED 73 BD 54
Store the Stack Pointer at 54BDH, the operand of the LD SP at 54BCH: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,56D6H 11 D6 56
Point Register Pair DE to 56D6H, the file control block of ATTRIB, just above the member (not in the file).
5207
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.
520A
If the NZ FLAG is set (no file specification), JUMP to 53C5H to work on a diskette.
520D
LD A,(DE) 1A
Fetch the first byte of the specification at Register Pair DE (56D6H) into Register A.
520E
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device name.
5210
If the Z FLAG is set (a device), JUMP to 5588H, inside the LD IX at 5587H, where the bytes read LD HL,559CH: File spec required.
5213
PUSH HL E5
Save Register Pair HL (the text after the specification) to the stack.
5214
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, as the file's buffer.
5217
LD B,L 45
Copy Register L (00H) into Register B: the record length, 00H for 256.
5218
GOSUB to 4424H (@OPEN) to open the file at Register Pair DE with the buffer at Register Pair HL: the NZ FLAG and an error number on failure.
521B
If the NZ FLAG is set (it could not be opened), JUMP to 53BDH to report the error in Register A.
521E
LD A,(56DCH) 3A DC 56
Fetch byte +06H of the control block from 56DCH into Register A: the drive of the file.
5221
LD B,A 47
Copy Register A (the drive of the file) into Register B.
5222
LD A,(475DH) 3A 5D 47
Fetch 475DH into Register A: one bit for each drive whose diskette keeps the time in the directory records.
5225
INC B 04
INCrement Register B: the drive plus one, the count of the rotations.
5226
RRCA 0F
Rotate Register A right (RRCA): the next drive's bit goes to the CARRY FLAG.
5227
DECrement Register B and LOOP BACK to 5226H: the CARRY FLAG ends as the bit of the file's drive.
5229
SBC A,A 9F
Subtract Register A from itself with the CARRY FLAG (SBC A,A): FFH when the drive keeps the time, else 00H.
522A
LD (52FAH),A 32 FA 52
Store Register A at 52FAH, the operand of the LD A at 52F9H: on such a drive bytes +12H-+13H of a record hold the time, so ACC cannot be given.
522D
POP HL E1
Restore Register Pair HL (the text after the specification) from the stack.
522E
LD A,(56D7H) 3A D7 56
Fetch byte +01H of the control block from 56D7H into Register A: bits 2-0 the access the password allows.
5231
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): 0 for full access.
5233
LD A,25H 3E 25
Load Register A with 25H, error 37 (illegal access attempted to protected file). LD does not change the flags.
5235
If the NZ FLAG is set (less than full access), JUMP to 53BDH to report error 25H.
5238
XOR A AF
Clear Register A (XOR A) for the mask of the changes.
5239
LD (5381H),A 32 81 53
Store Register A (00H) at 5381H, the operand of the LD D at 5380H: the mask of the changes asked for, none yet.
523C
PUSH HL E5
Save Register Pair HL (the text of the options) to the stack.
523D
LD A,(HL) 7E
Fetch the next character of the options at Register Pair HL into Register A.
523E
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
5240
If the Z FLAG is set (the end of the line), JUMP to 524FH.
5242
CP 03H FE 03
Compare Register A against 03H, the other end of text mark.
5244
If the Z FLAG is set (the end of the line), JUMP to 524FH.
5246
CP 61H FE 61
Compare Register A against 61H, the letter a: the CARRY FLAG below it.
5248
If the CARRY FLAG is set (not a small letter), JUMP to 524CH.
524A
RES 5,(HL) CB AE
Clear bit 5 of the character at Register Pair HL: a small letter becomes a capital in the text itself.
524C
INC HL 23
INCrement Register Pair HL to the next character.
524D
LOOP BACK to 523DH until the end of the line.
524F
POP HL E1
Restore Register Pair HL from the stack: the start of the options, now in capitals.
5250
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5251
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
5253
If the Z FLAG is set (a bracket), JUMP to 525CH.
5255
CP 20H FE 20
Compare Register A against 20H, a space before the options.
5257
If the NZ FLAG is set (the first option), JUMP to 525EH.
5259
INC HL 23
INCrement Register Pair HL past the space before the options.
525A
LOOP BACK to 5250H to look at the next character.
525C
INC HL 23
INCrement Register Pair HL past the bracket or the comma. 52D0H comes back here for each option.
525D
LD A,(HL) 7E
Fetch the first letter of the option at Register Pair HL into Register A.
525E
CP 49H FE 49
Compare Register A against 49H, the letter I (invisible).
5260
If the Z FLAG is set (I), JUMP to 52D5H to make the file invisible.
5262
CP 56H FE 56
Compare Register A against 56H, the letter V (visible).
5264
If the Z FLAG is set (V), JUMP to 52E7H to make the file visible.
5267
CP 41H FE 41
Compare Register A against 41H, the letter A (the access password).
5269
If the Z FLAG is set (ACC), JUMP to 52F9H for the access password.
526C
CP 55H FE 55
Compare Register A against 55H, the letter U (the update password).
526E
If the Z FLAG is set (UPDATE), JUMP to 5314H for the owner password.
5271
CP 4FH FE 4F
Compare Register A against 4FH, the letter O (the owner password, the same as U).
5273
If the Z FLAG is set (OWNER), JUMP to 5314H for the owner password.
5276
CP 50H FE 50
Compare Register A against 50H, the letter P (the protection level).
5278
If the NZ FLAG is set (no option starts so), JUMP to 5590H, inside the LD IX at 558FH, where the bytes read LD HL,55BEH: Attribute specification error!.

527BH - PROT=level

The value's first two letters are looked up in the table of eight two letter words at 55FAH: NO, EX, RE, WR, ~~ (never matched), NA, KI, FU; the level is 7 less the word's place (NO 7, EX 6, RE 5, WR 4, NA 2, KI 1, FU 0), and RE followed by N (RENAME) is 2. The level goes into the operand at 5389H and bit 0 of the mask is set.

527B
GOSUB to 5349H to pass over the rest of the keyword and read its value into 51E2H-51E9H: the NZ FLAG when a value was given.
527E
If the Z FLAG is set (no value), JUMP to 5590H for Attribute specification error!.
5281
PUSH HL E5
Save Register Pair HL (the place in the text) to the stack.
5282
LD B,08H 06 08
Load Register B with 08H, the eight words of the table.
5284
LD DE,(51E2H) ED 5B E2 51
Fetch the first two letters of the value from 51E2H-51E3H into Register Pair DE: Register E = the first, Register D = the second.
5288
LD HL,55FAH 21 FA 55
Point Register Pair HL to 55FAH, the table of the levels' two letter words.
528B
LD A,(HL) 7E
Fetch the first letter of the next word at Register Pair HL into Register A.
528C
INC HL 23
INCrement Register Pair HL to its second letter.
528D
CP E BB
Compare Register A against Register E (the first letter of the value).
528E
If the Z FLAG is set (the first letters match), GOSUB to 5297H to compare the second letters; on a match it does not return.
5291
INC HL 23
INCrement Register Pair HL to the next word of the table.
5292
DECrement Register B and LOOP BACK to 528BH for the next word.
5294
No word matches: JUMP to 5590H for Attribute specification error!.
5297
LD A,(HL) 7E
Fetch the second letter of the word at Register Pair HL into Register A.
5298
CP D BA
Compare Register A against Register D (the second letter of the value).
5299
RET NZ C0
RETurn if the NZ FLAG is set (no match), back into the loop.
529A
POP AF F1
Restore Register Pair AF from the stack: this takes off the return address, so the loop is left.
529B
LD A,B 78
Copy Register B (8 less the word's place) into Register A.
529C
SUB 08H D6 08
SUBtract 08H from Register A: minus the word's place.
529E
NOP 00
No operation: a byte of the level calculation with no effect.
529F
NOP 00
No operation: a second byte of the level calculation with no effect.
52A0
ADD A,07H C6 07
ADD 07H to Register A: 7 less the word's place, the protection level.
52A2
CP 05H FE 05
Compare Register A against 05H, the level of RE.
52A4
If the NZ FLAG is set (another word), JUMP to 52B1H.
52A6
LD A,(51E4H) 3A E4 51
Fetch the third letter of the value from 51E4H into Register A.
52A9
CP 4EH FE 4E
Compare Register A against 4EH, the letter N of RENAME.
52AB
LD A,05H 3E 05
Load Register A with 05H, READ. LD does not change the flags.
52AD
If the NZ FLAG is set (READ), JUMP to 52B1H with Register A = 05H.
52AF
LD A,02H 3E 02
Load Register A with 02H, the level RENAME (RE with N after it).
52B1
LD (5389H),A 32 89 53
Store Register A (the level) at 5389H, the operand of the OR at 5388H.
52B4
POP HL E1
Restore Register Pair HL (the place in the text) from the stack.
52B5
LD B,01H 06 01
Load Register B with 01H, bit 0 of the mask: the protection level changes.
52B7
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A. 5312H and 5327H come here.
52B8
CP 22H FE 22
Compare Register A against 22H, the closing quote of a value.
52BA
If the NZ FLAG is set (no quote), JUMP to 52BDH.
52BC
INC HL 23
INCrement Register Pair HL past the closing quote of the value.
52BD
LD A,(5381H) 3A 81 53
Fetch the mask from 5381H into Register A. 52E5H and 52F7H come here.
52C0
OR B B0
OR Register B (the bit of this option) into Register A.
52C1
LD (5381H),A 32 81 53
Store Register A (the mask) at 5381H, the operand of the LD D at 5380H.
52C4
LD A,(HL) 7E
Fetch the character after the option at Register Pair HL into Register A.
52C5
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
52C7
If the Z FLAG is set (the end of the line), JUMP to 52CBH, where the Z FLAG takes the JP Z to 5375H.
52C9
CP 29H FE 29
Compare Register A against 29H, the closing bracket.
52CB
If the Z FLAG is set (the end), JUMP to 5375H to change the directory record.
52CE
CP 2CH FE 2C
Compare Register A against 2CH, a comma before the next option.
52D0
If the Z FLAG is set, LOOP BACK to 525CH for the next option.
52D2
JUMP to 5590H for Attribute specification error!.

52D5H - I, V, ACC and OWNER

I and V take no value: they set or clear bit 3 (08H) in the operand at 5391H, the invisible bit to OR into the attribute byte, and bit 3 of the mask. ACC=password (refused on a drive that keeps the time in the record: File has no access password!) and OWNER=password (or UPDATE=password) are hashed through request E4H into 51F7H or 51F5H; they set bit 1 or bit 2 of the mask.

52D5
GOSUB to 5349H to pass over the rest of the keyword: the NZ FLAG when a value was given.
52D8
If the NZ FLAG is set (I takes no value), JUMP to 5590H for Attribute specification error!.
52DB
LD A,(5391H) 3A 91 53
Fetch the invisible bit from 5391H, the operand of the OR at 5390H, into Register A.
52DE
OR 08H F6 08
OR 08H into Register A: bit 3, the invisible bit of the attributes.
52E0
LD (5391H),A 32 91 53
Store Register A at 5391H, the operand of the OR at 5390H.
52E3
LD B,08H 06 08
Load Register B with 08H, bit 3 of the mask: the visibility changes.
52E5
JUMP to 52BDH to note the option in the mask.
52E7
GOSUB to 5349H to pass over the rest of the keyword: the NZ FLAG when a value was given.
52EA
If the NZ FLAG is set (V takes no value), JUMP to 5590H for Attribute specification error!.
52ED
LD A,(5391H) 3A 91 53
Fetch the invisible bit from 5391H into Register A.
52F0
AND F7H E6 F7
Clear bit 3 of Register A (AND F7H): visible.
52F2
LD (5391H),A 32 91 53
Store Register A at 5391H, the operand of the OR at 5390H.
52F5
LD B,08H 06 08
Load Register B with 08H, bit 3 of the mask: the visibility changes.
52F7
JUMP to 52BDH to note the option in the mask.
52F9
LD A,00H 3E 00
Load Register A with the operand at 52FAH: FFH when the drive keeps the time in the records (522AH), else 00H.
52FB
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for such a drive.
52FC
If the NZ FLAG is set, JUMP to 5584H, inside the LD IX at 5583H, where the bytes read LD HL,55DDH: File has no access password!.
52FF
GOSUB to 5349H to pass over the rest of the keyword and read its value into 51E2H-51E9H: the NZ FLAG when a value was given.
5302
If the Z FLAG is set (no value), JUMP to 5590H for Attribute specification error!.
5305
PUSH HL E5
Save Register Pair HL (the place in the text) to the stack.
5306
LD DE,51E2H 11 E2 51
Point Register Pair DE to 51E2H, the eight characters of the password.
5309
GOSUB to 532CH to hash the password at Register Pair DE: Register Pair HL = the hash.
530C
LD (51F7H),HL 22 F7 51
Store Register Pair HL (the hash) at 51F7H-51F8H, the access password hash for 53ABH.
530F
POP HL E1
Restore Register Pair HL (the place in the text) from the stack.
5310
LD B,02H 06 02
Load Register B with 02H, bit 1 of the mask: the access password changes.
5312
JUMP to 52B7H to note the option in the mask.
5314
GOSUB to 5349H to pass over the rest of the keyword and read its value into 51E2H-51E9H: the NZ FLAG when a value was given.
5317
If the Z FLAG is set (no value), JUMP to 5590H for Attribute specification error!.
531A
PUSH HL E5
Save Register Pair HL (the place in the text) to the stack.
531B
LD DE,51E2H 11 E2 51
Point Register Pair DE to 51E2H, the eight characters of the password.
531E
GOSUB to 532CH to hash the password at Register Pair DE: Register Pair HL = the hash.
5321
LD (51F5H),HL 22 F5 51
Store Register Pair HL (the hash) at 51F5H-51F6H, the owner password hash for 539BH.
5324
POP HL E1
Restore Register Pair HL (the place in the text) from the stack.
5325
LD B,04H 06 04
Load Register B with 04H, bit 2 of the mask: the owner password changes.
5327
JUMP to 52B7H to note the option in the mask.

5329H - Passwords and Values

5329H takes a password (54FBH: from a quoted value at Register Pair DE or typed after the prompt at Register Pair HL) and goes on into 532CH, which hashes the eight bytes at Register Pair DE through request E4H (SYS2/SYS): the hash comes back in Register Pair HL. 532FH copies a name (a letter, then letters or digits, at most eight) from Register Pair HL to Register Pair DE. 5349H passes over the rest of a keyword: at the end of the option it returns the Z FLAG; at an equals sign it reads the value (an optional quote) into 51E2H-51E9H, padded with spaces, and returns the NZ FLAG.

5329
GOSUB to 54FBH to get eight characters (the value or the typed answer) at 5700H: Register Pair DE comes back as 5700H.
532C
LD A,E4H 3E E4
Load Register A with E4H, the request code of the password hash.
532E
RST 28H EF
Issue the request in Register A through RST 28H: SYS2/SYS hashes the eight bytes at Register Pair DE into Register Pair HL and its RET goes back to the caller of 5329H or 532CH (the dispatcher drops this return address).
532F
LD A,(HL) 7E
Fetch the first character at Register Pair HL into Register A.
5330
INC HL 23
INCrement Register Pair HL past the first character of the name.
5331
JUMP to 533CH: the first character must be a letter.
5333
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A.
5334
INC HL 23
INCrement Register Pair HL past the character just fetched.
5335
CP 30H FE 30
Compare Register A against 30H, the digit 0: the CARRY FLAG below it.
5337
RET C D8
RETurn if the CARRY FLAG is set: the name ends.
5338
CP 3AH FE 3A
Compare Register A against 3AH: the CARRY FLAG for a digit.
533A
If the CARRY FLAG is set (a digit), JUMP to 5342H to keep it.
533C
CP 41H FE 41
Compare Register A against 41H, the letter A: the CARRY FLAG below it.
533E
RET C D8
RETurn if the CARRY FLAG is set: the name ends.
533F
CP 5BH FE 5B
Compare Register A against 5BH: the NO CARRY FLAG above Z.
5341
RET NC D0
RETurn if the NO CARRY FLAG is set: the name ends.
5342
LD (DE),A 12
Store Register A (a letter or digit) at Register Pair DE.
5343
INC DE 13
INCrement Register Pair DE to the next place.
5344
DECrement Register B and LOOP BACK to 5333H while places are left.
5346
LD A,(HL) 7E
Fetch the character after the eighth at Register Pair HL into Register A.
5347
INC HL 23
INCrement Register Pair HL past the character after the name.
5348
RET C9
RETurn with Register A = the character after the name.
5349
INC HL 23
INCrement Register Pair HL to the next character of the option.
534A
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
534B
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
534D
RET Z C8
RETurn if the Z FLAG is set: the option has no value.
534E
CP 29H FE 29
Compare Register A against 29H, the closing bracket.
5350
RET Z C8
RETurn if the Z FLAG is set: the option has no value.
5351
CP 2CH FE 2C
Compare Register A against 2CH, a comma before the next option.
5353
RET Z C8
RETurn if the Z FLAG is set: the option has no value.
5354
CP 3DH FE 3D
Compare Register A against 3DH, an equals sign.
5356
If the NZ FLAG is set (still the keyword), LOOP BACK to 5349H.
5358
INC HL 23
INCrement Register Pair HL past the equals sign.
5359
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
535A
CP 22H FE 22
Compare Register A against 22H, an opening quote.
535C
If the NZ FLAG is set (no quote), JUMP to 535FH.
535E
INC HL 23
INCrement Register Pair HL past the opening quote of the value.
535F
LD DE,51E2H 11 E2 51
Point Register Pair DE to 51E2H, SYS2/SYS's eight byte field for a password.
5362
LD B,08H 06 08
Load Register B with 08H, the eight places of the field.
5364
PUSH DE D5
Save Register Pair DE (51E2H, the field) to the stack.
5365
PUSH BC C5
Save Register Pair BC (Register B, 8) to the stack.
5366
LD A,20H 3E 20
Load Register A with 20H, a space to fill the field with.
5368
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
5369
INC DE 13
INCrement Register Pair DE to the next place.
536A
DECrement Register B and LOOP BACK to 5368H until the eight places are spaces.
536C
POP BC C1
Restore Register Pair BC (Register B, 8) from the stack.
536D
POP DE D1
Restore Register Pair DE (51E2H) from the stack.
536E
GOSUB to 532FH to copy the value from Register Pair HL to 51E2H: Register A = the character after it.
5371
DEC HL 2B
DECrement Register Pair HL back onto the character after the value.
5372
OR 01H F6 01
OR 01H into Register A: the NZ FLAG, a value was read.
5374
RET C9
RETurn with the NZ FLAG: the value is at 51E2H.

5375H - Change the Directory Record

The record of the file (byte +07H of the control block, drive +06H) is read with DIRRD. The mask at 5381H says what changes: bit 0 the protection level (bits 2-0 of +00H), bit 3 the invisible bit (bit 3 of +00H), bit 2 the owner password hash (+10H-+11H, from 51F5H), bit 1 the access password hash (+12H-+13H, from 51F7H). The sector is written back with DIRWR.

5375
LD BC,(56DCH) ED 4B DC 56
Load Register Pair BC from 56DCH-56DDH, bytes +06H and +07H of the control block: Register C = the drive, Register B = the directory record.
5379
GOSUB to 4B10H (DIRRD) to read the directory sector that holds record Register B of drive Register C into 4200H: Register Pair HL points at the record.
537C
If the NZ FLAG is set (it could not be read), JUMP to 53BDH to report the error in Register A.
537F
LD A,(HL) 7E
Fetch byte +00H of the record, the attributes, at Register Pair HL into Register A.
5380
LD D,00H 16 00
Load Register D with the mask of the changes, the operand at 5381H stored by 52C1H (00H in the file).
5382
BIT 0,D CB 42
Test bit 0 of Register D: a new protection level.
5384
If the Z FLAG is set (no PROT), JUMP to 538AH.
5386
AND F8H E6 F8
Clear bits 2-0 of Register A (AND F8H): the old level.
5388
OR 00H F6 00
OR the new level into Register A, the operand at 5389H stored by 52B1H (00H in the file).
538A
BIT 3,D CB 5A
Test bit 3 of Register D: a change of visibility.
538C
If the Z FLAG is set (no I or V), JUMP to 5392H.
538E
AND F7H E6 F7
Clear bit 3 of Register A (AND F7H): visible.
5390
OR 00H F6 00
OR the invisible bit into Register A, the operand at 5391H: 08H after I, 00H after V.
5392
LD (HL),A 77
Store Register A (the attributes) at Register Pair HL, +00H of the record.
5393
LD A,L 7D
Copy Register L (the low byte of the record's address) into Register A.
5394
ADD A,10H C6 10
ADD 10H to Register A: the low byte of +10H of the record.
5396
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +10H of the record.
5397
BIT 2,D CB 52
Test bit 2 of Register D: a new owner password.
5399
If the Z FLAG is set (no OWNER), JUMP to 53A5H.
539B
LD A,(51F5H) 3A F5 51
Fetch the low byte of the owner password hash from 51F5H into Register A.
539E
LD (HL),A 77
Store Register A at Register Pair HL, +10H of the record.
539F
LD A,(51F6H) 3A F6 51
Fetch the high byte of the hash from 51F6H into Register A.
53A2
INC HL 23
INCrement Register Pair HL to +11H of the record.
53A3
LD (HL),A 77
Store Register A (the high byte) at Register Pair HL, +11H.
53A4
DEC HL 2B
DECrement Register Pair HL back to +10H of the record.
53A5
INC HL 23
INCrement Register Pair HL to +11H of the record (on the way to +12H).
53A6
INC HL 23
INCrement Register Pair HL to +12H of the record.
53A7
BIT 1,D CB 4A
Test bit 1 of Register D: a new access password.
53A9
If the Z FLAG is set (no ACC), JUMP to 53B4H.
53AB
LD A,(51F7H) 3A F7 51
Fetch the low byte of the access password hash from 51F7H into Register A.
53AE
LD (HL),A 77
Store Register A at Register Pair HL, +12H of the record.
53AF
LD A,(51F8H) 3A F8 51
Fetch the high byte of the hash from 51F8H into Register A.
53B2
INC HL 23
INCrement Register Pair HL to +13H of the record.
53B3
LD (HL),A 77
Store Register A (the high byte) at Register Pair HL, +13H.
53B4
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back: the Z FLAG on success.
53B7
If the Z FLAG is set (written), JUMP to 54B9H to end the command with Register Pair HL = 0000H.
53BA
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH: no use when run from above (Register A keeps the error of DIRWR). Entered at 53BBH (from 53DDH) the bytes 3EH 2CH are LD A,2CH, error 44 (parameter error).
53BD
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.
53BF
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
53C2
JUMP to 5596H to end the command with Register Pair HL = FFFFH.

53C5H - A Diskette: NAME, PW, LOCK and UNLOCK

Without a file specification the drive comes from :d (drive 0 when not given) and the parameters are read by @PARAM (table 568DH). Without NAME, PW, LOCK or UNLOCK ATTRIB shows -Nothing done-. The diskette's granule allocation table is read into 5800H and its master password checked (54CBH). NAME=name or NAME (asked) puts a new name at 58D0H; PW=password or PW (asked) a new master password hash at 58CEH; the table is written back. LOCK gives every visible file without a password the master password; UNLOCK takes it off every file that has it.

53C5
LD C,00H 0E 00
Load Register C with 00H, drive 0 when no drive is given.
53C7
DEC HL 2B
DECrement Register Pair HL back to the character @FSPEC stopped at.
53C8
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
53C9
CP 3AH FE 3A
Compare Register A against 3AH, the colon of a drive specification.
53CB
If the NZ FLAG is set (no drive given), JUMP to 53D3H with drive 0.
53CD
INC HL 23
INCrement Register Pair HL to the drive's digit.
53CE
LD A,(HL) 7E
Fetch the digit at Register Pair HL into Register A.
53CF
SUB 30H D6 30
SUBtract 30H from Register A: the drive number.
53D1
LD C,A 4F
Copy Register A (the drive number) into Register C.
53D2
INC HL 23
INCrement Register Pair HL past the drive's digit.
53D3
LD A,C 79
Copy Register C (the drive number) into Register A.
53D4
LD (54CCH),A 32 CC 54
Store Register A (the drive) at 54CCH, the operand of the LD C at 54CBH.
53D7
LD DE,568DH 11 8D 56
Point Register Pair DE to 568DH, the parameter table for a diskette (PW, LOCK, L, UNLOCK, U, NAME, N, MPW, M).
53DA
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE. The NZ FLAG for a bad parameter.
53DD
If the NZ FLAG is set (a bad parameter), JUMP to 53BBH, inside the LD BC at 53BAH, where the bytes read LD A,2CH: error 2CH.
53E0
LD A,(540EH) 3A 0E 54
Fetch the low byte of the PW parameter from 540EH into Register A.
53E3
LD HL,5431H 21 31 54
Point Register Pair HL to 5431H, the low byte of the LOCK parameter.
53E6
OR (HL) B6
OR the byte at Register Pair HL into Register A.
53E7
LD HL,543BH 21 3B 54
Point Register Pair HL to 543BH, the low byte of the UNLOCK parameter.
53EA
OR (HL) B6
OR the byte at Register Pair HL into Register A.
53EB
LD HL,53F6H 21 F6 53
Point Register Pair HL to 53F6H, the low byte of the NAME parameter.
53EE
OR (HL) B6
OR the byte at Register Pair HL into Register A: the Z FLAG when none of the four was given.
53EF
If the Z FLAG is set (nothing to do), JUMP to 558CH, inside the LD IX at 558BH, where the bytes read LD HL,55AFH: -Nothing done-.
53F2
GOSUB to 54CBH to read the diskette's allocation table into 5800H and check its master password; it returns only when the password is right.
53F5
LD DE,0000H 11 00 00
Load Register Pair DE with the NAME parameter, the operand at 53F6H-53F7H: 0000H in the file, FFFFH for NAME alone, else the address of the quoted name.
53F8
LD A,D 7A
Copy Register D (the high byte of NAME) into Register A.
53F9
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when NAME was not given.
53FA
If the Z FLAG is set (no NAME), JUMP to 540DH for PW.
53FC
LD HL,5630H 21 30 56
Point Register Pair HL to 5630H, the prompt New disk pack name ?.
53FF
GOSUB to 54FBH to get eight characters (the quoted name, or the answer to the prompt) at 5700H.
5402
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the new name.
5405
LD DE,58D0H 11 D0 58
Point Register Pair DE to 58D0H, byte D0H of the allocation table at 5800H: the diskette's name.
5408
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name.
540B
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the new name into the table.
540D
LD DE,0000H 11 00 00
Load Register Pair DE with the PW parameter, the operand at 540EH-540FH: 0000H in the file, FFFFH for PW alone, else the address of the quoted password.
5410
LD A,D 7A
Copy Register D (the high byte of PW) into Register A.
5411
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when PW was not given.
5412
If the Z FLAG is set (no PW), JUMP to 5420H to write the table back.
5414
GOSUB to 5572H, which returns only when no JCL job runs (the password may have to be asked).
5417
LD HL,5648H 21 48 56
Point Register Pair HL to 5648H, the prompt New Master password ?.
541A
GOSUB to 5329H to get the new password (the quoted value or the answer to the prompt) and hash it: Register Pair HL = the hash.
541D
LD (58CEH),HL 22 CE 58
Store Register Pair HL (the hash) at 58CEH-58CFH, bytes CEH-CFH of the allocation table: the new master password.
5420
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
5423
LD A,(54CCH) 3A CC 54
Fetch the drive number from 54CCH into Register A.
5426
LD C,A 4F
Copy Register A (the drive number) into Register C.
5427
GOSUB to 554FH to write the allocation table at 5800H back to drive Register C and verify it: the Z FLAG on success, else Register A = 15H.
542A
If the NZ FLAG is set (the write failed), JUMP to 53BDH to report the error in Register A.
542D
LD HL,(58CEH) 2A CE 58
Fetch the master password hash from 58CEH-58CFH into Register Pair HL (the new one after PW).
5430
LD BC,0000H 01 00 00
Load Register Pair BC with the LOCK parameter, the operand at 5431H-5432H: 0000H in the file, FFFFH for LOCK.
5433
LD A,B 78
Copy Register B (the high byte of LOCK) into Register A.
5434
OR C B1
OR Register C (the low byte) into Register A: the NZ FLAG for LOCK.
5435
LD DE,4296H 11 96 42
Load Register Pair DE with 4296H, the hash of a blank password (eight spaces). LD does not change the flags.
5438
If the NZ FLAG is set (LOCK), JUMP to 5443H: files with a blank password get the master password.
543A
LD BC,0000H 01 00 00
Load Register Pair BC with the UNLOCK parameter, the operand at 543BH-543CH: 0000H in the file, FFFFH for UNLOCK.
543D
LD A,B 78
Copy Register B (the high byte of UNLOCK) into Register A.
543E
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when UNLOCK was not given.
543F
If the Z FLAG is set (neither LOCK nor UNLOCK), JUMP to 54B9H to end the command with Register Pair HL = 0000H.
5442
EX DE,HL EB
Exchange Register Pairs DE and HL: UNLOCK looks for the master password (Register Pair DE) and puts the blank one (Register Pair HL).
5443
LD (5495H),HL 22 95 54
Store Register Pair HL (the hash to put) at 5495H, the operand of the LD DE at 5494H.
5446
LD (548CH),DE ED 53 8C 54
Store Register Pair DE (the hash to look for) at 548CH, the operand of the LD HL at 548BH.
544A
LD A,(54CCH) 3A CC 54
Fetch the drive number from 54CCH into Register A.
544D
LD C,A 4F
Copy Register A (the drive number) into Register C.
544E
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
5451
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, above the member, for the hash index table.
5454
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder: the hash index table.
5456
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
5459
If the NZ FLAG is set (it could not be read), JUMP to 53BDH to report the error in Register A.

545CH - LOCK and UNLOCK: Every File

The hash index table at 5900H is walked a column at a time: the slots 00H, 20H ... E0H of a column are the eight records of one directory sector (slot n is record n). Each slot in use (not 00H, and not one of the system files' slots 00H-07H and 20H-27H) has its record read with DIRRD (once per sector, the sector number kept at 546DH). A record whose attributes are those of a visible file in use (bits 7-3 = 00010) and whose password hash (+10H-+11H) is the one looked for gets the new hash. After each column the sector is written back with DIRWR.

545C
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
545D
AND D8H E6 D8
Keep bits 7, 6, 4 and 3 of Register A (AND D8H): the Z FLAG for slots 00H-07H and 20H-27H, the records of the system files.
545F
If the Z FLAG is set (a system file's slot), JUMP to 549FH to pass it over.
5461
LD A,(HL) 7E
Fetch the slot at Register Pair HL into Register A: 00H when the record is free.
5462
OR A B7
Set the flags from Register A (OR A): the Z FLAG for a free slot.
5463
If the Z FLAG is set (a free slot), JUMP to 549FH.
5465
LD B,L 45
Copy Register L (the slot, the record number) into Register B.
5466
PUSH BC C5
Save Register Pair BC (Register B, the record; Register C, the drive) to the stack.
5467
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
5468
AND E0H E6 E0
Keep bits 7-5 of Register A (AND E0H): the record's place in its sector times 32.
546A
LD L,A 6F
Copy Register A into Register L: Register L = the offset of the record in the sector.
546B
XOR B A8
Exclusive OR Register B (the slot) into Register A: bits 4-0, the sector of the record.
546C
CP FFH FE FF
Compare Register A against the sector already read, the operand at 546DH (FFH in the file: none).
546E
If the Z FLAG is set (that sector is at 4200H), JUMP to 5479H.
5470
LD (546DH),A 32 6D 54
Store Register A (the sector) at 546DH, the operand of the CP at 546CH.
5473
GOSUB to 4B10H (DIRRD) to read the directory sector of record Register B of drive Register C into 4200H.
5476
If the NZ FLAG is set (it could not be read), JUMP to 53BDH to report the error in Register A.
5479
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = 4200H + the offset, the record in the buffer.
547B
LD A,(HL) 7E
Fetch byte +00H of the record, the attributes, at Register Pair HL into Register A.
547C
AND F8H E6 F8
Keep bits 7-3 of Register A (AND F8H), the kind of record.
547E
CP 10H FE 10
Compare Register A against 10H: in use (bit 4) and not an extension, system or invisible record.
5480
If the NZ FLAG is set (any other record), JUMP to 549BH.
5482
LD A,L 7D
Copy Register L (the record's offset) into Register A.
5483
ADD A,10H C6 10
ADD 10H to Register A: +10H, the password hash of the record.
5485
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +10H of the record.
5486
PUSH DE D5
Save Register Pair DE (as the walk uses it) to the stack.
5487
PUSH HL E5
Save Register Pair HL (+10H of the record) to the stack.
5488
LD E,(HL) 5E
Fetch the low byte of the record's password hash at Register Pair HL into Register E.
5489
INC HL 23
INCrement Register Pair HL to +11H of the record.
548A
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the record's password hash.
548B
LD HL,0000H 21 00 00
Load Register Pair HL with the hash looked for, the operand at 548CH-548DH stored by 5446H (0000H in the file).
548E
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
548F
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the record has the hash looked for.
5491
POP HL E1
Restore Register Pair HL from the stack: +10H of the record.
5492
If the NZ FLAG is set (another password), JUMP to 549AH.
5494
LD DE,0000H 11 00 00
Load Register Pair DE with the hash to put, the operand at 5495H-5496H stored by 5443H (0000H in the file).
5497
LD (HL),E 73
Store Register E (the low byte) at Register Pair HL, +10H of the record.
5498
INC L 2C
INCrement Register L to +11H of the record, the high byte of the hash.
5499
LD (HL),D 72
Store Register D (the high byte) at Register Pair HL, +11H: the record has the new password.
549A
POP DE D1
Restore Register Pair DE (as the walk uses it) from the stack.
549B
POP BC C1
Restore Register Pair BC from the stack: Register B = the slot.
549C
LD H,59H 26 59
Load Register H with 59H, the page of the hash index table.
549E
LD L,B 68
Copy Register B (the slot) into Register L: Register Pair HL = the slot again.
549F
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
54A0
ADD A,20H C6 20
ADD 20H to Register A: the next record of the same sector.
54A2
LD L,A 6F
Copy Register A (the next slot) into Register L.
54A3
If the NO CARRY FLAG is set (still inside the column), LOOP BACK to 545CH.
54A5
LD A,(546DH) 3A 6D 54
Fetch the sector last read from 546DH into Register A.
54A8
XOR L AD
Exclusive OR Register L (now the column's sector, 00H-1FH) into Register A: the Z FLAG when that sector is at 4200H.
54A9
If the NZ FLAG is set (it was not read), JUMP to 54B3H: nothing to write.
54AB
PUSH HL E5
Save Register Pair HL (the column) to the stack.
54AC
GOSUB to 4B1FH (DIRWR) to write the directory sector at 4200H back and verify it.
54AF
If the NZ FLAG is set (the write failed), JUMP to 53BDH to report the error in Register A.
54B2
POP HL E1
Restore Register Pair HL (the column) from the stack.
54B3
LD A,L 7D
Copy Register L (the column) into Register A.
54B4
INC L 2C
INCrement Register L to the next column of the table.
54B5
CP 1FH FE 1F
Compare Register A against 1FH: the Z FLAG after the last column.
54B7
If the NZ FLAG is set (columns left), LOOP BACK to 545CH.
54B9
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
54BC
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 54BDH-54BEH (0000H in the file, stored by 5200H). 5599H comes here with Register Pair HL = FFFFH.
54BF
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
54C0
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
54C1
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.
54C2
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
54C5
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
54C7
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
54C8
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

54CBH - The Allocation Table and the Master Password

Reads the granule allocation table of the drive into 5800H. When its master password (CEH-CFH) is the hash of PASSWORD (42E0H) nothing is asked. Otherwise the password (MPW=, or typed after Master password ?) must hash to the table's, or to 113DH (the hash of the master override password RS0LT0FF); else Invalid master password! ends the command.

54CB
LD C,00H 0E 00
Load Register C with the drive, the operand at 54CCH stored by 53D4H (00H in the file).
54CD
GOSUB to 554EH to read the allocation table of drive Register C into 5800H: the Z FLAG on success, else Register A = 14H.
54D0
If the NZ FLAG is set (it could not be read), JUMP to 53BDH to report the error in Register A.
54D3
LD HL,(58CEH) 2A CE 58
Fetch the master password hash from 58CEH-58CFH into Register Pair HL.
54D6
LD DE,42E0H 11 E0 42
Load Register Pair DE with 42E0H, the hash of PASSWORD.
54D9
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54DA
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the master password is PASSWORD.
54DC
RET Z C8
RETurn if the Z FLAG is set: no password is asked.
54DD
LD DE,(54F9H) ED 5B F9 54
Load Register Pair DE with the MPW parameter from 54F9H-54FAH: 0000H, FFFFH for MPW alone, else the address of the quoted password.
54E1
LD HL,564CH 21 4C 56
Point Register Pair HL to 564CH, the prompt Master password ? (the last part of New Master password ?).
54E4
GOSUB to 5329H to get the password and hash it: Register Pair HL = the hash.
54E7
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the hash of the password given.
54E8
LD HL,113DH 21 3D 11
Load Register Pair HL with 113DH, the hash of the master override password RS0LT0FF.
54EB
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54EC
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG for the override password.
54EE
RET Z C8
RETurn if the Z FLAG is set: the password is accepted.
54EF
LD HL,(58CEH) 2A CE 58
Fetch the master password hash from 58CEH-58CFH into Register Pair HL.
54F2
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54F3
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the password is the diskette's.
54F5
RET Z C8
RETurn if the Z FLAG is set: the password is accepted.
54F6
JUMP to 557CH, inside the LD IX at 557BH, where the bytes read LD HL,5664H: Invalid master password!.
54F9-54FA
DEFB 00H, 00H 00 00
The MPW parameter, where @PARAM stores the value of MPW or M: 0000H in the file, FFFFH for MPW alone, else the address of the quoted password.

54FBH - Get Eight Characters

Register Pair DE = a parameter (0000H not given, FFFFH given alone, else the address of its quoted value), Register Pair HL = a prompt. A quoted value is copied to 5700H up to ENTER, a comma or a quote; otherwise the prompt is displayed (not during a JCL job) and up to eight characters are typed there, BREAK ending the command with ATTRIB aborted!. The eight places are padded with spaces and small letters made capitals. Returns Register Pair DE = 5700H.

54FB
LD A,D 7A
Copy Register D (the high byte of the parameter) into Register A.
54FC
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for 0000H, not given.
54FD
If the Z FLAG is set (not given), JUMP to 551CH to ask.
54FF
INC A 3C
INCrement Register A: the Z FLAG for FFH, the keyword without a value.
5500
If the Z FLAG is set (no value), JUMP to 551CH to ask.
5502
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the place for the eight characters.
5505
PUSH HL E5
Save Register Pair HL (5700H, the characters) to the stack.
5506
LD B,08H 06 08
Load Register B with 08H, at most eight characters.
5508
LD A,(DE) 1A
Fetch the next character of the value at Register Pair DE into Register A.
5509
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
550B
If the Z FLAG is set (the end), JUMP to 5538H to pad with spaces.
550D
CP 2CH FE 2C
Compare Register A against 2CH, a comma before the next parameter.
550F
If the Z FLAG is set (the end), JUMP to 5538H to pad with spaces.
5511
CP 22H FE 22
Compare Register A against 22H, the closing quote.
5513
If the Z FLAG is set (the end), JUMP to 5538H to pad with spaces.
5515
INC DE 13
INCrement Register Pair DE to the next character of the value.
5516
LD (HL),A 77
Store Register A (the character) at Register Pair HL.
5517
INC HL 23
INCrement Register Pair HL to the next place.
5518
DECrement Register B and LOOP BACK to 5508H while places are left.
551A
JUMP to 553DH: eight characters were taken from the value.
551C
GOSUB to 5572H, which returns only when no JCL job runs.
551F
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL, up to its 03H.
5522
LD B,08H 06 08
Load Register B with 08H, at most eight characters.
5524
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the place for the answer.
5527
PUSH HL E5
Save Register Pair HL (5700H, the answer) to the stack.
5528
GOSUB to the ROM at 0040H (@KEYIN) to read up to Register B characters into Register Pair HL: Register B = the characters typed, the CARRY FLAG for BREAK.
552B
If the CARRY FLAG is set (BREAK), JUMP to 5580H, inside the LD IX at 557FH, where the bytes read LD HL,567DH: ATTRIB aborted!.
552D
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = 5700H.
552E
LD H,00H 26 00
Load Register H with 00H, the high byte of the count.
5530
LD L,B 68
Copy Register B (the characters typed) into Register L: Register Pair HL = their count.
5531
ADD HL,DE 19
ADD Register Pair DE (5700H) to Register Pair HL: the place after them.
5532
LD A,08H 3E 08
Load Register A with 08H, the eight places of the field.
5534
SUB B 90
SUBtract Register B (the characters typed) from Register A: the places left.
5535
If the Z FLAG is set (eight were typed), JUMP to 553DH.
5537
LD B,A 47
Copy Register A (the places left) into Register B.
5538
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL, a place not typed.
553A
INC HL 23
INCrement Register Pair HL to the next place.
553B
DECrement Register B and LOOP BACK to 5538H until the eight places are full.
553D
POP HL E1
Restore Register Pair HL from the stack: 5700H.
553E
PUSH HL E5
Save Register Pair HL (5700H) to the stack again.
553F
LD B,08H 06 08
Load Register B with 08H, the eight characters.
5541
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5542
CP 61H FE 61
Compare Register A against 61H, the letter a: the CARRY FLAG below it.
5544
If the CARRY FLAG is set (not a small letter), JUMP to 5549H.
5546
XOR 20H EE 20
Exclusive OR 20H into Register A: the capital letter.
5548
LD (HL),A 77
Store Register A (the capital) at Register Pair HL.
5549
INC HL 23
INCrement Register Pair HL to the next character.
554A
DECrement Register B and LOOP BACK to 5541H for the eight characters.
554C
POP DE D1
Restore Register Pair DE from the stack: 5700H, the eight characters.
554D
RET C9
RETurn with Register Pair DE = 5700H, the eight characters.

554EH - Read or Write the Allocation Table at 5800H

One routine with two entries: 554EH is OR AFH, which leaves the NZ FLAG (read); 554FH is the AFH alone, XOR A, which leaves the Z FLAG (write). Sector 0 of the directory cylinder of drive Register C is read into 5800H (error 14H) or written from it with the deleted data mark and verified (error 15H). Register Pairs DE and HL are kept.

554E
OR AFH F6 AF
OR AFH into Register A: the NZ FLAG, a read. Entered at 554FH (from 5427H) the byte AFH is XOR A: the Z FLAG, a write.
5550
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
5551
PUSH HL E5
Save Register Pair HL to the stack, for the caller.
5552
PUSH AF F5
Save Register Pair AF (the flag that says read or write) to the stack.
5553
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
5556
LD E,00H 1E 00
Load Register E with 00H, sector 0: the granule allocation table.
5558
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer of the table, above the member.
555B
POP AF F1
Restore Register Pair AF from the stack: the Z FLAG for a write.
555C
If the Z FLAG is set (a write), JUMP to 5565H.
555E
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
5561
LD A,14H 3E 14
Load Register A with 14H, error 20 (GAT read error). LD does not change the flags.
5563
JUMP to 556FH to return with the result of the read.
5565
GOSUB to 4768H (WRPROT) to write the buffer at Register Pair HL to cylinder Register D, sector Register E of drive Register C with the deleted data mark.
5568
If the Z FLAG is set (written), GOSUB to 4772H (VERSEC) to read it back: Register A = 06H for a directory sector.
556B
CP 06H FE 06
Compare Register A against 06H: the Z FLAG when the sector read back as a directory sector.
556D
LD A,15H 3E 15
Load Register A with 15H, error 21 (GAT write error). LD does not change the flags.
556F
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
5570
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
5571
RET C9
RETurn: the Z FLAG on success, else the NZ FLAG with the error number in Register A.

5572H - Not during a JCL Job; the Messages

5572H returns only when no JCL job runs (bit 5 of SFLAG$); otherwise it displays Invalid command during DO processing! and ends the command. 5578H-558FH is a chain of LD IX instructions: each entry after the first is the LD HL hidden after the DDH prefix, so a jump into the chain picks one message for @LOGOT.

5572
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5575
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5577
RET Z C8
RETurn if the Z FLAG is set (no JCL job): the caller goes on.
5578
LD HL,560AH 21 0A 56
Point Register Pair HL to 560AH, the message Invalid command during DO processing!.
557B
LD IX,5664H DD 21 64 56
Load Index Register IX with 5664H: no use when run from above. Entered at 557CH (from 54F6H) the bytes 21H 64H 56H are LD HL,5664H: Invalid master password!.
557F
LD IX,567DH DD 21 7D 56
Load Index Register IX with 567DH: no use when run from above. Entered at 5580H (from 552BH) the bytes 21H 7DH 56H are LD HL,567DH: ATTRIB aborted!.
5583
LD IX,55DDH DD 21 DD 55
Load Index Register IX with 55DDH: no use when run from above. Entered at 5584H (from 52FCH) the bytes 21H DDH 55H are LD HL,55DDH: File has no access password!.
5587
LD IX,559CH DD 21 9C 55
Load Index Register IX with 559CH: no use when run from above. Entered at 5588H (from 5210H) the bytes 21H 9CH 55H are LD HL,559CH: File spec required.
558B
LD IX,55AFH DD 21 AF 55
Load Index Register IX with 55AFH: no use when run from above. Entered at 558CH (from 53EFH) the bytes 21H AFH 55H are LD HL,55AFH: -Nothing done-.
558F
LD IX,55BEH DD 21 BE 55
Load Index Register IX with 55BEH: no use when run from above. Entered at 5590H (from the option checks) the bytes 21H BEH 55H are LD HL,55BEH: Attribute specification error!.
5593
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5596
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed. 53C2H comes here after an error.
5599
JUMP to 54BCH to put the stack back and end the command.

559CH - ATTRIB Data: Messages, the Protection Words, the Prompts and the Parameter Table

The texts, ended by 0DH (the prompts by 03H so that the answer is typed on the line), the eight two letter words of the protection levels, and the parameter table for a diskette.

559C-55AD
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 5588H: the specification names a device.
55AE
DEFB 0DH 0D
0DH, the end of the message File spec required, displayed with it.
55AF-55BC
DEFM "-Nothing done-" 2D 4E 6F 74 68 69 6E 67 20 64 6F 6E 65 2D
The message of 558CH: none of NAME, PW, LOCK and UNLOCK was given for a diskette.
55BD
DEFB 0DH 0D
0DH, the end of the message Nothing done, displayed with it.
55BE-55DB
DEFM "Attribute specification error!" 41 74 74 72 69 62 75 74 65 20 73 70 65 63 69 66 69 63 61 74 69 6F 6E 20 65 72 72 6F 72 21
The message of 5590H: an option of a file that ATTRIB does not know or that lacks its value.
55DC
DEFB 0DH 0D
0DH, the end of the message Attribute specification error!, displayed with it.
55DD-55F8
DEFM "File has no access password!" 46 69 6C 65 20 68 61 73 20 6E 6F 20 61 63 63 65 73 73 20 70 61 73 73 77 6F 72 64 21
The message of 5584H: ACC on a drive whose records keep the time where the access password would be.
55F9
DEFB 0DH 0D
0DH, the end of the message File has no access password!, displayed with it.
55FA-5609
DEFM "NOEXREWR~~NAKIFU" 4E 4F 45 58 52 45 57 52 7E 7E 4E 41 4B 49 46 55
The protection words, two letters each, levels 7 down to 0: NO (no access), EX (execute), RE (read), WR (write), ~~ (level 3, never matched), NA (rename), KI (kill), FU (full).
560A-562E
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 44 4F 20 70 72 6F 63 65 73 73 69 6E 67 21
The message of 5578H: a password would have to be asked during a JCL job.
562F
DEFB 0DH 0D
0DH, the end of the message Invalid command during DO processing!, displayed with it.
5630-5646
DEFM "New disk pack name ? " 4E 65 77 20 64 69 73 6B 20 70 61 63 6B 20 6E 61 6D 65 20 3F 20 20 20
The prompt of 53FCH for NAME without a value.
5647
DEFB 03H 03
03H, the end of the prompt: the answer is typed on the same line.
5648-5662
DEFM "New Master password ? " 4E 65 77 20 4D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20 20 20 20 20 20
The prompt of 5417H for PW without a value; 54E1H uses its end, from 564CH, as Master password ?.
5663
DEFB 03H 03
03H, the end of both prompts: the answer is typed on the same line.
5664-567B
DEFM "Invalid master password!" 49 6E 76 61 6C 69 64 20 6D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 21
The message of 557CH: the password given is neither the diskette's nor the override.
567C
DEFB 0DH 0D
0DH, the end of the message Invalid master password!, displayed with it.
567D-568B
DEFM "ATTRIB aborted!" 41 54 54 52 49 42 20 61 62 6F 72 74 65 64 21
The message of 5580H: BREAK was pressed at a prompt.
568C
DEFB 0DH 0D
0DH, the end of the message ATTRIB aborted!, displayed with it.
568D-5692
DEFM "PW " 50 57 20 20 20 20
Parameter table entry 1: the keyword PW, a new master password for the diskette.
5693-5694
DEFW 540EH 0E 54
Entry 1: 540EH, the operand of the LD DE at 540DH, where PW is stored.
5695-569A
DEFM "LOCK " 4C 4F 43 4B 20 20
Parameter table entry 2: the keyword LOCK, the master password for every file without one.
569B-569C
DEFW 5431H 31 54
Entry 2: 5431H, the operand of the LD BC at 5430H, where LOCK is stored.
569D-56A2
DEFM "L " 4C 20 20 20 20 20
Parameter table entry 3: the keyword L, short for LOCK.
56A3-56A4
DEFW 5431H 31 54
Entry 3: 5431H, the operand of the LD BC at 5430H, where L is stored.
56A5-56AA
DEFM "UNLOCK" 55 4E 4C 4F 43 4B
Parameter table entry 4: the keyword UNLOCK, no password for every file with the master password.
56AB-56AC
DEFW 543BH 3B 54
Entry 4: 543BH, the operand of the LD BC at 543AH, where UNLOCK is stored.
56AD-56B2
DEFM "U " 55 20 20 20 20 20
Parameter table entry 5: the keyword U, short for UNLOCK.
56B3-56B4
DEFW 543BH 3B 54
Entry 5: 543BH, the operand of the LD BC at 543AH, where U is stored.
56B5-56BA
DEFM "NAME " 4E 41 4D 45 20 20
Parameter table entry 6: the keyword NAME, a new name for the diskette.
56BB-56BC
DEFW 53F6H F6 53
Entry 6: 53F6H, the operand of the LD DE at 53F5H, where NAME is stored.
56BD-56C2
DEFM "N " 4E 20 20 20 20 20
Parameter table entry 7: the keyword N, short for NAME.
56C3-56C4
DEFW 53F6H F6 53
Entry 7: 53F6H, the operand of the LD DE at 53F5H, where N is stored.
56C5-56CA
DEFM "MPW " 4D 50 57 20 20 20
Parameter table entry 8: the keyword MPW, the diskette's master password.
56CB-56CC
DEFW 54F9H F9 54
Entry 8: 54F9H, the cell at 54F9H-54FAH, where MPW is stored.
56CD-56D2
DEFM "M " 4D 20 20 20 20 20
Parameter table entry 9: the keyword M, short for MPW.
56D3-56D4
DEFW 54F9H F9 54
Entry 9: 54F9H, the cell at 54F9H-54FAH, where M is stored.
56D5
DEFB 00H 00
00H, the end of the parameter table for a diskette, the last byte of the member.

5200H - Member 10 (DUMP): Entry, the Range and the File

The DUMP command (library member 71H), loaded at 5200H-5405H. It writes the memory from START (5500H when not given) to END (54FFH when not given) to a file: as a load module (default extension /CIM: a name record with up to six letters of the file's name, load blocks of at most 254 bytes, and a transfer record for TRA, 402DH when not given), or with ASCII as the bytes alone (default /TXT) followed by the ETX byte (03H when not given). LRL (1-256) sets the record length. The file's control block is at 542CH and its six letter name at 5426H, above the member; its buffer is 5500H.

5200
LD (5334H),SP ED 73 34 53
Store the Stack Pointer at 5334H, the operand of the LD SP at 5333H: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD DE,542CH 11 2C 54
Point Register Pair DE to 542CH, the file control block of DUMP, just above the member (not in the file).
5207
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.
520A
If the NZ FLAG is set (no file specification), JUMP to 5352H to display File spec required!.
520D
LD A,(DE) 1A
Fetch the first byte of the specification at Register Pair DE (542CH) into Register A.
520E
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a device name.
5210
If the Z FLAG is set (a device), JUMP to 5352H to display File spec required!.
5213
LD DE,53A4H 11 A4 53
Point Register Pair DE to 53A4H, the parameter table of DUMP (START, END, TRA, ASCII, LRL, ETX and their first letters).
5216
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE; each value goes into the operand the table names. The NZ FLAG for a bad parameter.
5219
If the NZ FLAG is set (a bad parameter), JUMP to 5349H, inside the LD BC at 5348H, where the bytes read LD A,2CH: error 2CH.
521C
LD HL,(52D9H) 2A D9 52
Fetch END, the operand at 52D9H-52DAH (54FFH in the file), into Register Pair HL.
521F
LD BC,(52D3H) ED 4B D3 52
Fetch START, the operand at 52D3H-52D4H (5500H in the file), into Register Pair BC.
5223
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
5224
SBC HL,BC ED 42
SUBtract Register Pair BC (START) from Register Pair HL (END): the CARRY FLAG when END is below START.
5226
LD HL,535DH 21 5D 53
Point Register Pair HL to 535DH, the message START or END error!. LD does not change the flags.
5229
If the CARRY FLAG is set (END below START), JUMP to 5355H to display the message at Register Pair HL.
522C
LD HL,(52D9H) 2A D9 52
Fetch END from 52D9H-52DAH into Register Pair HL.
522F
LD BC,5500H 01 00 55
Load Register Pair BC with 5500H, the start of the member's buffer.
5232
SBC HL,BC ED 42
SUBtract Register Pair BC and the CARRY FLAG (clear) from Register Pair HL: the CARRY FLAG when END is below 5500H.
5234
If the CARRY FLAG is set (END below 5500H), JUMP to 5242H.
5236
LD HL,5500H 21 00 55
Load Register Pair HL with 5500H, the start of the member's buffer.
5239
DEC HL 2B
DECrement Register Pair HL: 54FFH, the byte below the buffer.
523A
SBC HL,BC ED 42
SUBtract Register Pair BC (5500H) and the CARRY FLAG (clear) from Register Pair HL (54FFH): this always borrows, so the CARRY FLAG is set.
523C
LD HL,5371H 21 71 53
Point Register Pair HL to 5371H, the message Start less than X'5500'!. LD does not change the flags.
523F
If the NO CARRY FLAG is set (never, see 523AH), JUMP to 5355H to display the message.
5242
LD BC,0000H 01 00 00
Load Register Pair BC with the ASCII parameter, the operand at 5243H-5244H: 0000H in the file, FFFFH for ASCII.
5245
LD A,B 78
Copy Register B (the high byte of ASCII) into Register A.
5246
OR C B1
OR Register C (the low byte) into Register A: the NZ FLAG for ASCII.
5247
If the NZ FLAG is set (ASCII), JUMP to 5274H for the extension TXT.
5249
LD DE,5426H 11 26 54
Point Register Pair DE to 5426H, the six places of the name record's name.
524C
LD HL,542CH 21 2C 54
Point Register Pair HL to 542CH, the file specification.
524F
LD B,06H 06 06
Load Register B with 06H, at most six characters.
5251
LD A,(HL) 7E
Fetch the next character of the specification at Register Pair HL into Register A.
5252
CP 30H FE 30
Compare Register A against 30H, the digit 0: the CARRY FLAG below it.
5254
If the CARRY FLAG is set (the name ends), JUMP to 5269H to fill with spaces.
5256
CP 3AH FE 3A
Compare Register A against 3AH: the CARRY FLAG for a digit.
5258
If the CARRY FLAG is set (a digit), JUMP to 5262H to keep it.
525A
CP 41H FE 41
Compare Register A against 41H, the letter A: the CARRY FLAG below it.
525C
If the CARRY FLAG is set (the name ends), JUMP to 5269H to fill with spaces.
525E
CP 5BH FE 5B
Compare Register A against 5BH: the NO CARRY FLAG above Z.
5260
If the NO CARRY FLAG is set (the name ends), JUMP to 5269H to fill with spaces.
5262
LD (DE),A 12
Store Register A (a letter or digit) at Register Pair DE.
5263
INC HL 23
INCrement Register Pair HL to the next character of the specification.
5264
INC DE 13
INCrement Register Pair DE to the next place of the name.
5265
DECrement Register B and LOOP BACK to 5251H while places are left.
5267
JUMP to 526FH: six characters were taken for the name.
5269
LD A,20H 3E 20
Load Register A with 20H, a space for the places left.
526B
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
526C
INC DE 13
INCrement Register Pair DE to the next place.
526D
DECrement Register B and LOOP BACK to 5269H until the six places are full.
526F
LD HL,539EH 21 9E 53
Point Register Pair HL to 539EH, CIM, the default extension of a load module.
5272
JUMP to 5277H to add the extension at Register Pair HL.
5274
LD HL,53A1H 21 A1 53
Point Register Pair HL to 53A1H, TXT, the default extension for ASCII.
5277
LD DE,542CH 11 2C 54
Point Register Pair DE to 542CH, the file specification.
527A
GOSUB to 4473H (@FEXT) to add the extension at Register Pair HL to the specification at Register Pair DE when it has none.
527D
LD BC,0000H 01 00 00
Load Register Pair BC with the LRL parameter, the operand at 527EH-527FH: 0000H in the file (256), else the record length.
5280
LD A,B 78
Copy Register B (the high byte of LRL) into Register A.
5281
OR A B7
Set the flags from Register A (OR A): the Z FLAG for a length of 0-255.
5282
If the Z FLAG is set (a length of 0-255), JUMP to 528CH.
5284
DEC A 3D
DECrement Register A (the high byte): the Z FLAG only for 01H.
5285
If the NZ FLAG is set (512 or more), JUMP to 5349H to report error 2CH.
5288
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG only for 256.
5289
If the NZ FLAG is set (257-511), JUMP to 5349H to report error 2CH.
528C
OR C B1
OR Register C (the low byte of LRL) into Register A: the record length, 00H for 256.
528D
LD B,A 47
Copy Register A (the record length) into Register B, for @INIT.
528E
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the 256 byte buffer of the file.
5291
GOSUB to 4420H (@INIT) to open the file at Register Pair DE, or create it, with the buffer at Register Pair HL and record length Register B: the NZ FLAG on failure.
5294
If the NZ FLAG is set (it could not be opened or created), JUMP to 534BH to report the error in Register A.
5297
PUSH DE D5
Save Register Pair DE (542CH, the control block) to the stack.
5298
LD BC,(5432H) ED 4B 32 54
Load Register Pair BC from 5432H-5433H, bytes +06H and +07H of the control block: Register C = the drive, Register B = the directory record.
529C
LD DE,5406H 11 06 54
Point Register Pair DE to 5406H, right after the text Dumping: at 53FDH-5405H.
529F
PUSH DE D5
Save Register Pair DE (5406H, the place of the name) to the stack.
52A0
GOSUB to 44BBH (@FNAME) to write the name of directory record Register B of drive Register C as NAME/EXT:d at Register Pair DE, ended by 03H.
52A3
POP HL E1
Restore Register Pair HL from the stack: 5406H, the name.
52A4
If the NZ FLAG is set (the directory could not be read), JUMP to 534BH to report the error in Register A.
52A7
LD A,20H 3E 20
Load Register A with 20H, a space, the limit of the name's characters.
52A9
INC HL 23
INCrement Register Pair HL to the next character of the name.
52AA
CP (HL) BE
Compare Register A (20H) against the character at Register Pair HL: the CARRY FLAG for a character above the space.
52AB
If the CARRY FLAG is set (still the name), LOOP BACK to 52A9H.
52AD
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL over the 03H after the name: the line ends with ENTER.
52AF
LD HL,53FDH 21 FD 53
Point Register Pair HL to 53FDH, the text Dumping: followed by the name.
52B2
GOSUB to 447BH (@LOGOT) to display the line at Register Pair HL and send it to the job log.
52B5
POP DE D1
Restore Register Pair DE from the stack: 542CH, the control block.
52B6
LD A,(5243H) 3A 43 52
Fetch the low byte of the ASCII parameter from 5243H into Register A.
52B9
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for ASCII.
52BA
If the NZ FLAG is set (ASCII: no name record), JUMP to 52D2H.
52BC
LD A,05H 3E 05
Load Register A with 05H, the type of a name record.
52BE
GOSUB to 5344H to write the byte in Register A to the file at Register Pair DE.
52C1
LD A,06H 3E 06
Load Register A with 06H, the length of the name.
52C3
GOSUB to 5344H to write the byte in Register A to the file.
52C6
LD B,06H 06 06
Load Register B with 06H, the six characters of the name.
52C8
LD HL,5426H 21 26 54
Point Register Pair HL to 5426H, the name taken from the specification.
52CB
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
52CC
INC HL 23
INCrement Register Pair HL to the next character.
52CD
GOSUB to 5344H to write the character in Register A to the file.
52D0
DECrement Register B and LOOP BACK to 52CBH until the six characters are written.

52D2H - Write the Memory

From START to END in blocks of at most 254 bytes: a load module puts a load block header (01H, the length plus 2, the address) in front of each block; ASCII writes the bytes alone. Then a load module ends with the transfer record (02H, 02H, TRA), an ASCII file with the ETX byte, and the file is closed.

52D2
LD HL,5500H 21 00 55
Load Register Pair HL with START, the operand at 52D3H-52D4H: 5500H in the file, the first byte to write.
52D5
PUSH HL E5
Save Register Pair HL (the next byte to write) to the stack.
52D6
LD B,H 44
Copy Register H into Register B, the high byte of the next byte's address.
52D7
LD C,L 4D
Copy Register L into Register C: Register Pair BC = the next byte to write.
52D8
LD HL,54FFH 21 FF 54
Load Register Pair HL with END, the operand at 52D9H-52DAH: 54FFH in the file, the last byte to write.
52DB
INC HL 23
INCrement Register Pair HL: the byte after END.
52DC
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
52DD
SBC HL,BC ED 42
SUBtract Register Pair BC from Register Pair HL: the bytes left, the Z FLAG when none are.
52DF
If the Z FLAG is set (all written), JUMP to 530FH to end the file.
52E1
LD B,FEH 06 FE
Load Register B with FEH, 254, the most bytes of a block.
52E3
LD A,H 7C
Copy Register H (the high byte of the bytes left) into Register A.
52E4
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for 256 or more.
52E5
If the NZ FLAG is set, JUMP to 52EDH with a block of 254.
52E7
LD A,L 7D
Copy Register L (the bytes left) into Register A.
52E8
CP FFH FE FF
Compare Register A against FFH: the NO CARRY FLAG for 255.
52EA
If the NO CARRY FLAG is set, JUMP to 52EDH with a block of 254.
52EC
LD B,L 45
Copy Register L (the bytes left, at most 254) into Register B: the last block.
52ED
POP HL E1
Restore Register Pair HL from the stack: the first byte of the block.
52EE
LD A,(5243H) 3A 43 52
Fetch the low byte of the ASCII parameter from 5243H into Register A.
52F1
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for ASCII.
52F2
If the NZ FLAG is set (ASCII: no header), JUMP to 5306H.
52F4
INC A 3C
INCrement Register A: 01H, the type of a load block.
52F5
GOSUB to 5344H to write the byte in Register A to the file.
52F8
LD A,B 78
Copy Register B (the bytes of the block) into Register A.
52F9
ADD A,02H C6 02
ADD 02H to Register A: the length counts the two address bytes too.
52FB
GOSUB to 5344H to write the length in Register A.
52FE
LD A,L 7D
Copy Register L (the low byte of the block's address) into Register A.
52FF
GOSUB to 5344H to write the low byte of the load address.
5302
LD A,H 7C
Copy Register H (the high byte of the block's address) into Register A.
5303
GOSUB to 5344H to write the high byte of the load address.
5306
LD A,(HL) 7E
Fetch the next byte of memory at Register Pair HL into Register A.
5307
INC HL 23
INCrement Register Pair HL to the byte after it.
5308
GOSUB to 5344H to write the byte in Register A to the file.
530B
DECrement Register B and LOOP BACK to 5306H until the block is written.
530D
JUMP to 52D5H to write the next block of memory.
530F
POP HL E1
Restore Register Pair HL from the stack (the byte after END).
5310
LD A,(5243H) 3A 43 52
Fetch the low byte of the ASCII parameter from 5243H into Register A.
5313
OR A B7
Set the flags from Register A (OR A): the NZ FLAG for ASCII.
5314
LD BC,0003H 01 03 00
Load Register Pair BC with the ETX parameter, the operand at 5315H-5316H: 0003H in the file, the byte that ends an ASCII file. LD does not change the flags.
5317
LD A,C 79
Copy Register C (the ETX byte) into Register A.
5318
If the NZ FLAG is set (ASCII), JUMP to 5328H to write the ETX byte.
531A
GOSUB to 5342H to write 02H, the type of the transfer record.
531D
GOSUB to 5342H to write 02H, the length of the transfer record.
5320
LD HL,402DH 21 2D 40
Load Register Pair HL with TRA, the operand at 5321H-5322H: 402DH (@EXIT) in the file, the transfer address.
5323
LD A,L 7D
Copy Register L (the low byte of the transfer address) into Register A.
5324
GOSUB to 5344H to write the byte in Register A to the file.
5327
LD A,H 7C
Copy Register H (the high byte of the transfer address) into Register A.
5328
GOSUB to 5344H to write the byte in Register A (the high byte of TRA, or the ETX byte) to the file.
532B
GOSUB to 4428H (@CLOSE) to close the file at Register Pair DE.
532E
If the NZ FLAG is set (the close failed), JUMP to 534BH to report the error in Register A.
5330
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
5333
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 5334H-5335H (0000H in the file, stored by 5200H). 535BH comes here with Register Pair HL = FFFFH.
5336
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
5337
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
5338
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.
5339
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
533C
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
533E
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
533F
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.

5342H - Write One Byte; Errors

5342H writes 02H, 5344H the byte in Register A, to the file at Register Pair DE through the ROM's @PUT (001BH). A failure is reported through @ERROR; 5352H displays File spec required! and 5355H any message at Register Pair HL. All end the command with Register Pair HL = FFFFH.

5342
LD A,02H 3E 02
Load Register A with 02H, the type and the length of the transfer record.
5344
GOSUB to the ROM at 001BH (@PUT) to send the byte in Register A to the file whose control block is at Register Pair DE: the Z FLAG on success.
5347
RET Z C8
RETurn if the Z FLAG is set (the byte was written).
5348
LD BC,2C3EH 01 3E 2C
Load Register Pair BC with 2C3EH: no use when run from 5347H (Register A keeps the error of @PUT). Entered at 5349H (from 5219H, 5285H and 5289H) the bytes 3EH 2CH are LD A,2CH, error 44 (parameter error).
534B
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.
534D
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5350
JUMP to 5358H to end the command with Register Pair HL = FFFFH.
5352
LD HL,538AH 21 8A 53
Point Register Pair HL to 538AH, the message File spec required!.
5355
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5358
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
535B
JUMP to 5333H to put the stack back and end the command.

535DH - DUMP Data: Messages, Extensions and the Parameter Table

The three messages, the two default extensions, the parameter table (each keyword of six characters with the address of the operand that holds its value) and the text Dumping:, which the name at 5406H follows.

535D-536F
DEFM "START or END error!" 53 54 41 52 54 20 6F 72 20 45 4E 44 20 65 72 72 6F 72 21
The message of 5229H: END is below START, nothing can be written.
5370
DEFB 0DH 0D
0DH, the end of the message START or END error!, displayed with it.
5371-5388
DEFM "Start less than X'5500'!" 53 74 61 72 74 20 6C 65 73 73 20 74 68 61 6E 20 58 27 35 35 30 30 27 21
A message no path reaches: the JP NC at 523FH is never taken.
5389
DEFB 0DH 0D
0DH, the end of the message Start less than X'5500'!.
538A-539C
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 5352H: the text after DUMP is not a file specification, or names a device.
539D
DEFB 0DH 0D
0DH, the end of the message File spec required!, displayed with it.
539E-53A0
DEFM "CIM" 43 49 4D
The default extension of a load module (526FH).
53A1-53A3
DEFM "TXT" 54 58 54
The default extension of an ASCII dump (5274H).
53A4-53A9
DEFM "START " 53 54 41 52 54 20
Parameter table entry 1: the keyword START, the first address to write.
53AA-53AB
DEFW 52D3H D3 52
Entry 1: 52D3H, the operand of the LD HL at 52D2H, where START is stored.
53AC-53B1
DEFM "END " 45 4E 44 20 20 20
Parameter table entry 2: the keyword END, the last address to write.
53B2-53B3
DEFW 52D9H D9 52
Entry 2: 52D9H, the operand of the LD HL at 52D8H, where END is stored.
53B4-53B9
DEFM "TRA " 54 52 41 20 20 20
Parameter table entry 3: the keyword TRA, the transfer address of the load module.
53BA-53BB
DEFW 5321H 21 53
Entry 3: 5321H, the operand of the LD HL at 5320H, where TRA is stored.
53BC-53C1
DEFM "ASCII " 41 53 43 49 49 20
Parameter table entry 4: the keyword ASCII, the bytes alone.
53C2-53C3
DEFW 5243H 43 52
Entry 4: 5243H, the operand of the LD BC at 5242H, where ASCII is stored.
53C4-53C9
DEFM "LRL " 4C 52 4C 20 20 20
Parameter table entry 5: the keyword LRL, the record length of the file.
53CA-53CB
DEFW 527EH 7E 52
Entry 5: 527EH, the operand of the LD BC at 527DH, where LRL is stored.
53CC-53D1
DEFM "ETX " 45 54 58 20 20 20
Parameter table entry 6: the keyword ETX, the byte that ends an ASCII file.
53D2-53D3
DEFW 5315H 15 53
Entry 6: 5315H, the operand of the LD BC at 5314H, where ETX is stored.
53D4-53D9
DEFM "S " 53 20 20 20 20 20
Parameter table entry 7: the keyword S, short for START.
53DA-53DB
DEFW 52D3H D3 52
Entry 7: 52D3H, the operand of the LD HL at 52D2H, where S is stored.
53DC-53E1
DEFM "E " 45 20 20 20 20 20
Parameter table entry 8: the keyword E, short for END.
53E2-53E3
DEFW 52D9H D9 52
Entry 8: 52D9H, the operand of the LD HL at 52D8H, where E is stored.
53E4-53E9
DEFM "T " 54 20 20 20 20 20
Parameter table entry 9: the keyword T, short for TRA.
53EA-53EB
DEFW 5321H 21 53
Entry 9: 5321H, the operand of the LD HL at 5320H, where T is stored.
53EC-53F1
DEFM "A " 41 20 20 20 20 20
Parameter table entry 10: the keyword A, short for ASCII.
53F2-53F3
DEFW 5243H 43 52
Entry 10: 5243H, the operand of the LD BC at 5242H, where A is stored.
53F4-53F9
DEFM "L " 4C 20 20 20 20 20
Parameter table entry 11: the keyword L, short for LRL.
53FA-53FB
DEFW 527EH 7E 52
Entry 11: 527EH, the operand of the LD BC at 527DH, where L is stored.
53FC
DEFB 00H 00
00H, the end of the parameter table of DUMP (eleven entries).
53FD-5405
DEFM "Dumping: " 44 75 6D 70 69 6E 67 3A 20
The text of 52AFH; @FNAME puts the file's name right after it at 5406H, the first byte after the member.

5200H - Member 11 (PURGE): Entry, the Partspec and the Drive

The PURGE command (library member 72H), loaded at 5200H-577CH (5711H-5733H, a work area, are not in the file). PURGE partspec:d deletes the files of drive d whose name and extension match the partspec ($ matches any character; a space, which fills the masks, matches anything); a leading dash deletes the files that do not match. System files need SYS, invisible files INV; DATE="M/D/Y-M/D/Y" limits the files to a range of dates. Unless QUERY=N each file is asked about (Y deletes it); MPW gives the master password when the diskette has one other than PASSWORD. The drive is required.

5200
LD (52DEH),SP ED 73 DE 52
Store the Stack Pointer at 52DEH, the operand of the LD SP at 52DDH: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
LD A,(4423H) 3A 23 44
Fetch KFLAG$, the keyboard flags, from 4423H into Register A.
5207
AND FCH E6 FC
Clear bits 1-0 of Register A (AND FCH): no BREAK and no pause left from before.
5209
LD (4423H),A 32 23 44
Store Register A at 4423H, KFLAG$, with the two bits cleared.
520C
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A.
520D
INC HL 23
INCrement Register Pair HL past the character just fetched.
520E
CP 20H FE 20
Compare Register A against 20H, a space before the partspec.
5210
If the Z FLAG is set (a space), LOOP BACK to 520CH: Register A ends as the first character of the partspec.
5212
LD DE,5705H 11 05 57
Point Register Pair DE to 5705H, the eight byte mask of the name (spaces in the file).
5215
LD B,08H 06 08
Load Register B with 08H, the eight characters of the name.
5217
CP 2DH FE 2D
Compare Register A against 2DH, a dash: delete the files that do not match.
5219
If the NZ FLAG is set (no dash), JUMP to 5220H.
521B
LD (5352H),A 32 52 53
Store Register A (2DH) at 5352H, the operand of the LD A at 5351H: the sense of the match is turned round.
521E
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A.
521F
INC HL 23
INCrement Register Pair HL past the character after the dash.
5220
GOSUB to 5558H to copy the name part of the partspec into the mask at Register Pair DE: Register A comes back as the character that ended it.
5223
CP 2FH FE 2F
Compare Register A against 2FH, the slash before an extension.
5225
If the NZ FLAG is set (no extension), JUMP to 5231H.
5227
LD DE,570DH 11 0D 57
Point Register Pair DE to 570DH, the three byte mask of the extension.
522A
LD B,03H 06 03
Load Register B with 03H, the three characters of the extension.
522C
LD A,(HL) 7E
Fetch the first character of the extension at Register Pair HL into Register A.
522D
INC HL 23
INCrement Register Pair HL past the first character of the extension.
522E
GOSUB to 5558H to copy the extension part into the mask at Register Pair DE: Register A comes back as the character that ended it.
5231
CP 3AH FE 3A
Compare Register A against 3AH, the colon of the drive.
5233
If the NZ FLAG is set (no drive), JUMP to 5260H, where the NZ FLAG takes the JP NZ to the parameter error.
5235
LD A,(HL) 7E
Fetch the drive's digit at Register Pair HL into Register A.
5236
INC HL 23
INCrement Register Pair HL past the drive's digit.
5237
SUB 30H D6 30
SUBtract 30H from Register A: the drive number.
5239
CP 08H FE 08
Compare Register A against 08H: the NO CARRY FLAG for 8 or more.
523B
If the NO CARRY FLAG is set (no such drive), JUMP to 55D3H to report error 2CH.
523E
LD C,A 4F
Copy Register A (the drive number) into Register C for @CKDRV.
523F
LD (54ADH),A 32 AD 54
Store Register A (the drive) at 54ADH, the operand of the LD C at 54ACH.
5242
RLCA 07
Rotate Register A left (RLCA): twice the drive.
5243
RLCA 07
Rotate Register A left (RLCA): four times the drive.
5244
RLCA 07
Rotate Register A left (RLCA): eight times the drive.
5245
OR 47H F6 47
OR 47H into Register A: the second byte of BIT n,A for bit n = the drive.
5247
LD (558CH),A 32 8C 55
Store Register A at 558CH: the instruction at 558BH becomes BIT drive,A.
524A
LD (5423H),A 32 23 54
Store Register A at 5423H: the instruction at 5422H becomes BIT drive,A.
524D
GOSUB to 44B8H (@CKDRV) to check drive Register C: the Z FLAG when it is ready, the CARRY FLAG when it is write protected.
5250
LD A,20H 3E 20
Load Register A with 20H, error 32 (illegal drive number). LD does not change the flags.
5252
If the NZ FLAG is set (not ready), JUMP to 55D5H to report error 20H.
5255
LD A,0FH 3E 0F
Load Register A with 0FH, error 15 (write protected disk). LD does not change the flags.
5257
If the CARRY FLAG is set (write protected), JUMP to 55D5H to report error 0FH.
525A
LD DE,5734H 11 34 57
Point Register Pair DE to 5734H, the parameter table of PURGE (I, INV, S, SYS, MPW, QUERY, Q, DATE, D).
525D
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE. The NZ FLAG for a bad parameter.
5260
If the NZ FLAG is set (a bad parameter, or no drive), JUMP to 55D3H to report error 2CH.

5263H - DATE: The Range of Dates

DATE="M/D/Y" keeps the files of that date, "M/D/Y-" those from it on, "-M/D/Y" those up to it and "M/D/Y-M/D/Y" those between. Each date is packed by 55F4H as year (less 1980) x 800H + month x 80H + day x 4, the form 5577H gives a directory record's date. Bit 7 of 5710H says a lowest date is kept at 5711H-5712H, bit 0 a highest date at 5713H-5714H.

5263
LD HL,0000H 21 00 00
Load Register Pair HL with the DATE parameter, the operand at 5264H-5265H: 0000H in the file, else the address of the quoted text.
5266
LD A,H 7C
Copy Register H (the high byte of DATE) into Register A.
5267
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG when DATE was not given.
5268
If the Z FLAG is set (no DATE), JUMP to 5299H.
526A
LD A,(HL) 7E
Fetch the first character of the date text at Register Pair HL into Register A.
526B
CP 2DH FE 2D
Compare Register A against 2DH, a dash: only a highest date follows.
526D
If the Z FLAG is set (a dash first), JUMP to 5284H.
526F
LD A,80H 3E 80
Load Register A with 80H, bit 7: a lowest date is given.
5271
LD (5710H),A 32 10 57
Store Register A at 5710H, the flags of the dates.
5274
GOSUB to 55F4H to read the date at Register Pair HL: Register Pair BC = the packed date.
5277
LD (5711H),BC ED 43 11 57
Store Register Pair BC (the lowest date) at 5711H-5712H.
527B
LD A,(HL) 7E
Fetch the character after the date at Register Pair HL into Register A.
527C
CP 22H FE 22
Compare Register A against 22H, the closing quote.
527E
If the Z FLAG is set (one date only), JUMP to 528DH: the same date is the highest too.
5280
CP 2DH FE 2D
Compare Register A against 2DH, the dash before a highest date.
5282
If the NZ FLAG is set (anything else), JUMP to 5299H with the lowest date only.
5284
INC HL 23
INCrement Register Pair HL past the dash of the range.
5285
LD A,(HL) 7E
Fetch the character after the dash at Register Pair HL into Register A.
5286
CP 22H FE 22
Compare Register A against 22H, the closing quote: no highest date.
5288
If the Z FLAG is set (no highest date), JUMP to 5299H.
528A
GOSUB to 55F4H to read the highest date at Register Pair HL: Register Pair BC = the packed date.
528D
LD A,(5710H) 3A 10 57
Fetch the flags of the dates from 5710H into Register A.
5290
OR 01H F6 01
OR 01H into Register A: bit 0, a highest date is given.
5292
LD (5710H),A 32 10 57
Store Register A (the flags of the dates) at 5710H.
5295
LD (5713H),BC ED 43 13 57
Store Register Pair BC (the highest date) at 5713H-5714H.
5299
LD A,(53C0H) 3A C0 53
Fetch the low byte of the QUERY parameter from 53C0H into Register A: FFH in the file, 00H for QUERY=N.
529C
OR A B7
Set the flags from Register A (OR A): the Z FLAG for QUERY=N.
529D
If the Z FLAG is set (no questions), JUMP to 52A5H.
529F
GOSUB to 5552H to test bit 5 of SFLAG$: the NZ FLAG while a JCL job runs.
52A2
If the NZ FLAG is set (a JCL job and questions), JUMP to 55E4H, inside the LD IX at 55E3H, where the bytes read LD HL,5651H: Invalid command during DO processing.
52A5
GOSUB to 54ACH to read the drive's allocation table and check its master password.
52A8
LD A,(54ADH) 3A AD 54
Fetch the drive number from 54ADH into Register A.
52AB
LD C,A 4F
Copy Register A (the drive number) into Register C.
52AC
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
52AF
LD E,01H 1E 01
Load Register E with 01H, sector 1: the hash index table.
52B1
LD HL,5A00H 21 00 5A
Point Register Pair HL to 5A00H, above the member, for the hash index table.
52B4
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
52B7
LD A,16H 3E 16
Load Register A with 16H, error 22 (HIT read error). LD does not change the flags.
52B9
If the NZ FLAG is set (it could not be read), JUMP to 55D5H to report error 16H.
52BC
JUMP to 52ECH to start the walk with slot 00H.

52BEH - The Walk through the Hash Index Table

The slots are taken a column at a time: 00H, 20H ... E0H are the eight records of directory sector 0, then 01H, 21H ... and so on (slot n is record n). Slots 00H and 01H (the system's own records) and free slots are passed over. BREAK ends the command with Purge aborted between two files.

52BE
POP HL E1
Restore Register Pair HL from the stack (the record, not needed any more).
52BF
POP BC C1
Restore Register Pair BC from the stack: Register B = the slot just done.
52C0
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A: bit 0 set when BREAK was pressed.
52C3
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
52C4
If the CARRY FLAG is set (BREAK), JUMP to 55DCH to display Purge aborted.
52C7
LD H,5AH 26 5A
Load Register H with 5AH, the page of the hash index table.
52C9
LD L,B 68
Copy Register B (the slot) into Register L: Register Pair HL = the slot.
52CA
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
52CB
ADD A,20H C6 20
ADD 20H to Register A: the next record of the same directory sector.
52CD
LD L,A 6F
Copy Register A (the next slot) into Register L.
52CE
If the NO CARRY FLAG is set (still inside the column), JUMP to 52ECH.
52D0
INC L 2C
INCrement Register L: the first slot of the next column.
52D1
CP 1FH FE 1F
Compare Register A (the column just done) against 1FH: the Z FLAG after the last column.
52D3
If the NZ FLAG is set (columns left), JUMP to 52ECH.
52D5
LD A,0DH 3E 0D
Load Register A with 0DH, ENTER, to end the last line.
52D7
GOSUB to the ROM at 0033H to display the character in Register A on the video.
52DA
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
52DD
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 52DEH-52DFH (0000H in the file, stored by 5200H). 55F1H comes here with Register Pair HL = FFFFH.
52E0
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
52E1
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
52E2
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.
52E3
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
52E6
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
52E8
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
52E9
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.
52EC
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
52ED
AND FEH E6 FE
Clear bit 0 of Register A (AND FEH): the Z FLAG for slots 00H and 01H.
52EF
If the Z FLAG is set (the system's own records), JUMP to 52CAH to pass them over.
52F1
LD A,(HL) 7E
Fetch the slot at Register Pair HL into Register A: 00H for a free record.
52F2
OR A B7
Set the flags from Register A (OR A): the Z FLAG for a free slot.
52F3
If the Z FLAG is set (a free slot), JUMP to 52CAH.
52F5
LD B,L 45
Copy Register L (the slot, the record number) into Register B.
52F6
PUSH BC C5
Save Register Pair BC (Register B, the record; Register C, the drive) to the stack.
52F7
LD A,L 7D
Copy Register L (the slot of the hash index table) into Register A.
52F8
AND E0H E6 E0
Keep bits 7-5 of Register A (AND E0H): the record's place in its sector times 32.
52FA
LD L,A 6F
Copy Register A into Register L: the offset of the record in the sector.
52FB
XOR B A8
Exclusive OR Register B (the slot) into Register A: bits 4-0, the sector of the record.
52FC
CP FFH FE FF
Compare Register A against the sector already read, the operand at 52FDH (FFH in the file and after a kill: none).
52FE
If the Z FLAG is set (the sector is at 4200H), JUMP to 5309H.
5300
LD (52FDH),A 32 FD 52
Store Register A (the sector) at 52FDH, the operand of the CP at 52FCH.
5303
GOSUB to 4B10H (DIRRD) to read the directory sector of record Register B of drive Register C into 4200H.
5306
If the NZ FLAG is set (it could not be read), JUMP to 55D5H to report the error in Register A.
5309
LD H,42H 26 42
Load Register H with 42H: Register Pair HL = 4200H + the offset, the record in the buffer.
530B
LD A,(HL) 7E
Fetch byte +00H of the record, the attributes, at Register Pair HL into Register A.
530C
BIT 4,A CB 67
Test bit 4 of Register A: set when the record is in use.
530E
If the Z FLAG is set (not in use), JUMP to 52BFH for the next slot.
5310
BIT 7,A CB 7F
Test bit 7 of Register A: set for an extension record.
5312
If the NZ FLAG is set (an extension), JUMP to 52BFH for the next slot.
5314
BIT 6,A CB 77
Test bit 6 of Register A: set for a system file.
5316
If the Z FLAG is set (not a system file), JUMP to 5322H.
5318
LD DE,0000H 11 00 00
Load Register Pair DE with the SYS parameter, the operand at 5319H-531AH: 0000H in the file, FFFFH for SYS.
531B
LD A,D 7A
Copy Register D (the high byte of SYS) into Register A.
531C
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when SYS was not given.
531D
If the Z FLAG is set (a system file without SYS), JUMP to 52BFH to pass it over.
5320
JUMP to 532EH to compare the name with the masks.
5322
BIT 3,A CB 5F
Test bit 3 of Register A: set for an invisible file.
5324
If the Z FLAG is set (visible), JUMP to 532EH to compare the name.
5326
LD DE,0000H 11 00 00
Load Register Pair DE with the INV parameter, the operand at 5327H-5328H: 0000H in the file, FFFFH for INV.
5329
LD A,D 7A
Copy Register D (the high byte of INV) into Register A.
532A
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when INV was not given.
532B
If the Z FLAG is set (an invisible file without INV), JUMP to 52BFH to pass it over.

532EH - The Name, the Date, the Line

The eleven characters of the record's name and extension (+05H-+0FH) are compared with the masks; then the record's date (5577H) with the range. The line name/ext:d is built at 5719H; with questions the MOD mark (+), an opening brace and the date as dd-Mmm-yy follow, and the answer is asked for after the closing brace and a question mark.

532E
PUSH HL E5
Save Register Pair HL (the record) to the stack.
532F
LD A,L 7D
Copy Register L (the record's offset) into Register A.
5330
ADD A,05H C6 05
ADD 05H to Register A: the low byte of +05H, the name.
5332
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record's name.
5333
LD DE,5705H 11 05 57
Point Register Pair DE to 5705H, the masks of the name and the extension.
5336
LD B,0BH 06 0B
Load Register B with 0BH, the eleven characters.
5338
LD A,(DE) 1A
Fetch the next character of the mask at Register Pair DE into Register A.
5339
CP 24H FE 24
Compare Register A against 24H, a dollar sign: any character.
533B
If the Z FLAG is set, JUMP to 5344H: this character matches.
533D
CP (HL) BE
Compare Register A against the character of the name at Register Pair HL.
533E
If the Z FLAG is set (the same), JUMP to 5344H.
5340
CP 20H FE 20
Compare Register A against 20H, a space in the mask: anything.
5342
If the NZ FLAG is set (a different character), JUMP to 5351H: no match.
5344
INC HL 23
INCrement Register Pair HL to the next character of the name.
5345
INC DE 13
INCrement Register Pair DE to the next character of the mask.
5346
DECrement Register B and LOOP BACK to 5338H for the eleven characters.
5348
LD A,(5352H) 3A 52 53
The name matches: fetch the dash switch from 5352H into Register A.
534B
OR A B7
Set the flags from Register A (OR A): the NZ FLAG when a dash turned the sense round.
534C
If the NZ FLAG is set (matching files are kept), JUMP to 52BEH to pass it over.
534F
JUMP to 5357H to look at the date of the record.
5351
LD A,00H 3E 00
Load Register A with the dash switch, the operand at 5352H: 00H in the file, 2DH after a dash (521BH).
5353
OR A B7
Set the flags from Register A (OR A): the Z FLAG without a dash.
5354
If the Z FLAG is set (no match and no dash), JUMP to 52BEH to pass it over.
5357
POP HL E1
Restore Register Pair HL from the stack: the record.
5358
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
5359
INC HL 23
INCrement Register Pair HL to +01H of the record.
535A
GOSUB to 5577H to pack the record's date from +01H, +02H (and +13H) into Register Pair DE.
535D
LD A,(5710H) 3A 10 57
Fetch the flags of the dates from 5710H into Register A.
5360
RLCA 07
Rotate Register A left (RLCA): bit 7 goes to the CARRY FLAG.
5361
If the NO CARRY FLAG is set (no lowest date), JUMP to 5371H.
5363
LD A,D 7A
Copy Register D (the high byte of the record's date) into Register A.
5364
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when the record has no date.
5365
If the Z FLAG is set (no date), JUMP to 52BEH to pass it over.
5368
LD HL,(5711H) 2A 11 57
Fetch the lowest date from 5711H-5712H into Register Pair HL.
536B
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the record's date, Register Pair DE = the lowest date.
536C
RST 18H DF
Compare Register Pair HL with Register Pair DE through the ROM's RST 18H: the CARRY FLAG when the record's date is below the lowest.
536D
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair DE = the record's date.
536E
If the CARRY FLAG is set (too early), JUMP to 52BEH to pass it over.
5371
LD A,(5710H) 3A 10 57
Fetch the flags of the dates from 5710H into Register A.
5374
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
5375
If the NO CARRY FLAG is set (no highest date), JUMP to 5383H.
5377
LD A,D 7A
Copy Register D (the high byte of the record's date) into Register A.
5378
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when the record has no date.
5379
If the Z FLAG is set (no date), JUMP to 52BEH to pass it over.
537C
LD HL,(5713H) 2A 13 57
Fetch the highest date from 5713H-5714H into Register Pair HL.
537F
RST 18H DF
Compare Register Pair HL (the highest date) with Register Pair DE (the record's date) through the ROM's RST 18H: the CARRY FLAG when the record is later.
5380
If the CARRY FLAG is set (too late), JUMP to 52BEH to pass it over.
5383
POP HL E1
Restore Register Pair HL from the stack: the record.
5384
PUSH HL E5
Save Register Pair HL (the record) to the stack again.
5385
LD A,L 7D
Copy Register L (the record's offset) into Register A.
5386
ADD A,05H C6 05
ADD 05H to Register A: the low byte of +05H, the name.
5388
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the record's name.
5389
LD DE,5719H 11 19 57
Point Register Pair DE to 5719H, the line of the file in the work area.
538C
LD B,08H 06 08
Load Register B with 08H, at most eight characters of the name.
538E
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
538F
CP 20H FE 20
Compare Register A against 20H, a space: the end of the name.
5391
If the Z FLAG is set (the end of the name), JUMP to 5398H.
5393
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the line.
5394
INC HL 23
INCrement Register Pair HL to the next character of the name.
5395
INC DE 13
INCrement Register Pair DE to the next place in the line.
5396
DECrement Register B and LOOP BACK to 538EH while characters are left.
5398
LD A,L 7D
Copy Register L (the place in the name) into Register A.
5399
ADD A,B 80
ADD Register B (the characters not looked at) to Register A.
539A
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +0DH, the extension.
539B
LD A,(HL) 7E
Fetch the first character of the extension at Register Pair HL into Register A.
539C
CP 20H FE 20
Compare Register A against 20H, a space: no extension.
539E
If the Z FLAG is set (no extension), JUMP to 53B0H.
53A0
LD A,2FH 3E 2F
Load Register A with 2FH, the slash before the extension.
53A2
LD (DE),A 12
Store Register A (the slash) at Register Pair DE in the line.
53A3
INC DE 13
INCrement Register Pair DE to the next place.
53A4
LD B,03H 06 03
Load Register B with 03H, at most three characters of the extension.
53A6
LD A,(HL) 7E
Fetch the next character of the extension at Register Pair HL into Register A.
53A7
CP 20H FE 20
Compare Register A against 20H, a space: the end of the extension.
53A9
If the Z FLAG is set (the end of the extension), JUMP to 53B0H.
53AB
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the line.
53AC
INC HL 23
INCrement Register Pair HL to the next character of the extension.
53AD
INC DE 13
INCrement Register Pair DE to the next place in the line.
53AE
DECrement Register B and LOOP BACK to 53A6H while characters are left.
53B0
LD A,3AH 3E 3A
Load Register A with 3AH, the colon before the drive.
53B2
LD (DE),A 12
Store Register A (the colon) at Register Pair DE in the line.
53B3
INC DE 13
INCrement Register Pair DE to the next place.
53B4
LD A,(54ADH) 3A AD 54
Fetch the drive number from 54ADH into Register A.
53B7
OR 30H F6 30
OR 30H into Register A: the digit of the drive for the line.
53B9
LD (DE),A 12
Store Register A (the digit) at Register Pair DE in the line.
53BA
INC DE 13
INCrement Register Pair DE to the next place.
53BB
LD A,03H 3E 03
Load Register A with 03H, the end of text mark.
53BD
LD (DE),A 12
Store Register A (03H) at Register Pair DE: the line ends after name/ext:d for now.
53BE
PUSH DE D5
Save Register Pair DE (the place of the 03H) to the stack.
53BF
LD DE,FFFFH 11 FF FF
Load Register Pair DE with the QUERY parameter, the operand at 53C0H-53C1H: FFFFH in the file (ask), 0000H for QUERY=N.
53C2
LD A,E 7B
Copy Register E (the low byte of QUERY) into Register A.
53C3
OR D B2
OR Register D (the high byte) into Register A: the Z FLAG for QUERY=N.
53C4
If the Z FLAG is set (no questions), JUMP to 546EH to delete the file.
53C7
LD HL,56C4H 21 C4 56
Point Register Pair HL to 56C4H, the text Purge file: .
53CA
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, up to its 03H.
53CD
POP DE D1
Restore Register Pair DE from the stack: the place of the 03H in the line.
53CE
POP HL E1
Restore Register Pair HL from the stack: the record.
53CF
PUSH DE D5
Save Register Pair DE (the place after name/ext:d) to the stack.
53D0
INC HL 23
INCrement Register Pair HL to +01H of the record.
53D1
BIT 6,(HL) CB 76
Test bit 6 of +01H at Register Pair HL: the MOD flag, set when the file was written since its last backup.
53D3
If the Z FLAG is set (not changed), JUMP to 53DDH.
53D5
LD A,20H 3E 20
Load Register A with 20H, a space before the plus sign.
53D7
LD (DE),A 12
Store Register A (a space) at Register Pair DE in the line.
53D8
INC DE 13
INCrement Register Pair DE to the next place.
53D9
LD A,2BH 3E 2B
Load Register A with 2BH, the plus sign of a changed file.
53DB
LD (DE),A 12
Store Register A (the plus) at Register Pair DE in the line.
53DC
INC DE 13
INCrement Register Pair DE to the next place.
53DD
LD A,20H 3E 20
Load Register A with 20H, a space before the date.
53DF
LD (DE),A 12
Store Register A (a space) at Register Pair DE in the line.
53E0
INC DE 13
INCrement Register Pair DE to the next place.
53E1
INC HL 23
INCrement Register Pair HL to +02H of the record: the day and the low bits of the year.
53E2
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the place in the line.
53E3
LD (HL),7BH 36 7B
Store 7BH, an opening brace, at Register Pair HL in the line.
53E5
INC HL 23
INCrement Register Pair HL to the next place.
53E6
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair DE = the place in the line, Register Pair HL = +02H of the record.
53E7
LD A,(HL) 7E
Fetch +02H of the record at Register Pair HL into Register A: bits 7-3 the day, bits 2-0 the year.
53E8
OR A B7
Set the flags from Register A (OR A): the Z FLAG when the record has no date.
53E9
If the Z FLAG is set (no date), JUMP to 544AH to end the line.
53EB
RRCA 0F
Rotate Register A right (RRCA): the day moves one bit down.
53EC
RRCA 0F
Rotate Register A right (RRCA) again: the day moves down.
53ED
RRCA 0F
Rotate Register A right (RRCA) a third time: the day moves to bits 4-0.
53EE
AND 1FH E6 1F
Keep bits 4-0 of Register A (AND 1FH): the day, 1-31.
53F0
LD B,2FH 06 2F
Load Register B with 2FH, the character before 0, so that the first INC makes it 0.
53F2
INC B 04
INCrement Register B, the tens digit of the day.
53F3
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A, the day or what is left of it.
53F5
If the NO CARRY FLAG is set (10 or more were left), LOOP BACK to 53F2H.
53F7
ADD A,3AH C6 3A
ADD 3AH to Register A: the units less 10 plus 10 plus 30H, the units digit.
53F9
PUSH AF F5
Save Register Pair AF (the units digit) to the stack.
53FA
LD A,B 78
Copy Register B (the tens digit) into Register A.
53FB
LD (DE),A 12
Store Register A (the tens digit) at Register Pair DE in the line.
53FC
INC DE 13
INCrement Register Pair DE to the next place.
53FD
POP AF F1
Restore Register Pair AF (the units digit) from the stack.
53FE
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE in the line.
53FF
INC DE 13
INCrement Register Pair DE to the next place.
5400
LD A,2DH 3E 2D
Load Register A with 2DH, the dash between the day and the month.
5402
LD (DE),A 12
Store Register A (the dash) at Register Pair DE in the line.
5403
INC DE 13
INCrement Register Pair DE to the next place.
5404
PUSH HL E5
Save Register Pair HL (+02H of the record) to the stack.
5405
DEC HL 2B
DECrement Register Pair HL to +01H of the record: bits 3-0 the month.
5406
LD A,(HL) 7E
Fetch +01H of the record at Register Pair HL into Register A.
5407
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): the month, 1-12.
5409
DEC A 3D
DECrement Register A: the month less one, the index of its name.
540A
LD C,A 4F
Copy Register A (the month less one) into Register C.
540B
RLCA 07
Rotate Register A left (RLCA): twice the month less one.
540C
ADD A,C 81
ADD Register C to Register A: three times the month less one, the offset of its name.
540D
LD C,A 4F
Copy Register A (the offset) into Register C.
540E
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the offset.
5410
LD HL,56E1H 21 E1 56
Point Register Pair HL to 56E1H, the three letter names of the months.
5413
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the month's name.
5414
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC = 0003H, the three letters.
5416
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the month's name into the line.
5418
LD A,2DH 3E 2D
Load Register A with 2DH, the dash between the month and the year.
541A
LD (DE),A 12
Store Register A (the dash) at Register Pair DE in the line.
541B
INC DE 13
INCrement Register Pair DE to the next place.
541C
POP HL E1
Restore Register Pair HL from the stack: +02H of the record.
541D
LD C,38H 0E 38
Load Register C with 38H, the digit 8: the tens of the year for the 1980s.
541F
LD A,(475DH) 3A 5D 47
Fetch 475DH into Register A: one bit for each drive whose records keep the full year at +13H.
5422
BIT 0,A CB 47
Test the bit of the drive in Register A: the second byte at 5423H is set by 524AH (47H in the file, bit 0).
5424
If the NZ FLAG is set (the full year is kept), JUMP to 542BH.
5426
LD A,(HL) 7E
Fetch +02H of the record at Register Pair HL into Register A.
5427
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the year less 1980, 0-7.
5429
JUMP to 5441H to write the year as 8 and the digit in Register A.
542B
LD A,L 7D
Copy Register L (the offset of +02H) into Register A.
542C
ADD A,11H C6 11
ADD 11H to Register A: the low byte of +13H of the record.
542E
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +13H of the record.
542F
LD A,(HL) 7E
Fetch +13H of the record at Register Pair HL into Register A.
5430
AND 1FH E6 1F
Keep bits 4-0 of Register A (AND 1FH): the year less 1980, 0-31.
5432
CP 14H FE 14
Compare Register A against 14H (20): the NO CARRY FLAG for 2000 and later.
5434
If the CARRY FLAG is set (the 1900s), JUMP to 543AH.
5436
SUB 14H D6 14
SUBtract 14H (20) from Register A: the year less 2000.
5438
LD C,30H 0E 30
Load Register C with 30H, the digit 0: the tens of the year for 2000-2009.
543A
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG for units 0-9.
543C
If the CARRY FLAG is set (units 0-9), JUMP to 5441H.
543E
INC C 0C
INCrement Register C: the tens digit one higher (9 for the 1990s, 1 for 2010-2011).
543F
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A: the units of the year.
5441
LD B,A 47
Copy Register A (the units of the year) into Register B.
5442
LD A,C 79
Copy Register C (the tens digit) into Register A.
5443
LD (DE),A 12
Store Register A (the tens digit) at Register Pair DE in the line.
5444
INC DE 13
INCrement Register Pair DE to the next place.
5445
LD A,B 78
Copy Register B (the units of the year) into Register A.
5446
ADD A,30H C6 30
ADD 30H to Register A: the units digit of the year.
5448
LD (DE),A 12
Store Register A (the units digit) at Register Pair DE in the line.
5449
INC DE 13
INCrement Register Pair DE to the next place.
544A
LD A,03H 3E 03
Load Register A with 03H, the end of text mark.
544C
LD (DE),A 12
Store Register A (03H) at Register Pair DE: the end of the line.
544D
LD HL,5719H 21 19 57
Point Register Pair HL to 5719H, the line of the file.
5450
GOSUB to 4467H (@DSPLY) to display the line at Register Pair HL, up to its 03H.
5453
LD HL,56D1H 21 D1 56
Point Register Pair HL to 56D1H, the closing brace and the question mark.
5456
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL, up to its 03H.
5459
LD HL,5715H 21 15 57
Point Register Pair HL to 5715H, a place for the answer.
545C
LD B,03H 06 03
Load Register B with 03H, at most three characters.
545E
GOSUB to the ROM at 0040H (@KEYIN) to read the answer into Register Pair HL: the CARRY FLAG for BREAK.
5461
If the CARRY FLAG is set (BREAK), JUMP to 55DCH to display Purge aborted.
5464
LD A,(HL) 7E
Fetch the first character of the answer at Register Pair HL into Register A.
5465
RES 5,A CB AF
Clear bit 5 of Register A: a small letter counts as a capital.
5467
CP 59H FE 59
Compare Register A against 59H, the letter Y.
5469
If the NZ FLAG is set (not Y), JUMP to 52BEH: the file is kept.
546C
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): Register Pair HL = the place after name/ext:d.
546D
PUSH HL E5
Save Register Pair HL (that place) to the stack.

546EH - Delete the File

Purging: and the file's name are shown and logged, then a control block is made at 577DH, above the member, as for an open file: +00H 80H (open), +01H 01H (access KILL), +06H the drive and +07H the directory record. @KILL deletes the file; the directory sector at 4200H is then read again (52FDH = FFH). BREAK pressed before the deletion ends the command with Purge aborted.

546E
LD A,(4423H) 3A 23 44
Fetch KFLAG$ from 4423H into Register A: bit 0 set when BREAK was pressed.
5471
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes to the CARRY FLAG.
5472
If the CARRY FLAG is set (BREAK), JUMP to 55DCH to display Purge aborted.
5475
LD HL,56D7H 21 D7 56
Point Register Pair HL to 56D7H, the text Purging: .
5478
GOSUB to 447BH (@LOGOT) to display the text at Register Pair HL and send it to the job log; its 03H keeps the line open.
547B
POP HL E1
Restore Register Pair HL from the stack: the place after name/ext:d in the line.
547C
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL: the line now ends after name/ext:d.
547E
LD HL,5719H 21 19 57
Point Register Pair HL to 5719H, the line of the file.
5481
GOSUB to 447BH (@LOGOT) to display the name at Register Pair HL and send it to the job log.
5484
POP HL E1
Restore Register Pair HL from the stack: the word under it, not needed.
5485
POP BC C1
Restore Register Pair BC from the stack: Register B = the slot, the directory record of the file.
5486
PUSH BC C5
Save Register Pair BC (the slot) to the stack again, for 52BFH.
5487
LD A,B 78
Copy Register B (the directory record) into Register A.
5488
LD (5784H),A 32 84 57
Store Register A at 5784H, +07H of the control block at 577DH: the file's directory record.
548B
LD A,(54ADH) 3A AD 54
Fetch the drive number from 54ADH into Register A.
548E
LD (5783H),A 32 83 57
Store Register A (the drive) at 5783H, +06H of the control block.
5491
LD A,01H 3E 01
Load Register A with 01H, the access level KILL.
5493
LD (577EH),A 32 7E 57
Store Register A at 577EH, +01H of the control block: the access granted.
5496
LD A,80H 3E 80
Load Register A with 80H, bit 7: the control block describes an open file.
5498
LD (577DH),A 32 7D 57
Store Register A at 577DH, +00H of the control block.
549B
LD DE,577DH 11 7D 57
Point Register Pair DE to 577DH, the control block made for the file.
549E
GOSUB to 442CH (@KILL) to delete the file whose control block is at Register Pair DE.
54A1
If the NZ FLAG is set (it could not be deleted), JUMP to 55D5H to report the error in Register A.
54A4
LD A,FFH 3E FF
Load Register A with FFH, no directory sector in the buffer.
54A6
LD (52FDH),A 32 FD 52
Store Register A at 52FDH, the operand of the CP at 52FCH: the next record reads its sector again, since @KILL used the buffer at 4200H.
54A9
JUMP to 52BFH for the next slot of the hash index table.

54ACH - The Master Password

The drive's allocation table is read into 5900H. When its master password (CEH-CFH) is the hash of PASSWORD (42E0H) nothing is asked. Otherwise the password (MPW=, or typed after Master password ?) must hash to the table's or to 113DH (the hash of the master override password RS0LT0FF); else Invalid master password ends the command. During a JCL job without MPW nothing is asked and nothing is checked (54C7H).

54AC
LD C,00H 0E 00
Load Register C with the drive, the operand at 54ADH stored by 523FH (00H in the file).
54AE
GOSUB to 553FH to read the allocation table of drive Register C into 5900H: the Z FLAG on success, else Register A = 14H.
54B1
If the NZ FLAG is set (it could not be read), JUMP to 55D5H to report the error in Register A.
54B4
LD HL,(59CEH) 2A CE 59
Fetch the master password hash from 59CEH-59CFH (table bytes CEH-CFH) into Register Pair HL.
54B7
LD DE,42E0H 11 E0 42
Load Register Pair DE with 42E0H, the hash of PASSWORD.
54BA
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54BB
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the master password is PASSWORD.
54BD
RET Z C8
RETurn if the Z FLAG is set: no password is asked.
54BE
LD DE,0000H 11 00 00
Load Register Pair DE with the MPW parameter, the operand at 54BFH-54C0H: 0000H in the file, FFFFH for MPW alone, else the address of the quoted password.
54C1
LD HL,5678H 21 78 56
Point Register Pair HL to 5678H, the prompt Master password ?.
54C4
GOSUB to 54DAH to get the password and hash it into Register Pair HL: the NZ FLAG when a JCL job runs and nothing was given.
54C7
RET NZ C0
RETurn if the NZ FLAG is set: during a JCL job without MPW the password is not checked.
54C8
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the hash of the password given.
54C9
LD HL,113DH 21 3D 11
Load Register Pair HL with 113DH, the hash of the master override password RS0LT0FF.
54CC
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54CD
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG for the override password.
54CF
RET Z C8
RETurn if the Z FLAG is set: the password is accepted.
54D0
LD HL,(59CEH) 2A CE 59
Fetch the master password hash from 59CEH-59CFH into Register Pair HL.
54D3
XOR A AF
Clear Register A and the CARRY FLAG (XOR A) for the subtraction below.
54D4
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL: the Z FLAG when the password is the diskette's.
54D6
RET Z C8
RETurn if the Z FLAG is set: the password is accepted.
54D7
JUMP to 55E0H, inside the LD IX at 55DFH, where the bytes read LD HL,5690H: Invalid master password.
54DA
GOSUB to 54E6H to get eight characters at 5800H: Register Pair DE = 5800H, the NZ FLAG during a JCL job with nothing given.
54DD
RET NZ C0
RETurn if the NZ FLAG is set (nothing to hash).
54DE
GOSUB to 54E3H to hash the eight characters at Register Pair DE into Register Pair HL.
54E1
CP A BF
Compare Register A with itself (CP A): the Z FLAG, a password was hashed.
54E2
RET C9
RETurn with the Z FLAG and the hash in Register Pair HL.
54E3
LD A,E4H 3E E4
Load Register A with E4H, the request code of the password hash.
54E5
RST 28H EF
Issue the request in Register A through RST 28H: SYS2/SYS hashes the eight bytes at Register Pair DE into Register Pair HL; its RET goes back to 54E1H (the dispatcher drops this return address).

54E6H - Get Eight Characters

Register Pair DE = the MPW parameter (0000H not given, FFFFH alone, else the address of the quoted value), Register Pair HL = the prompt. A quoted value is copied to 5800H up to ENTER, a comma or a quote; otherwise, unless a JCL job runs (then the NZ FLAG is returned), the prompt is displayed and up to eight characters are typed, BREAK ending the command with Purge aborted. The eight places are padded with spaces and small letters made capitals. Returns Register Pair DE = 5800H and the Z FLAG.

54E6
LD A,D 7A
Copy Register D (the high byte of the parameter) into Register A.
54E7
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for 0000H, not given.
54E8
If the Z FLAG is set (not given), JUMP to 5507H to ask.
54EA
INC A 3C
INCrement Register A: the Z FLAG for FFH, the keyword without a value.
54EB
If the Z FLAG is set (no value), JUMP to 5507H to ask.
54ED
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the place for the eight characters.
54F0
PUSH HL E5
Save Register Pair HL (5800H) to the stack, for 552AH.
54F1
LD B,08H 06 08
Load Register B with 08H, at most eight characters.
54F3
LD A,(DE) 1A
Fetch the next character of the value at Register Pair DE into Register A.
54F4
CP 0DH FE 0D
Compare Register A against 0DH, ENTER, the end of the line.
54F6
If the Z FLAG is set (the end), JUMP to 5525H to pad with spaces.
54F8
CP 2CH FE 2C
Compare Register A against 2CH, a comma before the next parameter.
54FA
If the Z FLAG is set (the end), JUMP to 5525H to pad with spaces.
54FC
CP 22H FE 22
Compare Register A against 22H, the closing quote of the value.
54FE
If the Z FLAG is set (the end), JUMP to 5525H to pad with spaces.
5500
INC DE 13
INCrement Register Pair DE to the next character of the value.
5501
LD (HL),A 77
Store Register A (the character) at Register Pair HL.
5502
INC HL 23
INCrement Register Pair HL to the next place of the eight.
5503
DECrement Register B and LOOP BACK to 54F3H while places are left.
5505
JUMP to 552AH: eight characters were taken from the value.
5507
GOSUB to 5552H to test bit 5 of SFLAG$: the NZ FLAG while a JCL job runs.
550A
RET NZ C0
RETurn if the NZ FLAG is set: no prompt during a JCL job.
550B
GOSUB to 4467H (@DSPLY) to display the prompt at Register Pair HL, up to its 03H.
550E
LD B,08H 06 08
Load Register B with 08H, at most eight characters to type.
5510
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the place for the answer.
5513
PUSH HL E5
Save Register Pair HL (5800H) to the stack, for 552AH.
5514
GOSUB to the ROM at 0040H (@KEYIN) to read up to Register B characters into Register Pair HL: Register B = the count typed, the CARRY FLAG for BREAK.
5517
If the CARRY FLAG is set (BREAK), JUMP to 55DCH to display Purge aborted.
551A
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = 5800H.
551B
LD H,00H 26 00
Load Register H with 00H, the high byte of the count typed.
551D
LD L,B 68
Copy Register B (the characters typed) into Register L: Register Pair HL = their count.
551E
ADD HL,DE 19
ADD Register Pair DE (5800H) to Register Pair HL: the place after the characters typed.
551F
LD A,08H 3E 08
Load Register A with 08H, the eight places of the field.
5521
SUB B 90
SUBtract Register B (the characters typed) from Register A: the places left.
5522
If the Z FLAG is set (eight were typed), JUMP to 552AH.
5524
LD B,A 47
Copy Register A (the places left) into Register B.
5525
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL, a place not filled.
5527
INC HL 23
INCrement Register Pair HL to the next place of the eight.
5528
DECrement Register B and LOOP BACK to 5525H until the eight places are full.
552A
POP HL E1
Restore Register Pair HL from the stack: 5800H, the eight characters.
552B
PUSH HL E5
Save Register Pair HL (5800H) to the stack again.
552C
LD B,08H 06 08
Load Register B with 08H, the eight characters to look at.
552E
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
552F
CP 61H FE 61
Compare Register A against 61H, the letter a: the CARRY FLAG below it.
5531
If the CARRY FLAG is set (not a small letter), JUMP to 5539H.
5533
CP 7BH FE 7B
Compare Register A against 7BH: the NO CARRY FLAG above the letter z.
5535
If the NO CARRY FLAG is set (not a small letter), JUMP to 5539H.
5537
RES 5,(HL) CB AE
Clear bit 5 of the character at Register Pair HL: the small letter becomes a capital.
5539
INC HL 23
INCrement Register Pair HL to the next character of the eight.
553A
DECrement Register B and LOOP BACK to 552EH for the eight characters.
553C
POP DE D1
Restore Register Pair DE from the stack: 5800H, the eight characters.
553D
XOR A AF
Clear Register A (XOR A): the Z FLAG, the characters are ready.
553E
RET C9
RETurn with Register Pair DE = 5800H and the Z FLAG.

553FH - Helpers: The Allocation Table, the JCL Test, the Masks, a Record's Date

553FH reads sector 0 of the directory cylinder of drive Register C into 5900H (Register A = 14H on failure). 5552H returns the NZ FLAG while a JCL job runs. 5558H copies up to Register B characters of a partspec from Register Pair HL into a mask at Register Pair DE ($, letters and digits; small letters made capitals). 5577H packs a record's date from +01H (Register Pair HL) into Register Pair DE as year x 800H + month x 80H + day x 4: the year from +13H (bits 4-0, less 1980) on a drive whose bit in 475DH is set, else bits 2-0 of +02H.

553F
PUSH DE D5
Save Register Pair DE to the stack, for the caller.
5540
PUSH HL E5
Save Register Pair HL to the stack, for the caller.
5541
GOSUB to 4B65H (DIRCYL): Register D = the directory cylinder of drive Register C.
5544
LD E,00H 1E 00
Load Register E with 00H, sector 0: the granule allocation table.
5546
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, above the member, to receive the sector.
5549
GOSUB to 4B45H (RDSSEC) to read cylinder Register D, sector Register E of drive Register C into Register Pair HL: the Z FLAG on success.
554C
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
554D
POP DE D1
Restore Register Pair DE (as it was at the call) from the stack.
554E
RET Z C8
RETurn if the Z FLAG is set: the table is at 5900H.
554F
LD A,14H 3E 14
Load Register A with 14H, error 20 (GAT read error).
5551
RET C9
RETurn with the NZ FLAG and the error number in Register A.
5552
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5555
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5557
RET C9
RETurn with the NZ FLAG while a JCL job runs, the Z FLAG otherwise.
5558
CP 24H FE 24
Compare Register A (the character) against 24H, a dollar sign: any character.
555A
If the Z FLAG is set, JUMP to 5570H to put it into the mask.
555C
CP 41H FE 41
Compare Register A against 41H, the letter A: the NO CARRY FLAG from A up.
555E
If the NO CARRY FLAG is set (a letter or above), JUMP to 5566H.
5560
CP 3AH FE 3A
Compare Register A against 3AH: the NO CARRY FLAG for 3AH-40H.
5562
RET NC D0
RETurn if the NO CARRY FLAG is set: the character ends this part.
5563
CP 30H FE 30
Compare Register A against 30H, the digit 0: the CARRY FLAG below it.
5565
RET C D8
RETurn if the CARRY FLAG is set: the character ends this part (a slash, a colon is caught above).
5566
CP 61H FE 61
Compare Register A against 61H, the letter a: the CARRY FLAG below it.
5568
If the CARRY FLAG is set (a capital or a digit), JUMP to 5570H.
556A
CP 7BH FE 7B
Compare Register A against 7BH: the NO CARRY FLAG above the letter z.
556C
If the NO CARRY FLAG is set, JUMP to 5570H with the character as it is.
556E
RES 5,A CB AF
Clear bit 5 of Register A: the small letter becomes a capital.
5570
LD (DE),A 12
Store Register A (the character) at Register Pair DE in the mask.
5571
INC DE 13
INCrement Register Pair DE to the next place of the mask.
5572
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A.
5573
INC HL 23
INCrement Register Pair HL past the character just fetched.
5574
DECrement Register B and LOOP BACK to 5558H while places are left.
5576
RET C9
RETurn with Register A = the character after the part.
5577
LD A,(HL) 7E
Fetch +01H of the record at Register Pair HL into Register A: bits 3-0 the month.
5578
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): the month, 1-12.
557A
LD E,00H 1E 00
Load Register E with 00H, the low byte of the packed date.
557C
SRL A CB 3F
Shift Register A right (SRL): bit 0 of the month goes to the CARRY FLAG.
557E
RR E CB 1B
Rotate Register E right through the CARRY FLAG (RR): bit 0 of the month into bit 7 of Register E.
5580
LD D,A 57
Copy Register A (bits 3-1 of the month) into Register D.
5581
INC HL 23
INCrement Register Pair HL to +02H of the record.
5582
LD A,(HL) 7E
Fetch +02H at Register Pair HL into Register A: bits 7-3 the day.
5583
AND F8H E6 F8
Keep bits 7-3 of Register A (AND F8H): the day times 8.
5585
RRCA 0F
Rotate Register A right (RRCA): the day times 4, in bits 6-2.
5586
OR E B3
OR Register E (bit 0 of the month in bit 7) into Register A.
5587
LD E,A 5F
Copy Register A into Register E: the low byte of the packed date.
5588
LD A,(475DH) 3A 5D 47
Fetch 475DH into Register A: one bit for each drive whose records keep the full year at +13H.
558B
BIT 0,A CB 47
Test the bit of the drive in Register A: the second byte at 558CH is set by 5247H (47H in the file, bit 0).
558D
If the NZ FLAG is set (the full year is kept), JUMP to 5598H.
558F
LD A,(HL) 7E
Fetch +02H of the record at Register Pair HL into Register A.
5590
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the year less 1980, 0-7.
5592
RLCA 07
Rotate Register A left (RLCA): the year moves one bit up.
5593
RLCA 07
Rotate Register A left (RLCA): a second bit up.
5594
RLCA 07
Rotate Register A left (RLCA): the year is now in bits 7-3.
5595
OR D B2
OR Register D (bits 3-1 of the month) into Register A.
5596
LD D,A 57
Copy Register A into Register D: the high byte of the packed date.
5597
RET C9
RETurn with the packed date in Register Pair DE.
5598
LD A,L 7D
Copy Register L (the offset of +02H) into Register A.
5599
ADD A,11H C6 11
ADD 11H to Register A: the low byte of +13H of the record.
559B
LD L,A 6F
Copy Register A into Register L: Register Pair HL = +13H of the record.
559C
LD A,(HL) 7E
Fetch +13H of the record at Register Pair HL into Register A.
559D
AND 1FH E6 1F
Keep bits 4-0 of Register A (AND 1FH): the year less 1980, 0-31.
559F
JUMP to 5592H to put the year into the packed date.

55A1H - Read a Date M/D/Y

55A1H reads up to three fields of two digits separated by slashes (Register C = 2FH) into 5717H (the month), 5716H (the day) and 5715H (the year), returning the Z FLAG when all three were read. 55B6H reads two digits into Register A (Z), 55CCH one digit (CARRY for a digit).

55A1
LD DE,5717H 11 17 57
Point Register Pair DE to 5717H, where the first field (the month) goes.
55A4
LD B,03H 06 03
Load Register B with 03H, the three fields of a date.
55A6
PUSH DE D5
Save Register Pair DE (where this field goes) to the stack.
55A7
GOSUB to 55B6H to read two digits from Register Pair HL: Register A = their value with the Z FLAG.
55AA
POP DE D1
Restore Register Pair DE (where this field goes) from the stack.
55AB
RET NZ C0
RETurn if the NZ FLAG is set: the field is not two digits.
55AC
LD (DE),A 12
Store Register A (the field's value) at Register Pair DE.
55AD
DEC B 05
DECrement Register B, the fields still to read.
55AE
RET Z C8
RETurn if the Z FLAG is set: the three fields were read.
55AF
DEC DE 1B
DECrement Register Pair DE to the place of the next field.
55B0
LD A,(HL) 7E
Fetch the character after the field at Register Pair HL into Register A.
55B1
INC HL 23
INCrement Register Pair HL past the character after the field.
55B2
CP C B9
Compare Register A against Register C (2FH, a slash).
55B3
If the Z FLAG is set (a slash), LOOP BACK to 55A6H for the next field.
55B5
RET C9
RETurn with the NZ FLAG: the separator is not a slash.
55B6
GOSUB to 55CCH to take a digit at Register Pair HL: the CARRY FLAG for a digit.
55B9
If the NO CARRY FLAG is set (not a digit), JUMP to 55CAH to return the NZ FLAG.
55BB
LD E,A 5F
Copy Register A (the tens digit) into Register E.
55BC
RLCA 07
Rotate Register A left (RLCA): twice the digit.
55BD
RLCA 07
Rotate Register A left (RLCA): four times the digit.
55BE
ADD A,E 83
ADD Register E to Register A: five times the digit.
55BF
RLCA 07
Rotate Register A left (RLCA): ten times the digit.
55C0
LD E,A 5F
Copy Register A (ten times the tens) into Register E.
55C1
GOSUB to 55CCH to take the units digit at Register Pair HL: the CARRY FLAG for a digit.
55C4
If the NO CARRY FLAG is set (not a digit), JUMP to 55CAH to return the NZ FLAG.
55C6
ADD A,E 83
ADD Register E (the tens) to Register A (the units): the value of the field.
55C7
LD E,A 5F
Copy Register A (the value of the field) into Register E.
55C8
CP A BF
Compare Register A with itself (CP A): the Z FLAG, a good field.
55C9
RET C9
RETurn with the value in Register A and the Z FLAG.
55CA
OR A B7
Set the flags from Register A (OR A): the character less 30H is never 00H here, so the NZ FLAG.
55CB
RET C9
RETurn with the NZ FLAG: the field is not two digits.
55CC
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
55CD
INC HL 23
INCrement Register Pair HL past the character just fetched.
55CE
SUB 30H D6 30
SUBtract 30H from Register A: the value of a digit (a borrow wraps a character below 30H to a high value).
55D0
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG for a digit (0-9).
55D2
RET C9
RETurn with the value in Register A and the CARRY FLAG set for a digit.

55D3H - Errors and Messages

55D3H reports error 2CH and 55D5H the error in Register A through @ERROR. 55DCH-55EBH is a chain of LD IX instructions: each entry after the first is the LD HL hidden after the DDH prefix, so a jump into the chain picks one message for @LOGOT. All end the command with Register Pair HL = FFFFH.

55D3
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error).
55D5
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.
55D7
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
55DA
JUMP to 55EEH to end the command with Register Pair HL = FFFFH.
55DC
LD HL,5642H 21 42 56
Point Register Pair HL to 5642H, the message Purge aborted (after a line feed).
55DF
LD IX,5690H DD 21 90 56
Load Index Register IX with 5690H: no use when run from above. Entered at 55E0H (from 54D7H) the bytes 21H 90H 56H are LD HL,5690H: Invalid master password.
55E3
LD IX,5651H DD 21 51 56
Load Index Register IX with 5651H: no use when run from above. Entered at 55E4H (from 52A2H) the bytes 21H 51H 56H are LD HL,5651H: Invalid command during DO processing.
55E7
LD IX,56B4H DD 21 B4 56
Load Index Register IX with 56B4H: no use when run from above. Entered at 55E8H (from 55FAH, 5613H and 5620H) the bytes 21H B4H 56H are LD HL,56B4H: Bad date format.
55EB
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
55EE
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
55F1
JUMP to 52DDH to put the stack back and end the command.

55F4H - Read and Pack a Date

Reads M/D/Y from Register Pair HL: the month must be 1-12 and the day within the month (29 days in February of a leap year; the table's February is counted up for every leap year date read, so a second one allows 30). Years 00-11 count as 2000-2011. Returns Register Pair BC = (year less 1980) x 800H + month x 80H + day x 4 and Register Pair HL after the date; a bad date ends the command with Bad date format.

55F4
LD A,(HL) 7E
Fetch the first character of the date at Register Pair HL into Register A (55CCH fetches it again).
55F5
LD C,2FH 0E 2F
Load Register C with 2FH, the slash between the fields.
55F7
GOSUB to 55A1H to read the month, the day and the year into 5717H, 5716H and 5715H: the Z FLAG on success, Register Pair DE = 5715H.
55FA
If the NZ FLAG is set (bad), JUMP to 55E8H for Bad date format.
55FC
LD A,(DE) 1A
Fetch the year from Register Pair DE (5715H) into Register A.
55FD
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG for a year 12-99.
55FF
If the NO CARRY FLAG is set (a year 12-99), JUMP to 5604H.
5601
ADD A,64H C6 64
ADD 64H (100) to Register A: years 00-11 become 100-111.
5603
LD (DE),A 12
Store Register A (the year) at Register Pair DE (5715H).
5604
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the place after the date in the text.
5605
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the Z FLAG for a leap year (80 and 100 are multiples of 4).
5607
LD HL,56A9H 21 A9 56
Point Register Pair HL to 56A9H, the days of February. LD does not change the flags.
560A
If the NZ FLAG is set (not a leap year), JUMP to 560DH.
560C
INC (HL) 34
INCrement the days of February at Register Pair HL (56A9H).
560D
LD A,(5717H) 3A 17 57
Fetch the month (the first field) from 5717H into Register A.
5610
DEC A 3D
DECrement Register A: the month less one (month 0 wraps to FFH).
5611
CP 0CH FE 0C
Compare Register A against 0CH: the NO CARRY FLAG for a month that is not 1-12.
5613
If the NO CARRY FLAG is set (a bad month), JUMP to 55E8H for Bad date format.
5615
DEC HL 2B
DECrement Register Pair HL to 56A8H, the days of January.
5616
ADD A,L 85
ADD Register L to Register A: the low byte of the month's entry.
5617
LD L,A 6F
Copy Register A (the low byte of the entry) into Register L.
5618
If the NO CARRY FLAG is set (no carry), JUMP to 561BH.
561A
INC H 24
INCrement Register H: the carry into the high byte.
561B
LD A,(5716H) 3A 16 57
Fetch the day (the second field) from 5716H into Register A.
561E
DEC A 3D
DECrement Register A: the day less one (day 0 wraps to FFH).
561F
CP (HL) BE
Compare Register A against the month's days at Register Pair HL: the NO CARRY FLAG for a day the month does not have.
5620
If the NO CARRY FLAG is set (a bad day), JUMP to 55E8H for Bad date format.
5622
LD HL,5717H 21 17 57
Point Register Pair HL to 5717H, the month of the date.
5625
LD B,(HL) 46
Fetch the month at Register Pair HL into Register B.
5626
LD C,00H 0E 00
Load Register C with 00H, the low byte of the packed date.
5628
SRL B CB 38
Shift Register B right (SRL): bit 0 of the month goes to the CARRY FLAG.
562A
RR C CB 19
Rotate Register C right through the CARRY FLAG (RR): bit 0 of the month into bit 7 of Register C.
562C
DEC HL 2B
DECrement Register Pair HL to 5716H, the day.
562D
LD A,(HL) 7E
Fetch the day at Register Pair HL into Register A.
562E
DEC HL 2B
DECrement Register Pair HL to 5715H, the year.
562F
RLCA 07
Rotate Register A left (RLCA): twice the day.
5630
RLCA 07
Rotate Register A left (RLCA): four times the day, in bits 6-2.
5631
OR C B1
OR Register C (bit 0 of the month in bit 7) into Register A.
5632
LD C,A 4F
Copy Register A into Register C: the low byte of the packed date.
5633
LD A,(HL) 7E
Fetch the year at Register Pair HL (5715H) into Register A.
5634
SUB 50H D6 50
SUBtract 50H (80) from Register A: the year less 1980.
5636
CP 70H FE 70
Compare Register A against 70H: the CARRY FLAG for 0-6FH.
5638
If the CARRY FLAG is set (a year 1980-2011), JUMP to 563BH.
563A
XOR A AF
Clear Register A (XOR A): a year 12-79 (which wrapped) counts as 1980.
563B
RLCA 07
Rotate Register A left (RLCA): the year moves one bit up.
563C
RLCA 07
Rotate Register A left (RLCA): a second bit up.
563D
RLCA 07
Rotate Register A left (RLCA): the year is now in bits 7-3.
563E
OR B B0
OR Register B (bits 3-1 of the month) into Register A.
563F
LD B,A 47
Copy Register A into Register B: the high byte of the packed date.
5640
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the place after the date.
5641
RET C9
RETurn with the packed date in Register Pair BC.

5642H - PURGE Data: Messages, the Month Table, the Masks and the Parameter Table

The messages (Purge aborted after a line feed), the prompt and the question texts, the days of the months, the month names, the masks of the partspec, the flags of the dates; 5711H-5733H are a work area not in the file; then the parameter table.

5642
DEFB 0AH 0A
0AH, a line feed: Purge aborted starts on a line of its own.
5643-564F
DEFM "Purge aborted" 50 75 72 67 65 20 61 62 6F 72 74 65 64
The message of 55DCH: BREAK was pressed during the purge.
5650
DEFB 0DH 0D
0DH, the end of the message Purge aborted, displayed with it.
5651-5676
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 55E4H: questions cannot be asked during a JCL job.
5677
DEFB 0DH 0D
0DH, the end of the message Invalid command during DO processing.
5678-568E
DEFM "Master password ? " 4D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20 20 20 20 20 20
The prompt of 54C1H for the diskette's master password.
568F
DEFB 03H 03
03H, the end of the prompt: the answer is typed on the same line.
5690-56A6
DEFM "Invalid master password" 49 6E 76 61 6C 69 64 20 6D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64
The message of 55E0H: the password given is neither the diskette's nor the override.
56A7
DEFB 0DH 0D
0DH, the end of the message Invalid master password, displayed with it.
56A8
DEFB 1FH 1F
1FH, 31 days in January, for the day check of 561FH.
56A9
DEFB 1CH 1C
1CH, 28 days in February; 560CH counts it up for each leap year date read.
56AA-56B3
DEFB 1FH, 1EH, 1FH, 1EH, 1FH, 1FH, 1EH, 1FH, 1EH, 1FH 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
The days of March to December: 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.
56B4-56C2
DEFM "Bad date format" 42 61 64 20 64 61 74 65 20 66 6F 72 6D 61 74
The message of 55E8H: a date of DATE could not be read or is out of range.
56C3
DEFB 0DH 0D
0DH, the end of the message Bad date format, displayed with it.
56C4-56CF
DEFM "Purge file: " 50 75 72 67 65 20 66 69 6C 65 3A 20
The question of 53C7H; the line of the file follows.
56D0
DEFB 03H 03
03H, the end of the text Purge file: the line goes on.
56D1-56D5
DEFM "} ? " 7D 20 3F 20 20
The closing brace after the date and the question mark of 5453H.
56D6
DEFB 03H 03
03H, the end of the text: the answer is typed on the same line.
56D7-56DF
DEFM "Purging: " 50 75 72 67 69 6E 67 3A 20
The text of 5475H; the name of the file follows.
56E0
DEFB 03H 03
03H, the end of the text Purging: the line goes on.
56E1-5704
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 three letter names of the months for the line of a file (5410H).
5705-570C
DEFM " " 20 20 20 20 20 20 20 20
The mask of the name, eight spaces in the file (a space matches anything), filled by 5220H.
570D-570F
DEFM " " 20 20 20
The mask of the extension, three spaces in the file, filled by 522EH.
5710
DEFB 00H 00
The flags of the dates: bit 7 a lowest date at 5711H, bit 0 a highest date at 5713H (5271H, 5292H).
5711-5733
DEFS 35
Not in the file: 5711H-5712H the lowest date, 5713H-5714H the highest date, 5715H-5717H the year, day and month read (and 5715H the answer to the question), 5719H on the line of the file.
5734-5739
DEFM "I " 49 20 20 20 20 20
Parameter table entry 1: the keyword I, short for INV.
573A-573B
DEFW 5327H 27 53
Entry 1: 5327H, the operand of the LD DE at 5326H, where I is stored.
573C-5741
DEFM "INV " 49 4E 56 20 20 20
Parameter table entry 2: the keyword INV, invisible files too.
5742-5743
DEFW 5327H 27 53
Entry 2: 5327H, the operand of the LD DE at 5326H, where INV is stored.
5744-5749
DEFM "S " 53 20 20 20 20 20
Parameter table entry 3: the keyword S, short for SYS.
574A-574B
DEFW 5319H 19 53
Entry 3: 5319H, the operand of the LD DE at 5318H, where S is stored.
574C-5751
DEFM "SYS " 53 59 53 20 20 20
Parameter table entry 4: the keyword SYS, system files too.
5752-5753
DEFW 5319H 19 53
Entry 4: 5319H, the operand of the LD DE at 5318H, where SYS is stored.
5754-5759
DEFM "MPW " 4D 50 57 20 20 20
Parameter table entry 5: the keyword MPW, the master password of the diskette.
575A-575B
DEFW 54BFH BF 54
Entry 5: 54BFH, the operand of the LD DE at 54BEH, where MPW is stored.
575C-5761
DEFM "QUERY " 51 55 45 52 59 20
Parameter table entry 6: the keyword QUERY, ask about each file (on unless QUERY=N).
5762-5763
DEFW 53C0H C0 53
Entry 6: 53C0H, the operand of the LD DE at 53BFH, where QUERY is stored.
5764-5769
DEFM "Q " 51 20 20 20 20 20
Parameter table entry 7: the keyword Q, short for QUERY.
576A-576B
DEFW 53C0H C0 53
Entry 7: 53C0H, the operand of the LD DE at 53BFH, where Q is stored.
576C-5771
DEFM "DATE " 44 41 54 45 20 20
Parameter table entry 8: the keyword DATE, the range of dates.
5772-5773
DEFW 5264H 64 52
Entry 8: 5264H, the operand of the LD HL at 5263H, where DATE is stored.
5774-5779
DEFM "D " 44 20 20 20 20 20
Parameter table entry 9: the keyword D, short for DATE.
577A-577B
DEFW 5264H 64 52
Entry 9: 5264H, the operand of the LD HL at 5263H, where D is stored.
577C
DEFB 00H 00
00H, the end of the parameter table of PURGE, the last byte of the member.

5200H - Member 12 (FORMS): Entry and the Exit

The FORMS command (library member B1H), loaded at 5200H-5525H. It shows and changes the settings of the printer filter PR/FLT, which must be in memory as the module $FF (else Forms Filter not Resident). Ten bytes are worked on in a copy at 552BH (above the member, Index Register IY): three from the printer's device control block (+03H the page length, +04H the line count, +05H the lines to print) and seven from the filter's own block (the column, XLATE from and to, INDENT, the flags of ADDLF, FFHARD, TAB and SLINE, CHARS, MARGIN). FORMS alone shows them; FORMS (parameters) changes them, writes them back and shows them.

5200
LD (520BH),SP ED 73 0B 52
Store the Stack Pointer at 520BH, the operand of the LD SP at 520AH: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
GOSUB to 522DH to do the work: it returns (or its display's RET returns) here when the command was carried out.
5207
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
520A
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 520BH-520CH (0000H in the file, stored by 5200H). 522BH comes here with Register Pair HL = FFFFH.
520D
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
520E
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
520F
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.
5210
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5213
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5215
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5216
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.
5219
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error).
521B
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.
521D
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5220
JUMP to 5228H to end the command with Register Pair HL = FFFFH.
5222
LD HL,548AH 21 8A 54
Point Register Pair HL to 548AH, the message Forms Filter not Resident.
5225
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
5228
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
522B
JUMP to 520AH to put the stack back and end the command.

522DH - Find the Filter and Copy Its Settings

Request BCH finds the module $FF and returns Register Pair DE at its +08H, right after its name (the filter's own device control block). The word at +10H-+11H is the address of the printer's device control block: its +03H-+05H are copied to 552BH-552DH, the module's +12H-+18H to 552EH-5534H. The two addresses are noted in the operands at 52E7H and 52EFH for the write back.

522D
PUSH HL E5
Save Register Pair HL (the text after FORMS) to the stack.
522E
LD DE,5480H 11 80 54
Point Register Pair DE to 5480H, the name $FF ended by 03H.
5231
GOSUB to 53B8H to look the module up through request BCH: the Z FLAG when found, with Register Pair DE = the module +08H.
5234
If the NZ FLAG is set (no PR/FLT), JUMP to 5222H to display Forms Filter not Resident.
5236
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the module +08H.
5237
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the distance to the module +10H.
523A
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the module +10H.
523B
LD E,(HL) 5E
Fetch the low byte of the word at the module +10H (Register Pair HL) into Register E.
523C
INC HL 23
INCrement Register Pair HL to the module +11H.
523D
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the printer's device control block.
523E
INC HL 23
INCrement Register Pair HL to the module +12H, the filter's seven settings.
523F
PUSH HL E5
Save Register Pair HL (the module +12H) to the stack.
5240
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the printer's device control block.
5241
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC = 0003H (Register B is 00H).
5243
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: +03H of the device control block, the page length.
5244
LD (52E7H),HL 22 E7 52
Store Register Pair HL at 52E7H, the operand of the LD DE at 52E6H, for the write back.
5247
LD DE,552BH 11 2B 55
Point Register Pair DE to 552BH, the work copy, above the member.
524A
PUSH DE D5
Save Register Pair DE (552BH, the work copy) to the stack.
524B
POP IY FD E1
Restore it into Index Register IY: Index Register IY = 552BH, the work copy.
524D
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC = 0003H, three bytes.
524F
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the device control block +03H-+05H to 552BH-552DH (Index Register IY +00H-+02H).
5251
POP HL E1
Restore Register Pair HL from the stack: the module +12H.
5252
LD (52EFH),HL 22 EF 52
Store Register Pair HL at 52EFH, the operand of the LD DE at 52EEH, for the write back.
5255
LD C,07H 0E 07
Load Register C with 07H: Register Pair BC = 0007H, seven bytes.
5257
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the module +12H-+18H to 552EH-5534H (Index Register IY +03H-+09H).
5259
POP HL E1
Restore Register Pair HL from the stack: the text after FORMS.
525A
LD A,(HL) 7E
Fetch the first character of the text at Register Pair HL into Register A.
525B
CP 0EH FE 0E
Compare Register A against 0EH: the CARRY FLAG for 0DH or 03H, no parameters.
525D
If the NO CARRY FLAG is set (parameters follow), JUMP to 5262H.
525F
JUMP to 52F8H to show the settings; its RET returns to 5207H.

5262H - The Parameters

@PARAM stores each value at the cell the table names (545CH-546DH). DEFAULT copies the factory values (LINES not given, PAGE 66, the others 0) over the cells first. The cells then go into the work copy: CHARS, MARGIN, INDENT, the flags (TAB, FFHARD, ADDLF from the cells; SLINE, bit 3, kept), XLATE (from in the high byte, to in the low byte), PAGE + 1 at +00H, 1 at +01H, 0 for the column, LINES + 1 (or PAGE + 1 when LINES was not given) at +02H; without SLINE the three page values lose the 1 again.

5262
LD DE,53BBH 11 BB 53
Point Register Pair DE to 53BBH, the parameter table of FORMS.
5265
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE. The NZ FLAG for a bad parameter.
5268
If the NZ FLAG is set (a bad parameter), JUMP to 5219H to report error 2CH.
526B
LD BC,0000H 01 00 00
Load Register Pair BC with the DEFAULT parameter, the operand at 526CH-526DH: 0000H in the file, FFFFH for DEFAULT.
526E
LD A,B 78
Copy Register B (the high byte of DEFAULT) into Register A.
526F
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG when DEFAULT was not given.
5270
If the Z FLAG is set (no DEFAULT), JUMP to 527DH.
5272
LD HL,546EH 21 6E 54
Point Register Pair HL to 546EH, the factory values.
5275
LD DE,545CH 11 5C 54
Point Register Pair DE to 545CH, the cells of the parameters.
5278
LD BC,0014H 01 14 00
Load Register Pair BC with 0014H, the 20 bytes of the factory values.
527B
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the factory values over the cells (the last two bytes copied, 5480H-5481H, land on 546EH-546FH, after the cells).
527D
LD A,(5460H) 3A 60 54
Fetch the low byte of CHARS from 5460H into Register A.
5280
LD (IY+08H),A FD 77 08
Store Register A (CHARS) at Index Register IY +08H in the work copy.
5283
LD A,(546CH) 3A 6C 54
Fetch the low byte of MARGIN from 546CH into Register A.
5286
LD (IY+09H),A FD 77 09
Store Register A (MARGIN) at Index Register IY +09H in the work copy.
5289
LD A,(5462H) 3A 62 54
Fetch the low byte of INDENT from 5462H into Register A.
528C
LD (IY+06H),A FD 77 06
Store Register A (INDENT) at Index Register IY +06H in the work copy.
528F
XOR A AF
Clear Register A (XOR A): the new flags, built bit by bit.
5290
BIT 3,(IY+07H) FD CB 07 5E
Test bit 3 of the flags at Index Register IY +07H: SLINE.
5294
If the Z FLAG is set (SLINE off), JUMP to 5297H with Register A = 00H.
5296
INC A 3C
INCrement Register A: 01H, SLINE on, kept in the flags.
5297
LD HL,(5468H) 2A 68 54
Fetch the TAB cell from 5468H-5469H into Register Pair HL: FFFFH for TAB=ON, else 0000H.
529A
RLC L CB 05
Rotate Register L left (RLC): its bit 7 goes to the CARRY FLAG.
529C
RLA 17
Rotate Register A left through the CARRY FLAG (RLA): the TAB bit comes in at bit 0.
529D
LD HL,(5466H) 2A 66 54
Fetch the FFHARD cell from 5466H-5467H into Register Pair HL.
52A0
RLC L CB 05
Rotate Register L left (RLC): its bit 7 goes to the CARRY FLAG.
52A2
RLA 17
Rotate Register A left through the CARRY FLAG (RLA): the FFHARD bit comes in at bit 0.
52A3
LD HL,(5464H) 2A 64 54
Fetch the ADDLF cell from 5464H-5465H into Register Pair HL.
52A6
RLC L CB 05
Rotate Register L left (RLC): its bit 7 goes to the CARRY FLAG.
52A8
RLA 17
Rotate Register A left through the CARRY FLAG (RLA): Register A = SLINE x 8 + TAB x 4 + FFHARD x 2 + ADDLF.
52A9
LD (IY+07H),A FD 77 07
Store Register A (the flags) at Index Register IY +07H in the work copy.
52AC
LD HL,(546AH) 2A 6A 54
Fetch the XLATE cell from 546AH-546BH into Register Pair HL: Register H the character translated, Register L what it becomes.
52AF
LD (IY+04H),H FD 74 04
Store Register H (XLATE from) at Index Register IY +04H in the work copy.
52B2
LD (IY+05H),L FD 75 05
Store Register L (XLATE to) at Index Register IY +05H in the work copy.
52B5
LD A,(545EH) 3A 5E 54
Fetch the low byte of PAGE from 545EH into Register A.
52B8
INC A 3C
INCrement Register A: the page length plus one.
52B9
LD (IY+00H),A FD 77 00
Store Register A at Index Register IY +00H, the page length of the device control block.
52BC
LD (IY+01H),01H FD 36 01 01
Store 01H at Index Register IY +01H, the line count: the first line of a page.
52C0
LD (IY+03H),00H FD 36 03 00
Store 00H at Index Register IY +03H, the column: no character printed on the line.
52C4
LD A,(545CH) 3A 5C 54
Fetch the low byte of LINES from 545CH into Register A: FFH when LINES was not given.
52C7
INC A 3C
INCrement Register A: the lines plus one, 00H when not given.
52C8
AND A A7
Set the flags from Register A (AND A): the Z FLAG when LINES was not given.
52C9
If the NZ FLAG is set (LINES given), JUMP to 52CEH.
52CB
LD A,(IY+00H) FD 7E 00
Fetch the page length plus one from Index Register IY +00H into Register A: the lines are the page.
52CE
LD (IY+02H),A FD 77 02
Store Register A at Index Register IY +02H, the lines to print on a page.
52D1
BIT 3,(IY+07H) FD CB 07 5E
Test bit 3 of the flags at Index Register IY +07H: SLINE.
52D5
If the NZ FLAG is set (SLINE on), JUMP to 52E0H: the values keep the plus one.
52D7
DEC (IY+00H) FD 35 00
DECrement the page length at Index Register IY +00H.
52DA
DEC (IY+01H) FD 35 01
DECrement the line count at Index Register IY +01H.
52DD
DEC (IY+02H) FD 35 02
DECrement the lines to print at Index Register IY +02H.
52E0
GOSUB to 52F8H to show the new settings before they are written back.
52E3
LD HL,552BH 21 2B 55
Point Register Pair HL to 552BH, the work copy.
52E6
LD DE,0000H 11 00 00
Load Register Pair DE with the printer's device control block +03H, the operand at 52E7H-52E8H (0000H in the file) stored by 5244H.
52E9
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, three bytes.
52EC
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 552BH-552DH back to the device control block +03H-+05H.
52EE
LD DE,0000H 11 00 00
Load Register Pair DE with the module +12H, the operand at 52EFH-52F0H (0000H in the file) stored by 5252H.
52F1
LD C,07H 0E 07
Load Register C with 07H: Register Pair BC = 0007H, seven bytes.
52F3
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: 552EH-5534H back to the module +12H-+18H.
52F5
JUMP to 5207H to end the command with Register Pair HL = 0000H.

52F8H - Show the Settings

The template at 54A4H is filled from the work copy: ON over OFF for ADDLF, FFHARD and TAB; CHARS (or OFF), INDENT, LINES, MARGIN and PAGE as numbers (without the plus one when SLINE is on); and, when a translation is set (XLATE from and to differ), the two characters in hexadecimal on an extra line (the 0DH at 550CH becomes a line feed). The template is displayed as one text, its lines separated by line feeds.

52F8
BIT 0,(IY+07H) FD CB 07 46
Test bit 0 of the flags at Index Register IY +07H: ADDLF.
52FC
LD DE,54EEH 11 EE 54
Point Register Pair DE to 54EEH, the OFF of Addlf in the template. LD does not change the flags.
52FF
If the NZ FLAG is set (ADDLF on), GOSUB to 537BH to put ON there.
5302
LD A,(IY+08H) FD 7E 08
Fetch CHARS from Index Register IY +08H into Register A.
5305
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 0, no limit.
5306
LD DE,54C7H 11 C7 54
Point Register Pair DE to 54C7H, the OFF of Chars in the template. LD does not change the flags.
5309
If the NZ FLAG is set (a limit), GOSUB to 5384H to write Register A in three places at Register Pair DE (the flags are kept).
530C
If the NZ FLAG is set (the number was written), JUMP to 5314H.
530E
LD HL,5487H 21 87 54
Point Register Pair HL to 5487H, the text OFF.
5311
GOSUB to 537EH to copy OFF from Register Pair HL to Register Pair DE.
5314
BIT 1,(IY+07H) FD CB 07 4E
Test bit 1 of the flags at Index Register IY +07H: FFHARD.
5318
LD DE,54FBH 11 FB 54
Point Register Pair DE to 54FBH, the OFF of Ffhard in the template. LD does not change the flags.
531B
If the NZ FLAG is set (FFHARD on), GOSUB to 537BH to put ON there.
531E
LD A,(IY+06H) FD 7E 06
Fetch INDENT from Index Register IY +06H into Register A.
5321
LD DE,54E1H 11 E1 54
Point Register Pair DE to 54E1H, the number of Indent in the template.
5324
GOSUB to 5384H to write Register A in three places at Register Pair DE.
5327
LD A,(IY+02H) FD 7E 02
Fetch the lines to print from Index Register IY +02H into Register A.
532A
BIT 3,(IY+07H) FD CB 07 5E
Test bit 3 of the flags at Index Register IY +07H: SLINE.
532E
If the Z FLAG is set (SLINE off), JUMP to 5331H.
5330
DEC A 3D
DECrement Register A: the plus one is not shown.
5331
LD DE,54BAH 11 BA 54
Point Register Pair DE to 54BAH, the number of Lines in the template.
5334
GOSUB to 5384H to write Register A in three places at Register Pair DE.
5337
LD A,(IY+09H) FD 7E 09
Fetch MARGIN from Index Register IY +09H into Register A.
533A
LD DE,54D4H 11 D4 54
Point Register Pair DE to 54D4H, the number of Margin in the template.
533D
GOSUB to 5384H to write Register A in three places at Register Pair DE.
5340
LD A,(IY+00H) FD 7E 00
Fetch the page length from Index Register IY +00H into Register A.
5343
BIT 3,(IY+07H) FD CB 07 5E
Test bit 3 of the flags at Index Register IY +07H: SLINE.
5347
If the Z FLAG is set (SLINE off), JUMP to 534AH.
5349
DEC A 3D
DECrement Register A: the plus one is not shown.
534A
LD DE,54ADH 11 AD 54
Point Register Pair DE to 54ADH, the number of Page in the template.
534D
GOSUB to 5384H to write Register A in three places at Register Pair DE.
5350
BIT 2,(IY+07H) FD CB 07 56
Test bit 2 of the flags at Index Register IY +07H: TAB.
5354
LD DE,5508H 11 08 55
Point Register Pair DE to 5508H, the OFF of Tab in the template. LD does not change the flags.
5357
If the NZ FLAG is set (TAB on), GOSUB to 537BH to put ON there.
535A
LD A,(IY+04H) FD 7E 04
Fetch XLATE from at Index Register IY +04H into Register A.
535D
LD B,(IY+05H) FD 46 05
Fetch XLATE to at Index Register IY +05H into Register B.
5360
CP B B8
Compare Register A against Register B: the Z FLAG when nothing is translated.
5361
If the Z FLAG is set, JUMP to 5375H to display the template without the Xlate line.
5363
LD HL,550CH 21 0C 55
Point Register Pair HL to 550CH, the 0DH after the Tab line.
5366
LD (HL),0AH 36 0A
Store 0AH, a line feed, at Register Pair HL: the Xlate line is displayed too.
5368
LD HL,5518H 21 18 55
Point Register Pair HL to 5518H, the first X'00' of the Xlate line.
536B
GOSUB to 4D7BH (SYS0/SYS) to write Register A (XLATE from) as two hexadecimal digits at Register Pair HL.
536E
LD A,B 78
Copy Register B (XLATE to, the new character) into Register A.
536F
LD HL,5521H 21 21 55
Point Register Pair HL to 5521H, the second X'00' of the Xlate line.
5372
GOSUB to 4D7BH to write Register A (XLATE to) as two hexadecimal digits at Register Pair HL.
5375
LD HL,54A4H 21 A4 54
Point Register Pair HL to 54A4H, the template of the settings.
5378
JUMP to 4467H (@DSPLY) to display the template at Register Pair HL up to its 0DH; its RET returns to the caller.

537BH - Helpers: ON, Numbers, the Lookup

537BH copies ON (5484H) and 537EH the three bytes at Register Pair HL to Register Pair DE. 5384H writes Register A as three right justified decimal places at Register Pair DE (through the five places at 5526H, 539FH), keeping Register Pairs AF, BC and HL. 53B8H looks a module up by its name at Register Pair DE through request BCH.

537B
LD HL,5484H 21 84 54
Point Register Pair HL to 5484H, the text ON (with a space in front).
537E
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three characters.
5381
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the three characters into the template.
5383
RET C9
RETurn to the caller with the text copied into the template.
5384
PUSH BC C5
Save Register Pair BC to the stack, for the caller.
5385
PUSH HL E5
Save Register Pair HL to the stack, for the caller.
5386
PUSH AF F5
Save Register Pair AF (the number and the flags) to the stack.
5387
PUSH DE D5
Save Register Pair DE (where the number goes) to the stack.
5388
LD DE,5526H 11 26 55
Point Register Pair DE to 5526H, five places of scratch just above the member.
538B
LD H,00H 26 00
Load Register H with 00H, the high byte of the number.
538D
LD L,A 6F
Copy Register A (the number) into Register L: Register Pair HL = the number.
538E
GOSUB to 539FH to write Register Pair HL in decimal, right justified, in the five places 5526H-552AH.
5391
DEC DE 1B
DECrement Register Pair DE (after the five places) to 552AH.
5392
DEC DE 1B
DECrement Register Pair DE to 5529H, on the way to the last three places.
5393
DEC DE 1B
DECrement Register Pair DE to 5528H, the last three places.
5394
POP HL E1
Restore Register Pair HL from the stack: where the number goes.
5395
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 5528H, Register Pair DE = the place in the template.
5396
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, three places.
5399
LDIR ED B0
Copy (DE) = (HL) for Register Pair BC bytes, HL and DE counting up: the last three places into the template.
539B
POP AF F1
Restore Register Pair AF (the number and the flags) from the stack.
539C
POP HL E1
Restore Register Pair HL (as it was at the call) from the stack.
539D
POP BC C1
Restore Register Pair BC (as it was at the call) from the stack.
539E
RET C9
RETurn with Register Pairs AF, BC and HL as they were.
539F
LD B,05H 06 05
Load Register B with 05H, the count of the five places to fill.
53A1
LD A,20H 3E 20
Load Register A with 20H, a space for the places.
53A3
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
53A4
INC DE 13
INCrement Register Pair DE to the next place.
53A5
DECrement Register B and LOOP BACK to 53A3H until the five places are spaces.
53A7
PUSH DE D5
Save Register Pair DE (the address after the five places) to the stack.
53A8
DEC DE 1B
DECrement Register Pair DE to the last of the five places.
53A9
LD A,0AH 3E 0A
Load Register A with 0AH (10), the divisor for the next digit.
53AB
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A: the quotient in Register Pair HL, the remainder (the next digit from the right) in Register A.
53AE
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit.
53B0
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
53B1
DEC DE 1B
DECrement Register Pair DE to the place on the left.
53B2
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
53B3
OR L B5
OR Register L into Register A: the Z FLAG when the quotient is 0.
53B4
If the NZ FLAG is set (more digits), LOOP BACK to 53A9H.
53B6
POP DE D1
Restore Register Pair DE (the address after the five places) from the stack.
53B7
RET C9
RETurn with Register Pair DE after the five places.
53B8
LD A,BCH 3E BC
Load Register A with BCH, the request code that looks a module up by its name.
53BA
RST 28H EF
Issue the request in Register A through RST 28H: SYS10/SYS finds the module named at Register Pair DE (the Z FLAG, Register Pair HL = the module, Register Pair DE = the byte after its name) and its RET goes back to 5234H (the dispatcher drops this return address).

53BBH - FORMS Data: The Parameter Table, the Cells, the Factory Values and the Texts

The parameter table (each keyword of six characters and the address of its cell), the cells @PARAM fills, the factory values that DEFAULT copies over them, the module name $FF, ON and OFF, the message, and the template of the display, whose lines end with line feeds.

53BB-53C0
DEFM "LINES " 4C 49 4E 45 53 20
Parameter table entry 1: the keyword LINES, the lines printed on a page.
53C1-53C2
DEFW 545CH 5C 54
Entry 1: 545CH, the cell at 545CH-545DH, where @PARAM stores the value of LINES.
53C3-53C8
DEFM "L " 4C 20 20 20 20 20
Parameter table entry 2: the keyword L, short for LINES.
53C9-53CA
DEFW 545CH 5C 54
Entry 2: 545CH, the cell at 545CH-545DH, where @PARAM stores the value of L.
53CB-53D0
DEFM "PAGE " 50 41 47 45 20 20
Parameter table entry 3: the keyword PAGE, the length of a page in lines.
53D1-53D2
DEFW 545EH 5E 54
Entry 3: 545EH, the cell at 545EH-545FH, where @PARAM stores the value of PAGE.
53D3-53D8
DEFM "P " 50 20 20 20 20 20
Parameter table entry 4: the keyword P, short for PAGE.
53D9-53DA
DEFW 545EH 5E 54
Entry 4: 545EH, the cell at 545EH-545FH, where @PARAM stores the value of P.
53DB-53E0
DEFM "CHARS " 43 48 41 52 53 20
Parameter table entry 5: the keyword CHARS, the characters on a line.
53E1-53E2
DEFW 5460H 60 54
Entry 5: 5460H, the cell at 5460H-5461H, where @PARAM stores the value of CHARS.
53E3-53E8
DEFM "C " 43 20 20 20 20 20
Parameter table entry 6: the keyword C, short for CHARS.
53E9-53EA
DEFW 5460H 60 54
Entry 6: 5460H, the cell at 5460H-5461H, where @PARAM stores the value of C.
53EB-53F0
DEFM "INDENT" 49 4E 44 45 4E 54
Parameter table entry 7: the keyword INDENT, the indent after a line is wrapped.
53F1-53F2
DEFW 5462H 62 54
Entry 7: 5462H, the cell at 5462H-5463H, where @PARAM stores the value of INDENT.
53F3-53F8
DEFM "I " 49 20 20 20 20 20
Parameter table entry 8: the keyword I, short for INDENT.
53F9-53FA
DEFW 5462H 62 54
Entry 8: 5462H, the cell at 5462H-5463H, where @PARAM stores the value of I.
53FB-5400
DEFM "ADDLF " 41 44 44 4C 46 20
Parameter table entry 9: the keyword ADDLF, a line feed after each carriage return.
5401-5402
DEFW 5464H 64 54
Entry 9: 5464H, the cell at 5464H-5465H, where @PARAM stores the value of ADDLF.
5403-5408
DEFM "A " 41 20 20 20 20 20
Parameter table entry 10: the keyword A, short for ADDLF.
5409-540A
DEFW 5464H 64 54
Entry 10: 5464H, the cell at 5464H-5465H, where @PARAM stores the value of A.
540B-5410
DEFM "FFHARD" 46 46 48 41 52 44
Parameter table entry 11: the keyword FFHARD, a hardware form feed.
5411-5412
DEFW 5466H 66 54
Entry 11: 5466H, the cell at 5466H-5467H, where @PARAM stores the value of FFHARD.
5413-5418
DEFM "F " 46 20 20 20 20 20
Parameter table entry 12: the keyword F, short for FFHARD.
5419-541A
DEFW 5466H 66 54
Entry 12: 5466H, the cell at 5466H-5467H, where @PARAM stores the value of F.
541B-5420
DEFM "TAB " 54 41 42 20 20 20
Parameter table entry 13: the keyword TAB, tabs expanded.
5421-5422
DEFW 5468H 68 54
Entry 13: 5468H, the cell at 5468H-5469H, where @PARAM stores the value of TAB.
5423-5428
DEFM "T " 54 20 20 20 20 20
Parameter table entry 14: the keyword T, short for TAB.
5429-542A
DEFW 5468H 68 54
Entry 14: 5468H, the cell at 5468H-5469H, where @PARAM stores the value of T.
542B-5430
DEFM "XLATE " 58 4C 41 54 45 20
Parameter table entry 15: the keyword XLATE, a character translated into another.
5431-5432
DEFW 546AH 6A 54
Entry 15: 546AH, the cell at 546AH-546BH, where @PARAM stores the value of XLATE.
5433-5438
DEFM "X " 58 20 20 20 20 20
Parameter table entry 16: the keyword X, short for XLATE.
5439-543A
DEFW 546AH 6A 54
Entry 16: 546AH, the cell at 546AH-546BH, where @PARAM stores the value of X.
543B-5440
DEFM "MARGIN" 4D 41 52 47 49 4E
Parameter table entry 17: the keyword MARGIN, the left margin.
5441-5442
DEFW 546CH 6C 54
Entry 17: 546CH, the cell at 546CH-546DH, where @PARAM stores the value of MARGIN.
5443-5448
DEFM "M " 4D 20 20 20 20 20
Parameter table entry 18: the keyword M, short for MARGIN.
5449-544A
DEFW 546CH 6C 54
Entry 18: 546CH, the cell at 546CH-546DH, where @PARAM stores the value of M.
544B-5450
DEFM "DEFAUL" 44 45 46 41 55 4C
Parameter table entry 19: the keyword DEFAUL, the factory settings (DEFAULT, cut to six letters).
5451-5452
DEFW 526CH 6C 52
Entry 19: 526CH, the operand of the LD BC at 526BH, where @PARAM stores the value of DEFAUL.
5453-5458
DEFM "D " 44 20 20 20 20 20
Parameter table entry 20: the keyword D, short for DEFAULT.
5459-545A
DEFW 526CH 6C 52
Entry 20: 526CH, the operand of the LD BC at 526BH, where @PARAM stores the value of D.
545B
DEFB 00H 00
00H, the end of the parameter table of FORMS (20 entries).
545C-545D
DEFW FFFFH FF FF
The LINES cell: FFFFH in the file, the mark of LINES not given (52C4H), else the lines to print.
545E-545F
DEFW 0042H 42 00
The PAGE cell: 0042H (66) in the file, the page length.
5460-5461
DEFW 0000H 00 00
The CHARS cell: 0000H in the file, no limit on the characters of a line.
5462-5463
DEFW 0000H 00 00
The INDENT cell: 0000H in the file, no indent.
5464-5465
DEFW 0000H 00 00
The ADDLF cell: 0000H in the file (off), FFFFH for ADDLF.
5466-5467
DEFW 0000H 00 00
The FFHARD cell: 0000H in the file (off), FFFFH for FFHARD.
5468-5469
DEFW 0000H 00 00
The TAB cell: 0000H in the file (off), FFFFH for TAB.
546A-546B
DEFW 0000H 00 00
The XLATE cell: 0000H in the file; X'aabb' translates the character aa into bb.
546C-546D
DEFW 0000H 00 00
The MARGIN cell: 0000H in the file, no left margin.
546E-546F
DEFW FFFFH FF FF
The factory value of LINES, FFFFH (not given: the page length is used), copied to 545CH by DEFAULT.
5470-5471
DEFW 0042H 42 00
The factory value of PAGE, 0042H (66 lines), copied to 545EH by DEFAULT.
5472-547F
DEFB 00H x 14 00 x 14
The factory values of CHARS, INDENT, ADDLF, FFHARD, TAB, XLATE and MARGIN: 0000H each, copied to 5460H-546DH by DEFAULT.
5480-5482
DEFM "$FF" 24 46 46
The name of PR/FLT's module, looked up at 522EH; 527BH also copies these first two bytes to 546EH-546FH.
5483
DEFB 03H 03
03H, the end of the name $FF for the lookup by request BCH.
5484-5486
DEFM " ON" 20 4F 4E
The text ON with a space in front, copied by 537BH.
5487-5489
DEFM "OFF" 4F 46 46
The text OFF, copied by 530EH when CHARS is 0, no limit.
548A-54A2
DEFM "Forms Filter not Resident" 46 6F 72 6D 73 20 46 69 6C 74 65 72 20 6E 6F 74 20 52 65 73 69 64 65 6E 74
The message of 5222H: no module $FF in high memory.
54A3
DEFB 0DH 0D
0DH, the end of the message Forms Filter not Resident, displayed with it.
54A4-54AC
DEFM "Page = " 50 61 67 65 20 20 20 3D 20
The first line of the template displayed by 5375H.
54AD-54AF
DEFM " 66" 20 36 36
The page length in three places, written by 534DH.
54B0
DEFB 0AH 0A
0AH, a line feed: the end of the Page line, in the display of FORMS.
54B1-54B9
DEFM "Lines = " 4C 69 6E 65 73 20 20 3D 20
The second line of the template, in the display of FORMS.
54BA-54BC
DEFM " 66" 20 36 36
The lines to print in three places, written by 5334H.
54BD
DEFB 0AH 0A
0AH, a line feed: the end of the Lines line, in the display of FORMS.
54BE-54C6
DEFM "Chars = " 43 68 61 72 73 20 20 3D 20
The third line of the template, in the display of FORMS.
54C7-54C9
DEFM "OFF" 4F 46 46
CHARS: OFF, or the number written by 5309H, in the display of FORMS.
54CA
DEFB 0AH 0A
0AH, a line feed: the end of the Chars line, in the display of FORMS.
54CB-54D3
DEFM "Margin = " 4D 61 72 67 69 6E 20 3D 20
The fourth line of the template, in the display of FORMS.
54D4-54D6
DEFM " 0" 20 20 30
The margin in three places, written by 533DH.
54D7
DEFB 0AH 0A
0AH, a line feed: the end of the Margin line.
54D8-54E0
DEFM "Indent = " 49 6E 64 65 6E 74 20 3D 20
The fifth line of the template, in the display of FORMS.
54E1-54E3
DEFM " 0" 20 20 30
The indent in three places, written by 5324H.
54E4
DEFB 0AH 0A
0AH, a line feed: the end of the Indent line.
54E5-54ED
DEFM "Addlf = " 41 64 64 6C 66 20 20 3D 20
The sixth line of the template, in the display of FORMS.
54EE-54F0
DEFM "OFF" 4F 46 46
ADDLF: OFF, or ON copied by 52FFH, in the display of FORMS.
54F1
DEFB 0AH 0A
0AH, a line feed: the end of the Addlf line, in the display of FORMS.
54F2-54FA
DEFM "Ffhard = " 46 66 68 61 72 64 20 3D 20
The seventh line of the template, in the display of FORMS.
54FB-54FD
DEFM "OFF" 4F 46 46
FFHARD: OFF, or ON copied by 531BH, in the display of FORMS.
54FE
DEFB 0AH 0A
0AH, a line feed: the end of the Ffhard line.
54FF-5507
DEFM "Tab = " 54 61 62 20 20 20 20 3D 20
The eighth line of the template, in the display of FORMS.
5508-550A
DEFM "OFF" 4F 46 46
TAB: OFF, or ON copied by 5357H, in the display of FORMS.
550B
DEFB 0AH 0A
0AH, a line feed: the end of the Tab line, in the display of FORMS.
550C
DEFB 0DH 0D
0DH, the end of the display; 5366H makes it 0AH when a translation is set, so the Xlate line follows.
550D-5517
DEFM "Xlate = X'" 58 6C 61 74 65 20 20 3D 20 58 27
The Xlate line, shown only when a character is translated.
5518-5519
DEFM "00" 30 30
XLATE from in two hexadecimal digits, written by 536BH.
551A-5520
DEFM "' => X'" 27 20 3D 3E 20 58 27
The arrow between the two characters of the translation.
5521-5522
DEFM "00" 30 30
XLATE to in two hexadecimal digits, written by 5372H.
5523
DEFM "'" 27
The closing quote of the second character, in the display of FORMS.
5524
DEFB 0AH 0A
0AH, a line feed: the end of the Xlate line, in the display of FORMS.
5525
DEFB 0DH 0D
0DH, the end of the display with the Xlate line, the last byte of the member.

5200H - Member 13 (SETCOM): Entry and the Exit

The SETCOM command (library member B2H), loaded at 5200H-569CH. It shows and changes the settings of the RS-232 driver RS232/DVR, which must be in memory as the module $CL (else RS232/DVR not installed). Index Register IX points at the driver's four setting bytes (the module +08H): +00H the input signals (two bits each for RI 11H, CD 22H, DSR 44H and CTS 88H: 00 IGNORE, the low bit ON, both bits OFF), +01H the line (bit 0 RTS and bit 1 DTR, each clear for ON; bit 2 always set; bit 3 parity off; bit 4 two stop bits; bits 6-5 the word length; bit 7 even parity), +02H the baud rate's index in both halves, +03H the break character; +04H-+05H is the address of the driver's routine that sets the serial port from them. SETCOM alone shows the settings; SETCOM (parameters) changes them, runs that routine and shows them.

5200
LD (520BH),SP ED 73 0B 52
Store the Stack Pointer at 520BH, the operand of the LD SP at 520AH: the exit puts the stack back to this depth, so the RET there goes to the supervisor dispatcher (4BE7H) and on to the program that ran the command.
5204
GOSUB to 522DH to do the work: the display's RET comes back here when the command was carried out.
5207
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the result of a command that was carried out.
520A
LD SP,0000H 31 00 00
Load the Stack Pointer with the value saved at entry, the operand at 520BH-520CH (0000H in the file, stored by 5200H). 5223H comes here with Register Pair HL = FFFFH.
520D
LD A,H 7C
Copy Register H (the high byte of the result) into Register A.
520E
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set for 0000H.
520F
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.
5210
LD A,(430FH) 3A 0F 43
Fetch SFLAG$, the system flags, from 430FH into Register A.
5213
BIT 5,A CB 6F
Test bit 5 of Register A: set while a JCL job runs.
5215
RET Z C8
RETurn if the Z FLAG is set (no JCL job), with Register Pair HL = FFFFH: the command failed.
5216
A JCL job runs: JUMP to 4030H (@ABORT) so that the failed command ends the job.
5219
LD A,2CH 3E 2C
Load Register A with 2CH, error 44 (parameter error). Every check of 5394H that fails returns here.
521B
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.
521D
GOSUB to 4409H (@ERROR) to report the error in Register A; SYS4/SYS returns here.
5220
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the result of a command that failed.
5223
JUMP to 520AH to put the stack back and end the command.
5225
LD HL,5504H 21 04 55
Point Register Pair HL to 5504H, the message RS232/DVR not installed.
5228
GOSUB to 447BH (@LOGOT) to display the message at Register Pair HL and send it to the job log.
522B
JUMP to 5220H to end the command with Register Pair HL = FFFFH.

522DH - Find the Driver; the Parameters

Request BCH finds the module $CL; Index Register IX gets the module +08H. Without an opening bracket the settings are only shown (54E1H). With one, @PARAM reads the parameters, DEFAULT puts the factory settings in first, 5394H changes the setting bytes, and the driver's routine at +04H-+05H is jumped to; its RET goes to 54E1H, which shows the settings.

522D
PUSH HL E5
Save Register Pair HL (the text after SETCOM) to the stack.
522E
LD DE,5500H 11 00 55
Point Register Pair DE to 5500H, the name $CL ended by 03H.
5231
GOSUB to 54FDH to look the module up through request BCH: the Z FLAG when found, with Register Pair DE = the module +08H.
5234
PUSH DE D5
Save Register Pair DE (the module +08H) to the stack.
5235
POP IX DD E1
Restore it into Index Register IX: Index Register IX = the driver's setting bytes.
5237
POP HL E1
Restore Register Pair HL (the text after SETCOM) from the stack. POP does not change the flags.
5238
If the NZ FLAG is set (no RS232/DVR), JUMP to 5225H to display RS232/DVR not installed.
523A
DEC HL 2B
DECrement Register Pair HL, so that the INC below starts at the current character.
523B
INC HL 23
INCrement Register Pair HL to the next character of the text.
523C
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
523D
CP 20H FE 20
Compare Register A against 20H, a space before the parameters.
523F
If the Z FLAG is set (a space), LOOP BACK to 523BH to pass over it.
5241
CP 28H FE 28
Compare Register A against 28H, an opening bracket.
5243
LD BC,54E1H 01 E1 54
Load Register Pair BC with 54E1H, the jump to the display. LD does not change the flags.
5246
PUSH BC C5
Save Register Pair BC (54E1H) to the stack: the next RET goes there.
5247
RET NZ C0
RETurn if the NZ FLAG is set (no bracket): to 54E1H, which shows the settings.
5248
LD DE,55FCH 11 FC 55
Point Register Pair DE to 55FCH, the parameter table of SETCOM.
524B
GOSUB to 4476H (@PARAM) to read the parameters at Register Pair HL against the table at Register Pair DE. The NZ FLAG for a bad parameter.
524E
If the NZ FLAG is set (a bad parameter), JUMP to 5219H to report error 2CH.
5251
LD DE,0000H 11 00 00
Load Register Pair DE with the DEFAULT parameter, the operand at 5252H-5253H: 0000H in the file, FFFFH for DEFAULT.
5254
LD A,D 7A
Copy Register D (the high byte of DEFAULT) into Register A.
5255
OR E B3
OR Register E (the low byte) into Register A: the NZ FLAG for DEFAULT.
5256
If the NZ FLAG is set (DEFAULT), GOSUB to 5383H to put the factory settings into the four bytes at Index Register IX.
5259
GOSUB to 5394H to change the setting bytes from the parameters; a bad value ends the command with error 2CH.
525C
LD L,(IX+04H) DD 6E 04
Fetch the low byte of the driver's routine from Index Register IX +04H into Register L.
525F
LD H,(IX+05H) DD 66 05
Fetch the high byte from Index Register IX +05H into Register H: Register Pair HL = the routine that sets the serial port.
5262
JP (HL) E9
JUMP to the driver's routine at Register Pair HL: its RET goes to 54E1H (pushed at 5246H) to show the settings.

5263H - The Display: One Routine for Each Part

The list at 553CH names these routines in the order of the display (5364H calls them): RS232:, Baud=, Word=, Stop=, Parity=, Break=, Output control: DTR= and RTS=, Input control: RI=, DSR=, CD= and CTS=, a comma and a space between items, and ENTER at the end. Each ends with @DSPLY of its text (ended by 03H, so the line goes on) or the ROM's character display.

5263
LD HL,556CH 21 6C 55
Point Register Pair HL to 556CH, the 00H in front of RS232: .
5266
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H (the 00H shows nothing); Register Pair HL comes back unchanged.
5269
LD (HL),0AH 36 0A
Store 0AH at Register Pair HL (556CH): a later display would start with a line feed.
526B
RET C9
RETurn to the list walker at 537AH, which takes the next routine of the display.
526C
LD HL,5575H 21 75 55
Point Register Pair HL to 5575H, the text Baud=.
526F
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
5272
LD A,(IX+02H) DD 7E 02
Fetch the baud byte from Index Register IX +02H into Register A.
5275
AND 0FH E6 0F
Keep bits 3-0 of Register A (AND 0FH): the index of the baud rate.
5277
ADD A,A 87
ADD Register A to itself: the index times two, the offset of its word.
5278
LD HL,551CH 21 1C 55
Point Register Pair HL to 551CH, the table of the baud rates.
527B
ADD A,L 85
ADD Register L to Register A: the low byte of the rate's word.
527C
LD L,A 6F
Copy Register A (the low byte of the entry's address) into Register L.
527D
If the NO CARRY FLAG is set (no carry), JUMP to 5280H.
527F
INC H 24
INCrement Register H: the carry into the high byte.
5280
LD A,(HL) 7E
Fetch the low byte of the baud rate at Register Pair HL into Register A.
5281
INC HL 23
INCrement Register Pair HL to the high byte of the baud rate's word.
5282
LD H,(HL) 66
Fetch the high byte of the baud rate at Register Pair HL into Register H.
5283
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the baud rate.
5284
LD DE,55ECH 11 EC 55
Point Register Pair DE to 55ECH, the five places of a number.
5287
GOSUB to 54E4H to write Register Pair HL in decimal, right justified, at 55ECH-55F0H.
528A
LD A,03H 3E 03
Load Register A with 03H, the end of text mark.
528C
LD (DE),A 12
Store Register A (03H) at Register Pair DE (55F1H), after the five places.
528D
LD HL,55ECH 21 EC 55
Point Register Pair HL to 55ECH, the number as five places with leading spaces.
5290
LD A,20H 3E 20
Load Register A with 20H, a space, to pass over the leading spaces of the number.
5292
CP (HL) BE
Compare Register A (20H) against the place at Register Pair HL: the Z FLAG for a leading space.
5293
INC HL 23
INCrement Register Pair HL to the next place. INC of a pair does not change the flags.
5294
If the Z FLAG is set (a space), LOOP BACK to 5292H.
5296
DEC HL 2B
DECrement Register Pair HL back to the first digit.
5297
JUMP to 4467H (@DSPLY) to display the number at Register Pair HL; its RET returns to the list walker.
529A
LD HL,557BH 21 7B 55
Point Register Pair HL to 557BH, the text Word=.
529D
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
52A0
LD A,(IX+01H) DD 7E 01
Fetch the line byte from Index Register IX +01H into Register A.
52A3
RLCA 07
Rotate Register A left (RLCA): bit 7 goes round to bit 0.
52A4
RLCA 07
Rotate Register A left (RLCA) again: bits 6-5 move up one more place.
52A5
RLCA 07
Rotate Register A left (RLCA) a third time: bits 6-5 are now bits 1-0.
52A6
AND 03H E6 03
Keep bits 1-0 of Register A (AND 03H): the word length code.
52A8
If the parity of Register A is even (PE: 0 or 3), JUMP to 52ADH.
52AB
XOR 03H EE 03
Exclusive OR 03H into Register A: the codes 1 and 2 change places.
52AD
ADD A,35H C6 35
ADD 35H to Register A: the digit of the word length, 5 to 8.
52AF
JUMP to the ROM at 0033H to display the character in Register A; its RET returns to the list walker.
52B2
LD HL,5581H 21 81 55
Point Register Pair HL to 5581H, the text Stop=.
52B5
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
52B8
LD A,31H 3E 31
Load Register A with 31H, the digit 1, for one stop bit.
52BA
BIT 4,(IX+01H) DD CB 01 66
Test bit 4 of the line byte at Index Register IX +01H: set for two stop bits.
52BE
If the Z FLAG is set (one stop bit), JUMP to 52C1H.
52C0
INC A 3C
INCrement Register A: the digit 2, for two stop bits.
52C1
JUMP to the ROM at 0033H to display the digit in Register A; its RET returns to the list walker.
52C4
LD HL,5587H 21 87 55
Point Register Pair HL to 5587H, the text Parity=.
52C7
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
52CA
LD HL,55D8H 21 D8 55
Point Register Pair HL to 55D8H, the text OFF.
52CD
BIT 3,(IX+01H) DD CB 01 5E
Test bit 3 of the line byte at Index Register IX +01H: set when there is no parity.
52D1
If the NZ FLAG is set (no parity), JUMP to 4467H (@DSPLY) to display OFF.
52D4
LD HL,55DCH 21 DC 55
Point Register Pair HL to 55DCH, the text ODD.
52D7
BIT 7,(IX+01H) DD CB 01 7E
Test bit 7 of the line byte at Index Register IX +01H: set for even parity.
52DB
If the Z FLAG is set (odd parity), JUMP to 52E0H.
52DD
LD HL,55E0H 21 E0 55
Point Register Pair HL to 55E0H, the text EVEN.
52E0
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
52E3
LD HL,558FH 21 8F 55
Point Register Pair HL to 558FH, the text Break=.
52E6
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
52E9
LD A,(IX+03H) DD 7E 03
Fetch the break character from Index Register IX +03H into Register A.
52EC
LD HL,55F4H 21 F4 55
Point Register Pair HL to 55F4H, the two digits of X'00'.
52EF
GOSUB to 4D7BH (SYS0/SYS) to write Register A as two hexadecimal digits at Register Pair HL.
52F2
LD HL,55F2H 21 F2 55
Point Register Pair HL to 55F2H, the text X'nn'.
52F5
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
52F8
LD HL,5596H 21 96 55
Point Register Pair HL to 5596H, a line feed and the text Output control: .
52FB
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
52FE
LD HL,55A8H 21 A8 55
Point Register Pair HL to 55A8H, the text DTR=.
5301
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
5304
BIT 1,(IX+01H) DD CB 01 4E
Test bit 1 of the line byte at Index Register IX +01H: clear when DTR is on.
5308
JUMP to 5314H to display ON or OFF from the Z FLAG of the bit test.
530A
LD HL,55ADH 21 AD 55
Point Register Pair HL to 55ADH, the text RTS=.
530D
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
5310
BIT 0,(IX+01H) DD CB 01 46
Test bit 0 of the line byte at Index Register IX +01H: clear when RTS is on.
5314
LD HL,55D5H 21 D5 55
Point Register Pair HL to 55D5H, the text ON. LD does not change the flags.
5317
If the Z FLAG is set (the bit is clear), JUMP to 531CH to display ON.
5319
LD HL,55D8H 21 D8 55
Point Register Pair HL to 55D8H, the text OFF.
531C
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
531F
LD HL,55B2H 21 B2 55
Point Register Pair HL to 55B2H, a line feed and the text Input control: .
5322
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
5325
LD HL,55C3H 21 C3 55
Point Register Pair HL to 55C3H, the text RI=.
5328
LD A,11H 3E 11
Load Register A with 11H, the two bits of RI in the input byte.
532A
JUMP to 533FH to display the setting of the signal.
532C
LD HL,55C7H 21 C7 55
Point Register Pair HL to 55C7H, the text DSR=.
532F
LD A,44H 3E 44
Load Register A with 44H, the two bits of DSR in the input byte.
5331
JUMP to 533FH to display the setting of the signal.
5333
LD HL,55CCH 21 CC 55
Point Register Pair HL to 55CCH, the text CD=.
5336
LD A,22H 3E 22
Load Register A with 22H, the two bits of CD in the input byte.
5338
JUMP to 533FH to display the setting of the signal.
533A
LD HL,55D0H 21 D0 55
Point Register Pair HL to 55D0H, the text CTS=.
533D
LD A,88H 3E 88
Load Register A with 88H, the two bits of CTS in the input byte.
533F
PUSH AF F5
Save Register Pair AF (Register A, the signal's two bits) to the stack.
5340
GOSUB to 4467H (@DSPLY) to display the text at Register Pair HL up to its 03H.
5343
POP AF F1
Restore Register Pair AF (Register A, the signal's two bits) from the stack.
5344
AND (IX+00H) DD A6 00
AND the input byte at Index Register IX +00H into Register A: the signal's setting.
5347
LD HL,55E5H 21 E5 55
Point Register Pair HL to 55E5H, the text IGNORE. LD does not change the flags.
534A
If the Z FLAG is set (neither bit), JUMP to 5355H to display IGNORE.
534C
LD HL,55D5H 21 D5 55
Point Register Pair HL to 55D5H, the text ON. LD does not change the flags.
534F
If the parity of Register A is odd (PO: one bit set), JUMP to 5355H to display ON.
5352
LD HL,55D8H 21 D8 55
Point Register Pair HL to 55D8H, the text OFF: both bits set.
5355
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
5358
LD HL,55F8H 21 F8 55
Point Register Pair HL to 55F8H, the 0DH that ends the display.
535B
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.
535E
LD HL,55F9H 21 F9 55
Point Register Pair HL to 55F9H, a comma and a space between two items.
5361
JUMP to 4467H (@DSPLY) to display the text at Register Pair HL; its RET returns to the list walker.

5364H - The List Walker; the Factory Settings

5364H calls each routine named in the list at 553CH (Index Register IY walks it) until the word 0000H, by pushing the return address 537AH and jumping. 5383H puts the factory settings into the four bytes: 00H (every input signal ignored), A5H (RTS off, DTR on, 7 bits, one stop bit, even parity), 55H (300 baud) and 00H (no break character).

5364
PUSH IY FD E5
Save Index Register IY (as the caller had it) to the stack.
5366
LD IY,553CH FD 21 3C 55
Point Index Register IY to 553CH, the list of the display routines.
536A
LD L,(IY+00H) FD 6E 00
Fetch the low byte of the next routine from Index Register IY +00H into Register L.
536D
LD H,(IY+01H) FD 66 01
Fetch the high byte from Index Register IY +01H into Register H: Register Pair HL = the routine.
5370
LD A,H 7C
Copy Register H (the high byte) into Register A.
5371
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG for 0000H, the end of the list.
5372
If the Z FLAG is set (the end), JUMP to 5380H.
5374
PUSH HL E5
Save Register Pair HL (the routine) to the stack.
5375
LD HL,537AH 21 7A 53
Point Register Pair HL to 537AH, where the routine is to return.
5378
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (the Stack Pointer is not changed): 537AH goes on the stack, Register Pair HL = the routine.
5379
JP (HL) E9
JUMP to the routine at Register Pair HL; its RET comes back to 537AH.
537A
INC IY FD 23
INCrement Index Register IY to the high byte of the entry.
537C
INC IY FD 23
INCrement Index Register IY to the next entry of the list.
537E
LOOP BACK to 536AH for the next routine named in the list at 553CH.
5380
POP IY FD E1
Restore Index Register IY (as the caller had it) from the stack.
5382
RET C9
RETurn to the caller of the display: 5207H, the end of the command.
5383
LD (IX+00H),00H DD 36 00 00
Store 00H at Index Register IX +00H: every input signal ignored.
5387
LD (IX+01H),A5H DD 36 01 A5
Store A5H at Index Register IX +01H: bit 7 even parity, bits 6-5 = 01 seven bits, bit 2, bit 0 (RTS off).
538B
LD (IX+02H),55H DD 36 02 55
Store 55H at Index Register IX +02H: index 5 in both halves, 300 baud.
538F
LD (IX+03H),00H DD 36 03 00
Store 00H at Index Register IX +03H: no break character.
5393
RET C9
RETurn with the factory settings in the four bytes.

5394H - Change the Settings

5219H is pushed first, so that every RET NZ, RET C or RET NC of a check ends the command with a parameter error; the last instruction takes it off again. BAUD must be one of the sixteen rates of the table at 551CH; WORD 5-8; STOP 1-2; PARITY (or PARITY=ON), PARITY=OFF, PARITY="ODD" or "EVEN", EVEN and ODD; BREAK (03H), BREAK=OFF (01H) or a character; DTR and RTS ON or OFF; RI, DSR, CD and CTS ON, OFF or not given (IGNORE is kept). The line byte is built in Register C and stored at +01H.

5394
LD HL,5219H 21 19 52
Point Register Pair HL to 5219H, the parameter error.
5397
PUSH HL E5
Save Register Pair HL (5219H) to the stack: a check that returns goes there.
5398
LD DE,0000H 11 00 00
Load Register Pair DE with the BAUD parameter, the operand at 5399H-539AH: 0000H in the file, else the rate.
539B
LD A,D 7A
Copy Register D (the high byte of BAUD) into Register A.
539C
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when BAUD was not given.
539D
If the Z FLAG is set (no BAUD), JUMP to 53A6H.
539F
GOSUB to 54C5H to find the rate in Register Pair DE in the table: the Z FLAG with Register A = its index in both halves.
53A2
RET NZ C0
RETurn if the NZ FLAG is set (no such rate): to 5219H for the parameter error.
53A3
LD (IX+02H),A DD 77 02
Store Register A (the index twice) at Index Register IX +02H, the baud byte.
53A6
LD C,(IX+01H) DD 4E 01
Fetch the line byte from Index Register IX +01H into Register C.
53A9
LD DE,0000H 11 00 00
Load Register Pair DE with the WORD parameter, the operand at 53AAH-53ABH: 0000H in the file, else the bits of a word.
53AC
LD A,D 7A
Copy Register D (the high byte of WORD) into Register A.
53AD
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG when WORD was not given.
53AE
If the Z FLAG is set (no WORD), JUMP to 53C8H.
53B0
INC D 14
INCrement Register D, then DECrement it at 53B1H to test the high byte of WORD.
53B1
DEC D 15
DECrement Register D: the Z FLAG only when the high byte is 00H.
53B2
RET NZ C0
RETurn if the NZ FLAG is set (256 or more): to 5219H for the parameter error.
53B3
LD A,E 7B
Copy Register E (the bits of a word) into Register A.
53B4
SUB 05H D6 05
SUBtract 05H from Register A: 0-3 for 5-8 bits.
53B6
RET C D8
RETurn if the CARRY FLAG is set (fewer than 5): to 5219H for the parameter error.
53B7
CP 04H FE 04
Compare Register A against 04H: the NO CARRY FLAG for more than 8 bits.
53B9
RET NC D0
RETurn if the NO CARRY FLAG is set: to 5219H for the parameter error.
53BA
OR A B7
Set the flags from Register A (OR A): the PARITY of the code.
53BB
If the parity is even (PE: 0 or 3), JUMP to 53C0H.
53BE
XOR 03H EE 03
Exclusive OR 03H into Register A: the codes 1 and 2 change places (6 bits is 2, 7 bits is 1).
53C0
RRCA 0F
Rotate Register A right (RRCA): bit 0 goes round to bit 7.
53C1
RRCA 0F
Rotate Register A right (RRCA) again: the code moves down one more place.
53C2
RRCA 0F
Rotate Register A right (RRCA) a third time: bits 1-0 are now bits 6-5.
53C3
LD B,60H 06 60
Load Register B with 60H, the mask of bits 6-5.
53C5
GOSUB to 54B3H to put the bits of Register A under the mask in Register B into Register C.
53C8
LD DE,0000H 11 00 00
Load Register Pair DE with the STOP parameter, the operand at 53C9H-53CAH: 0000H in the file, else the stop bits.
53CB
LD A,E 7B
Copy Register E (the low byte of STOP) into Register A.
53CC
OR D B2
OR Register D (the high byte) into Register A: the Z FLAG when STOP was not given.
53CD
If the Z FLAG is set (no STOP), JUMP to 53E2H.
53CF
INC D 14
INCrement Register D, then DECrement it at 53D0H to test the high byte of STOP.
53D0
DEC D 15
DECrement Register D: the Z FLAG only when the high byte is 00H.
53D1
RET NZ C0
RETurn if the NZ FLAG is set (256 or more): to 5219H for the parameter error.
53D2
LD A,E 7B
Copy Register E (the stop bits) into Register A.
53D3
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 0.
53D4
RET Z C8
RETurn if the Z FLAG is set (0 stop bits): to 5219H for the parameter error.
53D5
CP 03H FE 03
Compare Register A against 03H: the NO CARRY FLAG for 3 or more.
53D7
RET NC D0
RETurn if the NO CARRY FLAG is set: to 5219H for the parameter error.
53D8
DEC A 3D
DECrement Register A: 0 for one stop bit, 1 for two.
53D9
RLCA 07
Rotate Register A left (RLCA): bit 0 moves up.
53DA
RLCA 07
Rotate Register A left (RLCA) again: the stop bit moves up one more place.
53DB
RLCA 07
Rotate Register A left (RLCA) a third time: the stop bit moves up one more place.
53DC
RLCA 07
Rotate Register A left (RLCA) a fourth time: the stop bit is now bit 4.
53DD
LD B,10H 06 10
Load Register B with 10H, the mask of bit 4 (the stop bits) of the line byte.
53DF
GOSUB to 54B3H to put the bit of Register A under the mask in Register B into Register C.
53E2
LD DE,0001H 11 01 00
Load Register Pair DE with the PARITY parameter, the operand at 53E3H-53E4H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF, else the address of the quoted text.
53E5
LD A,E 7B
Copy Register E (the low byte of PARITY) into Register A.
53E6
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
53E7
OR D B2
OR Register D into Register A: the Z FLAG only for 0001H, PARITY not given.
53E8
If the Z FLAG is set (no PARITY), JUMP to 5410H for ODD and EVEN.
53EA
LD A,D 7A
Copy Register D (the high byte of PARITY) into Register A.
53EB
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for PARITY=OFF.
53EC
If the Z FLAG is set (PARITY=OFF), JUMP to 5408H to set the no parity bit.
53EE
LD A,D 7A
Copy Register D (the high byte) into Register A.
53EF
AND E A3
AND Register E (the low byte) into Register A: FFH only for FFFFH.
53F0
INC A 3C
INCrement Register A: the Z FLAG for PARITY=ON.
53F1
If the Z FLAG is set (PARITY=ON), JUMP to 5408H to clear the no parity bit.
53F3
LD A,(DE) 1A
Fetch the first character of the quoted text at Register Pair DE into Register A.
53F4
GOSUB to 54BCH to make a small letter in Register A a capital.
53F7
CP 4FH FE 4F
Compare Register A against 4FH, the letter O of ODD.
53F9
If the Z FLAG is set (the text starts with O, ODD), JUMP to 5402H for odd parity.
53FB
CP 45H FE 45
Compare Register A against 45H, the letter E of EVEN.
53FD
RET NZ C0
RETurn if the NZ FLAG is set (neither): to 5219H for the parameter error.
53FE
SET 7,C CB F9
Set bit 7 of Register C (the line byte): even parity was asked for.
5400
JUMP to 5404H to turn parity on by clearing bit 3 of Register C.
5402
RES 7,C CB B9
Clear bit 7 of Register C (the line byte): odd parity was asked for.
5404
RES 3,C CB 99
Clear bit 3 of Register C (the line byte): parity is on, odd or even.
5406
JUMP to 5430H: EVEN and ODD are not looked at.
5408
LD A,D 7A
Copy Register D (the high byte of PARITY) into Register A.
5409
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for OFF.
540A
SET 3,C CB D9
Set bit 3 of Register C: no parity. SET does not change the flags.
540C
If the Z FLAG is set (PARITY=OFF), JUMP to 5430H.
540E
RES 3,C CB 99
Clear bit 3 of Register C: parity is on (PARITY=ON).
5410
LD DE,0001H 11 01 00
Load Register Pair DE with the ODD parameter, the operand at 5411H-5412H: 0001H in the file (not given), FFFFH for ODD, 0000H for ODD=N.
5413
LD A,E 7B
Copy Register E (the low byte of ODD) into Register A.
5414
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
5415
OR D B2
OR Register D into Register A: the Z FLAG only for 0001H, ODD not given.
5416
If the Z FLAG is set (no ODD), JUMP to 5420H.
5418
LD A,D 7A
Copy Register D (the high byte of ODD) into Register A.
5419
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for ODD=N.
541A
SET 7,C CB F9
Set bit 7 of Register C: even parity. SET does not change the flags.
541C
If the Z FLAG is set (ODD=N), JUMP to 5420H with even parity.
541E
RES 7,C CB B9
Clear bit 7 of Register C (the line byte): ODD asks for odd parity.
5420
LD DE,0001H 11 01 00
Load Register Pair DE with the EVEN parameter, the operand at 5421H-5422H: 0001H in the file (not given), FFFFH for EVEN, 0000H for EVEN=N.
5423
LD A,E 7B
Copy Register E (the low byte of EVEN) into Register A.
5424
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
5425
OR D B2
OR Register D into Register A: the Z FLAG only for 0001H, EVEN not given.
5426
If the Z FLAG is set (no EVEN), JUMP to 5430H.
5428
LD A,D 7A
Copy Register D (the high byte of EVEN) into Register A.
5429
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for EVEN=N.
542A
RES 7,C CB B9
Clear bit 7 of Register C: odd parity. RES does not change the flags.
542C
If the Z FLAG is set (EVEN=N), JUMP to 5430H with odd parity.
542E
SET 7,C CB F9
Set bit 7 of Register C (the line byte): EVEN asks for even parity.
5430
LD DE,0100H 11 00 01
Load Register Pair DE with the BREAK parameter, the operand at 5431H-5432H: 0100H in the file (not given), FFFFH for ON, 0000H for OFF, else the character.
5433
LD A,D 7A
Copy Register D (the high byte of BREAK) into Register A.
5434
DEC A 3D
DECrement Register A: 00H only for a high byte of 01H.
5435
OR E B3
OR Register E into Register A: the Z FLAG only for 0100H, BREAK not given.
5436
If the Z FLAG is set (no BREAK), JUMP to 5451H for DTR.
5438
LD A,D 7A
Copy Register D (the high byte of BREAK) into Register A.
5439
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for BREAK=OFF.
543A
If the Z FLAG is set (BREAK=OFF), JUMP to 5446H to store 01H as the break character.
543C
LD A,D 7A
Copy Register D (the high byte) into Register A.
543D
AND E A3
AND Register E (the low byte) into Register A: FFH only for FFFFH.
543E
INC A 3C
INCrement Register A: the Z FLAG for BREAK=ON.
543F
If the Z FLAG is set (BREAK=ON), JUMP to 5446H to store 03H as the break character.
5441
INC D 14
INCrement Register D, then DECrement it at 5442H to test the high byte of BREAK.
5442
DEC D 15
DECrement Register D: the Z FLAG only when the high byte is 00H.
5443
RET NZ C0
RETurn if the NZ FLAG is set (256 or more): to 5219H for the parameter error.
5444
JUMP to 544EH with the break character in Register E.
5446
LD A,D 7A
Copy Register D (the high byte of BREAK) into Register A.
5447
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for OFF.
5448
LD E,01H 1E 01
Load Register E with 01H, the break character for OFF. LD does not change the flags.
544A
If the Z FLAG is set (BREAK=OFF), JUMP to 544EH with Register E = 01H.
544C
LD E,03H 1E 03
Load Register E with 03H, the break character for ON.
544E
LD (IX+03H),E DD 73 03
Store Register E (the break character) at Index Register IX +03H.
5451
LD DE,0001H 11 01 00
Load Register Pair DE with the DTR parameter, the operand at 5452H-5453H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5454
LD A,E 7B
Copy Register E (the low byte of DTR) into Register A.
5455
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
5456
OR D B2
OR Register D into Register A: the Z FLAG only for 0001H, DTR not given.
5457
If the Z FLAG is set (no DTR), JUMP to 5461H.
5459
LD A,D 7A
Copy Register D (the high byte of DTR) into Register A.
545A
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for DTR=OFF.
545B
SET 1,C CB C9
Set bit 1 of Register C: DTR off. SET does not change the flags.
545D
If the Z FLAG is set (DTR=OFF), JUMP to 5461H with bit 1 of Register C set.
545F
RES 1,C CB 89
Clear bit 1 of Register C (the line byte): DTR=ON, the signal is on.
5461
LD DE,0001H 11 01 00
Load Register Pair DE with the RTS parameter, the operand at 5462H-5463H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5464
LD A,E 7B
Copy Register E (the low byte of RTS) into Register A.
5465
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
5466
OR D B2
OR Register D into Register A: the Z FLAG only for 0001H, RTS not given.
5467
If the Z FLAG is set (no RTS), JUMP to 5471H.
5469
LD A,D 7A
Copy Register D (the high byte of RTS) into Register A.
546A
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG for RTS=OFF.
546B
SET 0,C CB C1
Set bit 0 of Register C: RTS off. SET does not change the flags.
546D
If the Z FLAG is set (RTS=OFF), JUMP to 5471H with bit 0 of Register C set.
546F
RES 0,C CB 81
Clear bit 0 of Register C (the line byte): RTS=ON, the signal is on.
5471
SET 2,C CB D1
Set bit 2 of Register C, set in every line byte.
5473
LD (IX+01H),C DD 71 01
Store Register C (the new line byte) at Index Register IX +01H.
5476
LD HL,0001H 21 01 00
Load Register Pair HL with the RI parameter, the operand at 5477H-5478H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5479
LD C,01H 0E 01
Load Register C with 01H, the low bit of RI (11H).
547B
GOSUB to 5498H to set the signal's two bits in the input byte.
547E
LD HL,0001H 21 01 00
Load Register Pair HL with the DSR parameter, the operand at 547FH-5480H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5481
LD C,04H 0E 04
Load Register C with 04H, the low bit of DSR (44H).
5483
GOSUB to 5498H to set the signal's two bits in the input byte.
5486
LD HL,0001H 21 01 00
Load Register Pair HL with the CD parameter, the operand at 5487H-5488H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5489
LD C,02H 0E 02
Load Register C with 02H, the low bit of CD (22H).
548B
GOSUB to 5498H to set the signal's two bits in the input byte.
548E
LD HL,0001H 21 01 00
Load Register Pair HL with the CTS parameter, the operand at 548FH-5490H: 0001H in the file (not given), FFFFH for ON, 0000H for OFF.
5491
LD C,08H 0E 08
Load Register C with 08H, the low bit of CTS (88H).
5493
GOSUB to 5498H to set the signal's two bits in the input byte.
5496
POP AF F1
Restore Register Pair AF from the stack: this takes off the 5219H pushed at 5397H.
5497
RET C9
RETurn to 5259H with the four setting bytes at Index Register IX changed.

5498H - Helpers: A Signal, a Bit Field, Capitals, the Baud Table, Numbers

5498H sets the two bits of one input signal (Register C the low bit, the high bit four places up) from Register Pair HL: not given leaves them, OFF sets both, ON only the low bit. 54B3H puts the bits of Register A under the mask Register B into Register C. 54BCH makes a small letter in Register A a capital. 54C5H finds the rate in Register Pair DE in the baud table. 54E4H writes Register Pair HL in five decimal places at Register Pair DE. 54FDH looks a module up through request BCH.

5498
LD A,L 7D
Copy Register L (the low byte of the parameter) into Register A.
5499
DEC A 3D
DECrement Register A: 00H only for a low byte of 01H.
549A
OR H B4
OR Register H into Register A: the Z FLAG only for 0001H, not given.
549B
RET Z C8
RETurn if the Z FLAG is set: the signal is left as it is.
549C
LD A,C 79
Copy Register C (the low bit of the signal) into Register A.
549D
RLCA 07
Rotate Register A left (RLCA): the bit moves up.
549E
RLCA 07
Rotate Register A left (RLCA) again: the bit moves up one more place.
549F
RLCA 07
Rotate Register A left (RLCA) a third time: the bit moves up one more place.
54A0
RLCA 07
Rotate Register A left (RLCA) a fourth time: the high bit of the signal.
54A1
OR C B1
OR Register C (the low bit) into Register A: both bits of the signal.
54A2
LD B,A 47
Copy Register A (both bits of the signal) into Register B, kept for OFF.
54A3
CPL 2F
Complement Register A (CPL): every bit but the signal's two.
54A4
AND (IX+00H) DD A6 00
AND the input byte at Index Register IX +00H into Register A: the other signals.
54A7
LD E,A 5F
Copy Register A (the other signals) into Register E.
54A8
LD A,H 7C
Copy Register H (the high byte of the parameter) into Register A.
54A9
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG for OFF.
54AA
LD A,B 78
Copy Register B (both bits) into Register A. LD does not change the flags.
54AB
If the Z FLAG is set (OFF), JUMP to 54AEH with both bits.
54AD
LD A,C 79
Copy Register C (the low bit only) into Register A: ON.
54AE
OR E B3
OR Register E (the other signals) into Register A.
54AF
LD (IX+00H),A DD 77 00
Store Register A at Index Register IX +00H, the input byte.
54B2
RET C9
RETurn with the signal's two bits set in the input byte at Index Register IX +00H.
54B3
AND B A0
AND Register B (the mask) into Register A: the new bits of the field.
54B4
PUSH AF F5
Save Register Pair AF (the new bits) to the stack.
54B5
LD A,B 78
Copy Register B (the mask of the field) into Register A to complement it.
54B6
CPL 2F
Complement Register A (CPL): every bit outside the field.
54B7
AND C A1
AND Register C into Register A: the line byte without the field.
54B8
POP BC C1
Restore Register Pair BC from the stack: Register B = the new bits.
54B9
OR B B0
OR Register B (the new bits) into Register A.
54BA
LD C,A 4F
Copy Register A into Register C: the line byte with the new field.
54BB
RET C9
RETurn with the new line byte in Register C; Register B now holds the new bits.
54BC
CP 61H FE 61
Compare Register A against 61H, the letter a: the CARRY FLAG below it.
54BE
RET C D8
RETurn if the CARRY FLAG is set: not a small letter.
54BF
CP 7BH FE 7B
Compare Register A against 7BH: the NO CARRY FLAG above the letter z.
54C1
RET NC D0
RETurn if the NO CARRY FLAG is set: not a small letter.
54C2
AND 5FH E6 5F
Keep all bits but bit 5 of Register A (AND 5FH): the capital letter.
54C4
RET C9
RETurn with the capital letter in Register A; other characters are unchanged.
54C5
LD HL,551CH 21 1C 55
Point Register Pair HL to 551CH, the table of the sixteen baud rates.
54C8
LD BC,1000H 01 00 10
Load Register Pair BC with 1000H: Register B = 16 entries, Register C = the index, 0.
54CB
LD A,(HL) 7E
Fetch the low byte of the entry's rate at Register Pair HL into Register A.
54CC
INC HL 23
INCrement Register Pair HL to the high byte of the entry's baud rate.
54CD
CP E BB
Compare Register A against Register E (the low byte of the rate wanted).
54CE
If the NZ FLAG is set (different), JUMP to 54D4H.
54D0
LD A,(HL) 7E
Fetch the high byte of the entry's rate at Register Pair HL into Register A.
54D1
CP D BA
Compare Register A against Register D (the high byte of the rate wanted).
54D2
If the Z FLAG is set (the rate is found), JUMP to 54D9H.
54D4
INC HL 23
INCrement Register Pair HL to the next entry.
54D5
INC C 0C
INCrement Register C, the index of the next entry.
54D6
DECrement Register B and LOOP BACK to 54CBH while entries are left.
54D8
RET C9
RETurn with the NZ FLAG: the rate is not in the table.
54D9
LD A,C 79
Copy Register C (the index of the rate found) into Register A.
54DA
RLCA 07
Rotate Register A left (RLCA): the index moves up.
54DB
RLCA 07
Rotate Register A left (RLCA) again: the index moves up one more place.
54DC
RLCA 07
Rotate Register A left (RLCA) a third time: the index moves up one more place.
54DD
RLCA 07
Rotate Register A left (RLCA) a fourth time: the index in bits 7-4.
54DE
OR C B1
OR Register C into Register A: the index in both halves.
54DF
CP A BF
Compare Register A with itself (CP A): the Z FLAG, the rate was found.
54E0
RET C9
RETurn with the index in both halves of Register A and the Z FLAG.
54E1
JUMP to 5364H to show the settings; reached by the RET NZ at 5247H and by the driver's RET.
54E4
LD B,05H 06 05
Load Register B with 05H, the count of the five places to fill.
54E6
LD A,20H 3E 20
Load Register A with 20H, a space to clear the five places.
54E8
LD (DE),A 12
Store Register A (a space) at Register Pair DE.
54E9
INC DE 13
INCrement Register Pair DE to the next place.
54EA
DECrement Register B and LOOP BACK to 54E8H until the five places are spaces.
54EC
PUSH DE D5
Save Register Pair DE (the address after the five places) to the stack.
54ED
DEC DE 1B
DECrement Register Pair DE to the last of the five places.
54EE
LD A,0AH 3E 0A
Load Register A with 0AH (10), the divisor for the next digit.
54F0
GOSUB to 44C4H (@DIV) to divide Register Pair HL by Register A: the quotient in Register Pair HL, the remainder (the next digit from the right) in Register A.
54F3
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit.
54F5
LD (DE),A 12
Store Register A (the digit) at Register Pair DE.
54F6
DEC DE 1B
DECrement Register Pair DE to the place on the left.
54F7
LD A,H 7C
Copy Register H (the high byte of the quotient) into Register A.
54F8
OR L B5
OR Register L into Register A: the Z FLAG when the quotient is 0.
54F9
If the NZ FLAG is set (more digits), LOOP BACK to 54EEH.
54FB
POP DE D1
Restore Register Pair DE (the address after the five places) from the stack.
54FC
RET C9
RETurn with Register Pair DE after the five places.
54FD
LD A,BCH 3E BC
Load Register A with BCH, the request code that looks a module up by its name.
54FF
RST 28H EF
Issue the request in Register A through RST 28H: SYS10/SYS finds the module named at Register Pair DE (the Z FLAG, Register Pair HL = the module, Register Pair DE = the byte after its name) and its RET goes back to 5234H (the dispatcher drops this return address).

5500H - SETCOM Data: The Name, the Message, the Baud Rates, the Display List, the Texts and the Parameter Table

The module name $CL, the message for a missing driver, the sixteen baud rates (index 0-15, the value kept in both halves of the baud byte), the list of the display routines walked by 5364H, the texts of the display (each ended by 03H so that the line goes on), and the parameter table of @PARAM (each keyword of six characters and the address of its cell, the operand of an instruction in the code).

5500-5502
DEFM "$CL" 24 43 4C
The name of the module of RS232/DVR, looked up at 5231H through request BCH.
5503
DEFB 03H 03
03H, the end of the name $CL, below 21H as the lookup of request BCH needs.
5504-551A
DEFM "RS232/DVR not installed" 52 53 32 33 32 2F 44 56 52 20 6E 6F 74 20 69 6E 73 74 61 6C 6C 65 64
The message of 5225H: no module $CL in memory, the driver was not set with SET.
551B
DEFB 0DH 0D
0DH, the end of the message RS232/DVR not installed, displayed with it.
551C-551D
DEFW 0032H 32 00
Baud rate index 0 (0H): 50 baud, shown by 526CH and looked for by 54C5H.
551E-551F
DEFW 004BH 4B 00
Baud rate index 1 (1H): 75 baud, shown by 526CH and looked for by 54C5H.
5520-5521
DEFW 006EH 6E 00
Baud rate index 2 (2H): 110 baud, shown by 526CH and looked for by 54C5H.
5522-5523
DEFW 0087H 87 00
Baud rate index 3 (3H): 135 baud, shown by 526CH and looked for by 54C5H.
5524-5525
DEFW 0096H 96 00
Baud rate index 4 (4H): 150 baud, shown by 526CH and looked for by 54C5H.
5526-5527
DEFW 012CH 2C 01
Baud rate index 5 (5H): 300 baud (the factory setting of 5383H), shown by 526CH and looked for by 54C5H.
5528-5529
DEFW 0258H 58 02
Baud rate index 6 (6H): 600 baud, shown by 526CH and looked for by 54C5H.
552A-552B
DEFW 04B0H B0 04
Baud rate index 7 (7H): 1200 baud, shown by 526CH and looked for by 54C5H.
552C-552D
DEFW 0708H 08 07
Baud rate index 8 (8H): 1800 baud, shown by 526CH and looked for by 54C5H.
552E-552F
DEFW 07D0H D0 07
Baud rate index 9 (9H): 2000 baud, shown by 526CH and looked for by 54C5H.
5530-5531
DEFW 0960H 60 09
Baud rate index 10 (AH): 2400 baud, shown by 526CH and looked for by 54C5H.
5532-5533
DEFW 0E10H 10 0E
Baud rate index 11 (BH): 3600 baud, shown by 526CH and looked for by 54C5H.
5534-5535
DEFW 12C0H C0 12
Baud rate index 12 (CH): 4800 baud, shown by 526CH and looked for by 54C5H.
5536-5537
DEFW 1C20H 20 1C
Baud rate index 13 (DH): 7200 baud, shown by 526CH and looked for by 54C5H.
5538-5539
DEFW 2580H 80 25
Baud rate index 14 (EH): 9600 baud, shown by 526CH and looked for by 54C5H.
553A-553B
DEFW 4B00H 00 4B
Baud rate index 15 (FH): 19200 baud, shown by 526CH and looked for by 54C5H.
553C-553D
DEFW 5263H 63 52
Display list entry 1: the routine at 5263H, which displays RS232: at the start of the line.
553E-553F
DEFW 526CH 6C 52
Display list entry 2: the routine at 526CH, which displays Baud= and the rate.
5540-5541
DEFW 535EH 5E 53
Display list entry 3: the routine at 535EH, which displays a comma and a space.
5542-5543
DEFW 529AH 9A 52
Display list entry 4: the routine at 529AH, which displays Word= and the bits of a word.
5544-5545
DEFW 535EH 5E 53
Display list entry 5: the routine at 535EH, which displays a comma and a space.
5546-5547
DEFW 52B2H B2 52
Display list entry 6: the routine at 52B2H, which displays Stop= and the stop bits.
5548-5549
DEFW 535EH 5E 53
Display list entry 7: the routine at 535EH, which displays a comma and a space.
554A-554B
DEFW 52C4H C4 52
Display list entry 8: the routine at 52C4H, which displays Parity= and OFF, ODD or EVEN.
554C-554D
DEFW 535EH 5E 53
Display list entry 9: the routine at 535EH, which displays a comma and a space.
554E-554F
DEFW 52E3H E3 52
Display list entry 10: the routine at 52E3H, which displays Break= and the break character as X'nn'.
5550-5551
DEFW 52F8H F8 52
Display list entry 11: the routine at 52F8H, which displays a line feed and Output control: .
5552-5553
DEFW 52FEH FE 52
Display list entry 12: the routine at 52FEH, which displays DTR= and ON or OFF.
5554-5555
DEFW 535EH 5E 53
Display list entry 13: the routine at 535EH, which displays a comma and a space.
5556-5557
DEFW 530AH 0A 53
Display list entry 14: the routine at 530AH, which displays RTS= and ON or OFF.
5558-5559
DEFW 531FH 1F 53
Display list entry 15: the routine at 531FH, which displays a line feed and Input control: .
555A-555B
DEFW 5325H 25 53
Display list entry 16: the routine at 5325H, which displays RI= and ON, OFF or IGNORE.
555C-555D
DEFW 535EH 5E 53
Display list entry 17: the routine at 535EH, which displays a comma and a space.
555E-555F
DEFW 532CH 2C 53
Display list entry 18: the routine at 532CH, which displays DSR= and ON, OFF or IGNORE.
5560-5561
DEFW 535EH 5E 53
Display list entry 19: the routine at 535EH, which displays a comma and a space.
5562-5563
DEFW 5333H 33 53
Display list entry 20: the routine at 5333H, which displays CD= and ON, OFF or IGNORE.
5564-5565
DEFW 535EH 5E 53
Display list entry 21: the routine at 535EH, which displays a comma and a space.
5566-5567
DEFW 533AH 3A 53
Display list entry 22: the routine at 533AH, which displays CTS= and ON, OFF or IGNORE.
5568-5569
DEFW 5358H 58 53
Display list entry 23: the routine at 5358H, which displays the 0DH that ends the display.
556A-556B
DEFW 0000H 00 00
0000H, the end of the display list: 5372H stops the walk of 5364H here.
556C
DEFB 00H 00
00H in front of RS232: (displayed as nothing); 5269H makes it 0AH, a line feed, after the first display.
556D-5573
DEFM "RS232: " 52 53 32 33 32 3A 20
The heading of the display, shown by 5263H at the start of its first line.
5574
DEFB 03H 03
03H, the end of the text RS232:: the line goes on after it.
5575-5579
DEFM "Baud=" 42 61 75 64 3D
The text of the baud rate, shown by 526CH in front of the rate in decimal.
557A
DEFB 03H 03
03H, the end of the text Baud=: the line goes on after it.
557B-557F
DEFM "Word=" 57 6F 72 64 3D
The text of the bits of a word, shown by 529AH.
5580
DEFB 03H 03
03H, the end of the text Word=: the line goes on after it.
5581-5585
DEFM "Stop=" 53 74 6F 70 3D
The text of the stop bits, shown by 52B2H in front of the digit 1 or 2.
5586
DEFB 03H 03
03H, the end of the text Stop=: the line goes on after it.
5587-558D
DEFM "Parity=" 50 61 72 69 74 79 3D
The text of the parity, shown by 52C4H in front of OFF, ODD or EVEN.
558E
DEFB 03H 03
03H, the end of the text Parity=: the line goes on after it.
558F-5594
DEFM "Break=" 42 72 65 61 6B 3D
The text of the break character, shown by 52E3H.
5595
DEFB 03H 03
03H, the end of the text Break=: the line goes on after it.
5596
DEFB 0AH 0A
0AH, a line feed: Output control: starts a new line of the display.
5597-55A6
DEFM "Output control: " 4F 75 74 70 75 74 20 63 6F 6E 74 72 6F 6C 3A 20
The heading of the output signals, shown by 52F8H.
55A7
DEFB 03H 03
03H, the end of the text Output control:: the line goes on after it.
55A8-55AB
DEFM "DTR=" 44 54 52 3D
The text of the signal DTR (data terminal ready), shown by 52FEH.
55AC
DEFB 03H 03
03H, the end of the text DTR=: the line goes on after it.
55AD-55B0
DEFM "RTS=" 52 54 53 3D
The text of the signal RTS (request to send), shown by 530AH.
55B1
DEFB 03H 03
03H, the end of the text RTS=: the line goes on after it.
55B2
DEFB 0AH 0A
0AH, a line feed: Input control: starts a new line of the display.
55B3-55C1
DEFM "Input control: " 49 6E 70 75 74 20 63 6F 6E 74 72 6F 6C 3A 20
The heading of the input signals, shown by 531FH.
55C2
DEFB 03H 03
03H, the end of the text Input control:: the line goes on after it.
55C3-55C5
DEFM "RI=" 52 49 3D
The text of the signal RI (ring indicator), shown by 5325H.
55C6
DEFB 03H 03
03H, the end of the text RI=: the line goes on after it.
55C7-55CA
DEFM "DSR=" 44 53 52 3D
The text of the signal DSR (data set ready), shown by 532CH.
55CB
DEFB 03H 03
03H, the end of the text DSR=: the line goes on after it.
55CC-55CE
DEFM "CD=" 43 44 3D
The text of the signal CD (carrier detect), shown by 5333H.
55CF
DEFB 03H 03
03H, the end of the text CD=: the line goes on after it.
55D0-55D3
DEFM "CTS=" 43 54 53 3D
The text of the signal CTS (clear to send), shown by 533AH.
55D4
DEFB 03H 03
03H, the end of the text CTS=: the line goes on after it.
55D5-55D6
DEFM "ON" 4F 4E
ON, shown by 5314H for DTR and RTS and by 534CH for an input signal.
55D7
DEFB 03H 03
03H, the end of the text ON: the line goes on after it.
55D8-55DA
DEFM "OFF" 4F 46 46
OFF, shown for parity off, a signal off, or both bits of an input signal.
55DB
DEFB 03H 03
03H, the end of the text OFF: the line goes on after it.
55DC-55DE
DEFM "ODD" 4F 44 44
ODD, shown by 52D4H when parity is on and bit 7 of the line byte is clear.
55DF
DEFB 03H 03
03H, the end of the text ODD: the line goes on after it.
55E0-55E3
DEFM "EVEN" 45 56 45 4E
EVEN, shown by 52DDH when parity is on and bit 7 of the line byte is set.
55E4
DEFB 03H 03
03H, the end of the text EVEN: the line goes on after it.
55E5-55EA
DEFM "IGNORE" 49 47 4E 4F 52 45
IGNORE, shown by 5347H when neither bit of an input signal is set.
55EB
DEFB 03H 03
03H, the end of the text IGNORE: the line goes on after it.
55EC-55F0
DEFM "00000" 30 30 30 30 30
The five places of the baud rate, written in decimal by 54E4H with leading spaces.
55F1
DEFB 03H 03
03H, the end of the number; 528CH stores it again after the five places.
55F2-55F3
DEFM "X'" 58 27
The start of the break character in hexadecimal, shown by 52F2H.
55F4-55F5
DEFM "00" 30 30
The two hexadecimal digits of the break character, written by 52EFH.
55F6
DEFM "'" 27
The closing quote of the break character in hexadecimal, in the display of SETCOM.
55F7
DEFB 03H 03
03H, the end of the text X'nn': the line goes on after it.
55F8
DEFB 0DH 0D
0DH, ENTER: the end of the display of SETCOM, shown by 5358H.
55F9-55FA
DEFM ", " 2C 20
A comma and a space between two items of a line, shown by 535EH.
55FB
DEFB 03H 03
03H, the end of the comma and space: the line goes on after it.
55FC-5601
DEFM "BREAK " 42 52 45 41 4B 20
Parameter table entry 1: the keyword BREAK, the break character (ON, OFF or a character).
5602-5603
DEFW 5431H 31 54
Entry 1: 5431H, the operand of the LD DE at 5430H, where @PARAM stores the value of BREAK.
5604-5609
DEFM "BAUD " 42 41 55 44 20 20
Parameter table entry 2: the keyword BAUD, the baud rate.
560A-560B
DEFW 5399H 99 53
Entry 2: 5399H, the operand of the LD DE at 5398H, where @PARAM stores the value of BAUD.
560C-5611
DEFM "B " 42 20 20 20 20 20
Parameter table entry 3: the keyword B, short for BAUD.
5612-5613
DEFW 5399H 99 53
Entry 3: 5399H, the operand of the LD DE at 5398H, where @PARAM stores the value of B.
5614-5619
DEFM "WORD " 57 4F 52 44 20 20
Parameter table entry 4: the keyword WORD, the bits of a word (5-8).
561A-561B
DEFW 53AAH AA 53
Entry 4: 53AAH, the operand of the LD DE at 53A9H, where @PARAM stores the value of WORD.
561C-5621
DEFM "W " 57 20 20 20 20 20
Parameter table entry 5: the keyword W, short for WORD.
5622-5623
DEFW 53AAH AA 53
Entry 5: 53AAH, the operand of the LD DE at 53A9H, where @PARAM stores the value of W.
5624-5629
DEFM "STOP " 53 54 4F 50 20 20
Parameter table entry 6: the keyword STOP, the stop bits (1 or 2).
562A-562B
DEFW 53C9H C9 53
Entry 6: 53C9H, the operand of the LD DE at 53C8H, where @PARAM stores the value of STOP.
562C-5631
DEFM "S " 53 20 20 20 20 20
Parameter table entry 7: the keyword S, short for STOP.
5632-5633
DEFW 53C9H C9 53
Entry 7: 53C9H, the operand of the LD DE at 53C8H, where @PARAM stores the value of S.
5634-5639
DEFM "PARITY" 50 41 52 49 54 59
Parameter table entry 8: the keyword PARITY, the parity (ON, OFF, "ODD" or "EVEN").
563A-563B
DEFW 53E3H E3 53
Entry 8: 53E3H, the operand of the LD DE at 53E2H, where @PARAM stores the value of PARITY.
563C-5641
DEFM "P " 50 20 20 20 20 20
Parameter table entry 9: the keyword P, short for PARITY.
5642-5643
DEFW 53E3H E3 53
Entry 9: 53E3H, the operand of the LD DE at 53E2H, where @PARAM stores the value of P.
5644-5649
DEFM "EVEN " 45 56 45 4E 20 20
Parameter table entry 10: the keyword EVEN, even parity.
564A-564B
DEFW 5421H 21 54
Entry 10: 5421H, the operand of the LD DE at 5420H, where @PARAM stores the value of EVEN.
564C-5651
DEFM "E " 45 20 20 20 20 20
Parameter table entry 11: the keyword E, short for EVEN.
5652-5653
DEFW 5421H 21 54
Entry 11: 5421H, the operand of the LD DE at 5420H, where @PARAM stores the value of E.
5654-5659
DEFM "ODD " 4F 44 44 20 20 20
Parameter table entry 12: the keyword ODD, odd parity.
565A-565B
DEFW 5411H 11 54
Entry 12: 5411H, the operand of the LD DE at 5410H, where @PARAM stores the value of ODD.
565C-5661
DEFM "O " 4F 20 20 20 20 20
Parameter table entry 13: the keyword O, short for ODD.
5662-5663
DEFW 5411H 11 54
Entry 13: 5411H, the operand of the LD DE at 5410H, where @PARAM stores the value of O.
5664-5669
DEFM "DTR " 44 54 52 20 20 20
Parameter table entry 14: the keyword DTR, the output signal DTR (ON or OFF).
566A-566B
DEFW 5452H 52 54
Entry 14: 5452H, the operand of the LD DE at 5451H, where @PARAM stores the value of DTR.
566C-5671
DEFM "RTS " 52 54 53 20 20 20
Parameter table entry 15: the keyword RTS, the output signal RTS (ON or OFF).
5672-5673
DEFW 5462H 62 54
Entry 15: 5462H, the operand of the LD DE at 5461H, where @PARAM stores the value of RTS.
5674-5679
DEFM "RI " 52 49 20 20 20 20
Parameter table entry 16: the keyword RI, the input signal RI (ON or OFF).
567A-567B
DEFW 5477H 77 54
Entry 16: 5477H, the operand of the LD HL at 5476H, where @PARAM stores the value of RI.
567C-5681
DEFM "CD " 43 44 20 20 20 20
Parameter table entry 17: the keyword CD, the input signal CD (ON or OFF).
5682-5683
DEFW 5487H 87 54
Entry 17: 5487H, the operand of the LD HL at 5486H, where @PARAM stores the value of CD.
5684-5689
DEFM "DSR " 44 53 52 20 20 20
Parameter table entry 18: the keyword DSR, the input signal DSR (ON or OFF).
568A-568B
DEFW 547FH 7F 54
Entry 18: 547FH, the operand of the LD HL at 547EH, where @PARAM stores the value of DSR.
568C-5691
DEFM "CTS " 43 54 53 20 20 20
Parameter table entry 19: the keyword CTS, the input signal CTS (ON or OFF).
5692-5693
DEFW 548FH 8F 54
Entry 19: 548FH, the operand of the LD HL at 548EH, where @PARAM stores the value of CTS.
5694-5699
DEFM "DEFAUL" 44 45 46 41 55 4C
Parameter table entry 20: the keyword DEFAUL, DEFAULT (the first six letters), the factory settings.
569A-569B
DEFW 5252H 52 52
Entry 20: 5252H, the operand of the LD DE at 5251H, where @PARAM stores the value of DEFAUL.
569C
DEFB 00H 00
00H, the end of the parameter table, the last byte of the member.