2400H - Member 1 (FREE): Entry and Exit
SYS1/SYS runs FREE with request 22H; its header (file offset 0021H: record 00H, byte 7FH) points at member 1, which the overlay loader reads to 2400H-2822H, one stretch of 1059 bytes in five load blocks, and calls at 2400H with Register Pair HL at the text after the word FREE. FREE shows, for every drive or for one, the header line with the disk name, date, free and total space and free and possible files; FREE :d adds a map of the drive's granules and a footer with the media. The GAT and the HIT of the drive are read to GAT (2900H) and HIT (2A00H), the map lines are built in LINBUF (2B00H-2B4FH); none of these has bytes in the file. The entry keeps the Stack Pointer, so that a BREAK or an error deep in the code leaves at the entry's depth. The 631 changes: the entry and exit (the Stack Pointer kept before BREAK is tested, the return code made by SBC HL,HL from the Carry flag), the JR C dropped after the SUB 30H at CKIFDRV (2450H), LD D,B and LD E,B for LD DE,0 (25A7H), ABORT through ABORT1 (2681H), and the number conversions CVT2D to CVT5D made calls of @HEXD (2685H); the space in K keeps its five places (CALCK, 270DH, now CVT5D instead of 6.3.0's CVTDEC).
2400
LD (2411H),SP ED 73 11 24
FREEMAP: FREE's entry (request 22H): store the Stack Pointer into 2411H-2412H, the operand of the LD SP at SAVESP (2410H), so that every exit returns at the depth of the entry (a 631 change).
2404
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (a 631 change: source, see if break down).
2406
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was.
2407
SCF 37
Set the Carry flag: if BREAK was pressed, ABORT1 makes the return code FFFFH from it; SCF leaves the Z flag of @CKBRKC (a 631 change).
2408
If BREAK was pressed (NZ) jump to ABORT1 at 240EH with the Carry flag set: FFFFH, nothing shown (a 631 change: source, abort).
240A
Call FREE at 2422H, which shows the free space; it returns here only when it ends with no BREAK and no error (a 631 change).
240DEXIT
XOR A AF
EXIT: XOR Register A with itself: the Carry flag is cleared, for the return code 0000H; MAP's no diskette exit (24A5H) and the end of the map (250CH) jump here, and the list of every drive returns here by its RET at 2490H (a 631 change: source, clear Cflag).
240EABORT1
SBC HL,HL ED 62
ABORT1: subtract Register Pair HL and the Carry from itself with SBC: Register Pair HL = 0000H with the Carry clear, FFFFH with it set, the return code (a 631 change).
2410SAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 2411H-2412H, the value stored at 2400H (0000H in the file); IOERR jumps here with Register Pair HL = the error number (a 631 change).
2413
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, to clear a BREAK that ended the display (a 631 change: source, clear BREAK).
2415
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): a pending BREAK is cleared, so that it does not end the next command too.
2416
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or to the caller of @CMNDR, with Register Pair HL = 0000H, FFFFH or the error number.
2417IOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number: 14H or 16H for a GAT or HIT read error, 20H Illegal drive number, 2CH Parameter error, or that of a character I/O SVC (source: set HL = error #).
2418
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
241A
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: short error - & RETurn).
241C
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR (source: stuff error # in C).
241D
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message (source: display error).
241F
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short message of Register C.
2420
Jump to SAVESP at 2410H, which restores the Stack Pointer of the entry and returns with Register Pair HL = the error number (source: exit).
2422H - FREE: the Parameter and the Drive
FREE keeps the address of SFLAG$ for the page pause, looks along the line for an opening parenthesis and, when one is found, lets @PARAM read P (print) from PRMTBL$ (281CH). The first character on the line then chooses: anything below 29H, the closing parenthesis (the carriage return, the opening parenthesis, a space), lists every drive; a digit 0 to 7, or a colon and the digit, maps that drive; anything else is Illegal drive number. Characters after the digit are not looked at (FREE :12 maps drive 1).
2422FREE
LD A,65H 3E 65
FREE: load Register A with 65H, SVC 101, @FLAGS, which returns the address of the system flags (source: IY => system flags).
2424
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
2425
LD DE,0012H 11 12 00LD DE,SFLAG$
Load Register Pair DE with 0012H, the offset of SFLAG$ in the flag table (source: DE => offset to SFLAG$).
2428
ADD IY,DE FD 19
Add Register Pair DE, 0012H, to Index Register IY: IY = 007CH, SFLAG$ (source: IY => SFLAG$).
242A
LD (2667H),IY FD 22 67 26
Store Index Register IY, 007CH, at 2667H-2668H, the operand of the LD A at SFLAG1 (2666H), which tests the DO flag before a page pause (source: save for later test).
242E
PUSH HL E5
Save Register Pair HL, the place in the command line after the word FREE, on the stack (source: save command ptr).
242FSKPLP
LD A,(HL) 7E
SKPLP: load Register A with the byte at Register Pair HL, the next character of the line (source: p/u char).
2430
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of a parameter list (source: parameter(s) ?).
2432
If Register A is the parenthesis (Z) jump to GETPRMS at 243BH, with Register Pair HL at it (source: yes - get parameters).
2434
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends the line (source: end of line ?).
2436
If Register A is the carriage return (Z) jump to GETHL at 2441H with the Z flag set: no parameters (source: recover command ptr).
2438
INC HL 23
Increment Register Pair HL to the next character of the line (source: bump ptr).
2439
Jump back to SKPLP at 242FH: the drive spec, if any, is passed over (source: no - go til terminator).
243BGETPRMS
LD DE,281CH 11 1C 28LD DE,PRMTBL$
GETPRMS: load Register Pair DE with 281CH, PRMTBL$, the parameter table in the enhanced format, which holds P alone (source: DE => parameter table).
243E
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads the list at Register Pair HL.
2440
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): Z when every word was found; P puts FFFFH into 2646H, the operand at PPARM; NZ with Register A = 2CH, Parameter error.
2441GETHL
POP HL E1
GETHL: restore Register Pair HL, the place in the command line after the word FREE, from the stack; the flags are kept (source: recover cmdline ptr).
2442
If @PARAM returned NZ jump to IOERR at 2417H with Register A = 2CH: Parameter error (source: NZ - parameter error).
2445
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character after the word FREE and its spaces (source: p/u first character).
2446
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis: the carriage return, the opening parenthesis and the signs below them mean that no drive was named (source: end of line ?).
2448
If Register A is below 29H (Carry) jump to FREE0 at 245BH, which lists every drive (source: display lines).
244A
CP 3AH FE 3A
Compare Register A with 3AH, the colon before a drive number (source: drivspec ?).
244C
If Register A is not the colon (NZ) jump to CKIFDRV at 2450H: the drive number may be given without it (source: no - check if numeric).
244E
INC HL 23
Increment Register Pair HL past the colon (source: yes - p/u next char).
244F
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the colon.
2450CKIFDRV
SUB 30H D6 30
CKIFDRV: subtract 30H from Register A: the digits 0 to 7 become 00H to 07H, the characters below the digit 0 wrap round to D0H-FFH; 6.3.0 had a JR C here, dropped in 631 as the CP below catches them (source: legal drive number ?).
2452
CP 08H FE 08
Compare Register A with 08H: a drive number is below 8.
2454
If Register A is below 08H (Carry) jump to MAP at 2491H with Register A = the drive number (source: less than 8 - good).
2456ILDRNUM
LD A,20H 3E 20
ILDRNUM: load Register A with 20H, error 32, Illegal drive number; MAP jumps here for a drive that is not enabled (source: "Illegal Drive Number").
2458
Jump to IOERR at 2417H, which shows the short message and returns 0020H (source: display & abort).
245BH - FREE0 and FREE1: Every Drive
With P a space and a carriage return go to the printer first. Then for each drive 0 to 7 whose DCT is enabled (C3H, a JP, at DCT+0): @CKDRV tests that a diskette is in it, and the header line (GETINFO) or Drive :d [No Disk] is shown. A drive that is not enabled is passed over with nothing shown.
245BFREE0
LD HL,(2646H) 2A 46 26
FREE0: load Register Pair HL with the word at 2646H-2647H, the operand of PPARM's LD DE (2645H): FFFFH when P was given, 0000H otherwise (source: p/u P parm).
245E
INC L 2C
Increment Register L, the low byte of the value of P: Z only for FFH, P given (source: specified ?).
245F
If P was not given (NZ) jump to FREE0A at 246BH (source: no - don't PRINT).
2461
LD C,20H 0E 20
Load Register C with 20H, a space, for @PRT (source: output space).
2463
Call PRT at 273FH, which sends Register C to the printer with @PRT (source: to printer).
2466
LD C,0DH 0E 0D
Load Register C with 0DH, a carriage return, for @PRT (source: output C/R).
2468
Call PRT at 273FH to send the carriage return: the printed list starts on a line of its own (source: to printer).
246BFREE0A
LD C,00H 0E 00
FREE0A: load Register C with 00H, the first drive (source: init drive # to 0).
246DFREE1
PUSH BC C5
FREE1: save Register Pair BC on the stack, Register C the drive number (source: save drive #).
246E
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which returns the address of the drive's DCT (source: IY => DCT).
2470
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the DCT of the drive in Register C, 0470H plus ten times the drive number.
2471
LD A,(IY+00H) FD 7E 00
Load Register A with DCT+0 (IY+00H), Index Register IY holding the DCT's address: C3H, a JP to the driver, when the drive is enabled, C9H when it is not (source: drive on line ?).
2474
CP 0C3H FE C3
Compare Register A with C3H, the JP of an enabled drive.
2476
If the drive is not enabled (NZ) jump to NXTDRV at 248AH: nothing is shown for it (source: no - get next drive).
2478
LD A,21H 3E 21
Load Register A with 21H, SVC 33, @CKDRV, which tests that the drive holds a diskette (source: disk in drive ?).
247A
RST 28H EF
Call @CKDRV with RST 28H (SYS2/SYS) for the drive in Register C: Z when it is ready; the Carry flag for a write protected diskette is not looked at.
247B
PUSH AF F5
Save Register Pair AF on the stack: the flags of @CKDRV (source: save @CKDRV condition).
247C
Call CKBREAK at 267DH, which leaves through ABORT with FFFFH if BREAK was pressed (source: check BREAK).
247F
POP AF F1
Restore Register Pair AF from the stack: the flags of @CKDRV (source: recover @CKDRV cond).
2480
If the drive holds a diskette (Z) jump to DOINF at 2487H (source: disk in - use header).
2482
Call NO_DISK at 264EH, which shows Drive :d [No Disk] for the drive in Register C (source: no - display No Disk).
2485
Jump to NXTDRV at 248AH for the next drive (source: get next drive).
2487DOINF
DOINF: call GETINFO at 250FH, which reads the GAT and the HIT and shows the header line of the drive in Register C (source: display header string).
248ANXTDRV
POP BC C1
NXTDRV: restore Register Pair BC from the stack, Register C the drive number (source: C = drive #).
248B
INC C 0C
Increment Register C to the next drive (source: inc it).
248C
BIT 3,C CB 59
Test bit 3 of Register C: set when Register C has reached 08H, after drive 7 (source: finished ?).
248E
If bit 3 is clear (Z) jump back to FREE1 at 246DH for the next drive (source: no - get next drive).
2490
RET C9
Return to 240DH, EXIT, after drive 7: the return code 0000H (source: finished - RETurn).
2491H - MAP: the Map of One Drive
For FREE :d the drive must be enabled (else Illegal drive number) and hold a diskette (else Drive :d [No Disk] and the return code 0000H). The header line is followed by a line of dashes, then the map: each line starts with the cylinder numbers it covers ( 0- 7 first, from MTRK) and holds eight cylinders, nine columns each, from LINBUF+8 (2B08H); a granule is shown as x when it is in use, as a point when it is free, as an asterisk when it is locked out (floppies only), and the directory cylinder as a D for each granule. A line of dashes and the footer with the media end it. The nine columns hold at most nine granules: with ten or more the step is taken as a byte, so each next cylinder starts 265 bytes after the one before, outside the line (B147). The first line's numbers are the fixed text MTRK, whatever the drive's size (B151).
2491MAP
LD C,A 4F
MAP: load Register C with Register A, the drive number 0 to 7 (source: xfer drive # to C).
2492
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which returns the address of the drive's DCT (source: IY => DCT + 0).
2494
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the DCT of the drive in Register C.
2495
LD A,(IY+00H) FD 7E 00
Load Register A with DCT+0 (IY+00H), Index Register IY holding the DCT's address: C3H for an enabled drive, C9H otherwise (source: p/u enable/disable).
2498
CP 0C3H FE C3
Compare Register A with C3H, the JP of an enabled drive (source: drive enabled ?).
249A
If the drive is not enabled (NZ) jump to ILDRNUM at 2456H: Illegal drive number (source: no - illegal drive #).
249D
LD A,21H 3E 21
Load Register A with 21H, SVC 33, @CKDRV, which tests that the drive holds a diskette (source: disk in drive ?).
249F
RST 28H EF
Call @CKDRV with RST 28H (SYS2/SYS) for the drive in Register C: Z when it is ready; the Carry flag for a write protected diskette is not looked at.
24A0
If the drive holds a diskette (Z) jump to DISKIN at 24A8H (source: good - disk in drive).
24A2
Call NO_DISK at 264EH, which shows Drive :d [No Disk] for the drive in Register C (source: display No Disk).
24A5
Jump to EXIT at 240DH: the return code is 0000H, as for a map shown (source: go to exit routine).
24A8DISKIN
DISKIN: call CKBREAK at 267DH, which leaves through ABORT with FFFFH if BREAK was pressed (source: check for BREAK).
24AB
Call GETINFO at 250FH, which reads the GAT to 2900H and the HIT to 2A00H and shows the header line (source: get GAT, create header).
24AE
Call DISPUND at 26D9H, which fills LINBUF with dashes and shows it (source: display underline).
24B1
Call CLRLN at 266FH, which fills LINBUF, 2B00H-2B4EH, with spaces and ends it with a carriage return at 2B4FH (source: clear line buffer).
24B4
LD HL,2758H 21 58 27LD HL,MTRK
Load Register Pair HL with 2758H, MTRK, the text 0- 7, the cylinder numbers of the first line, fixed even for a drive of fewer than eight cylinders (B151) (source: initial track #s).
24B7
LD DE,2B00H 11 00 2BLD DE,LINBUF
Load Register Pair DE with 2B00H, LINBUF, the start of the line.
24BA
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the seven characters of the text (source: len track # display).
24BD
LDIR ED B0
Copy the seven characters from Register Pair HL, 2758H-275EH, to Register Pair DE, 2B00H-2B06H, with LDIR (Register Pair BC = 0007H, and 0000H after it).
24BF
LD HL,2900H 21 00 29LD HL,GAT
Load Register Pair HL with 2900H, GAT, the first byte of the allocation map, that of cylinder 0 (source: pt to stored GAT).
24C2
DEC C 0D
Decrement Register C from 00H, left by the LDIR, to FFH: the cylinder number is minus one before the first increment (source: init cyl = -1).
24C3NEXTLIN
LD B,08H 06 08
NEXTLIN: load Register B with 08H, the cylinders of a line (TPL) (source: max track per line count).
24C5
LD IX,2B08H DD 21 08 2B
Load Index Register IX with 2B08H, LINBUF+8, the column of the first cylinder of the line, after the numbers (source: pt to display buffer).
24C9DSPSC
INC C 0C
DSPSC: increment Register C, the cylinder to show (source: current cylinder).
24CA
Call DFRE at 2697H, which writes the granules of cylinder C, from its GAT byte at Register Pair HL, at Index Register IX and moves IX past them (source: display free grans).
24CD
INC HL 23
Increment Register Pair HL to the GAT byte of the next cylinder (source: pt to next track).
24CE
LD A,(IY+06H) FD 7E 06
Load Register A with DCT+6 (IY+06H), Index Register IY holding the DCT's address: the highest cylinder number of the drive (source: p/u max cylinder).
24D1
CP C B9
Compare Register A with Register C, the cylinder just shown (source: finished ?).
24D2
If it was the last cylinder (Z) jump to ENDRET at 24F1H, which shows the line and the footer (source: yes - display footer).
24D4
LD A,(2699H) 3A 99 26
Load Register A with the byte at 2699H, the operand of GRANS (2698H): the granules of a cylinder, stored at 2563H (source: p/u grans/cyl).
24D7
NEG ED 44
Negate Register A: minus the number of granules.
24D9
ADD A,09H C6 09
Add 09H to Register A: 9 less the granules, the columns from the end of this cylinder to the next; for ten to sixteen granules it wraps round to F9H-FFH (B147) (source: A = offset to next).
24DB
LD D,00H 16 00
Load Register D with 00H, the high byte of the offset, which is never negative (source: stuff in DE).
24DD
LD E,A 5F
Load Register E with Register A: Register Pair DE = 9 less the granules, as a number 0 to 255.
24DE
ADD IX,DE DD 19
Add Register Pair DE to Index Register IX: IX = the column of the next cylinder, nine after the start of this one when there are nine or fewer granules (source: where to dsp next track).
24E0
Decrement Register B and jump back to DSPSC at 24C9H while it is not zero: eight cylinders to a line (source: loop current 6 trks).
24E2
PUSH HL E5
Save Register Pair HL, the GAT byte of the next cylinder, on the stack (source: save buffer loc'n).
24E3
PUSH BC C5
Save Register Pair BC on the stack, Register C the last cylinder shown (source: save current cyl).
24E4
Call DSPLINE at 263CH, which shows LINBUF (2B00H) (source: display current line).
24E7
Call CLRLN at 266FH, which fills LINBUF with spaces again (source: clear line buffer).
24EA
POP BC C1
Restore Register Pair BC from the stack, Register C the last cylinder shown (source: recover cylinder # in C).
24EB
Call DSPTRK at 26E1H, which writes the numbers of the next line's cylinders, from C+1, at the start of LINBUF (source: calc new track #'s).
24EE
POP HL E1
Restore Register Pair HL, the GAT byte of the next cylinder, from the stack (source: restore GAT pointer).
24EF
Jump back to NEXTLIN at 24C3H for the next line (source: get next line).
24F1ENDRET
ENDRET: call DSPLINE at 263CH, which shows the last line of the map, with the cylinders in it so far (source: display tracks in buffer).
24F4
Call DISPUND at 26D9H, which shows a line of dashes under the map (source: display underline).
24F7
LD HL,27AFH 21 AF 27LD HL,FOOTER
Load Register Pair HL with 27AFH, FOOTER, the line Type => and the media (source: HL => footer message).
24FA
Call DSPMSG at 263FH, which shows the footer (and prints it with P); Register Pair HL comes back at 27AFH, or at 2B4FH after a page pause (source: display footer string).
24FD
LD A,(265BH) 3A 5B 26
Load Register A with the byte at 265BH, the operand of CKPAGE (265AH): the lines left before the next page pause (source: p/u # of lines left).
2500
CP 02H FE 02
Compare Register A with 02H: at least two lines left on the page (source: at least 2 lines left?).
2502
If two or more lines are left (No Carry) jump to FRET at 2507H; with P the count stays 16H and FREE does not wait (source: Lprint, free to return).
2504
Call KEY at 2733H, which waits for a key with @KEY, so that the footer is seen before the screen scrolls; SFLAG$ bit 5 is not tested here, and the empty line after it brings CKPAGE's count to 0, a second wait (B150) (source: wait for char).
2507FRET
LD (HL),0DH 36 0D
FRET: store 0DH, a carriage return, at Register Pair HL, the first byte of the footer (27AFH) or the end of LINBUF: an empty line (source: scroll).
2509
Call DSPMSG at 263FH, which shows the empty line at Register Pair HL (source: display line).
250C
Jump to EXIT at 240DH: the return code 0000H (source: go to normal exit).
250FH - GETINFO: the Header Line
GETINFO reads the GAT (sector 0 of the directory cylinder) to 2900H and the HIT (sector 1) to 2A00H with @RDSSC, and fills the header line: the drive number, the disk name and date from the GAT (D0H-DFH), the free and the total space in K with two decimals, and the free and the possible files. The sizes come from the DCT: DCT+8 bits 4-0 the sectors of a granule less one, bits 7-5 the granules of a side of a cylinder less one (doubled when DCT+4 bit 5 says two sided), DCT+6 the highest cylinder. The sectors of a cylinder are worked out by @MUL8 in eight bits (exactly 256 is caught at 2588H), so a drive with more than 256 would be shown wrong (B146). The footer gets the media: 5 or 8 inch (DCT+3 bit 5), Floppy or Hard (bit 3), the heads (DCT+7 bits 7-5 for a hard drive, 1 or 2 sides for a floppy) and SINGLE, DOUBLE or RIGID density (bit 6).
250FGETINFO
LD A,C 79
GETINFO: load Register A with Register C, the drive number 0 to 7 (source: p/u drive #).
2510
ADD A,30H C6 30
Add 30H to Register A: the drive number as a digit (source: convert to ASCII).
2512
LD (2766H),A 32 66 27LD (HDRIVE),A
Store Register A at 2766H, HDRIVE, the d after Drive : in the header line (source: stuff into header string).
2515
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which returns the address of the drive's DCT (source: IY => DCT+0).
2517
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the DCT of the drive in Register C.
2518
LD D,(IY+09H) FD 56 09
Load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: p/u directory cylinder).
251B
LD E,00H 1E 00
Load Register E with 00H: sector 0 of the directory cylinder, the GAT (source: sector zero).
251D
LD HL,2900H 21 00 29LD HL,GAT
Load Register Pair HL with 2900H, GAT, the 256 byte buffer after the member (source: HL => GAT I/O buffer).
2520
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, which reads a sector of the directory cylinder (source: read system sector).
2522
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): the GAT into 2900H-29FFH for the drive in Register C, cylinder in Register D, sector in Register E; Z when it was read.
2523
LD A,14H 3E 14
Load Register A with 14H, error 20, GAT read error; the LD leaves the flags of @RDSSC (source: init to "GAT read error").
2525DERR
DERR: if the read failed (NZ) jump to IOERR at 2417H with Register A = 14H, or 16H from 2532H: the message and its number as the return code (source: jump on GAT read error).
2528
Call CKBREAK at 267DH, which leaves through ABORT with FFFFH if BREAK was pressed (source: check for BREAK).
252B
INC E 1C
Increment Register E to 01H, sector 1 of the directory cylinder, the HIT (source: sector 1).
252C
INC H 24
Increment Register H: Register Pair HL = 2A00H, HIT, the buffer after the GAT (source: HL => HIT I/O buffer).
252D
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, to read the HIT (source: read system sector).
252F
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): the HIT into 2A00H-2AFFH; Z when it was read.
2530
LD A,16H 3E 16
Load Register A with 16H, error 22, HIT read error; the LD leaves the flags of @RDSSC (source: init to "HIT read error").
2532
If the read failed (NZ) jump back to DERR at 2525H, which goes on to IOERR with Register A = 16H (source: go to error handler).
2534
Call CKBREAK at 267DH, which leaves through ABORT with FFFFH if BREAK was pressed (source: check for BREAK).
2537
LD A,(IY+08H) FD 7E 08
Load Register A with DCT+8 (IY+08H), Index Register IY holding the DCT's address: bits 4-0 hold the sectors of a granule less one (source: bits 4-0 contain #).
253A
AND 1FH E6 1F
AND Register A with 1FH: the sectors of a granule less one, 0 to 31 (source: of sectors/granule).
253C
INC A 3C
Increment Register A: the sectors of a granule, 1 to 32 (source: adjust for zero offset).
253D
PUSH AF F5
Save Register Pair AF on the stack: Register A, the sectors of a granule (source: save sectors/granule).
253E
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H: Register H, Register L and Register A, 00H, 00H and the sectors of a granule, are the 24 bit number that CALCK2 takes (source: set HLA = # sec/gran).
2541
LD DE,27F8H 11 F8 27LD DE,FGRAN
Load Register Pair DE with 27F8H, FGRAN, the place of the size of a granule in the footer (source: DE => destination).
2544
LD BC,2685H 01 85 26LD BC,CVT2D
Load Register Pair BC with 2685H, CVT2D, the conversion to two places, as a granule is at most 8K (source: only 2 digits possible).
2547
Call CALCK2 at 2710H, which writes the sectors in Register A as K with two decimals at 27F8H, nn.nn (source: convert to K).
254A
POP AF F1
Restore Register Pair AF from the stack: Register A, the sectors of a granule (source: A = sectors/granule).
254B
LD E,A 5F
Load Register E with Register A, the sectors of a granule, the multiplicand for @MUL8 (source: xfer to E).
254C
LD L,(IY+06H) FD 6E 06
Load Register L with DCT+6 (IY+06H), Index Register IY holding the DCT's address: the highest cylinder number (source: p/u # of cylinders).
254F
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the highest cylinder number (source: msb = 0).
2551
INC HL 23
Increment Register Pair HL: the number of cylinders, 1 to 256 (source: relative to zero).
2552
PUSH AF F5
Save Register Pair AF on the stack again: Register A, the sectors of a granule, for the free space at 25BDH (source: save # of sectors/gran).
2553
LD A,(IY+08H) FD 7E 08
Load Register A with DCT+8 (IY+08H), Index Register IY holding the DCT's address: bits 7-5 hold the granules of a cylinder side less one (source: bits 7-5 contain).
2556
AND 0E0H E6 E0
AND Register A with E0H: bits 7-5 alone (source: # of granules/cylinder).
2558
RLCA 07
Rotate Register A left one bit, the first of three that move bits 7-5 into bits 2-0 (source: & shift to bits 0-2).
2559
RLCA 07
Rotate Register A left one more bit: bits 7-5 of DCT+8 are now in bits 0 and 7-6.
255A
RLCA 07
Rotate Register A left a third time: the granules of a side less one in bits 2-0, 0 to 7.
255B
INC A 3C
Increment Register A: the granules of a side, 1 to 8 (source: adjust for zero offset).
255C
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of DCT+4 (IY+04H), Index Register IY holding the DCT's address: set for a two sided drive (source: double sided?).
2560
If the drive is one sided (Z) jump to FREE2 at 2563H (source: bypass if one-sided).
2562
ADD A,A 87
Add Register A to itself: two sides hold twice the granules of a cylinder, 2 to 16 (source: else double the count).
2563FREE2
LD (2699H),A 32 99 26
FREE2: store Register A, the granules of a cylinder, at 2699H, the operand of GRANS (2698H), read by DFRE and at 24D4H (source: save # grans/cyl).
2566
LD C,A 4F
Load Register C with Register A, the granules of a cylinder, for @MUL8 (source: save in C for @MULT8).
2567
LD A,5AH 3E 5A
Load Register A with 5AH, SVC 90, @MUL8; the dispatcher gives the routine Register C in Register A (source: mult E x C).
2569
RST 28H EF
Call @MUL8 with RST 28H (SYS0/SYS): Register A = Register C times Register E, the sectors of a cylinder, in eight bits only: 256 gives 00H and more than 256 their excess over a multiple of 256 (B146).
256A
PUSH AF F5
Save Register Pair AF on the stack: Register A, the sectors of a cylinder (source: save # sectors/cyl).
256B
PUSH HL E5
Save Register Pair HL, the number of cylinders, on the stack (source: save # cylinders).
256C
LD HL,0100H 21 00 01
Load Register Pair HL with 0100H, 256, the most files a directory can hold, the 256 bytes of the HIT (source: 256 files maximum).
256F
SUB 02H D6 02
Subtract 02H from Register A: the sectors of the directory cylinder less the GAT and the HIT, the sectors of directory entries (source: set A = # secs in dir).
2571
CP 20H FE 20
Compare Register A with 20H, 32: 32 sectors of eight entries fill the 256 of the HIT (source: greater than 32 ?).
2573
If Register A is 32 or more (No Carry; also 00H and 01H sectors, which wrap to FEH and FFH) jump to FREE3 at 257BH with 256 files (source: yes - use default of 256).
2575
ADD A,A 87
Add Register A to itself: the directory sectors times 2 (source: multiply # of sectors).
2576
ADD A,A 87
Add Register A to itself again: times 4 (source: in directory by 8).
2577
ADD A,A 87
Add Register A to itself a third time: times 8, the directory entries, eight in a sector (source: to get # of slots).
2578
LD L,A 6F
Load Register L with Register A, the number of directory entries (source: stuff in HL).
2579
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the number of directory entries, below 256.
257BFREE3
LD (2617H),HL 22 17 26
FREE3: store Register Pair HL, the possible files, at 2617H-2618H, the operand of FREE7's LD DE (2616H) (source: file slots to test later).
257E
LD DE,27ABH 11 AB 27LD DE,HPOSSF
Load Register Pair DE with 27ABH, HPOSSF, the place of the possible files in the header (source: DE => destination).
2581
Call CVT3D at 2689H, which writes Register Pair HL in three places at 27ABH-27ADH (source: cvt HL to ASCII @ DE).
2584
POP HL E1
Restore Register Pair HL, the number of cylinders, from the stack (source: recover # of cylinders).
2585
POP AF F1
Restore Register Pair AF from the stack: Register A, the sectors of a cylinder (source: rcvr # of sectors/cyl).
2586
LD C,A 4F
Load Register C with Register A, the sectors of a cylinder, the multiplier for @MUL16 (source: set C = sec/cyl).
2587
OR A B7
OR Register A with itself: Z when the sectors of a cylinder came out as 00H, 256.
2588
If Register A is 00H (Z) jump to SKIPMUL at 258DH: Register Pair HL and Register A, the cylinders and 00H, are then the cylinders times 256 as CALCK reads them (source: don't multiply if zero).
258A
LD A,5BH 3E 5B
Load Register A with 5BH, SVC 91, @MUL16; the dispatcher gives the routine Register C in Register A (source: multiply HL x C).
258C
RST 28H EF
Call @MUL16 with RST 28H (BOOT/SYS): Register H, Register L and Register A = Register Pair HL times Register C, the sectors of the drive, high byte first.
258DSKIPMUL
LD DE,2794H 11 94 27LD DE,HPOSSK
SKIPMUL: load Register Pair DE with 2794H, HPOSSK, the place of the total space in the header (source: DE => destination).
2590
Call CALCK at 270DH, which writes the sectors in Register L and Register A as K, nnnnn.nn, at 2794H (source: stuff into string).
2593
LD HL,29D0H 21 D0 29
Load Register Pair HL with 29D0H, GAT+D0H, the disk name, eight characters (source: HL => pack name).
2596
LD DE,2769H 11 69 27LD DE,HNAME
Load Register Pair DE with 2769H, HNAME, the place of the name in the header (source: DE => string destination).
2599
LD C,08H 0E 08
Load Register C with 08H: Register B is 00H after CALCK's LDIR, so Register Pair BC = 0008H (source: 8 chars to xfer).
259B
LDIR ED B0
Copy the name from Register Pair HL, 29D0H-29D7H, to Register Pair DE, 2769H-2770H, with LDIR (Register Pair BC = 0008H); Register Pair HL ends at 29D8H, GAT+D8H.
259D
LD DE,2773H 11 73 27LD DE,HDATE
Load Register Pair DE with 2773H, HDATE, the place of the date in the header (source: DE => destination).
25A0
LD C,08H 0E 08
Load Register C with 08H, Register Pair BC = 0008H, the eight characters of the date (source: 8 chars to xfer).
25A2
LDIR ED B0
Copy the date from Register Pair HL, 29D8H-29DFH, GAT+D8H, to Register Pair DE, 2773H-277AH, with LDIR (Register Pair BC = 0008H, and 0000H after it).
25A4
LD HL,2900H 21 00 29LD HL,GAT
Load Register Pair HL with 2900H, GAT, the allocation byte of cylinder 0 (source: pt to start of GAT).
25A7
LD D,B 50
Load Register D with Register B, 00H after the LDIR (a 631 change: source, init gran counter (B=0)).
25A8
LD E,B 58
Load Register E with Register B, 00H: Register Pair DE = 0000H, the free granules counted (a 631 change for LD DE,0).
25A9
LD A,(29CCH) 3A CC 29
Load Register A with the byte at 29CCH, GAT+CCH, the cylinders in excess of 35 (source: p/u cyl excess).
25AC
ADD A,23H C6 23
Add 23H, 35, to Register A: the cylinders of the diskette by its GAT (source: add base).
25AE
LD B,A 47
Load Register B with Register A, the cylinders, the count of GAT bytes to look at (source: set loop counter).
25AFFREE4
LD A,(HL) 7E
FREE4: load Register A with the byte at Register Pair HL, the allocation byte of a cylinder, one bit for each granule, 1 for in use (source: p/u GAT byte & set).
25B0FREE5
SCF 37
FREE5: set the Carry flag, so that the RRA shifts a 1 into bit 7 (source: carry so bit 7 stays 1).
25B1
RRA 1F
Rotate Register A right through the Carry: the bit of the next granule goes into the Carry, a 1 comes into bit 7 (source: slide gran bit to carry).
25B2
If the granule is in use (Carry) jump to FREE6 at 25B5H (source: ignore if in use).
25B4
INC DE 13
Increment Register Pair DE, the free granules (source: free, bump gran counter).
25B5FREE6
CP 0FFH FE FF
FREE6: compare Register A with FFH: when only 1 bits are left the rest of the byte holds no free granule (the granules a cylinder does not have are 1 in the GAT) (source: end of byte?).
25B7
If Register A is not FFH (NZ) jump back to FREE5 at 25B0H for the next bit (source: loop if not).
25B9
INC L 2C
Increment Register L to the allocation byte of the next cylinder (source: bump GAT byte pointer).
25BA
Decrement Register B and jump back to FREE4 at 25AFH while it is not zero (source: loop for # cyls).
25BC
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the free granules (source: xfer # grans to HL).
25BD
POP AF F1
Restore Register Pair AF from the stack: Register A, the sectors of a granule, saved at 2552H (source: rcvr # of sectors/gran).
25BE
LD C,A 4F
Load Register C with Register A, the sectors of a granule, the multiplier for @MUL16 (source: put in C for @MUL16).
25BF
LD A,5BH 3E 5B
Load Register A with 5BH, SVC 91, @MUL16; the dispatcher gives the routine Register C in Register A (source: multiply HL x C).
25C1
RST 28H EF
Call @MUL16 with RST 28H (BOOT/SYS): Register H, Register L and Register A = the free granules times the sectors of a granule, the free sectors.
25C2
LD DE,278AH 11 8A 27LD DE,HFREEK
Load Register Pair DE with 278AH, HFREEK, the place of the free space in the header (source: cvrt to decimal).
25C5
Call CALCK at 270DH, which writes the free sectors as K, nnnnn.nn, at 278AH (source: cvrt to ASCII & stuff).
25C8
LD A,35H 3E 35
Load Register A with 35H, the digit 5, for 5 1/4 inch media (source: init 5"/8" media).
25CA
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of DCT+3 (IY+03H), Index Register IY holding the DCT's address: set for an 8 inch drive (source: test DCT for size).
25CE
If the bit is clear (Z) jump to FIVEIN at 25D2H with the 5 (source: go if 5").
25D0
LD A,38H 3E 38
Load Register A with 38H, the digit 8, for 8 inch media (source: else reset to 8").
25D2FIVEIN
LD (27B8H),A 32 B8 27LD (FSIZE),A
FIVEIN: store Register A, 5 or 8, at 27B8H, FSIZE, after Type => in the footer (source: stuff size into header).
25D5
LD A,(IY+07H) FD 7E 07
Load Register A with DCT+7 (IY+07H), Index Register IY holding the DCT's address: for a hard drive bits 7-5 hold the heads less one (source: bits 7-5 = # heads).
25D8
RLCA 07
Rotate Register A left one bit, the first of three that move bits 7-5 into bits 2-0 (source: shift to 0-2).
25D9
RLCA 07
Rotate Register A left one more bit: bits 7-5 are now in bits 0 and 7-6.
25DA
RLCA 07
Rotate Register A left a third time: the heads less one in bits 2-0.
25DB
AND 07H E6 07
AND Register A with 07H: the heads less one alone, 0 to 7 (source: mask off other junk).
25DD
INC A 3C
Increment Register A: the heads, 1 to 8 (source: relative to zero).
25DE
OR 30H F6 30
OR Register A with 30H: the heads as a digit, 1 to 8 (source: make it ASCII).
25E0
LD (27CDH),A 32 CD 27LD (FHEADS),A
Store Register A at 27CDH, FHEADS, after Heads = in the footer; a floppy has it replaced at 2602H (source: stuff into header).
25E3
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of DCT+3 (IY+03H), Index Register IY holding the DCT's address: set for a hard drive (source: check if hard).
25E7
If the drive is a floppy (Z) jump to DOSIDES at 25F9H (source: not hard - check sides).
25E9
LD HL,2752H 21 52 27LD HL,HARD
Load Register Pair HL with 2752H, HARD, the text Hard and two spaces (source: HL => "Hard ").
25EC
LD DE,27BBH 11 BB 27LD DE,FTYPE
Load Register Pair DE with 27BBH, FTYPE, the place of Floppy in the footer (source: DE => dest in footer).
25EF
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six characters to copy (source: BC = 6 chars to xfer).
25F2
LDIR ED B0
Copy Hard and its two spaces from Register Pair HL, 2752H-2757H, to Register Pair DE, 27BBH-27C0H, over Floppy, with LDIR (Register Pair BC = 0006H) (source: transfer to footer).
25F4
LD HL,274CH 21 4C 27LD HL,RIGID
Load Register Pair HL with 274CH, RIGID, the text RIGID and a space, for the density (source: HL => "RIGID").
25F7
Jump to D3 at 260EH, which copies it over SINGLE (source: xfer "RIGID" to footer).
25F9DOSIDES
LD A,31H 3E 31
DOSIDES: load Register A with 31H, the digit 1, one side (source: init # of sides).
25FB
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of DCT+4 (IY+04H), Index Register IY holding the DCT's address: set for a two sided drive (source: test DCT for sides).
25FF
If the drive is one sided (Z) jump to ONESIDE at 2602H with the 1 (source: go if 1-sides).
2601
INC A 3C
Increment Register A to 32H, the digit 2, two sides (source: else bump to 2).
2602ONESIDE
LD (27CDH),A 32 CD 27LD (FHEADS),A
ONESIDE: store Register A, 1 or 2, at 27CDH, FHEADS, after Heads = in the footer, over the value from DCT+7 (source: stuff into header).
2605
BIT 6,(IY+03H) FD CB 03 76
Test bit 6 of DCT+3 (IY+03H), Index Register IY holding the DCT's address: set for double density (source: test SDEN/DDEN).
2609
If the drive is single density (Z) jump to FREE7 at 2616H: SINGLE is already in the footer (source: single - that's default).
260B
LD HL,2746H 21 46 27LD HL,MDDEN
Load Register Pair HL with 2746H, MDDEN, the text DOUBLE (source: density MSG - double).
260ED3
LD DE,27DBH 11 DB 27LD DE,FDENS
D3: load Register Pair DE with 27DBH, FDENS, the place of SINGLE in the footer (source: density MSG dsp pos).
2611
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six characters to copy (source: 6 chars to xfer).
2614
LDIR ED B0
Copy DOUBLE or RIGID from Register Pair HL to Register Pair DE, 27DBH-27E0H, over SINGLE, with LDIR (Register Pair BC = 0006H) (source: move Double to cover).
2616FREE7
LD DE,0000H 11 00 00
FREE7: load Register Pair DE with the possible files, which 257BH stored at 2617H-2618H, the operand (0000H in the file) (source: p/u # of poss entries).
2619
LD HL,2A00H 21 00 2ALD HL,HIT
Load Register Pair HL with 2A00H, HIT+0, the first of the 256 HIT bytes, one for each directory entry (source: HL => HIT + 0).
261CFREE8
DEC DE 1B
FREE8: decrement Register Pair DE: every HIT byte is first taken as an entry that cannot be used, and given back below when it is free (source: dec count in case of SYS).
261D
LD A,(29CDH) 3A CD 29
Load Register A with the byte at 29CDH, GAT+CDH, the format byte: bit 7 set for a data diskette (source: bit 7 set if data disk).
2620
RLCA 07
Rotate Register A left one bit: bit 7 of the format byte goes into the Carry flag.
2621
If the diskette is a data diskette (Carry) jump to DATDISK at 2628H: no entry is kept for the system files (source: set - ignore SYS check).
2623
LD A,L 7D
Load Register A with Register L, the HIT position: bits 4-0 the directory sector less two, bits 7-5 the entry in it (source: p/u HIT offset).
2624
AND 0D8H E6 D8
AND Register A with D8H: Z for the positions 00H-07H and 20H-27H, entries 0 and 1 of the first eight directory sectors, kept for the system files (source: reserved slot ?).
2626
If the position is kept for the system files (Z) jump to FREE9 at 262DH: it is not counted as free (source: yes - can't use it).
2628DATDISK
LD A,(HL) 7E
DATDISK: load Register A with the byte at Register Pair HL, the HIT byte: 00H when the entry is free, else the hash of the file's name (source: file in use?).
2629
OR A B7
OR Register A with itself: Z when the entry is free.
262A
If the entry is in use (NZ) jump to FREE9 at 262DH (source: yes - don't bump count).
262C
INC DE 13
Increment Register Pair DE: the free entry is given back to the count (source: bump free count).
262DFREE9
INC L 2C
FREE9: increment Register L to the next HIT byte (source: bump HIT pointer).
262E
If Register L has not come back to 00H (NZ) jump back to FREE8 at 261CH: all 256 HIT bytes are looked at; those past the directory's entries are 00H and are given back too (source: loop if not through).
2630
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the free files (source: available files to HL).
2631
LD DE,27A7H 11 A7 27LD DE,HFREEF
Load Register Pair DE with 27A7H, HFREEF, the place of the free files in the header (source: cvrt to ASCII into msg).
2634
Call CVT3D at 2689H, which writes Register Pair HL in three places at 27A7H-27A9H (source: convert & RETurn).
2637
LD HL,275FH 21 5F 27LD HL,HEADER
Load Register Pair HL with 275FH, HEADER, the header line, Drive :d and the rest up to its carriage return at 27AEH (source: HL => header string).
263A
Jump to DSPMSG at 263FH, which shows the header line and returns to GETINFO's caller (source: display header & RETurn).
263CH - DSPLINE, DSPMSG, NO_DISK and CKPAGE: Show a Line
DSPMSG tests BREAK, shows the line at Register Pair HL with @DSPLY and, with P, prints it with @PRINT; without P it counts the lines of the screen and, after 22 lines and then every 23, waits for a key with @KEY, unless a DO file is running (SFLAG$ bit 5); after the footer of a map FREE may wait once more at 2504H (B150). After that wait it runs on into CLRLN, which empties LINBUF. NO_DISK shows Drive :d [No Disk].
263CDSPLINE
LD HL,2B00H 21 00 2BLD HL,LINBUF
DSPLINE: load Register Pair HL with 2B00H, LINBUF, the map line, and fall into DSPMSG (source: fall into display & RET).
263FDSPMSG
DSPMSG: call CKBREAK at 267DH, which leaves through ABORT with FFFFH if BREAK was pressed (source: check for BREAK).
2642
Call DSPLY at 2739H, which shows the line at Register Pair HL up to its carriage return with @DSPLY (source: display message to video).
2645PPARM
LD DE,0000H 11 00 00
PPARM: load Register Pair DE with the value of P, which @PARAM stored at 2646H-2647H, the operand: FFFFH for P, 0000H in the file (source: p/u P parm).
2648
INC E 1C
Increment Register E, the low byte of the value of P: Z only for FFH, P given (source: was it entered ?).
2649
If P was not given (NZ) jump to CKPAGE at 265AH, which counts the lines of the screen (source: no - check page pause).
264B
Jump to PRINT at 273CH, which prints the same line with @PRINT and returns to DSPMSG's caller: no page pause with P (source: output line to the printer).
264ENO_DISK
LD A,C 79
NO_DISK: load Register A with Register C, the drive number (source: p/u drive #).
264F
ADD A,30H C6 30
Add 30H to Register A: the drive number as a digit (source: cvt to ASCII).
2651
LD (2806H),A 32 06 28LD (NODISKN),A
Store Register A at 2806H, NODISKN, the d after Drive : in the message (source: stuff in string).
2654
LD HL,27FFH 21 FF 27LD HL,NODISK
Load Register Pair HL with 27FFH, NODISK, the message Drive :d [No Disk] (source: HL => message).
2657
Jump to DSPMSG at 263FH, which shows it and returns to NO_DISK's caller (source: display mess & RETurn).
265ACKPAGE
LD A,16H 3E 16
CKPAGE: load Register A with 16H, 22, the lines left on the screen; the operand at 265BH is counted down and set to 17H at each pause (source: ck for display pause).
265C
DEC A 3D
Decrement Register A, the lines left, for the line just shown (source: count down).
265D
LD (265BH),A 32 5B 26
Store Register A, the lines left, back at 265BH, the operand of CKPAGE's LD A (source: update).
2660
RET NZ C0
Return if lines are left (NZ): no pause yet (source: ret if not yet full).
2661
LD A,17H 3E 17
Load Register A with 17H, 23, the lines of a full screen less one, for the next page (source: max lines to print).
2663
LD (265BH),A 32 5B 26
Store Register A, 17H, at 265BH, the operand of CKPAGE's LD A: the count starts again (source: reset to max).
2666SFLAG1
LD A,(0000H) 3A 00 00
SFLAG1: load Register A with the byte at 007CH, SFLAG$, which 242AH stored as the operand at 2667H-2668H (0000H in the file) (source: p/u SFLAG$).
2669
AND 20H E6 20
AND Register A with 20H: bit 5 of SFLAG$, set while a DO file is running (source: DO in effect ?).
266B
RET NZ C0
Return if a DO file is running (NZ): nobody is there to press a key (source: yes - RETurn).
266C
Call KEY at 2733H, which waits for a key with @KEY; the key is not looked at, and BREAK is caught by the next CKBREAK (source: wait for key entry).
266FH - DISPHDR, CLRLN and BUFSTUF: Fill LINBUF
CLRLN fills the 79 bytes of LINBUF (2B00H-2B4EH) with spaces, BUFSTUF with the character in Register A, and both end it with a carriage return at 2B4FH; Register Pair HL returns at 2B4FH. CKBREAK leaves through ABORT when BREAK is pressed. CVT2D to CVT5D write Register Pair HL in decimal at Register Pair DE in two to five places with @HEXD.
266FDISPHDR / CLRLN
LD A,20H 3E 20
DISPHDR: CLRLN: load Register A with 20H, a space, the character to fill LINBUF with; CKPAGE runs on into here after a pause (source: clear buffer).
2671BUFSTUF
LD HL,2B00H 21 00 2BLD HL,LINBUF
BUFSTUF: load Register Pair HL with 2B00H, LINBUF, the line buffer after the HIT (source: point to buffer).
2674
LD B,4FH 06 4F
Load Register B with 4FH, 79, the length of the line (source: length of buffer).
2676CLRLN1
LD (HL),A 77
CLRLN1: store Register A, the fill character, at Register Pair HL (source: stuff with char given).
2677
INC HL 23
Increment Register Pair HL to the next byte of LINBUF.
2678
Decrement Register B and jump back to CLRLN1 at 2676H while it is not zero: 2B00H-2B4EH are filled.
267A
LD (HL),0DH 36 0D
Store 0DH, a carriage return, at Register Pair HL, 2B4FH: the end of the line (source: end line with C/R).
267C
RET C9
Return with Register Pair HL = 2B4FH and Register B = 00H.
267DCKBREAK
LD A,6AH 3E 6A
CKBREAK: load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (source: BREAK hit ?).
267F
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was.
2680
RET Z C8
Return to the caller if BREAK was not pressed (Z) (source: no - RETurn).
2681ABORT
SCF 37
ABORT: set the Carry flag, for the return code FFFFH (a 631 change: source, BREAK hit - abort).
2682
Jump to ABORT1 at 240EH, which makes Register Pair HL FFFFH from the Carry flag and leaves at the entry's depth (a 631 change: source, make HL = -1).
2685CVT2D
LD B,02H 06 02
CVT2D: load Register B with 02H, two places, for @HEXD (a 631 change).
2687
Jump to CVTDEC at 2693H with Register B = 02H, the two places of the size of a granule (a 631 change).
2689CVT3D
LD B,03H 06 03
CVT3D: load Register B with 03H, three places, for @HEXD: the files and the cylinder numbers (a 631 change).
268B
Jump to CVTDEC at 2693H with Register B = 03H, the three places of a file count or a cylinder number (a 631 change).
268DCVT4D
LD B,04H 06 04
CVT4D: load Register B with 04H, four places, for @HEXD; nothing calls this entry (a 631 change).
268F
Jump to CVTDEC at 2693H with Register B = 04H; the jump is never reached, as nothing calls CVT4D (a 631 change).
2691CVT5D
LD B,05H 06 05
CVT5D: load Register B with 05H, five places, for @HEXD: the space in K, as wide as 6.3.0's CVTDEC made it (a 631 change).
2693CVTDEC
LD A,5FH 3E 5F
CVTDEC: load Register A with 5FH, SVC 95, @HEXD, which writes Register Pair HL as a decimal number in Register B places (a 631 change: source, HEXD).
2695
RST 28H EF
Call @HEXD with RST 28H (BOOT/SYS): Register B spaces at Register Pair DE, then the digits written from the last place back; Register Pair DE returns after the last place (a 631 change).
2696
RET C9
Return with Register Pair DE after the number (a 631 change: 6.3.0 had its own conversion here, CVD1, which wrote the digits from the left).
2697H - DFRE and DDIR: One Cylinder of the Map
DFRE writes, from Index Register IX on, one character for each granule of cylinder C: D for every granule of the directory cylinder; otherwise x for a granule in use and a point for a free one, from the GAT byte at Register Pair HL (rotated in place, bit 0 first), then on a floppy an asterisk over each granule locked out in the lockout table at GAT+60H. Index Register IX returns after the last granule.
2697DFRE
PUSH BC C5
DFRE: save Register Pair BC on the stack, Register C the cylinder (source: save C, cur cyl loc).
2698GRANS
LD B,00H 06 00
GRANS: load Register B with the granules of a cylinder, which 2563H stored at 2699H, the operand (00H in the file) (source: p/u grans/cylinder).
269A
LD A,(IY+09H) FD 7E 09
Load Register A with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: p/u dir cyl from DCT).
269D
CP C B9
Compare Register A with Register C, the cylinder to show (source: directory ?).
269E
If it is the directory cylinder (Z) jump to DDIR at 26CFH, which writes a D for each granule (source: yes - use "D"'s).
26A0
PUSH IX DD E5
Save Index Register IX, the column of the cylinder's first granule, on the stack (source: save buffer pointer).
26A2
PUSH BC C5
Save Register Pair BC on the stack, Register B the granules of a cylinder (source: save grans/cyl).
26A3DF1
RRC (HL) CB 0E
DF1: rotate the byte at Register Pair HL, the GAT byte of the cylinder, right: the bit of the next granule goes into the Carry flag, 1 for in use (source: p/u next granule).
26A5
LD A,78H 3E 78
Load Register A with 78H, the letter x, for a granule in use; the LD leaves the Carry flag (source: init "in use").
26A7
If the granule is in use (Carry) jump to DF2 at 26ABH with the x (source: set - use "x").
26A9
LD A,2EH 3E 2E
Load Register A with 2EH, a point, for a free granule (source: else free).
26ABDF2
LD (IX+00H),A DD 77 00
DF2: store Register A, x or the point, at IX+00H, Index Register IX the column of the granule (source: stuff char).
26AE
INC IX DD 23
Increment Index Register IX to the column of the next granule (source: next display loc).
26B0
Decrement Register B and jump back to DF1 at 26A3H while it is not zero: one character for each granule (source: loop thru all grans).
26B2
POP BC C1
Restore Register Pair BC from the stack: Register B the granules of a cylinder again (source: B = grans per cyl).
26B3
POP IX DD E1
Restore Index Register IX from the stack: the column of the cylinder's first granule (source: IX to start of track).
26B5
PUSH HL E5
Save Register Pair HL, the GAT byte of the cylinder, on the stack (source: save cyl ptr).
26B6
LD DE,0060H 11 60 00
Load Register Pair DE with 0060H, the distance from a cylinder's allocation byte to its lockout byte in the GAT (source: offset to lockout table).
26B9
ADD HL,DE 19
Add Register Pair DE, 0060H, to Register Pair HL: Register Pair HL = the lockout byte of the cylinder, GAT+60H on (source: point to lockout).
26BALO1
BIT 3,(IY+03H) FD CB 03 5E
LO1: test bit 3 of DCT+3 (IY+03H), Index Register IY holding the DCT's address: set for a hard drive, whose GAT has no lockout table (source: if hard drive, there's).
26BE
If the drive is a hard drive (NZ) jump to LO2 at 26C8H, with nothing marked (source: no lockout).
26C0
RRC (HL) CB 0E
Rotate the byte at Register Pair HL, the lockout byte, right: the bit of the next granule goes into the Carry flag, 1 for locked out (source: gran locked out ?).
26C2
If the granule is not locked out (No Carry) jump to LO2 at 26C8H (source: no - bump buff ptr).
26C4
LD (IX+00H),2AH DD 36 00 2A
Store 2AH, an asterisk, at IX+00H, Index Register IX the column of the granule, over its x (source: asterisk = lockout).
26C8LO2
INC IX DD 23
LO2: increment Index Register IX to the column of the next granule (source: next gran dsp loc).
26CA
Decrement Register B and jump back to LO1 at 26BAH while it is not zero (source: B grans/cyl).
26CC
POP HL E1
Restore Register Pair HL, the GAT byte of the cylinder, from the stack.
26CD
POP BC C1
Restore Register Pair BC from the stack, Register C the cylinder.
26CE
RET C9
Return with Index Register IX after the cylinder's last granule.
26CFDDIR
LD (IX+00H),44H DD 36 00 44
DDIR: store 44H, the letter D, at IX+00H, Index Register IX the column of a granule of the directory cylinder (source: stuff "D" char).
26D3
INC IX DD 23
Increment Index Register IX to the column of the next granule (source: loop thru all DIR grans).
26D5
Decrement Register B, the granules left, and jump back to DDIR at 26CFH while it is not zero.
26D7
POP BC C1
Restore Register Pair BC from the stack, Register C the cylinder.
26D8
RET C9
Return with Index Register IX after the directory cylinder's last granule.
26D9H - DISPUND, DSPTRK and DSPTK4: Dashes and Cylinder Numbers
DISPUND shows a line of 79 dashes. DSPTRK writes at the start of LINBUF the numbers of the cylinders of the next line, C+1 to C+8 or to the last cylinder, as nnn-nnn (one number when the line holds only the last cylinder); DSPTK4 writes cylinder C in three places at Register Pair DE.
26D9DISPUND
LD A,2DH 3E 2D
DISPUND: load Register A with 2DH, a dash, the character to fill LINBUF with (source: character to underline).
26DB
Call BUFSTUF at 2671H, which fills LINBUF, 2B00H-2B4EH, with dashes and ends it with a carriage return (source: stuff line & display).
26DE
Jump to DSPLINE at 263CH, which shows the line of dashes and returns to DISPUND's caller (source: display line).
26E1DSPTRK
PUSH DE D5
DSPTRK: save Register Pair DE on the stack (source: save registers used).
26E2
PUSH BC C5
Save Register Pair BC on the stack, Register C the last cylinder of the line shown.
26E3
LD DE,2B00H 11 00 2BLD DE,LINBUF
Load Register Pair DE with 2B00H, LINBUF, where the numbers go (source: display buffer).
26E6
INC C 0C
Increment Register C to the first cylinder of the next line (source: bump to next cylinder).
26E7
Call DSPTK4 at 2704H, which writes cylinder C at 2B00H-2B02H; Register Pair DE returns at 2B03H (source: display cylinder number).
26EA
LD A,(IY+06H) FD 7E 06
Load Register A with DCT+6 (IY+06H), Index Register IY holding the DCT's address: the highest cylinder number (source: p/u maximum # cyls).
26ED
CP C B9
Compare Register A with Register C, the first cylinder of the line (source: are we at the top?).
26EE
If it is the last cylinder (Z) jump to DSPTK3 at 2701H: the line has one number (source: go if yes).
26F0
PUSH AF F5
Save Register Pair AF on the stack: Register A, the highest cylinder number (source: save max cylinder).
26F1
LD A,2DH 3E 2D
Load Register A with 2DH, a dash, between the two numbers (source: stuff dash in buffer).
26F3
LD (DE),A 12
Store Register A, the dash, at Register Pair DE, 2B03H.
26F4
POP AF F1
Restore Register Pair AF from the stack: Register A, the highest cylinder number (source: recover max cylinder).
26F5
INC DE 13
Increment Register Pair DE to 2B04H, the place of the second number (source: position to next avail).
26F6
LD B,07H 06 07
Load Register B with 07H, the cylinders after the first of a full line (source: need 7 more on a line).
26F8DSPTK1
INC C 0C
DSPTK1: increment Register C to the next cylinder (source: bump until 7 or max).
26F9
CP C B9
Compare Register A, the highest cylinder number, with Register C.
26FA
If Register C has reached the last cylinder (Z) jump to DSPTK2 at 26FEH.
26FC
Decrement Register B and jump back to DSPTK1 at 26F8H while it is not zero: Register C ends at the eighth cylinder of the line.
26FEDSPTK2
DSPTK2: call DSPTK4 at 2704H, which writes cylinder C, the last of the line, at 2B04H-2B06H (source: stuff ending cyl on line).
2701DSPTK3
POP BC C1
DSPTK3: restore Register Pair BC from the stack, Register C the last cylinder of the line shown (source: recover registers).
2702
POP DE D1
Restore Register Pair DE from the stack, the value it had when DSPTRK was called.
2703
RET C9
Return to the map loop at 24EEH (source: RETurn).
2704DSPTK4
LD L,C 69
DSPTK4: load Register L with Register C, the cylinder number (source: xfer cylinder # to HL).
2705
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the cylinder number.
2707
PUSH BC C5
Save Register Pair BC on the stack, Register C the cylinder number, as CVT3D loads Register B with the count of places (source: save cylinder #).
2708
Call CVT3D at 2689H, which writes Register Pair HL in three places at Register Pair DE and moves Register Pair DE past them (source: convert cyl# to ASCII).
270B
POP BC C1
Restore Register Pair BC from the stack, Register C the cylinder number (source: C = cylinder #).
270C
RET C9
Return with Register Pair DE after the three places (source: RETurn).
270DH - CALCK, CALCK2 and DIVHLA: Sectors as K
Register H, Register L and Register A hold a number of sectors (high byte first); CALCK and CALCK2 drop Register H, divide Register L and Register A by four into the whole K, written in five places (CALCK, CVT5D) or the places of the routine in Register Pair BC (CALCK2), then the decimal point is passed and two places of hundredths, 00, 25, 50 or 75, are copied from HUNDTAB. A number of 65536 sectors or more loses its high byte (B146), which only a total of more than 256 sectors to a cylinder could reach.
270DCALCK
LD BC,2691H 01 91 26LD BC,CVT5D
CALCK: load Register Pair BC with 2691H, CVT5D, the conversion to five places, for the free and total space (a 631 change: source, select 5 digit; 6.3.0 loaded CVTDEC, whose comment says 4 digit default but which also wrote five places).
2710CALCK2
LD (2720H),BC ED 43 20 27
CALCK2: store Register Pair BC, the conversion routine, at 2720H-2721H, the operand of the CALL at CONVERT (271FH).
2714DIVHLA
LD H,L 65
DIVHLA: load Register H with Register L, the middle byte of the sectors; the high byte, Register H, is lost (source: per disk pack).
2715
LD L,A 6F
Load Register L with Register A, the low byte of the sectors: Register Pair HL = the sectors, modulo 65536.
2716
SRL H CB 3C
Shift Register H right one bit, bit 0 into the Carry flag: the first halving of the sectors (source: divide total sectors).
2718
RR L CB 1D
Rotate Register L right through the Carry: Register Pair HL = the sectors divided by 2 (source: by 4 to calculate).
271A
SRL H CB 3C
Shift Register H right one more bit, bit 0 into the Carry flag (source: space in K).
271C
RR L CB 1D
Rotate Register L right through the Carry: Register Pair HL = the sectors divided by 4, the whole K, as a sector is a quarter of a K.
271E
PUSH AF F5
Save Register Pair AF on the stack: Register A, the low byte of the sectors, whose bits 1-0 are the quarters (source: save offset).
271FCONVERT
CONVERT: call the conversion routine whose address 2710H stored at 2720H-2721H, the operand (0000H in the file): Register Pair HL, the whole K, in decimal at Register Pair DE (source: cvt HL to ASCII @ DE).
2722
POP AF F1
Restore Register Pair AF from the stack: Register A, the low byte of the sectors (source: recover offset).
2723
INC DE 13
Increment Register Pair DE past the decimal point that follows the number in the text (source: go past decimal point).
2724
AND 03H E6 03
AND Register A with 03H: the sectors left over, the quarters of a K, 0 to 3 (source: modulo 4).
2726
ADD A,A 87
Add Register A to itself: twice the quarters, the offset of their two digits in HUNDTAB (source: multiply by 2).
2727
LD B,00H 06 00
Load Register B with 00H, the high byte of the offset (source: to position to).
2729
LD C,A 4F
Load Register C with Register A: Register Pair BC = the offset, 0, 2, 4 or 6 (source: hundredths string).
272A
LD HL,2814H 21 14 28LD HL,HUNDTAB
Load Register Pair HL with 2814H, HUNDTAB, the digits 00255075 (source: HL => table base).
272D
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL = the two digits of the hundredths (source: HL => hundredths string).
272E
LD C,02H 0E 02
Load Register C with 02H: Register Pair BC = 0002H, the two digits to copy (source: 2 chars to xfer).
2730
LDIR ED B0
Copy the two digits from Register Pair HL to Register Pair DE with LDIR (Register Pair BC = 0002H, and 0000H after it) (source: stuff in string).
2732
RET C9
Return with Register Pair DE after the hundredths and Register Pair BC = 0000H (source: RETurn).
2733H - KEY, DSP, DSPLY, PRINT, PRT and DO_OUT: the Character I/O SVCs
Five entries load Register A with an SVC number; the first four are each followed by a byte 11H, the first byte of an LD DE,nnnn whose operand is the next entry's LD A, so that every entry runs on to DO_OUT (PRT straight into it) with its own number and Register Pair DE changed (the SVCs set Register Pair DE themselves). DO_OUT issues the SVC and returns on Z; an error goes to IOERR with its number in Register A.
2733KEY
LD A,01H 3E 01
KEY: load Register A with 01H, SVC 1, @KEY, which waits for a key (source: wait for key).
2735
DEFB 11H 11
2735H: the first byte of an LD DE,nnnn that swallows DSP's LD A,02H (2736H-2737H), so that KEY goes on with Register A = 01H.
2736DSP
LD A,02H 3E 02
DSP: load Register A with 02H, SVC 2, @DSP, which shows the character in Register C; nothing in the member calls this entry (source: display byte).
2738
DEFB 11H 11
2738H: the first byte of an LD DE,nnnn that swallows DSPLY's LD A,0AH (2739H-273AH), so that KEY and DSP go on with their own SVC numbers (source: LD DE,nnnn).
2739DSPLY
LD A,0AH 3E 0A
DSPLY: load Register A with 0AH, SVC 10, @DSPLY, which shows the line at Register Pair HL up to its carriage return (source: display line).
273B
DEFB 11H 11
273BH: the first byte of an LD DE,nnnn that swallows PRINT's LD A,0EH (273CH-273DH), so that the entries above it go on with their own SVC numbers.
273CPRINT
LD A,0EH 3E 0E
PRINT: load Register A with 0EH, SVC 14, @PRINT, which prints the line at Register Pair HL up to its carriage return (source: print line).
273E
DEFB 11H 11
273EH: the first byte of an LD DE,nnnn that swallows PRT's LD A,06H (273FH-2740H), so that the entries above it go on to DO_OUT with their own SVC numbers.
273FPRT
LD A,06H 3E 06
PRT: load Register A with 06H, SVC 6, @PRT, which sends the character in Register C to the printer (source: print byte).
2741DO_OUT
RST 28H EF
DO_OUT: call the SVC in Register A with RST 28H (BOOT/SYS): @KEY, @DSP, @DSPLY, @PRINT or @PRT; Z when it worked (source: do SVC & check error).
2742
RET Z C8
Return if the SVC returned Z (source: RETurn if good).
2743
Jump to IOERR at 2417H with the SVC's error number in Register A, such as Device not available from a printer that is not ready (source: NZ - I/O error).
2746H - The Texts, the Header and Footer Lines, HUNDTAB and PRMTBL$
The texts copied into the footer; the first cylinder numbers of the map; the header line from Drive : to its carriage return at 27AEH, whose d, name, date, nnnnn.nn and ddd places are filled in by GETINFO; the footer line from Type => to its carriage return at 27FEH; the No Disk line; HUNDTAB, the two digit hundredths of 0, 1, 2 and 3 quarters of a K; and the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H. GAT (2900H-29FFH), HIT (2A00H-2AFFH) and LINBUF (2B00H-2B4FH) follow the member with no bytes in the file.
2746-274BMDDEN
DEFM "DOUBLE" 44 4F 55 42 4C 45
MDDEN, 2746H-274BH: copied over SINGLE in the footer for a double density drive (260BH).
274C-2751RIGID
DEFM "RIGID " 52 49 47 49 44 20
RIGID, 274CH-2751H: copied over SINGLE in the footer for a hard drive (25F4H).
2752-2757HARD
DEFM "Hard " 48 61 72 64 20 20
HARD, 2752H-2757H: copied over Floppy in the footer for a hard drive (25E9H).
2758-275EMTRK
DEFM " 0- 7" 20 20 30 2D 20 20 37
MTRK, 2758H-275EH: the cylinder numbers of the first map line, copied to LINBUF at 24B4H; later lines are written by DSPTRK.
275F-2765HEADER
DEFM "Drive :" 44 72 69 76 65 20 3A
HEADER, 275FH-2765H: the start of the header line, shown from here at 2637H.
2766-2768HDRIVE
DEFM "d " 64 20 20
HDRIVE, 2766H-2768H: the drive number, stored at 2512H, and two spaces.
2769-2772HNAME
DEFM "diskname " 64 69 73 6B 6E 61 6D 65 20 20
HNAME, 2769H-2772H: the disk name, eight characters from GAT+D0H (259BH), and two spaces.
2773-2789HDATE
DEFM "dd/mm/yy Free Space =" 64 64 2F 6D 6D 2F 79 79 20 20 20 46 72 65 65 20 53 70 61 63 65 20 3D
HDATE, 2773H-2789H: the date of the diskette, eight characters from GAT+D8H (25A2H), and the words Free Space =.
278A-2793HFREEK
DEFM "nnnnn.nnK/" 6E 6E 6E 6E 6E 2E 6E 6E 4B 2F
HFREEK, 278AH-2793H: the free space in K, written by CALCK at 25C5H, a slash after it.
2794-27A6HPOSSK
DEFM "nnnnn.nnK Files = " 6E 6E 6E 6E 6E 2E 6E 6E 4B 20 20 46 69 6C 65 73 20 3D 20
HPOSSK, 2794H-27A6H: the total space in K, written by CALCK at 2590H, and the word Files.
27A7-27AAHFREEF
DEFM "ddd/" 64 64 64 2F
HFREEF, 27A7H-27AAH: the free files, written by CVT3D at 2634H, a slash after them.
27AB-27AEHPOSSF
DEFM "ddd" / DEFB 0DH 64 64 64 0D
HPOSSF, 27ABH-27AEH: the possible files, written by CVT3D at 2581H, and the carriage return that ends the header line.
27AF-27B7FOOTER
DEFM "Type => " 54 79 70 65 20 3D 3E 20 20
FOOTER, 27AFH-27B7H: the start of the footer line, shown from here at 24FAH; FRET stores a carriage return over its first byte at the end (2507H).
27B8-27BAFSIZE
DEFM "s" / DEFB 22H / DEFM " " 73 22 20
FSIZE, 27B8H-27BAH: the size of the media, the s replaced by 5 or 8 at 25D2H, then the inch sign (a double quote) and a space.
27BB-27CCFTYPE
DEFM "Floppy Heads = " 46 6C 6F 70 70 79 20 20 20 20 48 65 61 64 73 20 3D 20
FTYPE, 27BBH-27CCH: Floppy, replaced by Hard for a hard drive (25F2H), and the word Heads.
27CD-27DAFHEADS
DEFM "n Density = " 6E 20 20 20 44 65 6E 73 69 74 79 20 3D 20
FHEADS, 27CDH-27DAH: the heads or sides, a digit stored at 25E0H and for a floppy again at 2602H, and the word Density.
27DB-27F7FDENS
DEFM "SINGLE Note - 1 Position = " 53 49 4E 47 4C 45 20 20 20 4E 6F 74 65 20 2D 20 31 20 50 6F 73 69 74 69 6F 6E 20 3D 20
FDENS, 27DBH-27F7H: SINGLE, replaced by DOUBLE or RIGID (2614H), and the note that one position of the map is one granule of the size that follows.
27F8-27FDFGRAN
DEFM "nn.nnK" 6E 6E 2E 6E 6E 4B
FGRAN, 27F8H-27FDH: the size of a granule in K, written by CALCK2 at 2547H with two places.
27FEENDFOOT
DEFB 0DH 0D
ENDFOOT, 27FEH: the carriage return that ends the footer line.
27FF-2805NODISK
DEFM "Drive :" 44 72 69 76 65 20 3A
NODISK, 27FFH-2805H: the start of the line shown by NO_DISK (2654H) for a drive with no diskette.
2806-2813NODISKN
DEFM "d [No Disk]" / DEFB 0DH 64 20 20 5B 4E 6F 20 20 44 69 73 6B 5D 0D
NODISKN, 2806H-2813H: the drive number, stored at 2651H, the words [No Disk] and the carriage return that ends the line.
2814-281BHUNDTAB
DEFM "00255075" 30 30 32 35 35 30 37 35
HUNDTAB, 2814H-281BH: the hundredths of 0, 1, 2 and 3 quarters of a K, two digits each, copied by CALCK at 2730H.
281CPRMTBL$
DEFB 80H 80
PRMTBL$, 281CH: 80H, the mark of a table in the enhanced format, given to @PARAM at 243BH.
281D-281E
DEFB 41H / DEFM "P" 41 50
281DH-281EH: type 41H (a flag, bit 6, one letter) and the name P; @PARAM does not check the kind of value.
281F
DEFB 00H 00
281FH: the response byte of P, never read: PPARM and FREE0 test the value itself.
2820-2821
DEFW 2646H 46 26
2820H-2821H: the address of the value of P, 2646H, the operand of the LD DE at PPARM (2645H).
2822
DEFB 00H 00
2822H: the 00H that ends the table (a NOP in the source), the last byte of the member.
2400H - Member 2 (DATE and TIME): the Two Entries
SYS1/SYS runs TIME with request 16H and DATE with request 15H; their headers (file offsets 0029H for DATE and 0031H for TIME) both point to record 0004H, byte B9H, member 2, which the overlay loader reads to 2400H-2602H and 2700H-278AH, 515 and 139 bytes in four load blocks (2400H-24FFH, 2500H-25FFH, 2600H-2602H and 2700H-278AH), and calls at 2400H for TIME or 2403H for DATE, with Register Pair HL at the text after the command word (SYS1 has passed the spaces after it). The member keeps no Stack Pointer: every exit is a RET at the depth of the entry, into the tail of RST28 (1A77H). The 631 changes are all for the years 2000 to 2011: 242FH (years 00-11 taken as 2000-2011), 243BH (32 years, not 20), 24A2H (the leap day count of 32 years) and 24F5H (the year written in full by @HEXDEC).
2400
TIME's entry (request 16H): jump to TIME at 2518H; DATE's code begins after this jump, at 2403H (source: Time entry point).
2403DATE
LD A,6AH 3E 6A
DATE: DATE's entry (request 15H): load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (source: Break key down?).
2405
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was; a BREAK found is cleared, as @CKBRKC waits for the key's release and empties the type-ahead.
2406
If no BREAK was pressed (Z) jump to BEGINA at 240CH, the date itself (source: Ok if not).
2408
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code of a command ended by BREAK (source: else abort).
240B
RET C9
Return through the tail of RST28 (1A77H) with Register Pair HL = FFFFH: nothing is shown or changed.
240CH - BEGINA: Read or Set the Date
@DATE is asked only for its pointer to DATE$ (Register Pair DE = 0033H); the eight characters it writes go to DUMBUF, 278EH, after the member, and are not used. With no date on the line the date is shown; otherwise PARSDAT reads three two digit fields into DTBUF (278BH-278DH, after the member): the month into DTBUF+2, the day into DTBUF+1, the year into DTBUF+0, the order of DATE$. The year must be 80 to 99 or 00 to 11 (1980 to 2011), the month 1 to 12, the day 1 to the length of the month, with February 29 days in a leap year; the three bytes are then copied to DATE$ (0033H-0035H) and the new date is shown. February's length in MAXDAY$ (0403H), which the clock's midnight roll-over reads, is not changed (B142).
240CBEGINA
PUSH HL E5
BEGINA: save Register Pair HL, the place in the command line after the word DATE, on the stack (source: save command ptr).
240D
LD HL,278EH 21 8E 27LD HL,DUMBUF
Load Register Pair HL with 278EH, DUMBUF, eight bytes just after the three of DTBUF: @DATE writes its eight characters MM/DD/YY to 278EH-2795H, after the member, where nothing reads them (source: HL => Dummy Buffer).
2410
LD A,12H 3E 12
Load Register A with 12H, SVC 18, @DATE, which writes the date as text and returns the address of DATE$ (source: DE <= DATE$+0).
2412
RST 28H EF
Call @DATE with RST 28H (SYS0/SYS 1420H, which calls DATELO$ in BOOT/SYS): Register Pair DE = 0033H, DATE$+0, the year byte, on return.
2413
POP HL E1
Restore Register Pair HL, the place in the command line, from the stack (source: recover command ptr).
2414
PUSH DE D5
Save Register Pair DE, 0033H, the address of DATE$, on the stack to move it into Index Register IY (source: xfer ptr to IY).
2415
POP IY FD E1
Load Index Register IY with 0033H from the stack: IY+00H is DATE$+0, the year, IY+01H the day, IY+02H the month, IY+03H and IY+04H the day of the year and the day of the week.
2417
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character after the word DATE and its spaces (source: p/u character).
2418
CP 0EH FE 0E
Compare Register A with 0EH: any byte from 00H to 0DH, the carriage return of the line or another control character, means that no date was typed (source: date entry ?).
241A
If Register A is below 0EH (Carry) jump to DSPDATE at 2462H, which shows the date kept in DATE$ (source: no - display date).
241D
LD C,30H 0E 30
Load Register C with 30H, the digit 0: PARSDAT takes as a separator a colon or any character below it (source: init separator).
241F
Call PARSDAT at 25B5H to read three fields of two digits from Register Pair HL into DTBUF, 278BH-278DH; Z when all three were read, with Register Pair DE = 278BH, DTBUF+0.
2422
If PARSDAT returned NZ (a character that is not a digit, a wrong separator, or the end of the line too soon) jump to BADFMT at 2511H: Bad Date format.
2425
NOP 00
No operation: the first of nine zero bytes (2425H-242DH) that the US version has where the international one swaps the month and the day; there INC DE is here (source: pad US ver to match Intl).
2426
NOP 00
No operation: the second of the nine zero bytes, 2426H, LD H,D in the international version, kept so that the code after them stands at the same addresses.
2427
NOP 00
No operation: the third of the nine zero bytes, 2427H; the international version has LD L,E here, then LD C,(HL), INC HL, LD A,(HL), LD (DE),A, LD (HL),C and DEC DE.
2428
NOP 00
No operation: the fourth of the nine zero bytes, 2428H; in the international version the date is typed DD/MM/YY and the two fields are swapped into DATE$ order.
2429
NOP 00
No operation: the fifth of the nine zero bytes, 2429H, a byte of the padding that keeps the US and international versions of DATE the same length.
242A
NOP 00
No operation: the sixth of the nine zero bytes, 242AH, a byte of the padding of the US version, run through on the way to the year test at 242EH.
242B
NOP 00
No operation: the seventh of the nine zero bytes, 242BH, a byte of the padding of the US version, run through on the way to the year test at 242EH.
242C
NOP 00
No operation: the eighth of the nine zero bytes, 242CH, a byte of the padding of the US version, run through on the way to the year test at 242EH.
242D
NOP 00
No operation: the last of the nine zero bytes, 242DH; Register Pair DE still holds 278BH, the year typed, for the test that follows.
242E
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, 278BH, DTBUF+0: the year as typed, 0 to 99 (source: p/u year entry).
242F
CP 0CH FE 0C
Compare Register A with 0CH, the year 12: the years 00 to 11 stand for 2000 to 2011 (a 631 change).
2431
If Register A is 0CH or more (No Carry) jump to L2436 at 2436H: the year is taken as 19xx (a 631 change).
2433
ADD A,64H C6 64
Add 64H, 100, to Register A: the years 00 to 11 become 100 to 111, the year less 1900, as DATE$ keeps it (a 631 change).
2435
LD (DE),A 12
Store Register A, the year 100 to 111, back into DTBUF+0 at Register Pair DE, 278BH (a 631 change).
2436L2436
SUB 50H D6 50
L2436: subtract 50H, 80, from Register A, the year less 1900: the years 1980 to 2011 give 0 to 31 (source: accept only 80-87).
2438
If the subtraction gave Carry, a year 12 to 79, jump to BADFMT at 2511H: Bad Date format; no date after 2011 can be set (B145) (source: less than 80 - bad).
243B
CP 20H FE 20
Compare Register A with 20H, 32: the 631 range is 32 years, 1980 to 2011 (6.3.0 compared with 20, 1980 to 1999).
243D
If Register A is 20H or more (No Carry) jump to BADFMT2 at 2457H, whose JP NC goes on to BADFMT: this cannot happen once the years 00 to 11 are added in (source: yes - bad).
243F
AND 03H E6 03
AND Register A with 03H: Z for the years 1980, 1984 and every fourth year to 2008, the leap years of the range, 2000 among them (source: 0 or 4 ?).
2441
LD HL,274DH 21 4D 27
Load Register Pair HL with 274DH, MAXDAYS+2, the length of February in the member's own table (28 in the file); the LD leaves the flags of the AND (source: set Feb to have 29 days).
2444
If the year is not a leap year (NZ) jump to NOTLEAP at 2447H, with February left at 28 days (source: no - don't inc).
2446
INC (HL) 34
Increment the byte at Register Pair HL, 274DH: February has 29 days in a leap year; the member's copy only, not MAXDAY$ at 0403H (source: leap year - inc max days).
2447NOTLEAP
LD A,(278DH) 3A 8D 27
NOTLEAP: load Register A with the byte at 278DH, DTBUF+2, the month as typed (source: p/u month).
244A
DEC A 3D
Decrement Register A: the months 1 to 12 become 0 to 11, and 0 becomes FFH (source: set month = 0-11).
244B
CP 0CH FE 0C
Compare Register A with 0CH: a month 0 (now FFH) or above 12 is 0CH or more (source: valid month ?).
244D
If Register A is 0CH or more (No Carry) jump to BADFMT2 at 2457H, whose JP NC goes on to BADFMT: Bad Date format (source: abort if 0 or >12).
244F
DEC HL 2B
Decrement Register Pair HL from 274DH to 274CH, MAXDAYS+1, the length of January (source: HL => max day table).
2450
ADD A,L 85
Add Register L, 4CH, to Register A, the month less one: no Carry, as the table lies within 2700H-27FFH (source: add month # to start).
2451
LD L,A 6F
Load Register L with Register A: Register Pair HL points at MAXDAYS plus the month, the length of the month typed (source: HL => max days for month).
2452
LD A,(278CH) 3A 8C 27
Load Register A with the byte at 278CH, DTBUF+1, the day as typed (source: p/u day entry).
2455
DEC A 3D
Decrement Register A: the days 1 to 31 become 0 to 30, and a day 0 becomes FFH (source: reduce for test (0->FF)).
2456
CP (HL) BE
Compare Register A with the byte at Register Pair HL, the length of the month: a day above it (or a day 0) gives No Carry (source: more than max days ?).
2457BADFMT2
BADFMT2: if Register A is not below the length of the month (No Carry) jump to BADFMT at 2511H; 243DH and 244DH jump here with No Carry too (source: go if too large (or 0)).
245A
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = 278BH, DTBUF+0, the three bytes of the date typed (source: point HL to DTBUF).
245B
PUSH IY FD E5
Save Index Register IY, 0033H, the address of DATE$, on the stack to move it into Register Pair DE (source: point DE = DATE$).
245D
POP DE D1
Load Register Pair DE with 0033H, DATE$+0, from the stack: where the three bytes go.
245E
LD C,03H 0E 03
Load Register C with 03H; Register B is 00H after PARSDAT, so Register Pair BC = 0003H, the three bytes to copy (source: BC = 3 chars to xfer).
2460
LDIR ED B0
Copy the three bytes from Register Pair HL, 278BH-278DH, to Register Pair DE, 0033H-0035H, with LDIR (Register Pair BC = 0003H): DATE$ holds the new year, day and month (source: xfer 3 chars).
2462H - DSPDATE and GOTDATE: the Day of the Year and the Day of the Week
With no month in DATE$ (00H, the date not set) the message Date not in system is shown and FFFFH returned. Otherwise the day of the year is counted from the month lengths of MAXDAYS (February given 29 days in a leap year) and stored at DATE$+3 and bit 0 of DATE$+4; the day of the week is worked out as (day of the year + years since 1980 + leap days before the year + 1) modulo 7 + 1, 1 for Sunday (a value that stays right up to 2040: B145), and stored in bits 3-1 of DATE$+4. The bit 0 of DATE$+4 is ORed in and never cleared, and bit 7, the leap year flag, is kept as it was (B143). Then the line Ddd, Mmm dd, yyyy is built in DATEBUF (2739H-274AH) and shown through @LOGOT.
2462DSPDATE
LD A,(IY+02H) FD 7E 02
DSPDATE: load Register A with the byte at DATE$+2 (IY+02H, 0035H), Index Register IY holding 0033H: the month, 00H when no date was set (source: p/u month).
2465
LD HL,2758H 21 58 27LD HL,NODATE$
Load Register Pair HL with 2758H, NODATE$, the message Date not in system, for LOGABRT (source: "No Date in system").
2468
OR A B7
OR Register A with itself: Z when the month is 00H, no date in the system (source: better not be zero).
2469
If there is no date (Z) jump to LOGABRT at 2514H, which shows Date not in system and returns FFFFH (source: log & abort).
246CGOTDATE
LD B,A 47
GOTDATE: load Register B with Register A, the month 1 to 12: the number of month lengths to add up for the day of the year (source: xfer month to B).
246D
LD HL,274DH 21 4D 27
Load Register Pair HL with 274DH, MAXDAYS+2, the length of February in the member's table (source: adjust February if).
2470
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, 274DH: 28, or 29 when the date just typed is in a leap year (source: year is leap year).
2471
SUB 1DH D6 1D
Subtract 1DH, 29, from Register A: Z when February was already given 29 days at 2446H (source: & not already adjusted).
2473
If February already has 29 days (Z) jump to PUDAY at 247DH (source: in parsing date entry).
2475
LD A,(IY+00H) FD 7E 00
Load Register A with the byte at DATE$+0 (IY+00H, 0033H), Index Register IY holding 0033H: the year less 1900, 80 to 111 (source: p/u year).
2478
AND 03H E6 03
AND Register A with 03H: Z for a year divisible by four, a leap year (80 is a multiple of four, so the year less 1900 is tested as it is) (source: 1980 and 1984 are lp yrs).
247A
If the year is not a leap year (NZ) jump to PUDAY at 247DH, with February left at 28 days (source: not leap year - fine).
247C
INC (HL) 34
Increment the byte at Register Pair HL, 274DH: February has 29 days in this leap year (source: bump to 29).
247DPUDAY
LD L,(IY+01H) FD 6E 01
PUDAY: load Register L with the byte at DATE$+1 (IY+01H, 0034H), Index Register IY holding 0033H: the day of the month (source: p/u day # this month).
2480
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the day of the month, the start of the day of the year (source: in HL).
2482
LD DE,274BH 11 4B 27LD DE,MAXDAYS
Load Register Pair DE with 274BH, MAXDAYS: its first byte is 0, so the loop adds the lengths of the months before the month (source: DE => max day table).
2485DAYLP
LD A,(DE) 1A
DAYLP: load Register A with the byte at Register Pair DE, the length of a month (0 for the first pass) (source: p/u max day).
2486
ADD A,L 85
Add Register L to Register A: the low byte of the count plus the month length; Carry when it passes FFH (source: add to HL).
2487
LD L,A 6F
Load Register L with Register A, the new low byte of the day count in Register Pair HL.
2488
ADC A,H 8C
Add Register H and the Carry to Register A, which holds Register L: the result is Register L + Register H + Carry.
2489
SUB L 95
Subtract Register L from Register A: Register A = Register H + Carry, the new high byte of the count.
248A
LD H,A 67
Load Register H with Register A: Register Pair HL has had the month length added as a 16 bit sum.
248B
INC DE 13
Increment Register Pair DE to the next month's length in MAXDAYS (source: bump days ptr).
248C
Decrement Register B, the months still to add, and jump back to DAYLP at 2485H while it is not zero: the lengths of entry 0 and the months before the month are added (source: B months of max days).
248E
LD (IY+03H),L FD 75 03
Store Register L, the low byte of the day of the year, 1 to 366, at DATE$+3 (IY+03H, 0036H), Index Register IY holding 0033H (source: stuff in lsb).
2491
LD A,H 7C
Load Register A with Register H, the high byte of the day of the year: 01H from the 256th day on, else 00H (source: get bit "8").
2492
OR (IY+04H) FD B6 04
OR Register A with the byte at DATE$+4 (IY+04H, 0037H), Index Register IY holding 0033H: a bit 0 already set there is kept, even for a day below 256 (B143) (source: and OR it in).
2495
LD (IY+04H),A FD 77 04
Store Register A at DATE$+4 (IY+04H, 0037H), Index Register IY holding 0033H: bit 0, bit 8 of the day of the year (source: then put it back).
2498
LD A,(IY+00H) FD 7E 00
Load Register A with the byte at DATE$+0 (IY+00H, 0033H), Index Register IY holding 0033H: the year less 1900 (source: p/u year).
249B
SUB 50H D6 50
Subtract 50H, 80, from Register A: the number of years since 1980, 0 to 31 (source: offset from 80).
249D
LD E,A 5F
Load Register E with Register A, the years since 1980; each year moves the day of the week on by one (source: put 0-7 in E).
249E
ADD A,03H C6 03
Add 03H to Register A: (years + 3) / 4 is the number of 29 Februaries from 1980 up to the year before (source: ck for year >= 84).
24A0
RRCA 0F
Rotate Register A right one bit, the first of the two shifts that divide it by four (bit 0 goes to bit 7).
24A1
RRCA 0F
Rotate Register A right one more bit: bits 5-2 of the sum are now in bits 3-0, bits 1-0 in bits 7-6.
24A2
AND 0FH E6 0F
AND Register A with 0FH: the leap days, 0 to 8, without the two low bits rotated into the top (a 631 change: 6.3.0 kept bits 2-0, enough for 20 years).
24A4
ADD A,E 83
Add Register E, the years since 1980, to Register A, the leap days: the days the week has moved since 1 January 1980 apart from this year's (source: add back to year).
24A5
LD E,A 5F
Load Register E with Register A, the shift of the day of the week (source: & save in DE).
24A6
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the shift, 0 to 39.
24A8
ADD HL,DE 19
Add Register Pair DE to Register Pair HL, the day of the year: the number to divide by seven (source: add to days in year).
24A9
INC HL 23
Increment Register Pair HL: 1 January 1980 was a Tuesday, day 3 when Sunday is 1, and its count, 1, becomes 2 (source: to start in right place).
24AA
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the days of a week, to subtract (source: now divide by 7).
24AD
XOR A AF
XOR Register A with itself: Register A = 00H and the Carry flag cleared for the first SBC.
24AEDIV7
SBC HL,BC ED 42
DIV7: subtract Register Pair BC, 0007H, and the Carry from Register Pair HL (source: subtract weeks (7-days)).
24B0
If the subtraction gave No Carry jump back to DIV7 at 24AEH: Register Pair HL ends as the count modulo 7, less 7 (source: until under flow).
24B2
LD A,L 7D
Load Register A with Register L, the remainder less 7: F9H to FFH.
24B3
ADD A,08H C6 08
Add 08H to Register A: the remainder plus 1, 1 to 7, the day of the week with 1 for Sunday (source: add back to get 1-7).
24B5
LD B,A 47
Load Register B with Register A, the day of the week, the entry of DAYTBL for DSPMDY at 24C8H (source: save day of week).
24B6
RLCA 07
Rotate Register A left one bit: the day of the week in bits 3-1, 02H to 0EH (source: shift to bits 1-3).
24B7
LD C,A 4F
Load Register C with Register A, the day of the week in bits 3-1 (source: to store in DATE$).
24B8
LD A,(IY+04H) FD 7E 04
Load Register A with the byte at DATE$+4 (IY+04H, 0037H), Index Register IY holding 0033H (source: p/u DATE$ + 4).
24BB
AND 0F1H E6 F1
AND Register A with F1H: keep bits 7-4 (bit 7 the leap year flag, kept as the start-up set it: B143) and bit 0, and clear the old day of the week (source: keep lp yr bit & bit 0).
24BD
OR C B1
OR Register A with Register C, the new day of the week in bits 3-1 (source: merge day of week).
24BE
LD (IY+04H),A FD 77 04
Store Register A at DATE$+4 (IY+04H, 0037H), Index Register IY holding 0033H (source: stuff back in).
24C1
LD HL,2700H 21 00 27LD HL,DAYTBL
Load Register Pair HL with 2700H, DAYTBL, the names of the days, three letters each, Sunday first (source: HL => day string table).
24C4
LD DE,2739H 11 39 27LD DE,DATEBUF
Load Register Pair DE with 2739H, DATEBUF, the line to show, Day, Mon xx, then YRBUF (source: date display buffer).
24C7
PUSH DE D5
Save Register Pair DE, 2739H, on the stack: LOGDT takes it back for @LOGOT (source: save start).
24C8
Call DSPMDY at 25A6H to copy entry B of DAYTBL, the day's three letters, to 2739H-273BH; Register Pair DE returns at 273CH (source: write out the day).
24CB
INC DE 13
Increment Register Pair DE from 273CH to 273DH, past the comma of DATEBUF (source: bump).
24CC
INC DE 13
Increment Register Pair DE from 273DH to 273EH, past the space: the place of the month's name.
24CD
LD A,(IY+02H) FD 7E 02
Load Register A with the byte at DATE$+2 (IY+02H, 0035H), Index Register IY holding 0033H: the month, 1 to 12 (source: p/u month number).
24D0
LD B,A 47
Load Register B with Register A, the month, the entry of MONTBL for DSPMDY (source: stuff in B).
24D1
LD HL,2715H 21 15 27LD HL,MONTBL
Load Register Pair HL with 2715H, MONTBL, the names of the months, three letters each, January first (source: HL => month string table).
24D4
Call DSPMDY at 25A6H to copy the month's three letters to 273EH-2740H; Register Pair DE returns at 2741H, the space after them (source: write out the month name).
24D7
INC DE 13
Increment Register Pair DE from 2741H to 2742H, the two places of the day of the month (source: DE => day destination).
24D8
LD A,(IY+01H) FD 7E 01
Load Register A with the byte at DATE$+1 (IY+01H, 0034H), Index Register IY holding 0033H: the day of the month (source: p/u day).
24DB
LD B,0FFH 06 FF
Load Register B with FFH: the count of tens starts at minus one, as DIV10 counts once more than it subtracts (source: init # of tens to -1).
24DDDIV10
INC B 04
DIV10: increment Register B, the tens counted so far (source: divide by 10).
24DE
SUB 0AH D6 0A
Subtract 0AH, 10, from Register A, the day (source: with quotient in B).
24E0
If the subtraction gave No Carry jump back to DIV10 at 24DDH: Register B ends as the tens digit, Register A as the units less 10 (source: subtract until carry).
24E2
PUSH AF F5
Save Register Pair AF on the stack: Register A, the units digit less 10 (source: save (10-remainder)).
24E3
LD A,B 78
Load Register A with Register B, the tens digit, 0 to 3 (source: p/u quotient).
24E4
ADD A,30H C6 30
Add 30H to Register A: the tens digit as a character (source: change to ASCII).
24E6
CP 30H FE 30
Compare Register A with 30H, the character 0 (source: zero?).
24E8
If the tens digit is not 0 (NZ) jump to NOTLD0 at 24ECH (source: no - use it).
24EA
LD A,20H 3E 20
Load Register A with 20H, a space: a day below 10 is shown with a space before it (source: change leading 0 to ' ').
24ECNOTLD0
LD (DE),A 12
NOTLD0: store Register A, the tens digit or the space, at Register Pair DE, 2742H (source: stuff in buffer).
24ED
INC DE 13
Increment Register Pair DE to 2743H, the place of the units digit (source: DE => ones destination).
24EE
POP AF F1
Restore Register Pair AF from the stack: Register A, the units digit less 10, F6H to FFH (source: get back remainder).
24EF
ADD A,3AH C6 3A
Add 3AH to Register A: the units digit less 10 plus 3AH is the digit as a character, 30H to 39H (source: change to ASCII).
24F1
LD (DE),A 12
Store Register A, the units digit, at Register Pair DE, 2743H; the comma of DATEBUF at 2744H follows it (source: stuff in buffer).
24F2
LD A,(IY+00H) FD 7E 00
Load Register A with the byte at DATE$+0 (IY+00H, 0033H), Index Register IY holding 0033H: the year less 1900 (source: form last year digit).
24F5
LD HL,076CH 21 6C 07
Load Register Pair HL with 076CH, 1900, to which the year byte is added (a 631 change).
24F8
ADD A,L 85
Add Register L, 6CH, to Register A, the year less 1900: Carry when the sum passes FFH (a 631 change).
24F9
LD L,A 6F
Load Register L with Register A, the low byte of the year in full (a 631 change).
24FA
ADC A,H 8C
Add Register H, 07H, and the Carry to Register A, which holds Register L: Register L + Register H + Carry (a 631 change).
24FB
SUB L 95
Subtract Register L from Register A: Register A = Register H + Carry, the high byte of the year (a 631 change).
24FC
LD H,A 67
Load Register H with Register A: Register Pair HL = 1900 + the year byte, 1980 to 2011 (a 631 change).
24FD
LD DE,2745H 11 45 27LD DE,YRBUF
Load Register Pair DE with 2745H, YRBUF, the five places after the comma, ended by the carriage return at 274AH (a 631 change).
2500
LD A,61H 3E 61
Load Register A with 61H, SVC 97, @HEXDEC, which writes Register Pair HL as five decimal places with spaces before the digits (a 631 change).
2502
RST 28H EF
Call @HEXDEC with RST 28H (BOOT/SYS): 2745H-2749H = a space and the four digits of the year, Register Pair DE ends at 274AH (a 631 change: 6.3.0 wrote the last digit, and a 9 for the 1990s, into its 198x).
2503LOGDT
LD B,00H 06 00
LOGDT: load Register B with 00H, the mark of a normal exit, from which LOGMSG makes the return code 0000H (source: B = 0 (normal exit)).
2505
POP HL E1
Restore Register Pair HL from the stack: 2739H for the date, 2742H for the time, the start of the line to show (source: HL => date/time string).
2506LOGMSG
PUSH BC C5
LOGMSG: save Register Pair BC on the stack, Register B the exit mark, 00H or FFH (source: save error #, B (exit)).
2507
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows a line and writes it to the job log too.
2509
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the text at Register Pair HL up to its carriage return (source: log message).
250A
POP BC C1
Restore Register Pair BC from the stack: Register B the exit mark (source: B = exit condition).
250B
LD H,B 60
Load Register H with Register B, 00H or FFH (source: set HL = -1 or 0).
250C
LD L,B 68
Load Register L with Register B: Register Pair HL = 0000H after the date or the time, FFFFH after a message.
250D
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, to clear a BREAK pressed while the line was shown (source: clear any break).
250F
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): a pending BREAK is cleared; the flags it returns are not used.
2510
RET C9
Return through the tail of RST28 (1A77H) with Register Pair HL = 0000H or FFFFH (source: RETurn with condition).
2511BADFMT
LD HL,276BH 21 6B 27LD HL,BADDAT$
BADFMT: load Register Pair HL with 276BH, BADDAT$, Bad Date format; TIME stores 277BH, BADTIM$, into this operand at 2534H (source: illegal Date/Time).
2514LOGABRT
LD B,0FFH 06 FF
LOGABRT: load Register B with FFH, the mark of an exit after a message: the return code FFFFH (source: abort condition).
2516
Jump back to LOGMSG at 2506H to show the message at Register Pair HL and return FFFFH (source: log message).
2518H - TIME: Read the Parameters
TIME looks along the line for an opening parenthesis; when one is found @PARAM reads CLOCK from PRMTBL$ (25F8H). Either way BADFMT is changed to give Bad Time format. A @PARAM error is shown as a short message and its number returned.
2518TIME
LD A,6AH 3E 6A
TIME: load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (source: Break key down?).
251A
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was; a BREAK found is cleared, as @CKBRKC waits for the key's release and empties the type-ahead.
251B
If no BREAK was pressed (Z) jump to BEGINB at 2521H (source: ok if not).
251D
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code of a command ended by BREAK (source: else abort).
2520
RET C9
Return through the tail of RST28 (1A77H) with Register Pair HL = FFFFH: the time is neither shown nor changed.
2521BEGINB
PUSH HL E5
BEGINB: save Register Pair HL, the place in the command line after the word TIME, on the stack (source: save pointer).
2522TLOOP
LD A,(HL) 7E
TLOOP: load Register A with the byte at Register Pair HL, the next character of the line (source: p/u character).
2523
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of a parameter list (source: any parameters ?).
2525
If Register A is the parenthesis (Z) jump to GETPRMS at 252EH, with Register Pair HL at it (source: yes - get 'em).
2527
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends the line; no other end is looked for (source: end of line ?).
2529
If Register A is the carriage return (Z) jump to CLRSTK at 2534H with the Z flag set: no parameters (source: yes - go check time).
252B
INC HL 23
Increment Register Pair HL to the next character of the line (source: bump ptr).
252C
Jump back to TLOOP at 2522H: the time typed, if any, is passed over (source: do til terminator).
252EGETPRMS
LD DE,25F8H 11 F8 25LD DE,PRMTBL$
GETPRMS: load Register Pair DE with 25F8H, PRMTBL$, the parameter table in the enhanced format, which holds CLOCK alone (source: DE => Parameter Table).
2531
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads the list at Register Pair HL (source: get parameters).
2533
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): Z when every word was found; CLOCK, CLOCK=ON or CLOCK=YES puts FFFFH into 2588H, CLOCK=OFF or CLOCK=NO 0000H, and the response byte at 25FFH is made nonzero; NZ with Register A = 2CH, Parameter error.
2534CLRSTK
LD HL,277BH 21 7B 27LD HL,BADTIM$
CLRSTK: load Register Pair HL with 277BH, BADTIM$, the message Bad Time format; the LD leaves the flags (source: chg "Bad date format").
2537
LD (2512H),HL 22 12 25
Store Register Pair HL, 277BH, at 2512H, the operand of BADFMT's LD HL at 2511H, so that every bad entry below shows Bad Time format (source: to "Bad time...).
253A
POP HL E1
Restore Register Pair HL, the place in the command line after the word TIME, from the stack; the flags of @PARAM, or of the CP at 2527H, are kept (source: recover command ptr).
253B
If @PARAM gave Z, or there was no parameter list, jump to GDPARMS at 2547H (source: Z - ok to continue).
253DIOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number from @PARAM (source: xfer errcod to HL).
253E
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
2540
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: short error).
2542
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR (source: xfer to C).
2543
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message (source: log error).
2545
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short message of Register C.
2546
RET C9
Return through the tail of RST28 (1A77H) with Register Pair HL = the error number; the time is not changed.
2547H - GDPARMS: Set the Time
When the line begins with the parameters the time is shown (DSPTIME), and a time typed after them is never read (B148). Otherwise PARSDAT reads two or three fields, the hours into DTBUF+2, the minutes into DTBUF+1 and the seconds, 0 when the line ends after the minutes, into DTBUF+0, the order of TIME$. The hours may not be above 23, the minutes and seconds not above 59. The three bytes are copied to TIME$ (002DH-002FH), and CLOCK, when it was given, switches the clock display; the time set is not shown. The seconds may be left out only when the carriage return follows the minutes at once: TIME 12:30 (CLOCK) and a space after 12:30 give Bad Time format (B144).
2547GDPARMS
LD A,(HL) 7E
GDPARMS: load Register A with the byte at Register Pair HL, the first character after the word TIME and its spaces (source: p/u char).
2548
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis: the line begins with the parameters, and anything after them is not looked at (B148) (source: parms only?).
254A
If Register A is the parenthesis (Z) jump to DSPTIME at 2599H, which shows the time (source: display old time).
254D
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return: TIME alone (source: end of line?).
254F
If Register A is the carriage return (Z) jump to DSPTIME at 2599H, which shows the time (source: display old time).
2552
XOR A AF
XOR Register A with itself: Register A = 00H, for the two stores that follow.
2553
LD (25D2H),A 32 D2 25LD (ISTIM),A
Store Register A, 00H, at 25D2H, ISTIM, the operand of the LD A,0FFH at 25D1H: PARSDAT is told that it reads a time, which may end after two fields (source: show doing time).
2556
LD (278BH),A 32 8B 27LD (DTBUF),A
Store Register A, 00H, at 278BH, DTBUF+0, the seconds, for a time typed without them (source: init seconds to 0).
2559
LD C,30H 0E 30
Load Register C with 30H, the digit 0: PARSDAT takes as a separator a colon or any character below it (source: init separator).
255B
Call PARSDAT at 25B5H to read the fields from Register Pair HL into DTBUF, 278BH-278DH: the hours at 278DH, the minutes at 278CH, the seconds at 278BH; Z when they were read (source: parse entry).
255E
If PARSDAT returned NZ jump to BADFMT at 2511H, which now shows Bad Time format and returns FFFFH (source: bad - abort).
2560
LD HL,278DH 21 8D 27
Load Register Pair HL with 278DH, DTBUF+2, the hours (source: HL => hours byte).
2563
LD A,17H 3E 17
Load Register A with 17H, 23, the last hour of the day (source: greater than 23 ?).
2565
CP (HL) BE
Compare Register A with the byte at Register Pair HL, 278DH, the hours: Carry when they are above 23.
2566
If the hours are above 23 (Carry) jump to BADFMT at 2511H: Bad Time format (source: yes - bad format).
2568
DEC HL 2B
Decrement Register Pair HL to 278CH, DTBUF+1, the minutes (source: HL => minutes).
2569
LD A,3BH 3E 3B
Load Register A with 3BH, 59, the last minute of an hour and the last second of a minute (source: greater than 59 ?).
256B
CP (HL) BE
Compare Register A with the byte at Register Pair HL, 278CH, the minutes: Carry when they are above 59.
256C
If the minutes are above 59 (Carry) jump to BADFMT at 2511H: Bad Time format (source: yes - bad format).
256E
DEC HL 2B
Decrement Register Pair HL to 278BH, DTBUF+0, the seconds (source: HL => seconds).
256F
CP (HL) BE
Compare Register A, 3BH, with the byte at Register Pair HL, 278BH, the seconds: Carry when they are above 59 (source: greater than 59 ?).
2570
If the seconds are above 59 (Carry) jump to BADFMT at 2511H: Bad Time format (source: yes - bad format).
2572
PUSH HL E5
Save Register Pair HL, 278BH, DTBUF+0, on the stack (source: save TIME buffer ptr).
2573
LD HL,278EH 21 8E 27LD HL,DUMBUF
Load Register Pair HL with 278EH, DUMBUF: @TIME writes its eight characters HH:MM:SS to 278EH-2795H, where nothing reads them (source: HL => dummy buffer).
2576
LD A,13H 3E 13
Load Register A with 13H, SVC 19, @TIME, which writes the time as text and returns the address of TIME$ (source: DE <= TIME$+0).
2578
RST 28H EF
Call @TIME with RST 28H (BOOT/SYS 078DH): Register Pair DE = 002DH, TIME$+0, the seconds, on return.
2579
POP HL E1
Restore Register Pair HL, 278BH, DTBUF+0, from the stack (source: recover TIME buffer ptr).
257A
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three bytes of the time (source: 3 bytes to xfer).
257D
LDIR ED B0
Copy the three bytes from Register Pair HL, 278BH-278DH, to Register Pair DE, 002DH-002FH, with LDIR (Register Pair BC = 0003H): TIME$ holds the new seconds, minutes and hours; the clock interrupt goes on counting from them (source: xfer).
257FH - DOCLOCK and CLOCK: the Clock Display
CLOCK sets or resets bit 4 of VFLAG$ (007FH), which the clock task in BOOT/SYS (TIMTSK$, 0751H) tests every second to show the time at the top right of the screen. CLOCK alone, CLOCK=ON or CLOCK=YES give the word FFFFH and set the bit; anything else, CLOCK=OFF or CLOCK=NO (0000H) and any number but one whose low byte is FFH, resets it. Turning the display off leaves the last time shown on the screen.
257FDOCLOCK
LD HL,0000H 21 00 00
DOCLOCK: load Register Pair HL with 0000H, the return code of a normal exit (source: HL = 0 (normal exit)).
2582
LD A,(25FFH) 3A FF 25LD A,(CRESP)
Load Register A with the byte at 25FFH, CRESP, the response byte of CLOCK in PRMTBL$: 00H unless CLOCK was given (source: p/u response).
2585
OR A B7
OR Register A with itself: Z when CLOCK was not given.
2586
RET Z C8
Return with Register Pair HL = 0000H if CLOCK was not given (Z): through the tail of RST28 from 257FH, to DSPTIME from its CALL at 25A0H (source: RETurn if no response).
2587CLOCK
LD DE,0000H 11 00 00
CLOCK: load Register Pair DE with the value of CLOCK, which @PARAM stored at 2588H-2589H, the operand: FFFFH for ON, 0000H for OFF (0000H in the file) (source: p/u parm = FFFF or 0000).
258A
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which returns the address of the system flags (source: IY => system flags).
258C
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
258D
SET 4,(IY+15H) FD CB 15 E6
Set bit 4 of VFLAG$ (IY+15H, 007FH), Index Register IY holding 006AH: the clock display is on, even for CLOCK=OFF until 2593H (B149) (source: set clock bit).
2591
INC E 1C
Increment Register E, the low byte of the value of CLOCK: Z only for FFH, CLOCK alone, =ON, =YES or a number such as 255 (source: return if CLOCK = YES).
2592
RET Z C8
Return with the clock display on if Register E became 00H (Z), with Register Pair HL = 0000H.
2593
RES 4,(IY+15H) FD CB 15 A6
Reset bit 4 of VFLAG$ (IY+15H, 007FH), Index Register IY holding 006AH: the clock display is off; the time last drawn stays on the screen (source: otherwise reset bit).
2597
DEC E 1D
Decrement Register E back to the low byte of the value: Z for CLOCK=OFF or =NO, 00H (source: set Z flag).
2598
RET C9
Return with the clock display off and Register Pair HL = 0000H; the flags are not looked at by either caller (source: done - RETurn).
2599DSPTIME
LD HL,2742H 21 42 27
DSPTIME: load Register Pair HL with 2742H, DATEBUF+9, the eight places of the time; the carriage return of YRBUF at 274AH ends them (source: pt to space for time str).
259C
PUSH HL E5
Save Register Pair HL, 2742H, on the stack: LOGDT takes it back for @LOGOT (source: save pointer).
259D
LD A,13H 3E 13
Load Register A with 13H, SVC 19, @TIME, which writes the time as HH:MM:SS at Register Pair HL (source: xfer time into buffer).
259F
RST 28H EF
Call @TIME with RST 28H (BOOT/SYS 078DH): 2742H-2749H = the time from TIME$ (002DH-002FH).
25A0
Call DOCLOCK at 257FH: when CLOCK was given the clock display is switched on or off before the time is shown (source: set/reset clock bit).
25A3
Jump to LOGDT at 2503H, which shows the time at 2742H and returns 0000H (source: log it & exit).
25A6H - DSPMDY: Copy a Name from a Table
Register B holds the entry, 1 for the first; Register Pair HL the table of three letter names, which may not cross a 256 byte boundary (the address is worked out on Register L alone); the three letters go to Register Pair DE, which returns after them.
25A6DSPMDY
DEC B 05
DSPMDY: decrement Register B: the day of the week 1-7 or the month 1-12 becomes the entry 0-6 or 0-11 (source: B = entry, 0-6).
25A7
LD A,L 7D
Load Register A with Register L, the low byte of the table: 00H for DAYTBL, 15H for MONTBL (source: p/u lsb of table start).
25A8
ADD A,B 80
Add Register B, the entry, to Register A: the first of three additions, as each entry is three bytes long.
25A9
ADD A,B 80
Add Register B to Register A again: two thirds of the entry's offset (source: entries 3 bytes long).
25AA
ADD A,B 80
Add Register B to Register A a third time: the low byte of the table plus three times the entry.
25AB
LD L,A 6F
Load Register L with Register A: Register Pair HL points at the entry's first letter (source: HL => table entry).
25AC
LD B,03H 06 03
Load Register B with 03H, the three letters to copy (source: three chars to xfer).
25AEDSPM1
LD A,(HL) 7E
DSPM1: load Register A with the byte at Register Pair HL, a letter of the name (source: p/u char from table).
25AF
LD (DE),A 12
Store Register A, the letter, at Register Pair DE, the place in DATEBUF (source: stuff into buffer).
25B0
INC HL 23
Increment Register Pair HL to the next letter of the name (source: bump).
25B1
INC DE 13
Increment Register Pair DE to the next place in DATEBUF.
25B2
Decrement Register B and jump back to DSPM1 at 25AEH while it is not zero: three letters are copied (source: three chars to xfer).
25B4
RET C9
Return with Register Pair DE after the three letters and Register Pair HL after the entry (source: done - RETurn).
25B5H - PARSDAT, PRS2 and PRS4: Read Three Fields of Two Digits
PARSDAT reads at most three fields of exactly two digits each from Register Pair HL and stores them backwards, at DTBUF+2 (278DH), DTBUF+1 and DTBUF+0, so that the first field typed is the month or the hours. After each of the first two fields a separator is read: a colon, or any character below Register C (30H, the digit 0: a slash, a dash, a point, a space, a comma); the carriage return is one of them, and is accepted after the second field only when ISTIM (25D2H) has been made 00H by TIME. Nothing after the third field is looked at. It returns Z, Register B = 00H and Register Pair DE = 278BH when all the fields were read, Z with Register B = 01H when a time ends after the minutes, NZ otherwise.
25B5PARSDAT
LD DE,278DH 11 8D 27
PARSDAT: load Register Pair DE with 278DH, DTBUF+2, where the first field goes (source: point to buf end).
25B8
LD B,03H 06 03
Load Register B with 03H, the three fields to read (source: process 3 fields).
25BAPRS1
PUSH DE D5
PRS1: save Register Pair DE, the place for the field, on the stack: PRS2 works in Register E (source: save pointer).
25BB
Call PRS2 at 25DBH to read two digits at Register Pair HL; Z with Register A = their value 0 to 99, NZ for a character that is not a digit (source: get a digit pair).
25BE
POP DE D1
Restore Register Pair DE, the place for the field, from the stack (source: recover pointer).
25BF
RET NZ C0
Return NZ if the two characters were not both digits (source: ret if bad digit pair).
25C0
LD (DE),A 12
Store Register A, the value of the field, at Register Pair DE (source: else stuff the value).
25C1
DEC B 05
Decrement Register B, the fields still to read (source: loop countdown).
25C2
RET Z C8
Return Z with Register B = 00H after the third field: whatever follows it on the line is not looked at (source: do for 3 fields).
25C3
DEC DE 1B
Decrement Register Pair DE to the place of the next field, DTBUF+1 or DTBUF+0 (source: backup the pointer).
25C4
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the two digits, the separator (source: p/u separator).
25C5
INC HL 23
Increment Register Pair HL past the separator (source: bump pointer).
25C6
CP 3AH FE 3A
Compare Register A with 3AH, the colon, which always separates fields (source: check for ':').
25C8
If Register A is the colon (Z) jump back to PRS1 at 25BAH for the next field (source: loop if so).
25CA
CP C B9
Compare Register A with Register C, 30H: a separator must be below the digit 0 (source: correct ?).
25CB
If Register A is 30H or more (No Carry) jump to PRSRET at 25D9H, which returns NZ: a digit or a letter where a separator should be (source: NC = bad).
25CD
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return: the end of the line before the third field (source: if end of line, ck for time).
25CF
If Register A is any other separator (NZ) jump back to PRS1 at 25BAH for the next field.
25D1
LD A,0FFH 3E FF
Load Register A with FFH; the operand at 25D2H, ISTIM, is FFH in the file for DATE and made 00H by TIME at 2553H (source: set zero by time).
25D3
OR A B7
OR Register A with itself: NZ for DATE, which must have three fields, Z for TIME.
25D4
If Register A is FFH (NZ) jump to PRSRET at 25D9H: a date that ends too soon (source: bad if date).
25D6
LD A,B 78
Load Register A with Register B, the fields still to read: 1 when the line ends after the minutes.
25D7
DEC A 3D
Decrement Register A: Z when Register B was 1, so the time has its hours and minutes, and the seconds keep the 00H stored at 2556H (source: if B was one, done).
25D8
RET Z C8
Return Z when the time ended after the minutes; Register B is 01H.
25D9PRSRET
OR A B7
PRSRET: OR Register A with itself: NZ, as Register A is not 00H on any path here (a separator of 30H or more, FFH, or the fields left less one) (source: set NZ).
25DA
RET C9
Return NZ: the entry is not valid (source: return bad entry).
25DBPRS2
PRS2: call PRS4 at 25F1H to read the tens digit at Register Pair HL; Carry with Register A = 0 to 9 when it is a digit (source: get a digit).
25DE
If the character is not a digit (No Carry) jump to PRS3 at 25EFH, which returns NZ (source: illegal - return).
25E0
LD E,A 5F
Load Register E with Register A, the tens digit, to multiply it by ten (source: multiply by ten).
25E1
RLCA 07
Rotate Register A left one bit: the tens digit times 2, no carry for 0 to 9 (source: X 2).
25E2
RLCA 07
Rotate Register A left one more bit: the tens digit times 4 (source: X 4).
25E3
ADD A,E 83
Add Register E, the tens digit, to Register A: the tens digit times 5 (source: X 5).
25E4
RLCA 07
Rotate Register A left one bit: the tens digit times 10, 0 to 90 (source: X 10).
25E5
LD E,A 5F
Load Register E with Register A, the tens digit times 10 (source: stuff in E).
25E6
Call PRS4 at 25F1H to read the units digit at Register Pair HL (source: get ones digit).
25E9
If the character is not a digit (No Carry) jump to PRS3 at 25EFH, which returns NZ (source: bad - return NZ).
25EB
ADD A,E 83
Add Register E, the tens times 10, to Register A, the units digit: the value of the field, 0 to 99 (source: accumulate new digit).
25EC
LD E,A 5F
Load Register E with Register A, the value of the field (source: save 2-digit value).
25ED
CP A BF
Compare Register A with itself: the Z flag set, the value kept in Register A (source: clear flags).
25EE
RET C9
Return Z with Register A = the value of the two digits (source: return Z).
25EFPRS3
OR A B7
PRS3: OR Register A with itself: NZ, as Register A, the character less 30H, is 0AH or more (source: set NZ).
25F0
RET C9
Return NZ: the field did not hold two digits (source: RETurn).
25F1PRS4
LD A,(HL) 7E
PRS4: load Register A with the byte at Register Pair HL, a character of the line (source: p/u a digit &).
25F2
INC HL 23
Increment Register Pair HL past the character (source: bump ptr).
25F3
SUB 30H D6 30
Subtract 30H from Register A: the digits 0 to 9 become 00H to 09H (source: convert to binary).
25F5
CP 0AH FE 0A
Compare Register A with 0AH: Carry for a digit, No Carry for any other character, the ones below 30H too as they wrap round to D0H-FFH (source: legal ?).
25F7
RET C9
Return Carry with Register A = the digit, or No Carry (source: C - legal, NC - illegal).
25F8H - PRMTBL$, the Names, the Line and the Messages
The parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H; 253 bytes not in the file, as the source starts the second block at the next 256 byte boundary; the names of the days and months, three letters each; DATEBUF and YRBUF, the line in which the date or the time is shown; the month lengths; and the three messages, each ended by a carriage return. DTBUF (278BH-278DH) and DUMBUF (278EH-2795H) follow the member with no bytes in the file.
25F8PRMTBL$
DEFB 80H 80
PRMTBL$, 25F8H: 80H, the mark of a table in the enhanced format, given to @PARAM at 252EH.
25F9-25FE
DEFB 55H / DEFM "CLOCK" 55 43 4C 4F 43 4B
25F9H-25FEH: type 55H (a flag, bit 6, with a one letter short form, bit 4, and five letters) and the name CLOCK, C for short; @PARAM does not check the kind of value.
25FFCRESP
DEFB 00H 00
CRESP, 25FFH: the response byte of CLOCK, 00H until @PARAM finds the word; read by DOCLOCK at 2582H.
2600-2601
DEFW 2588H 88 25
2600H-2601H: the address of the value of CLOCK, 2588H, the operand of the LD DE at CLOCK (2587H).
2602
DEFB 00H 00
2602H: the 00H that ends the table, the last byte of the third load block (2600H-2602H) and the last before the gap.
2603-26FF
DEFS 253
2603H-26FFH: 253 bytes not in the file; the source moves the origin to the next 256 byte boundary (ORG $<-8+1<+8) so that DAYTBL and MONTBL lie within one page, as DSPMDY works out its addresses on Register L alone.
2700-2714DAYTBL
DEFM "SunMonTueWedThuFriSat" 53 75 6E 4D 6F 6E 54 75 65 57 65 64 54 68 75 46 72 69 53 61 74
DAYTBL, 2700H-2714H: the seven days, three letters each, Sunday first, the entries 1 to 7 of the day of the week (24C8H).
2715-2738MONTBL
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
MONTBL, 2715H-2738H: the twelve months, three letters each, January first (24D4H).
2739-2744DATEBUF
DEFM "Day, Mon xx," 44 61 79 2C 20 4D 6F 6E 20 78 78 2C
DATEBUF, 2739H-2744H: the line shown by DATE: the day's name goes to 2739H, the month's to 273EH, the day of the month to 2742H-2743H; TIME writes HH:MM:SS from 2742H (2599H).
2745-274AYRBUF
DEFM " 198x" / DEFB 0DH 20 31 39 38 78 0D
YRBUF, 2745H-274AH: five places that @HEXDEC fills with a space and the year in full (2502H), and the carriage return that ends the line of the date and of the time.
274B-2757MAXDAYS
DEFB 00H, 1FH, 1CH, 1FH, 1EH, 1FH, 1EH, 1FH, 1FH, 1EH, 1FH, 1EH, 1FH 00 1F 1C 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
MAXDAYS, 274BH-2757H: 0, then the lengths of the twelve months, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31; February, 274DH, becomes 29 in a leap year (2446H, 247CH).
2758-276ANODATE$
DEFM "Date not in system" / DEFB 0DH 44 61 74 65 20 6E 6F 74 20 69 6E 20 73 79 73 74 65 6D 0D
NODATE$, 2758H-276AH: shown when DATE$ holds no month (2465H), ended by its carriage return.
276B-277ABADDAT$
DEFM "Bad Date format" / DEFB 0DH 42 61 64 20 44 61 74 65 20 66 6F 72 6D 61 74 0D
BADDAT$, 276BH-277AH: shown by BADFMT (2511H) for a date that is not valid, ended by its carriage return.
277B-278ABADTIM$
DEFM "Bad Time format" / DEFB 0DH 42 61 64 20 54 69 6D 65 20 66 6F 72 6D 61 74 0D
BADTIM$, 277BH-278AH: put into BADFMT's operand by TIME (2534H) for a time that is not valid; the last byte of the member.
2400H - Member 3 (DEBUG and VERIFY): the Entries and DEBUG
SYS1/SYS runs DEBUG with request 14H and VERIFY with request 1BH; their two headers (file offsets 0039H for DEBUG, entry 2403H, and 0041H for VERIFY, entry 2400H; both record 07H, byte 5AH) point at member 3, which the overlay loader reads to 2400H-2521H, 290 bytes in two load blocks, and calls with Register Pair HL at the text after the command word. Both read old style parameter tables (six character names and a word for each) with @PARAM, and both switch off only when the word of OFF and N ORs to FFH: OFF or N with no value or with =Y, ON or YES, or a number whose two bytes OR to FFH (NPARM, 24B6H). With no parenthesis @PARAM reads nothing, so DEBUG OFF and VERIFY OFF typed without one switch on (B127). Neither keeps the Stack Pointer, tests BREAK or calls @CKBRKC: every exit ends with RET at the depth of the entry, into the tail of RST28 (1A77H). Its source has no 631 change.
2400
VERIFY's entry (request 1BH): jump to VERIFY at 2478H (source: verify entry point).
2403DEBUG
LD DE,24F1H 11 F1 24LD DE,PRM1TBL
DEBUG: DEBUG's entry (request 14H): load Register Pair DE with 24F1H, PRM1TBL, the table of EXT and E, ON, OFF, Y and N for @PARAM (source: pt to y/n on/off parms).
2406
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads a parameter list in parentheses at Register Pair HL against the table at Register Pair DE.
2408
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): each parameter given stores its value as a word at the address in its table entry, FFFFH for a word with no equals sign; with no opening parenthesis after the word it returns Z at once and stores nothing, so DEBUG OFF without parentheses switches on (B127).
2409
If @PARAM returned NZ (a word not in the table or a bad value, error 44) jump to IOERR at 24C3H (source: jump on parm error).
240C
Call NPARM at 24B6H, which also points Index Register IY at FLGTAB$: Z when the word of OFF and N ORs to FFH (OFF or N alone, or =Y), NZ otherwise (source: ck on yes or no entry).
240F
If Z (OFF or N) jump to DBG2 at 2432H, which turns the debugger off (source: go if no).
2411
LD A,(2473H) 3A 73 24LD A,(EPARM)
Load Register A with the byte at 2473H, the low byte of EPARM, the word @PARAM stored for EXT or E (0000H in the file) (source: ck on extended DEBUG).
2414
OR A B7
OR Register A with itself: Z when EXT was not given (or was given with a value whose low byte is 00H).
2415
If EXT was not asked for jump to DBG0 at 2421H and turn on the debugger of SYS5/SYS only.
2417
BIT 0,(IY+02H) FD CB 02 46
Test bit 0 of CFLAG$ (IY+02H, 006CH), Index Register IY holding 006AH: HIGH$ frozen; CLEANUP clears it on every @EXIT and @CMNDI, so it is set here only when a program set it and runs DEBUG through @CMNDR (source: can't put extended DEBUG if himem not available).
241B
If HIGH$ is frozen jump to CANT at 24CDH: No memory space available, and the debugger is left as it was.
241E
Call DBG3 at 2475H, whose RST 28H runs SYS9/SYS: the overlay returns here, to 2421H, as the dispatcher drops the RST's own return (source: call if EXT entered).
2421DBG0
SET 7,(IY+12H) FD CB 12 FE
DBG0: set bit 7 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: the DEBUG flag, from which SYS1's CLEANUP sets @DBGHK on every @EXIT and @CMNDI (source: turn on DEBUG flag).
2425
LD D,08H 16 08
Load Register D with 08H, the mask of bit 3 of DODATA$ (0B94H), set for special characters from C0H-FFH, for GET$DO (source: set to mask bit 3).
2427
Call GET$DO at 2498H: bit 3 of DODATA$ is kept in its bit 7 and cleared, so that while the debugger is on the video driver shows C0H-FFH as tabs.
242ADBG0A
XOR A AF
DBG0A: clear Register A to 00H, the NOP of the debugger hook when it is on (source: and enable DEBUG).
242BDBG1
LD (199FH),A 32 9F 19LD (@DBGHK),A
DBG1: store Register A into 199FH, @DBGHK. The store does not last: RST28 kept the hook's byte (C9H, which SYS1 stored before the library request) at 1A79H, and its tail at 1A7AH puts it back when the member returns. The hook comes on at the next @EXIT or @CMNDI, when CLEANUP sets it from SFLAG$ bit 7; after DEBUG run through @CMNDR it stays C9H until then.
242EEXIT
LD HL,0000H 21 00 00
EXIT: load Register Pair HL with 0000H, the return code for no error (source: set no error); VERIFY ends here too (2496H).
2431
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, which CLEANUP left under SYS1's entry, or to the caller of @CMNDR, with Register Pair HL = 0000H.
2432H - DBG2: DEBUG (OFF)
DEBUG (OFF) clears the DEBUG flag and gives DODATA$ back its bit 3. With EXT as well (DEBUG (OFF,EXT)) it also removes the extended debugger of SYS9/SYS, but only when HIGH$ may be changed, the module is installed (EXTDBG$, 19A4H, is not ORARET@, 1503H) and it is the lowest module in high memory (HIGH$ + 1): HIGH$ is set back to the word at the module's +2, the last byte the module used, which is the HIGH$ that SYS9 found, and EXTDBG$ back to 1503H. In every case @DBGHK is set to C9H.
2432DBG2
RES 7,(IY+12H) FD CB 12 BE
DBG2: reset bit 7 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: the DEBUG flag is off (source: turn off DEBUG flag).
2436
LD D,80H 16 80
Load Register D with 80H, the mask of bit 7 of DODATA$, where DEBUG (ON) kept bit 3 (source: set to mask bit 7).
2438
Call GET$DO at 2498H: bit 7 of DODATA$ goes back into bit 3 and bit 7 is cleared.
243BDBG2A
LD A,(2473H) 3A 73 24LD A,(EPARM)
DBG2A: load Register A with the byte at 2473H, the low byte of EPARM, the value of EXT or E (source: ck on extended DEBUG requested).
243E
OR A B7
OR Register A with itself, which also clears the Carry flag for the ADC at 244EH: Z when EXT was not given.
243F
If EXT was not given jump to DBG4 at 246FH, which switches the hook off.
2441
BIT 0,(IY+02H) FD CB 02 46
Test bit 0 of CFLAG$ (IY+02H, 006CH), Index Register IY holding 006AH: HIGH$ frozen, set only by a program running DEBUG through @CMNDR (source: can we alter HIGH$).
2445
If HIGH$ is frozen jump to DBG4 at 246FH: the extended debugger stays in memory and in use, with no message.
2447
LD DE,(19A4H) ED 5B A4 19LD DE,(EXTDBG$)
Load Register Pair DE with the word at 19A4H-19A5H, EXTDBG$, the address that the debugger jumps to for a command it does not know (source: is extended resident).
244B
LD HL,0EAFDH 21 FD EA
Load Register Pair HL with EAFDH, the two's complement of 1503H (ORARET@, the default value of EXTDBG$).
244E
ADC HL,DE ED 5A
Add Register Pair DE and the Carry flag (clear) to Register Pair HL with ADC, which sets the Z flag (ADD HL,DE would not): Z when Register Pair DE is 1503H.
2450
If EXTDBG$ is 1503H jump to DBG4 at 246FH: no extended debugger is installed (source: go if not resident).
2452
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, which asks @HIGH$ for the current value (source: set to get HIGH$).
2455
LD B,L 45
Load Register B with Register L, 00H: @HIGH$ function 0, HIGH$ rather than LOW$.
2456
LD A,64H 3E 64
Load Register A with 64H, SVC 100, @HIGH$, which gets or sets HIGH$ or LOW$.
2458
RST 28H EF
Call @HIGH$ with RST 28H (SYS0/SYS): Register Pair HL = HIGH$, the highest byte free for programs (source: p/u current pointer).
2459
INC HL 23
Increment Register Pair HL to HIGH$ + 1, the first byte of the lowest module in high memory (source: point to assumed module).
245A
XOR A AF
Clear Register A to 00H and the Carry flag for the SBC below.
245B
SBC HL,DE ED 52
Subtract Register Pair DE, the module's address from EXTDBG$, from Register Pair HL: Z when the extended debugger is the lowest module (source: check if extended debugger is lowest).
245D
If another module was put below it jump to DBG4 at 246FH: the extended debugger cannot be released and stays in use, with no message (source: can't release if not).
245F
INC DE 13
Increment Register Pair DE to the module's +1 (source: point to last byte used).
2460
INC DE 13
Increment Register Pair DE to the module's +2, the word after the JR of the module header: the last byte the module uses.
2461
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the module's +2.
2462
LD E,(HL) 5E
Load Register E with the byte at Register Pair HL, the low byte of the module's last byte (source: this will be new HIGH$).
2463
INC HL 23
Increment Register Pair HL to the module's +3.
2464
LD D,(HL) 56
Load Register D with the byte at Register Pair HL, the high byte: Register Pair DE = the last byte of the module, the HIGH$ that SYS9/SYS found.
2465
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the new HIGH$ (source: new high to HL).
2466
LD A,64H 3E 64
Load Register A with 64H, SVC 100, @HIGH$, Register B still 00H: set HIGH$ to Register Pair HL.
2468
RST 28H EF
Call @HIGH$ with RST 28H to set HIGH$ back above the module, which frees its memory; the result is not tested (source: reset HIGH$).
2469
LD HL,1503H 21 03 15LD HL,ORARET@
Load Register Pair HL with 1503H, ORARET@, the OR A / RET that EXTDBG$ holds when no extended debugger is installed.
246C
LD (19A4H),HL 22 A4 19LD (EXTDBG$),HL
Store Register Pair HL into 19A4H-19A5H, EXTDBG$: the debugger no longer jumps into the freed memory (source: reset extended debugger vector to default).
246FDBG4
LD A,0C9H 3E C9
DBG4: load Register A with C9H, the RET that switches the debugger hook off (source: turn off DEBUG vector).
2471
Jump to DBG1 at 242BH, which stores Register A into @DBGHK (199FH) and ends with 0000H.
2473-2474EPARM
DEFW 0000H 00 00
EPARM, 2473H-2474H: the word that @PARAM stores for EXT or E, FFFFH when given without a value; only its low byte is tested (2411H, 243BH). 0000H in the file, which is read again for each command.
2475DBG3
LD A,9BH 3E 9B
DBG3: load Register A with 9BH, the overlay request that runs SYS9/SYS, the extended debugger (source: get SYS9 loaded and up).
2477
RST 28H EF
Call SYS9/SYS with RST 28H: unless EXTDBG$ already holds another address than 1503H, SYS9 lowers HIGH$ by the module's size (without testing LOW$), copies the module EXTDBG above it and points EXTDBG$ at it; it returns to 2421H, the address after the CALL at 241EH.
2478H - VERIFY
VERIFY (ON) puts @VER (1560H) into the SVC table word of @WRITE (SVC 75, 0196H): @VER is @WRITE with the read back after writing (VEROP) set. It also sets DFLAG$ bit 2, which DEVICE shows as Verify; VERIFY (OFF) puts back @WRITE (1531H) and resets the bit. VERIFY alone is VERIFY (ON). The word is written whatever it held, so a program that had pointed SVC 75 elsewhere loses its hook.
2478VERIFY
LD DE,2501H 11 01 25LD DE,PRM2TBL
VERIFY: load Register Pair DE with 2501H, PRM2TBL, the table of ON, OFF, Y and N (source: pt to ext plus above, the second half of DEBUG's table).
247B
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, for the parameter list at Register Pair HL.
247D
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS) to read the parameters against the table at Register Pair DE, 2501H.
247E
If @PARAM returned NZ (error 44; EXT too, which this table does not hold) jump to IOERR at 24C3H (source: quit on parm error).
2480
Call NPARM at 24B6H, which also points Index Register IY at FLGTAB$: Z when OFF or N was given (source: ck yes/no).
2483
LD HL,1531H 21 31 15LD HL,@WRITE
Load Register Pair HL with 1531H, @WRITE, the vector for writes without a read back (source: init to vector WRITE).
2486
RES 2,(IY+03H) FD CB 03 96
Reset bit 2 of DFLAG$ (IY+03H, 006DH), Index Register IY holding 006AH: verify off; the RES leaves the flags of NPARM (source: indicate VERIFY=OFF).
248A
If OFF or N was given (Z) jump to VER1 at 2493H with Register Pair HL = 1531H.
248C
LD HL,1560H 21 60 15LD HL,@VER
Load Register Pair HL with 1560H, @VER, which writes and then reads the sector back (source: init to vector VERIFY).
248F
SET 2,(IY+03H) FD CB 03 D6
Set bit 2 of DFLAG$ (IY+03H, 006DH), Index Register IY holding 006AH: verify on (source: indicate VERIFY=ON).
2493VER1
LD (0196H),HL 22 96 01
VER1: store Register Pair HL into 0196H-0197H, the word of SVC 75, @WRITE, in SVCTAB$ (0100H + 2 x 75): with 1560H, @VER, each sector the file routines write is read back after it is written (source: change SVCTAB vector).
2496
Jump to EXIT at 242EH, which returns with Register Pair HL = 0000H.
2498H - GET$DO and NPARM
GET$DO finds the video driver's module $DO with @GTMOD and moves one bit of DODATA$, its mode byte (0B94H): with mask 08H bit 3 (special characters from C0H-FFH) into bit 7, with mask 80H bit 7 back into bit 3; the other bit of the pair is cleared and the rest kept. The bit kept is whatever bit 7 or bit 3 holds at the time, so a second DEBUG (ON) keeps the 0 that the first one left in bit 3, and DEBUG (OFF) with no DEBUG (ON) before it takes bit 7, which is 0: either way bit 3 ends up clear, until a program sends control code 15H, which toggles it (B120). NPARM gives Z only when the word of OFF and N ORs to FFH: ON and Y store their word at YPARM (24C1H), which is never read, so DEBUG (ON=N) or VERIFY (Y=NO) still switches on (B119).
2498GET$DO
PUSH DE D5
GET$DO: save Register Pair DE, Register D holding the mask, on the stack (source: save mask value).
2499
LD DE,24B2H 11 B2 24LD DE,$DO$
Load Register Pair DE with 24B2H, $DO$, the module name $DO ended by 03H.
249C
LD A,53H 3E 53
Load Register A with 53H, SVC 83, @GTMOD, which finds a memory module by the name at Register Pair DE.
249E
RST 28H EF
Call @GTMOD with RST 28H (SYS12/SYS): Z with Register Pair DE after the name in the module's header, 0B90H for the video driver (DODVR, 0B88H), NZ when no module $DO is found.
249F
LD HL,0004H 21 04 00
Load Register Pair HL with 0004H, the bytes after the name: the DCB word and the word after it (source: point to 1st data byte).
24A2
ADD HL,DE 19
Add Register Pair DE to Register Pair HL: 0B94H, DODATA$; the ADD leaves the Z flag of @GTMOD.
24A3
POP DE D1
Restore Register Pair DE from the stack, Register D the mask (source: rcvr mask value).
24A4
RET NZ C0
Return if @GTMOD returned NZ: no $DO module, nothing changed (source: return if not found).
24A5
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DODATA$, the video mode byte (source: p/u existing state).
24A6
AND D A2
AND Register A with Register D, the mask: bit 3 alone (08H) or bit 7 alone (80H) is kept.
24A7
RLCA 07
Rotate Register A left, the first of four RLCA that swap its two halves: bit 3 goes to bit 7, bit 7 to bit 3.
24A8
RLCA 07
Rotate Register A left a second time with RLCA, the bit moving on.
24A9
RLCA 07
Rotate Register A left a third time with RLCA, the bit moving on.
24AA
RLCA 07
Rotate Register A left a fourth time: the kept bit is now in the other place.
24AB
LD E,A 5F
Load Register E with Register A, the moved bit (source: tempy save).
24AC
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DODATA$, again.
24AD
AND 77H E6 77
AND Register A with 77H: bits 7 and 3 cleared, the rest of the mode byte kept (source: strip bits 3 and 7).
24AF
OR E B3
OR Register A with Register E, the moved bit (source: merge comp state).
24B0
LD (HL),A 77
Store Register A into the byte at Register Pair HL, DODATA$ (0B94H).
24B1
RET C9
Return to DEBUG with DODATA$ (0B94H) changed, or unchanged after a NZ.
24B2-24B5$DO$
DEFM "$DO" / DEFB 03H 24 44 4F 03
$DO$, 24B2H-24B5H: the name of the video driver's module for @GTMOD (2499H), ended by 03H.
24B6NPARM
LD BC,0000H 01 00 00
NPARM: load Register Pair BC with the word of OFF and N, whose table entries point at 24B7H, this operand: 0000H in the file, FFFFH when OFF or N is given (source: p/u no parm entry).
24B9
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which points Index Register IY to FLGTAB$ (006AH) (source: point to flag table).
24BB
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH for the caller's flag tests.
24BC
LD A,B 78
Load Register A with Register B, the high byte of the word of OFF and N.
24BD
OR C B1
OR Register A with Register C, the low byte: FFH when OFF or N was given without a value or with =Y (or a number whose two bytes OR to FFH), 00H when they were not given (source: if NO, make Z).
24BE
XOR 0FFH EE FF
Exclusive OR Register A with FFH: Z when OFF or N was given, NZ (switch on) in every other case, ON=N or Y=N too, as YPARM is not read (B119).
24C0
RET C9
Return to DEBUG or VERIFY with the Z flag set for OFF.
24C1-24C2YPARM
DEFW 0000H 00 00
YPARM, 24C1H-24C2H: the word that @PARAM stores for ON or Y; nothing reads it (B119). 0000H in the file.
24C3H - Exits and the Parameter Tables
IOERR shows the short message of an error and returns its number; CANT shows No memory space available and returns FFFFH. The two old style tables follow: PRM1TBL (DEBUG) holds EXT and E for EPARM, then PRM2TBL, the part that VERIFY reads, holds ON and Y for YPARM and OFF and N for NPARM+1; a 00H ends both.
24C3IOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number (source: set HL = error code).
24C4
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
24C6
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: short error).
24C8
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
24C9
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message.
24CB
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short error message.
24CC
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or to the caller of @CMNDR, with Register Pair HL = the error number (source: return to DOS).
24CDCANT
LD HL,24D7H 21 D7 24LD HL,CANT$
CANT: load Register Pair HL with 24D7H, CANT$, No memory space available.
24D0
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
24D2
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message at 24D7H.
24D3
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code after a message of the member's own.
24D6
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or to the caller of @CMNDR, with Register Pair HL = FFFFH.
24D7-24F0CANT$
DEFM "No memory space available" / DEFB 0DH 4E 6F 20 6D 65 6D 6F 72 79 20 73 70 61 63 65 20 61 76 61 69 6C 61 62 6C 65 0D
CANT$, 24D7H-24F0H: the message of CANT (24CDH), ended by its carriage return.
24F1-24F8PRM1TBL
DEFM "EXT " / DEFW 2473H 45 58 54 20 20 20 73 24
PRM1TBL, 24F1H-24F8H: the old style entry EXT, its word stored at EPARM (2473H); DEBUG's table starts here (2403H).
24F9-2500
DEFM "E " / DEFW 2473H 45 20 20 20 20 20 73 24
24F9H-2500H: E, the short form of EXT, also stored at EPARM (2473H).
2501-2508PRM2TBL
DEFM "ON " / DEFW 24C1H 4F 4E 20 20 20 20 C1 24
PRM2TBL, 2501H-2508H: ON, its word stored at YPARM (24C1H), which is never read; VERIFY's table starts here (2478H).
2509-2510
DEFM "OFF " / DEFW 24B7H 4F 46 46 20 20 20 B7 24
2509H-2510H: OFF, its word stored at 24B7H, the operand of NPARM's LD BC (24B6H).
2511-2518
DEFM "Y " / DEFW 24C1H 59 20 20 20 20 20 C1 24
2511H-2518H: Y, the short form of ON, also stored at YPARM (24C1H).
2519-2520
DEFM "N " / DEFW 24B7H 4E 20 20 20 20 20 B7 24
2519H-2520H: N, the short form of OFF, also stored at 24B7H, NPARM's operand.
2521
DEFB 00H 00
2521H: the 00H where a next entry would begin, which ends both tables for @FNDPRM.
2400H - Member 4 (ATTRIB): Entry, Exits and Messages
SYS1/SYS runs ATTRIB with request 51H; its 08H header at file offset 0049H gives record 0008H, byte 87H, file offset 0887H, where member 4 begins, which the overlay loader reads to 2400H-2901H, one stretch of 1282 bytes in six load blocks, and calls at 2400H with Register Pair HL at the text after the word ATTRIB. ATTRIB has two forms: with a file spec it changes that file's protection level, visibility and owner password in its directory entry; with a drive spec or none it changes the disk name and master password in the GAT and, with LOCK or UNLOCK, the owner passwords of the drive's ordinary files. The password buffer PSWDBUF (2902H), HASHBUF (290AH), the FCB (290EH) and the three 256 byte buffers BUFFER (2A00H), GATBUF (2B00H) and HITBUF (2C00H) follow the member and have no bytes in the file. The entry keeps the Stack Pointer and tests no BREAK; every exit goes through SAVESP, which clears a BREAK with @CKBRKC. Its one 631 change is the test of the drive digit at 25BDH.
2400ATTRIB
LD (2431H),SP ED 73 31 24
ATTRIB: ATTRIB's entry (request 51H): store the Stack Pointer into 2431H-2432H, the operand of the LD SP at SAVESP (2430H), so that every exit returns at the depth of the entry (source: save stack pointer).
2404
Call ATTRIB1 at 2437H, which does the command and returns to 2407H only when it ends with no error and no message.
2407
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code for no error (source: set no error).
240A
Jump to SAVESP at 2430H, which restores the Stack Pointer of the entry, clears a BREAK and returns (source: p/u stack & return).
240CH - IOERR, the Messages and SAVESP
IOERR shows the short message of an SVC's error number through @ERROR and returns it as the code; the number 3FH (63, the extended error) is ATTRIB's own sign that Register Pair HL points at a message of its own, which EXTERR shows with @LOGOT before the code FFFFH. ABORT, SPCREQ, NOTDUN and ATBERR are a chain of LD HL instructions made into LD IX by the DDH byte before each, so each one keeps Register Pair HL at its own message.
240CIOERR
CP 3FH FE 3F
IOERR: compare Register A, the error number, with 3FH, 63, the extended error that ATTRIB's own routines give with Register Pair HL at a message (source: extended error?).
240E
If Register A is 3FH jump to EXTERR at 242AH, which shows the message at Register Pair HL with @LOGOT.
2410
LD L,A 6F
Load Register L with Register A, the error number (source: error # to HL).
2411
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
2413
OR 0C0H F6 C0
OR Register A with 0C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: abbrev & return).
2415
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
2416
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message.
2418
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short message of Register C.
2419
Jump to SAVESP at 2430H, which restores the Stack Pointer of the entry and returns with Register Pair HL = the error number (source: p/u stack & RETurn).
241BABORT
LD HL,28C9H 21 C9 28LD HL,ABORT$
ABORT: load Register Pair HL with 28C9H, ABORT$, Command aborted, for a BREAK at a prompt (274CH).
241E
DEFB 0DDH DD
241EH: the DDH that makes the next LD HL,27D9H an LD IX,27D9H, so that ABORT keeps Register Pair HL at its own message; Index Register IX is changed and not used after.
241FSPCREQ
LD HL,27D9H 21 D9 27LD HL,SPCREQ$
SPCREQ: load Register Pair HL with 27D9H, SPCREQ$, File spec required, for a device spec (2443H).
2422
DEFB 0DDH DD
2422H: the DDH that makes the next LD HL,27ECH an LD IX,27ECH, so that ABORT and SPCREQ keep Register Pair HL at their message.
2423NOTDUN
LD HL,27ECH 21 EC 27LD HL,NOTDUN$
NOTDUN: load Register Pair HL with 27ECH, NOTDUN$, Specifications Required, when the disk form is given none of PW, LOCK, UNLOCK and NAME (25EDH).
2426
DEFB 0DDH DD
2426H: the DDH that makes the next LD HL,2804H an LD IX,2804H, so that ABORT, SPCREQ and NOTDUN keep Register Pair HL at their message; Index Register IX is left at 2804H and not used after.
2427ATBERR
LD HL,2804H 21 04 28LD HL,ATBERR$
ATBERR: load Register Pair HL with 2804H, ATBERR$, Attribute specification error, for anything wrong in the file form's parameters.
242AEXTERR
LD A,0CH 3E 0C
EXTERR: load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
242C
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message at Register Pair HL.
242D
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with 0FFFFH, the return code after a message of ATTRIB's own (source: set abort error).
2430SAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 2431H-2432H, the value stored at 2400H (0000H in the file), the depth of the entry (source: reload stack pointer).
2433
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (source: clean up BREAK).
2435
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): a pending BREAK is cleared, so that it does not end the next command too.
2436
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, or to the caller of @CMNDR, with Register Pair HL = 0000H, FFFFH or the error number.
2437H - ATTRIB1: a File or a Drive
ATTRIB1 tries the text as a file spec with @FSPEC: whatever @FSPEC refuses, a drive spec, nothing, or a spec it cannot read such as TEST/DAT. with an empty password, is taken as the disk form at PROT (25B1H); a device spec is refused with File spec required. The file is opened with SFLAG$ bit 0 set, so SYS2 skips its open bit and LRL checks and writes nothing to the directory; it is never closed. The open must give full access, which the owner password gives when it is typed (no password typed counts as the right one for a file with no owner password, whatever its level), and the level FULL gives whatever is typed: any other access level is refused with error 37 (25H, Illegal access attempted to protected file; the source's comment says access denied, error 25 would be File access denied). A file with the level NO and its password not given is refused by @OPEN itself with error 25.
2437ATTRIB1
LD DE,290EH 11 0E 29LD DE,FCB
ATTRIB1: load Register Pair DE with 290EH, FCB, the 32 byte FCB after the member, for @FSPEC (source: check filespec or drive #).
243A
LD A,4EH 3E 4E
Load Register A with 4EH, SVC 78, @FSPEC, which copies a file spec from the text at Register Pair HL into the FCB at Register Pair DE.
243C
RST 28H EF
Call @FSPEC with RST 28H (SYS1/SYS): Z with the spec in the FCB and Register Pair HL past it and the spaces after it; NZ when the text is not a spec, with Register Pair HL after the character that stopped it (at it for a 0DH or an opening parenthesis).
243D
If @FSPEC failed (NZ) jump to PROT at 25B1H, which takes the text for a drive spec or none: the disk form (source: assume drive # if error).
2440
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, 290EH, FCB+0, the first character of the spec (source: cannot be a device).
2441
CP 2AH FE 2A
Compare Register A with 2AH, the asterisk of a device spec.
2443
If Register A is the asterisk jump to SPCREQ at 241FH: a device spec, such as that of the keyboard, gives File spec required.
2446
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which gives the address of the system flag table (source: get flag table pointer).
2448
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$; Register Pair HL is kept.
2449
PUSH HL E5
Push Register Pair HL, the command line pointer after the spec, which @OPEN would change (source: save cmdline ptr).
244A
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, the 256 byte buffer after the member, as the file's buffer for @OPEN (source: use local buffer).
244D
LD B,L 45
Load Register B with Register L, 00H: the logical record length 256 for @OPEN (source: open the file).
244E
SET 0,(IY+12H) FD CB 12 C6
Set bit 0 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: SYS2's @OPEN then builds the FCB with no further checks (no File already open, no LRL test, no open bit written to the directory) and clears the bit (source: don't set file open bit).
2452
LD A,3BH 3E 3B
Load Register A with 3BH, SVC 59, @OPEN, which opens the file named in the FCB at Register Pair DE, 290EH, with the password typed in the spec.
2454
RST 28H EF
Call @OPEN with RST 28H (SYS2/SYS): Z when the file is found and the password allows it; the FCB then holds the access level at FCB+1 bits 2-0 and the drive and DEC at FCB+6 and FCB+7.
2455
POP HL E1
Pop Register Pair HL, the command line pointer pushed at 2449H (source: rcvr cmdline ptr).
2456
If @OPEN failed (NZ) jump to IOERR at 240CH with its error number in Register A: 24 File not in directory, 25 File access denied for a file of level NO without its password, 19 Illegal file name, 32 Illegal drive number (source: jump if non-existant).
2459
LD A,(290FH) 3A 0F 29
Load Register A with the byte at 290FH, FCB+1: bits 2-0 hold the access the open gave, 0 for full access, which the owner password (or the level FULL) gives (source: p/u protection).
245C
AND 07H E6 07
AND Register A with 07H, keeping the access level, bits 2-0 (source: mask other bits).
245E
LD A,25H 3E 25
Load Register A with 25H, error 37, Illegal access attempted to protected file; LD keeps the flags of the AND (source: init for access denied).
2460
If the access level is not 0 (NZ) jump to IOERR at 240CH with error 37: the file may be changed only with full access (source: jump if no can do).
2463
XOR A AF
XOR Register A with itself: Register A = 00H.
2464
LD (2587H),A 32 87 25
Store Register A, 00H, into 2587H, the operand of the LD D at PRMCOD (2586H): no parameter has been given yet; it is 00H in the file already (source: init prot to 0).
2467
PUSH HL E5
Push Register Pair HL, the start of the parameters, for after the conversion to capitals (source: save cmdline ptr).
2468H - ATT0 and ATT1: Capitals and the Parameter List
The rest of the line, up to its carriage return or an 03H, is changed to capital letters in place in INBUF$, quoted passwords too. Then the spaces are passed over to an opening parenthesis; a line with no parenthesis is read from its first character after the spaces, so ATTRIB FILE INV works too (in this file form only). Each parameter is known by its first letter alone: I is INV, V is VIS, O is OWNER and P is PROT, whatever follows the letter before the equals sign, so P=RE, PROT=RE and PIZZA=RE are the same; any other letter, a space after the parenthesis or a line with no parameter gives Attribute specification error.
2468ATT0
LD A,(HL) 7E
ATT0: load Register A with the byte at Register Pair HL, a character of the command line (source: & cvrt lc to UC).
2469
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends the line.
246B
If Register A is the carriage return jump to ATT02 at 247EH: the whole line is done (source: done if CR).
246D
CP 03H FE 03
Compare Register A with 03H, the ETX that can end a line too (source: ETX).
246F
If Register A is 03H jump to ATT02 at 247EH: the line ends there too.
2471
CP 61H FE 61
Compare Register A with 61H, the small letter a (source: not lc?).
2473
If Register A is below 61H (Carry) jump to ATT01 at 247BH: not a small letter.
2475
CP 7BH FE 7B
Compare Register A with 7BH, the character after the small letter z.
2477
If Register A is 7BH or above (No Carry) jump to ATT01 at 247BH: not a small letter.
2479
RES 5,(HL) CB AE
Reset bit 5 of the byte at Register Pair HL: the small letter becomes its capital in the command line (source: a-z to A-Z).
247BATT01
INC HL 23
ATT01: increment Register Pair HL to the next character (source: bump to next char).
247C
Jump back to ATT0 at 2468H for the next character (source: loop).
247EATT02
POP HL E1
ATT02: pop Register Pair HL, the start of the parameters pushed at 2467H (source: rcvr orig cmdline ptr).
247FATT1
LD A,(HL) 7E
ATT1: load Register A with the byte at Register Pair HL (source: scan for start of parm).
2480
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis (source: there yet?).
2482
If Register A is the opening parenthesis jump to ATT2 at 248BH (source: jump if so).
2484
CP 20H FE 20
Compare Register A with 20H, a space (source: ignore spaces).
2486
If Register A is not a space jump to ATT3 at 248DH with it: the parameters are read without a parenthesis (source: assume parm on dif char).
2488
INC HL 23
Increment Register Pair HL past the space, to the next character of the line.
2489
Jump back to ATT1 at 247FH for the next character.
248BATT2
INC HL 23
ATT2: increment Register Pair HL past the opening parenthesis, or past the comma between two parameters (from 24F7H) (source: bump past '(').
248C
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first letter of the parameter.
248DATT3
CP 49H FE 49
ATT3: compare Register A with 49H, the letter I of INV (source: ck for INV).
248F
If Register A is I jump to DOINV at 24FCH, whatever letters follow it in the word.
2491
CP 56H FE 56
Compare Register A with 56H, the letter V of VIS (source: ck for VIS).
2493
If Register A is V jump to DOVIS at 250EH, whatever letters follow it in the word.
2495
CP 4FH FE 4F
Compare Register A with 4FH, the letter O of OWNER (source: ck for OWNER).
2497
If Register A is O jump to DOOWN at 2520H, whatever letters follow it in the word.
249A
CP 50H FE 50
Compare Register A with 50H, the letter P of PROT (source: ck for PROT).
249C
If Register A is not P jump to ATBERR at 2427H: Attribute specification error (source: err if none of the above).
249FH - PROT=: the Protection Level
The value after the equals sign is copied to PSWDBUF (2902H) by PRSFLD; only its first two letters are compared with the eight pairs of PROTS$ (2822H), NO EX RE UP WR RN RM FU, for the levels 7 down to 0 (NO, EXEC, READ, UPDATE, WRITE, RENAME, REMOVE, FULL). RE stands for READ, RENAME and REMOVE alike, so its third letter is tested: N gives RENAME (2), and anything else should give REMOVE (1) for M and READ (5) otherwise; but the compare with M is made after Register A has been changed to 1, so it never matches and REMOVE, typed as REM or REMOVE, gives READ (B152). RM gives REMOVE. A value that matches no pair gives Attribute specification error. The level is stored into PROTLVL's operand (258FH) and bit 0 set in PRMCOD's operand (2587H).
249F
Call PRSFLD at 254FH, which passes over the rest of the word to an equals sign and copies the value after it to PSWDBUF, 2902H-2909H: NZ with Register Pair HL at the character after the value; Z when the word ends with no equals sign (source: parse field).
24A2
If PRSFLD found no equals sign (Z) jump to ATBERR at 2427H: PROT needs a value (source: error if end of line).
24A5
PUSH HL E5
Push Register Pair HL, the command line pointer at the character after the value (source: save ptr to next char).
24A6
LD B,08H 06 08
Load Register B with 08H, the eight pairs of letters in PROTS$, and the count of the DJNZ at 24B6H (source: init for 8 prots).
24A8
LD DE,(2902H) ED 5B 02 29LD DE,(PSWDBUF)
Load Register Pair DE with the word at 2902H-2903H, PSWDBUF: Register E = the first letter of the value, Register D = the second (source: p/u 1st 2 chars).
24AC
LD HL,2822H 21 22 28LD HL,PROTS$
Load Register Pair HL with 2822H, PROTS$, the pairs NO EX RE UP WR RN RM FU (source: pt to various prots).
24AFDOPR01
LD A,(HL) 7E
DOPR01: load Register A with the byte at Register Pair HL, the first letter of a pair (source: p/u 1st prot char).
24B0
INC HL 23
Increment Register Pair HL to the second letter of the pair (source: bump pointer).
24B1
CP E BB
Compare Register A with Register E, the first letter of the value (source: does 1st match?).
24B2
If the first letters are the same call DOPR02 at 24BCH, which compares the second letters and does not come back here when they match (source: check 2nd if 1st OK).
24B5
INC HL 23
Increment Register Pair HL to the first letter of the next pair (source: bump to next).
24B6
Decrement Register B and jump back to DOPR01 at 24AFH until all eight pairs have been compared (source: loop for all 8).
24B8
POP HL E1
Pop Register Pair HL, the pointer pushed at 24A5H, to keep the stack straight (SAVESP restores it anyway) (source: stack integrity).
24B9
Jump to ATBERR at 2427H: the value is none of the levels (source: abort if no match).
24BCDOPR02
LD A,(HL) 7E
DOPR02: load Register A with the byte at Register Pair HL, the second letter of the pair (source: p/u 2nd table char).
24BD
CP D BA
Compare Register A with Register D, the second letter of the value (source: match user's entry?).
24BE
RET NZ C0
If they differ return to 24B5H for the next pair (source: go back if not).
24BF
POP AF F1
Pop Register Pair AF, which drops the return address 24B5H: the search is over (source: pop the ret addr).
24C0
LD A,B 78
Load Register A with Register B, the count of the pair that matched: 8 for NO down to 1 for FU (source: calculate which prot was).
24C1
DEC A 3D
Decrement Register A: the protection level, 7 for NO, 6 EX, 5 RE, 4 UP, 3 WR, 2 RN, 1 RM, 0 FU (source: entered by the user).
24C2
If Register A is 0, FULL, jump to DOPR03 at 24D8H to store it (source: jump on PROT=FU).
24C4
CP 05H FE 05
Compare Register A with 05H, the level of the pair RE, which READ, RENAME and REMOVE all begin with (source: REname, REad, REmove?).
24C6
If Register A is not 05H jump to DOPR03 at 24D8H: the pair decides the level (source: go if none of the above).
24C8
LD A,(2904H) 3A 04 29
Load Register A with the byte at 2904H, PSWDBUF+2, the third letter of the value (source: p/u user's 3rd char).
24CB
CP 4EH FE 4E
Compare Register A with 4EH, the letter N of RENAME (source: was it 'N'?).
24CD
LD A,02H 3E 02
Load Register A with 02H, the level RENAME; LD keeps the flags of the compare (source: init for REname).
24CF
If the third letter is N jump to DOPR03 at 24D8H with Register A = 02H, RENAME (source: go if REName).
24D1
DEC A 3D
Decrement Register A to 01H, the level REMOVE (source: else init to REMove).
24D2
CP 4DH FE 4D
Compare Register A with 4DH, the letter M, to test for REMOVE; Register A now holds 01H, not the third letter, so the compare never matches (B152) (source: & test entry).
24D4
If Register A were 4DH jump to DOPR03 at 24D8H with REMOVE; it never is.
24D6
LD A,05H 3E 05
Load Register A with 05H, the level READ, for every value beginning RE but REN: REMOVE gets READ too (B152) (source: else assume REAd).
24D8DOPR03
LD (258FH),A 32 8F 25
DOPR03: store Register A, the protection level 0 to 7, into 258FH, the operand of the OR at PROTLVL (258EH) (source: stuff protection level).
24DB
POP HL E1
Pop Register Pair HL, the command line pointer pushed at 24A5H, at the character after the value (source: rcvr INBUF$ pointer).
24DC
LD B,01H 06 01
Load Register B with 01H, bit 0 of PRMCOD: PROT given (source: init to show PROT given).
24DEH - DOPR04 and DOPR05: the Next Parameter
Each parameter ORs its bit into PRMCOD (bit 0 PROT, bit 2 OWNER, bit 3 INV or VIS). A closing quote after a value is passed over. Then a comma leads to the next parameter, the closing parenthesis or the end of the line to UPDDIR, which writes the directory entry; anything else is Attribute specification error, so a value of more than eight characters (a ninth letter is left) is refused. Nothing after the closing parenthesis is read.
24DEDOPR04
LD A,(HL) 7E
DOPR04: load Register A with the byte at Register Pair HL, the character after the value (source: p/u next parm).
24DF
CP 22H FE 22
Compare Register A with 22H, the quotation mark that may close a value (source: closing quote on last?).
24E1
If Register A is not the quotation mark jump to DOPR05 at 24E4H (source: go if something else).
24E3
INC HL 23
Increment Register Pair HL past the closing quotation mark (source: ignore closing quote).
24E4DOPR05
LD A,(2587H) 3A 87 25
DOPR05: load Register A with the byte at 2587H, the operand of the LD D at PRMCOD, the bits of the parameters given so far (source: p/u parm test bits).
24E7
OR B B0
OR Register A with Register B, the bit of this parameter: 01H PROT, 04H OWNER, 08H INV or VIS (source: merge PROT entered).
24E8
LD (2587H),A 32 87 25
Store Register A into 2587H, the operand of PRMCOD's LD D (source: restuff parm test bits).
24EB
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the parameter (source: p/u next char).
24EC
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return (source: end of line?).
24EE
If Register A is the carriage return jump to 24F2H, the JP Z to UPDDIR, with the Z flag set (source: go on end-of-line).
24F0
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis (source: end of parms?).
24F2
If Register A is the carriage return or the closing parenthesis (Z) jump to UPDDIR at 257BH, which changes the directory entry (source: go on end of parms).
24F5
CP 2CH FE 2C
Compare Register A with 2CH, the comma between parameters (source: more parms?).
24F7
If Register A is the comma jump back to ATT2 at 248BH for the next parameter (source: loop on more parms).
24F9
Jump to ATBERR at 2427H: any other character after a parameter is an error (source: exit on wrong char).
24FCH - DOINV, DOVIS and DOOWN
INV and VIS take no value: an equals sign after the word is Attribute specification error. They set or clear bit 3 (invisible) of the operand of IVCOD (2596H); the last one given wins. OWNER takes a value, the new owner password: it is hashed through SYS2/SYS into HASHBUF (290AH). An empty value, OWNER= as in the manual, or one whose first character is not a letter, leaves PSWDBUF all spaces, whose hash 4296H is no password; a first character that is not a letter then fails at DOPR05 as the character after the value, so only the empty value gets through.
24FCDOINV
DOINV: call PRSFLD at 254FH, which passes over the rest of the word: Z when it ends at a comma, the closing parenthesis or the end of the line, NZ when an equals sign follows (source: parse parm).
24FF
If PRSFLD found an equals sign (NZ) jump to ATBERR at 2427H: INV takes no value (source: go on parm error).
2502
LD A,(2597H) 3A 97 25
Load Register A with the byte at 2597H, the operand of the OR at IVCOD (2596H) (source: set bit 3 to indicate).
2505
OR 08H F6 08
OR Register A with 08H, bit 3 of the attributes byte, invisible (source: that INV given).
2507
LD (2597H),A 32 97 25
Store Register A into 2597H, the operand of IVCOD's OR.
250A
LD B,08H 06 08
Load Register B with 08H, bit 3 of PRMCOD: INV or VIS given (source: show vis/inv done).
250C
Jump to DOPR05 at 24E4H, which records the bit and goes on to the next parameter (source: merge w/prev. parms).
250EDOVIS
DOVIS: call PRSFLD at 254FH, which passes over the rest of the word: Z at a comma, the closing parenthesis or the end of the line, NZ when an equals sign follows (source: parse parm).
2511
If PRSFLD found an equals sign (NZ) jump to ATBERR at 2427H: VIS takes no value (source: quit on parm error).
2514
LD A,(2597H) 3A 97 25
Load Register A with the byte at 2597H, the operand of IVCOD's OR (source: strip bit 3).
2517
AND 0F7H E6 F7
AND Register A with 0F7H, clearing bit 3: visible.
2519
LD (2597H),A 32 97 25
Store Register A into 2597H, the operand of IVCOD's OR.
251C
LD B,08H 06 08
Load Register B with 08H, bit 3 of PRMCOD: INV or VIS given (source: show vis/inv done).
251E
Jump to DOPR05 at 24E4H, which records the bit and goes on (source: merge w/prev. parms).
2520DOOWN
DOOWN: call PRSFLD at 254FH, which copies the value after the equals sign to PSWDBUF, 2902H-2909H, filled out with spaces: NZ with Register Pair HL at the character after it, Z with no equals sign (source: parse parm).
2523
If there is no equals sign (Z) jump to ATBERR at 2427H: OWNER needs one (source: quit on parm error).
2526
PUSH HL E5
Push Register Pair HL, the command line pointer after the value (source: save cmdline ptr).
2527
LD DE,2902H 11 02 29LD DE,PSWDBUF
Load Register Pair DE with 2902H, PSWDBUF, the eight characters of the new owner password for the hash.
252A
Call DOHASH at 2716H, which has SYS2/SYS hash the eight characters at Register Pair DE into Register Pair HL (4296H for eight spaces, no password) (source: hash the password).
252D
LD (290AH),HL 22 0A 29LD (HASHBUF),HL
Store Register Pair HL, the hash, into 290AH-290BH, HASHBUF, for UPDDIR (25A1H).
2530
POP HL E1
Pop Register Pair HL, the command line pointer pushed at 2526H.
2531
LD B,04H 06 04
Load Register B with 04H, bit 2 of PRMCOD: OWNER given (source: show OWNER done).
2533
Jump to DOPR04 at 24DEH, which passes over a closing quote, records the bit and goes on (source: merge w/prev. parms).
2535H - XSPEC8A to XSPEC11 and PRSFLD: Copy a Value
PRSFLD passes over the rest of a parameter word: a carriage return, the closing parenthesis or a comma ends it with Z (no value); an equals sign is followed by the value, an opening quotation mark passed over. PSWDBUF (2902H-2909H) is filled with spaces and the value copied into it by XSPEC8A: a letter first, then letters and digits, at most eight. The copy stops at the first other character, which Register Pair HL is left at, or after eight characters, with Register Pair HL at the ninth; a value that does not begin with a letter leaves PSWDBUF all spaces. PRSFLD then returns NZ. These are the rules of a file name (the source's XSPEC routines of SYS2/SYS), so a value may hold no sign, as a password may not.
2535XSPEC8A
LD A,(HL) 7E
XSPEC8A: load Register A with the byte at Register Pair HL, the first character of the value (source: p/u a filespec character).
2536
INC HL 23
Increment Register Pair HL to the character after it (source: & 1st test for A-Z).
2537
Jump to XSPEC10 at 2542H: the first character must be a letter.
2539XSPEC9
LD A,(HL) 7E
XSPEC9: load Register A with the byte at Register Pair HL, the next character of the value (source: p/u a filespec character).
253A
INC HL 23
Increment Register Pair HL to the character after it (source: advance to next one).
253B
CP 30H FE 30
Compare Register A with 30H, the digit 0 (source: check for 0-9).
253D
RET C D8
If Register A is below 30H return with the Carry flag set: the value ends at a sign or a space (source: quit if < 0).
253E
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9.
2540
If Register A is a digit 0 to 9 (Carry) jump to XSPEC11 at 2548H to store it (source: go if numeric).
2542XSPEC10
CP 41H FE 41
XSPEC10: compare Register A with 41H, the letter A (source: check for A-Z).
2544
RET C D8
If Register A is below 41H (Carry) return: the value ends here.
2545
CP 5BH FE 5B
Compare Register A with 5BH, the character after the letter Z.
2547
RET NC D0
If Register A is 5BH or above (No Carry) return: the value ends here.
2548XSPEC11
LD (DE),A 12
XSPEC11: store Register A, a valid character, at Register Pair DE in PSWDBUF (source: character is valid).
2549
INC DE 13
Increment Register Pair DE to the next byte of PSWDBUF (source: advance to next one).
254A
Decrement Register B and jump back to XSPEC9 at 2539H until eight characters have been stored (source: & loop).
254C
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the eighth (source: p/u following character).
254D
INC HL 23
Increment Register Pair HL past it, as the returns above have done for the character that ended the value.
254E
RET C9
Return with Register A = the character after the eighth and Register Pair HL past it (source: go home).
254FPRSFLD
INC HL 23
PRSFLD: increment Register Pair HL to the next character of the word (source, the routine's heading: parse rest of parm, ignore until separator).
2550
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL (source: get next char).
2551
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return (source: ret on end of line).
2553
RET Z C8
If Register A is the carriage return return with the Z flag set: no value.
2554
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis (source: ret on closing paren).
2556
RET Z C8
If Register A is the closing parenthesis return with Z: no value.
2557
CP 2CH FE 2C
Compare Register A with 2CH, the comma (source: ret on separator).
2559
RET Z C8
If Register A is the comma return with Z: no value.
255A
CP 3DH FE 3D
Compare Register A with 3DH, the equals sign (source: assignment operator?).
255C
If Register A is not the equals sign jump back to PRSFLD at 254FH: the rest of the word is passed over (source: loop if not).
255E
INC HL 23
Increment Register Pair HL past the equals sign.
255F
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the value.
2560
CP 22H FE 22
Compare Register A with 22H, the quotation mark (source: is quote there?).
2562
If Register A is not the quotation mark jump to 2565H.
2564
INC HL 23
Increment Register Pair HL past the opening quotation mark (source: bypass the quote).
2565
LD DE,2902H 11 02 29LD DE,PSWDBUF
Load Register Pair DE with 2902H, PSWDBUF, where the value goes.
2568
LD B,08H 06 08
Load Register B with 08H, the length of PSWDBUF.
256A
PUSH DE D5
Push Register Pair DE, 2902H, for the copy after the filling.
256B
PUSH BC C5
Push Register Pair BC, Register B = 08H, for the copy after the filling.
256C
LD A,20H 3E 20
Load Register A with 20H, a space (source: space out the buffer).
256EPRSF01
LD (DE),A 12
PRSF01: store Register A, the space, at Register Pair DE in PSWDBUF.
256F
INC DE 13
Increment Register Pair DE to the next byte of PSWDBUF, 2903H to 290AH.
2570
Decrement Register B and jump back to PRSF01 at 256EH until all eight bytes are spaces.
2572
POP BC C1
Pop Register Pair BC: Register B = 08H again, the most characters copied.
2573
POP DE D1
Pop Register Pair DE: 2902H again, the start of PSWDBUF.
2574
Call XSPEC8A at 2535H, which copies the value from Register Pair HL to Register Pair DE (source: transfer the spec).
2577
DEC HL 2B
Decrement Register Pair HL back to the character that ended the value (XSPEC8A has passed over it), or to the ninth character of a long one.
2578
OR 01H F6 01
OR Register A with 01H: the Z flag is cleared, NZ, a value was given (source: show got a parm).
257A
RET C9
Return NZ with Register Pair HL at the character after the value.
257BH - UPDDIR: Write the File's Directory Entry
The directory entry is read again with @DIRRD from the drive and DEC that @OPEN put into the FCB, and changed for the parameters given: the level in bits 2-0 of the attributes byte (DIR+0), the invisible bit 3, and the owner password hash at DIR+16 and DIR+17; then @DIRWR writes the sector back. Nothing else of the entry is touched, so a SYS file stays one and its access password field (the 6.3 time field at DIR+18) is left alone.
257BUPDDIR
LD BC,(2914H) ED 4B 14 29
UPDDIR: load Register Pair BC with the word at 2914H-2915H: Register C = FCB+6, the drive, Register B = FCB+7, the file's DEC (source: p/u drive & DEC).
257F
LD A,57H 3E 57
Load Register A with 57H, SVC 87, @DIRRD, which reads the directory sector of the DEC in Register B on the drive in Register C (source: read its directory).
2581
RST 28H EF
Call @DIRRD with RST 28H (SYS0/SYS): Z with Register Pair HL at the file's entry in SBUFF$ (1D00H-1DFFH); NZ with error 17.
2582
If @DIRRD failed (NZ) jump to IOERR at 240CH with Register A = 11H, 17, Directory read error (source: quit on read error).
2585
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+0, the attributes byte (source: p/u attributes byte).
2586PRMCOD
LD D,00H 16 00
PRMCOD: load Register D with the byte at 2587H, the bits of the parameters given (0 PROT, 2 OWNER, 3 INV or VIS), stored at 24E8H (source: p/u parm test bits).
2588
BIT 0,D CB 42
Test bit 0 of Register D: PROT given (source: was prot entered?).
258A
If PROT was not given jump to UPDIR1 at 2590H (source: jump if not).
258C
AND 0F8H E6 F8
AND Register A with 0F8H, clearing bits 2-0, the protection level (source: rmv prot level).
258EPROTLVL
OR 00H F6 00
PROTLVL: OR Register A with the byte at 258FH, the new level 0 to 7 stored at 24D8H (00H in the file) (source: merge new prot level).
2590UPDIR1
BIT 3,D CB 5A
UPDIR1: test bit 3 of Register D: INV or VIS given (source: was inv or vis entered?).
2592
If neither was given jump to UPDIR2 at 2598H (source: bypass if not).
2594
AND 0F7H E6 F7
AND Register A with 0F7H, clearing bit 3, the invisible bit (source: remove any vis/inv).
2596IVCOD
OR 00H F6 00
IVCOD: OR Register A with the byte at 2597H, 08H for INV, 00H for VIS (00H in the file) (source: merge new inv/vis).
2598UPDIR2
LD (HL),A 77
UPDIR2: store Register A, the new attributes byte, at Register Pair HL, DIR+0 in SBUFF$ (source: & update dir rec).
2599
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address (source: pt to owner pswd).
259A
ADD A,10H C6 10
Add 10H to Register A: the offset of DIR+16, the owner password hash; an entry starts at a multiple of 20H, so there is no Carry.
259C
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+16 of the entry in SBUFF$.
259D
BIT 2,D CB 52
Test bit 2 of Register D: OWNER given (source: was OWN parm entered?).
259F
If OWNER was not given jump to UPDIR4 at 25AAH (source: bypass if not).
25A1
LD A,(290AH) 3A 0A 29LD A,(HASHBUF)
Load Register A with the byte at 290AH, HASHBUF, the low byte of the new owner password hash (source: xfer new hashed pswd).
25A4
LD (HL),A 77
Store Register A at Register Pair HL, DIR+16 (source: into the directory).
25A5
LD A,(290BH) 3A 0B 29
Load Register A with the byte at 290BH, HASHBUF+1, the high byte of the hash (source: OWNER psw position).
25A8
INC HL 23
Increment Register Pair HL to DIR+17, the high byte of the owner password hash.
25A9
LD (HL),A 77
Store Register A at Register Pair HL, DIR+17.
25AAUPDIR4
LD A,58H 3E 58
UPDIR4: load Register A with 58H, SVC 88, @DIRWR, which writes the directory sector in SBUFF$ back for the DEC in Register B on the drive in Register C (source: write dir back to disk).
25AC
RST 28H EF
Call @DIRWR with RST 28H (SYS0/SYS): Z when written and verified; NZ with 18, Directory write error, or 15, Write protected disk.
25AD
If @DIRWR failed (NZ) jump to IOERR at 240CH with its error number in Register A (source: abort on write error).
25B0
RET C9
Return to 2407H, after the CALL at 2404H: the return code 0000H (source: done - return).
25B1H - PROT: the Disk Form and Its Drive
When @FSPEC refused the text, ATTRIB steps Register Pair HL back one character: after a colon @FSPEC has moved past it, so a drive spec :d is found and its digit must be 0 to 7 (631: the CP 08H alone, 6.3.0 had a JR C first) and the drive ready by @CKDRV, else Illegal drive number (error 32; a write protected diskette is not refused here). Without a colon drive 0 is used, untested. The step back relies on @FSPEC having moved past a separator, which it does for a colon but not for an opening parenthesis; SYS1 has already passed the spaces after the command word, so ATTRIB is entered with Register Pair HL at the parenthesis either way. With a space the step back lands on it, which does no harm; with none, ATTRIB(LOCK), it lands on the B of ATTRIB, @PARAM finds no parameters and the command ends with Specifications Required (B156). A drive spec typed straight after the word, ATTRIB:1 (LOCK), is taken by SYS1 as the drive of the command name, so ATTRIB finds no colon and changes drive 0 (B163). Any space inside the list is Parameter error (SYS1, B165), so the list must be typed without spaces. @PARAM then reads PW, LOCK, UNLOCK, NAME and MPW from PRMTBL$ (28D9H); at least one of the first four must be given (only the low byte of each value is tested), else Specifications Required. The master password is tested next (TSTMPW, 26E2H).
25B1PROT
LD C,00H 0E 00
PROT: load Register C with 00H, drive 0, used when no drive spec is given (source: init for drive 0).
25B3
DEC HL 2B
Decrement Register Pair HL to the character before the one @FSPEC left it at: a colon when @FSPEC stopped at one; for ATTRIB(LOCK) the B of ATTRIB (B156), for ATTRIB:1 (LOCK) the space, as SYS1 took the :1 for the command's drive (B163) (source: backup to separator).
25B4
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL (source: ck for drive entered).
25B5
CP 3AH FE 3A
Compare Register A with 3AH, the colon of a drive spec (source: colon indicator?).
25B7
If Register A is not the colon jump to PROT01 at 25CEH with drive 0, and with Register Pair HL at that character, where @PARAM will begin (source: bypass if not).
25B9
INC HL 23
Increment Register Pair HL to the drive digit (source: point to drive #).
25BA
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the drive digit (source: p/u drive).
25BB
SUB 30H D6 30
Subtract 30H from Register A, the digit 0: the drive number, 0 to 7, or a value of 8 or above (and, for a character below 0, of D0H or above) (source: cvrt to binary).
25BD
CP 08H FE 08
Compare Register A with 08H: Carry for a drive 0 to 7 (631: the one test also catches a character below the digit 0) (source: less than 0, illegal).
25BF
LD C,A 4F
Load Register C with Register A, the drive number (631).
25C0
LD A,20H 3E 20
Load Register A with 20H, error 32, Illegal drive number; LD keeps the flags of the compare (631).
25C2
If Register A was 8 or above (No Carry) jump to IOERR at 240CH with error 32 (631).
25C5
LD A,21H 3E 21
Load Register A with 21H, SVC 33, @CKDRV, which tests that the drive in Register C is enabled and has a diskette (source: do a check drive).
25C7
RST 28H EF
Call @CKDRV with RST 28H (SYS2/SYS): Z when ready (the Carry flag set for a write protected diskette, which ATTRIB does not test), NZ when not.
25C8
LD A,20H 3E 20
Load Register A with 20H, error 32, Illegal drive number; LD keeps the flags of @CKDRV (source: init illegal drive).
25CA
If the drive is not ready (NZ) jump to IOERR at 240CH with error 32 (source: go if bad).
25CD
INC HL 23
Increment Register Pair HL past the drive digit, to where @PARAM will begin (source: bump line pointer).
25CEPROT01
LD A,C 79
PROT01: load Register A with Register C, the drive number, 0 to 7.
25CF
LD (26E3H),A 32 E3 26
Store Register A into 26E3H, the operand of the LD C at TSTMPW (26E2H), where every later use of the drive reads it (source: stuff drive for later).
25D2
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which gives the address of the drive's DCT (source: get DCT -> IY).
25D4
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the DCT of the drive in Register C, for DCT+9, the directory cylinder (264BH, 2677H).
25D5
LD DE,28D9H 11 D9 28LD DE,PRMTBL$
Load Register Pair DE with 28D9H, PRMTBL$, the parameter table (source: get parms).
25D8
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads the parameter list at Register Pair HL by the table at Register Pair DE.
25DA
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): Z with each value given stored into the word its entry names (a string as the address of its first character after the quotation mark, a flag as FFFFH or 0000H); NZ with error 44 for a word not in the table, and for any space inside the list (B165); with no list at all, Z and nothing stored.
25DB
If @PARAM failed (NZ) jump to IOERR at 240CH with Register A = 2CH, 44, Parameter error (source: quit on parm error).
25DE
LD A,(2639H) 3A 39 26
Load Register A with the byte at 2639H, the low byte of PW's value, the operand of the LD DE at PPARM (2638H) (source: make sure a parm).
25E1
LD HL,265CH 21 5C 26
Load Register Pair HL with 265CH, the low byte of LOCK's value, the operand of the LD BC at LPARM (265BH) (source: was entered).
25E4
OR (HL) B6
OR Register A with the byte at Register Pair HL, 265CH.
25E5
LD HL,2666H 21 66 26
Load Register Pair HL with 2666H, the low byte of UNLOCK's value, the operand of the LD BC at UPARM (2665H).
25E8
OR (HL) B6
OR Register A with the byte at Register Pair HL, 2666H.
25E9
LD HL,25F7H 21 F7 25
Load Register Pair HL with 25F7H, the low byte of NAME's value, the operand of the LD DE at NPARM (25F6H).
25EC
OR (HL) B6
OR Register A with the byte at Register Pair HL, 25F7H: zero only when none of PW, LOCK, UNLOCK and NAME was given (MPW alone does nothing).
25ED
If none was given (Z) jump to NOTDUN at 2423H: Specifications Required (source: quit if none entered).
25F0
Call TSTMPW at 26E2H, which reads the GAT into GATBUF (2B00H) and, unless the master password is PASSWORD, takes MPW or asks for it and compares (source: test master password).
25F3
If TSTMPW failed (NZ) jump to IOERR at 240CH: a GAT read error (14H, 20), 3FH with Register Pair HL at Invalid master password (GETMPW gives no other message of its own: B154), or the error of @DSPLY (source: quit on error).
25F6H - NPARM: the New Disk Name
NAME="s" gives the new name, NAME alone (or NAME with a value whose bytes OR to FFH) asks for it with New disk pack name ? (not inside a DO file). GMPW1 checks it as a password: a letter, then letters and digits, up to eight, padded with spaces, small letters made capitals; a ninth character and more are dropped, anything else is Invalid disk name. The name goes into the GAT copy (GAT+D0H, written at 2652H) and into the first eight bytes of PAKNAM$ in sector 2 of cylinder 0 (offset 10H; BOOT/SYS loads that sector to 0400H, PAKNAM$ 0410H), read and written at once with @RDSEC and @WRSEC (any error is shown as it comes, 15 for a write protected diskette), before PW is checked and the GAT written: if they fail, sector 2 has the new name and the GAT the old one (B162).
25F6NPARM
LD DE,0000H 11 00 00
NPARM: load Register Pair DE with the word at 25F7H-25F8H, the value of NAME stored by @PARAM (0000H in the file): the address of the name in the command line, FFFFH for NAME alone (source: p/u Name parm).
25F9
LD A,D 7A
Load Register A with Register D, the high byte of NAME's value.
25FA
OR E B3
OR Register A with Register E: zero when NAME was not given.
25FB
If NAME was not given (Z) jump to PPARM at 2638H (source: jump if name not entered).
25FD
LD HL,2857H 21 57 28LD HL,PACKNM$
Load Register Pair HL with 2857H, PACKNM$, New disk pack name ?, the prompt GMPW1 shows when the name must be typed (source: get name into buf1).
2600
Call GMPW1 at 2719H, which puts the name from Register Pair DE, or typed at the prompt, into BUFFER, 2A00H-2A07H, checked and in capitals: Z when good.
2603
If the name is refused (NZ) jump to IOERR at 240CH: 3FH with Register Pair HL at Invalid disk name or Invalid command during DO processing, or the error of @DSPLY (source: quit on error).
2606
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, the new name (source: HL = new name).
2609
LD DE,2BD0H 11 D0 2B
Load Register Pair DE with 2BD0H, GAT+D0H in GATBUF, the disk name (source: where new name goes).
260C
PUSH DE D5
Push Register Pair DE, 2BD0H, the name in the GAT, for the copy into sector 2.
260D
PUSH HL E5
Push Register Pair HL, 2A00H, the buffer for sector 2.
260E
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name (source: name len).
2611
LDIR ED B0
Copy the name from Register Pair HL, 2A00H-2A07H, to Register Pair DE, 2BD0H-2BD7H, with LDIR (Register Pair BC = 0008H, and 0000H after it) (source: xfer new name).
2613
POP HL E1
Pop Register Pair HL, 2A00H, the buffer for sector 2.
2614
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2 (source: trk 0, sect 2).
2617
LD A,(26E3H) 3A E3 26
Load Register A with the byte at 26E3H, the drive, TSTMPW's operand (source: p/u drive).
261A
LD C,A 4F
Load Register C with Register A, the drive, for @RDSEC.
261B
LD A,31H 3E 31
Load Register A with 31H, SVC 49, @RDSEC, which reads the sector at Register Pair DE of the drive in Register C into the buffer at Register Pair HL, 2A00H (source: read SIS).
261D
RST 28H EF
Call @RDSEC with RST 28H (SYS0/SYS, which goes on to the drive's driver): Z when read; NZ with the error number.
261E
POP HL E1
Pop Register Pair HL, 2BD0H, the new name in the GAT copy (source: get name pointer).
261F
If @RDSEC failed (NZ) jump to IOERR at 240CH with its error number in Register A (source: quit if read error).
2622
PUSH BC C5
Push Register Pair BC, Register C = the drive (Register B = 00H) (source: save drive).
2623
LD DE,2A10H 11 10 2A
Load Register Pair DE with 2A10H, offset 10H of the sector, PAKNAM$ (source: point to where name goes).
2626
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight characters of the name.
2629
LDIR ED B0
Copy the name from Register Pair HL, 2BD0H-2BD7H, to Register Pair DE, 2A10H-2A17H, with LDIR (Register Pair BC = 0008H, then 0000H): the first eight bytes of PAKNAM$ (source: xfer new name to SIS).
262B
POP BC C1
Pop Register Pair BC, Register C = the drive (source: recover drive).
262C
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H, cylinder 0, sector 2.
262F
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, the sector with the new name.
2632
LD A,35H 3E 35
Load Register A with 35H, SVC 53, @WRSEC, which writes the buffer at Register Pair HL to the sector at Register Pair DE of the drive in Register C (source: write new SIS).
2634
RST 28H EF
Call @WRSEC with RST 28H (SYS0/SYS, which goes on to the drive's driver): Z when written; NZ with the error number, 15 for a write protected diskette; written before PW is checked and the GAT is written, which may still fail (B162).
2635
If @WRSEC failed (NZ) jump to IOERR at 240CH with its error number in Register A (source: quit on write error).
2638H - PPARM and PROT02: the New Master Password and the GAT
PW="s" gives the new master password, PW alone asks for it with New master password ?; it is checked as a name is, hashed through SYS2/SYS and put into GAT+CEH. An empty PW="" fills the buffer with spaces, which are refused (Invalid master password), so the master password cannot be removed. The GAT is then written back with @WRSSC and verified, whatever was given, LOCK or UNLOCK alone too: every failure of the write, a write protected diskette too, is reported as GAT write error (B155). LOCK and UNLOCK use the master password as it is after PW, the new one when PW is given (B164). Then LOCK, or else UNLOCK, chooses the change of the owner passwords; with neither ATTRIB is done.
2638PPARM
LD DE,0000H 11 00 00
PPARM: load Register Pair DE with the word at 2639H-263AH, the value of PW stored by @PARAM (0000H in the file): the address of the password in the command line, FFFFH for PW alone (source: was PW parm used?).
263B
LD A,D 7A
Load Register A with Register D, the high byte of PW's value.
263C
OR E B3
OR Register A with Register E: zero when PW was not given.
263D
If PW was not given (Z) jump to PROT02 at 264BH (source: jump if PW not entered).
263F
LD HL,286FH 21 6F 28LD HL,NEWMPW$
Load Register Pair HL with 286FH, NEWMPW$, New master password ?, the prompt for GETMPW (source: buffer for new MPW).
2642
Call GETMPW at 2709H, which puts the password from Register Pair DE, or typed, into BUFFER, checks it and hashes it into Register Pair HL: Z when good (source: input the new one).
2645
If the password is refused (NZ) jump to IOERR at 240CH: 3FH with Register Pair HL at Invalid master password, or the error of @DSPLY (source: quit if bad PW).
2648
LD (2BCEH),HL 22 CE 2B
Store Register Pair HL, the hash of the new master password, into 2BCEH-2BCFH, GAT+CEH in GATBUF (source: stuff PW).
264BPROT02
LD D,(IY+09H) FD 56 09
PROT02: load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder; GATWR loads it again itself (source: dir cl => reg D).
264E
LD A,(26E3H) 3A E3 26
Load Register A with the byte at 26E3H, the drive, TSTMPW's operand (source: p/u drive).
2651
LD C,A 4F
Load Register C with Register A, the drive, for GATWR.
2652
Call GATWR at 279CH, which writes GATBUF, 2B00H, to sector 0 of the directory cylinder with @WRSSC and verifies it: Z when good, NZ with 15H, 21 (source: write sector 0 from buf).
2655
If the GAT was not written (NZ) jump to IOERR at 240CH with error 21, GAT write error (source: jump on write error).
2658
LD HL,(2BCEH) 2A CE 2B
Load Register Pair HL with the word at 2BCEH-2BCFH, GAT+CEH, the hash of the master password, the new one if PW was given, so UNLOCK with PW looks for the new password (B164) (source: p/u pack MPW).
265BLPARM
LD BC,0000H 01 00 00
LPARM: load Register Pair BC with the word at 265CH-265DH, the value of LOCK stored by @PARAM (0000H in the file): FFFFH for LOCK (source: lock parm used?).
265E
LD A,B 78
Load Register A with Register B, the high byte of LOCK's value.
265F
OR C B1
OR Register A with Register C: zero when LOCK was not given.
2660
LD DE,4296H 11 96 42LD DE,BLNKMPW
Load Register Pair DE with 4296H, the hash of eight spaces, no password (source: p/u blank MPW for test).
2663
If LOCK was given (NZ) jump to PROT03 at 266CH: the files whose owner password is none (Register Pair DE, 4296H) get the master password (Register Pair HL) (source: jump if LOCK entered).
2665UPARM
LD BC,0000H 01 00 00
UPARM: load Register Pair BC with the word at 2666H-2667H, the value of UNLOCK stored by @PARAM (0000H in the file): FFFFH for UNLOCK (source: unlock parm used?).
2668
LD A,B 78
Load Register A with Register B, the high byte of UNLOCK's value.
2669
OR C B1
OR Register A with Register C: zero when UNLOCK was not given.
266A
RET Z C8
If neither LOCK nor UNLOCK was given (Z) return to 2407H: done, with the name and the master password written (source: neither LOCK or UNLOCK).
266B
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: for UNLOCK the files whose owner password is the master password (now Register Pair DE) get none (Register Pair HL, 4296H) (source: switch new & test MPW).
266CH - PROT03 to PROT10: LOCK and UNLOCK
The two hashes are planted as operands: THISPW (26B3H) the owner password to look for, REVMPW (26BCH) the one to put. The HIT (sector 1 of the directory cylinder) is read to HITBUF (2C00H) with @RDSSC; a failure is passed to IOERR as @RDSSC leaves Register A, the error number less 6, so the message is wrong (B153). The HIT is then walked a directory sector at a time: a HIT position's DEC has the sector (less 2) in bits 4-0 and the entry in bits 7-5, so the positions L, L+20H ... L+E0H are the eight entries of one sector. For each used position the sector is read with @DIRRD (only when it is not the one already in SBUFF$), and the entry is changed when its attributes, without the level, are exactly 10H, in use and nothing else: invisible, SYS, PDS and extended entries are left as they are (the manual names only the visible non-system files; it does not mention the partitioned data sets). A changed or unchanged sector that was read is written back with @DIRWR when its eight positions are done. LOCK puts the master password on every such file with no owner password; UNLOCK takes it off every such file whose owner password is the master password.
266CPROT03
LD (26BDH),HL 22 BD 26
PROT03: store Register Pair HL, the hash to put, into 26BDH-26BEH, the operand of the LD DE at REVMPW (26BCH) (source: stuff new MPW).
266F
LD (26B4H),DE ED 53 B4 26
Store Register Pair DE, the hash to look for, into 26B4H-26B5H, the operand of the LD HL at THISPW (26B3H) (source: stuff test MPW).
2673
LD A,(26E3H) 3A E3 26
Load Register A with the byte at 26E3H, the drive, TSTMPW's operand (source: p/u drive #).
2676
LD C,A 4F
Load Register C with Register A, the drive, for @RDSSC, @DIRRD and @DIRWR.
2677
LD D,(IY+09H) FD 56 09
Load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: get dir cyl => reg D).
267A
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder, the HIT (source: point to HIT).
267C
LD HL,2C00H 21 00 2CLD HL,HITBUF
Load Register Pair HL with 2C00H, HITBUF, after the member (source: point to HIT buffer).
267F
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, which reads a system sector (one written with the F8H data mark) to the buffer at Register Pair HL (source: read it into buffer).
2681
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): Z with Register A = 00H when read; NZ with Register A = the error number less 6, which IOERR then takes for the error number (B153).
2682
If @RDSSC failed (NZ) jump to IOERR at 240CH with that value in Register A: Unknown error code, or Extended error, or a message of another error, never HIT read error (B153) (source: quit on read error).
2685PROT04
LD A,(HL) 7E
PROT04: load Register A with the byte at Register Pair HL, the HIT position's hash, 00H for a position not in use (source: p/u a DEC).
2686
OR A B7
OR Register A with itself, to test for 00H, a HIT position not in use.
2687
If the position is not in use jump to PROT09 at 26C7H, the next entry of the sector (source: loop on spare).
2689
LD B,L 45
Load Register B with Register L, the position's number in the HIT, the DEC of the file (source: put DEC in reg B).
268A
PUSH BC C5
Push Register Pair BC, Register B = the DEC, Register C = the drive (source: & save it in stack).
268B
LD A,L 7D
Load Register A with Register L, the DEC (source: ck if this DEC points).
268C
AND 0E0H E6 E0
AND Register A with 0E0H: bits 7-5, the entry in its sector, times 20H, the offset of the entry in the sector (source: to same dir sector as).
268E
LD L,A 6F
Load Register L with Register A, the offset of the entry in the sector, for the address in SBUFF$ at 26A1H (source: the previous DEC).
268F
XOR B A8
XOR Register A with Register B, the DEC: Register A = DEC AND 1FH, the directory sector less 2.
2690PROT05
CP 0FFH FE FF
PROT05: compare Register A with the byte at 2691H, the sector less 2 of the directory sector now in SBUFF$ (FFH in the file, no sector yet) (source: 1st time, no DEC).
2692
If the sector is the one already in SBUFF$ jump to PROT06 at 26A1H (source: jump if the same).
2694
LD (2691H),A 32 91 26
Store Register A, this sector less 2, into 2691H, the operand of the CP at PROT05 (source: save it for testing).
2697
LD A,57H 3E 57
Load Register A with 57H, SVC 87, @DIRRD, which reads the directory sector of the DEC in Register B on the drive in Register C to SBUFF$ (source: read this dir sector).
2699
RST 28H EF
Call @DIRRD with RST 28H (SYS0/SYS): Z with Register Pair HL at the entry in SBUFF$ (1D00H-1DFFH); NZ with error 17.
269A
If @DIRRD failed (NZ) jump to IOERR at 240CH with Register A = 11H, 17, Directory read error (source: quit on read error).
269D
LD A,H 7C
Load Register A with Register H, 1DH, the page of SBUFF$ (source: set hi-order SBUFF$).
269E
LD (26A2H),A 32 A2 26
Store Register A into 26A2H, the operand of the LD H at PROT06 (00H in the file).
26A1PROT06
LD H,00H 26 00
PROT06: load Register H with the byte at 26A2H, 1DH: Register Pair HL = the entry in SBUFF$ (source: point to buf hi-order).
26A3
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+0, the attributes byte (source: p/u type code).
26A4
AND 0F8H E6 F8
AND Register A with 0F8H, dropping bits 2-0, the protection level (source: remove protection).
26A6
CP 10H FE 10
Compare Register A with 10H, bit 4 alone: in use, and not invisible (bit 3), PDS (bit 5), SYS (bit 6) or an extended entry (bit 7) (source: jump if INV, SYS, FXDE).
26A8
If the entry is anything else jump to PROT08 at 26C3H: it is left alone.
26AA
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address (source: point to password fields).
26AB
ADD A,10H C6 10
Add 10H to Register A: the offset of DIR+16, the owner password hash.
26AD
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+16 of the entry in SBUFF$.
26AE
PUSH DE D5
Push Register Pair DE, kept over the compare (source: save reg DE).
26AFPROT07
PUSH HL E5
PROT07: push Register Pair HL, the address of DIR+16 (source: save pointer to OWNER).
26B0
LD E,(HL) 5E
Load Register E with the byte at Register Pair HL, DIR+16, the low byte of the owner password hash (source: p/u owner MPW).
26B1
INC HL 23
Increment Register Pair HL to DIR+17, the high byte of the owner password hash.
26B2
LD D,(HL) 56
Load Register D with the byte at Register Pair HL, DIR+17, the high byte of the hash: Register Pair DE = the file's owner password hash.
26B3THISPW
LD HL,0000H 21 00 00
THISPW: load Register Pair HL with the word at 26B4H-26B5H (0000H in the file), the hash to look for, stored at 266FH: 4296H for LOCK, the master password for UNLOCK (source: p/u test MPW & see).
26B6
XOR A AF
XOR Register A with itself, clearing the Carry flag for the SBC (source: if this one matches).
26B7
SBC HL,DE ED 52
Subtract Register Pair DE, the file's hash, from Register Pair HL, the one looked for, with SBC: zero when they are the same.
26B9
POP HL E1
Pop Register Pair HL, the address of DIR+16 (source: restore ptr to OWN).
26BA
If the hashes differ jump to PROT07B at 26C2H: the file keeps its password (source: don't change if diff).
26BCREVMPW
LD DE,0000H 11 00 00
REVMPW: load Register Pair DE with the word at 26BDH-26BEH (0000H in the file), the hash to put, stored at 266CH: the master password for LOCK, 4296H for UNLOCK (source: else p/u new MPW).
26BF
LD (HL),E 73
Store Register E, the low byte of the new hash, at Register Pair HL, DIR+16 (source: & insert it).
26C0
INC L 2C
Increment Register L to DIR+17 (an entry does not cross a page).
26C1
LD (HL),D 72
Store Register D, the high byte of the new hash, at Register Pair HL, DIR+17.
26C2PROT07B
POP DE D1
PROT07B: pop Register Pair DE, pushed at 26AEH (source: restore reg DE).
26C3PROT08
POP BC C1
PROT08: pop Register Pair BC, Register B = the DEC, Register C = the drive, pushed at 268AH (source: recover DEC).
26C4
LD H,2CH 26 2C
Load Register H with 2CH, the page of HITBUF (source: point to HIT hi-order).
26C6
LD L,B 68
Load Register L with Register B, the DEC: Register Pair HL is the HIT position again (source: stuff HIT lo-order).
26C7PROT09
LD A,L 7D
PROT09: load Register A with Register L, the HIT position (source: point to next entry).
26C8
ADD A,20H C6 20
Add 20H to Register A: the next entry of the same directory sector; the Carry flag is set after the eighth (source: for this dir sector).
26CA
LD L,A 6F
Load Register L with Register A, the next position: after the eighth entry it is the sector less 2 again.
26CB
If there was no Carry jump back to PROT04 at 2685H for the next entry of the sector (source: jump if still in same).
26CD
LD A,(2691H) 3A 91 26
Load Register A with the byte at 2691H, the sector less 2 of the sector in SBUFF$ (source: p/u current DEC).
26D0
XOR L AD
XOR Register A with Register L, the sector less 2 just walked: zero when that sector was read into SBUFF$.
26D1
If the sector was not read (no entry of it in use) jump to PROT10 at 26DBH (source: jump if different).
26D3
PUSH HL E5
Push Register Pair HL, the HIT position, which @DIRWR does not keep.
26D4
LD A,58H 3E 58
Load Register A with 58H, SVC 88, @DIRWR, which writes SBUFF$ back to the directory sector of the DEC in Register B on the drive in Register C; Register B holds the DEC of a used entry of this sector (source: write out this sector).
26D6
RST 28H EF
Call @DIRWR with RST 28H (SYS0/SYS): Z when written and verified; NZ with 18, Directory write error, or 15, Write protected disk.
26D7
POP HL E1
Pop Register Pair HL, the HIT position, for PROT10 at 26DBH.
26D8
If @DIRWR failed (NZ) jump to IOERR at 240CH with its error number in Register A; the sectors written before stay changed (source: quit on write error).
26DBPROT10
LD A,L 7D
PROT10: load Register A with Register L, the sector less 2 just done (source: advance to the next).
26DC
INC L 2C
Increment Register L to the first position of the next sector (source: directory sector).
26DD
CP 1FH FE 1F
Compare Register A with 1FH, the last of the 32 sector numbers a HIT can name (source: at end of disk?).
26DF
If it was not the last jump back to PROT04 at 2685H for the next sector (source: loop if not).
26E1
RET C9
Return to 2407H: done (source: else go home).
26E2H - TSTMPW, GETMPW and DOHASH: the Master Password
TSTMPW reads the GAT into GATBUF and looks at its master password hash (GAT+CEH): when it is that of PASSWORD (42E0H, as on the release diskette) nothing is asked and MPW is not looked at, even when wrong. Otherwise the password is MPW="s", or typed at Master password ? (MPW not given, or MPW alone), hashed and compared: a difference is Invalid master password. GETMPW gets a password through GMPW1 and turns its 3FH messages into Invalid master password, which is meant for a password of the wrong form but also replaces Invalid command during DO processing: inside a DO file a disk whose master password is not PASSWORD gives Invalid master password, though nothing was typed (B154). DOHASH has SYS2/SYS hash a password: the request E4H (function 60H of overlay 4, SYS2) is sent straight through RST 28H, whose dispatcher drops the return address of the RST, so SYS2 returns to DOHASH's caller.
26E2TSTMPW
LD C,00H 0E 00
TSTMPW: load Register C with the byte at 26E3H, the drive stored at 25CFH (00H in the file) (source: init to drive requested).
26E4
Call GATRD at 279BH, which reads the GAT of the drive in Register C to GATBUF, 2B00H-2BFFH: Z when read, NZ with 14H, 20 (source: read GAT into GATBUF).
26E7
RET NZ C0
If the GAT was not read (NZ) return with error 20, GAT read error (source: back on error).
26E8
LD HL,(2BCEH) 2A CE 2B
Load Register Pair HL with the word at 2BCEH-2BCFH, GAT+CEH, the hash of the disk's master password.
26EB
LD DE,42E0H 11 E0 42LD DE,PASSWORD
Load Register Pair DE with 42E0H, the hash of PASSWORD (source: password=PASSWORD?).
26EE
XOR A AF
XOR Register A with itself, clearing the Carry flag for the SBC; Register A = 00H.
26EF
SBC HL,DE ED 52
Subtract Register Pair DE, 42E0H, from Register Pair HL with SBC: zero when the master password is PASSWORD.
26F1
RET Z C8
If the master password is PASSWORD return with Z: nothing is asked (source: back if PASSWORD).
26F2MPARM
LD DE,0000H 11 00 00
MPARM: load Register Pair DE with the word at 26F3H-26F4H, the value of MPW stored by @PARAM (0000H in the file): the address of the password in the command line, FFFFH for MPW alone (source: p/u MPW string addr).
26F5
LD HL,2887H 21 87 28LD HL,CURMPW$
Load Register Pair HL with 2887H, CURMPW$, Master password ?, the prompt when MPW was not given (source: init prompt).
26F8
Call GETMPW at 2709H, which puts the password into BUFFER, checks it and hashes it into Register Pair HL: Z when good (source: hash parm or entry).
26FB
RET NZ C0
If the password is refused (NZ) return with its error (source: back on bad PW).
26FC
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the hash of the password given (source: xfer hashed MPW to DE).
26FD
LD HL,(2BCEH) 2A CE 2B
Load Register Pair HL with the word at 2BCEH-2BCFH, GAT+CEH, the disk's master password hash (source: grab pack MPW &).
2700
XOR A AF
XOR Register A with itself, clearing the Carry flag for the SBC (source: check if user entered).
2701
SBC HL,DE ED 52
Subtract Register Pair DE, the hash given, from Register Pair HL with SBC: zero when the password is the disk's (source: the pack MPW).
2703
LD HL,289FH 21 9F 28LD HL,BADMPW$
Load Register Pair HL with 289FH, BADMPW$, Invalid master password, for IOERR when they differ; LD keeps the flags (source: init error pointer).
2706
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, ATTRIB's sign for a message of its own (source: set extended error).
2708
RET C9
Return with Z when the master password is right, NZ with Register A = 3FH when it is not (source: Z or NZ).
2709GETMPW
GETMPW: call GMPW1 at 2719H, which puts the password from Register Pair DE, or typed at the prompt at Register Pair HL, into BUFFER, 2A00H-2A07H, checked and in capitals (source: get MPW into buffer).
270C
If the password is good (Z) jump to DOHASH at 2716H, which hashes it and returns to GETMPW's caller with the hash in Register Pair HL.
270E
CP 3FH FE 3F
Compare Register A with 3FH: is the error one of ATTRIB's own messages? (source: extended error?)
2710
RET NZ C0
If not (an error of @DSPLY) return with it, NZ.
2711
LD HL,289FH 21 9F 28LD HL,BADMPW$
Load Register Pair HL with 289FH, BADMPW$, Invalid master password, in place of Invalid disk name, and also of Invalid command during DO processing (B154) (source: switch error message).
2714
OR A B7
OR Register A, 3FH, with itself: the Z flag is cleared, NZ (source: to password error).
2715
RET C9
Return NZ with Register A = 3FH and Register Pair HL at Invalid master password.
2716DOHASH
LD A,0E4H 3E E4
DOHASH: load Register A with 0E4H, the SYS2/SYS request to hash a password (function 60H, HASHPSWD at 1E2EH) (source: hash password (DE) to HL).
2718
RST 28H EF
Send the request with RST 28H: the dispatcher drops this RST's return address, loads SYS2/SYS and calls it; it hashes the eight characters at Register Pair DE into Register Pair HL, with Register A = 00H and Z, and returns to the caller of DOHASH (source: ret to what called).
2719H - GMPW1 to CKMPW7 and INVNAM: Get and Check a Name or Password
The value comes from the command line when its word is a real address, from a prompt when it is 0000H (not given) or its bytes OR to FFH (the word given alone, FFFFH); a prompt inside a DO file is refused (CKINDO). From the line, up to eight characters are copied to the carriage return, a comma or the closing quotation mark, and anything after the eighth is not read; typed, @KEYIN takes eight at most (BREAK gives Command aborted). The rest of the eight bytes is filled with spaces. CKMPW then wants a letter first, letters and digits after it, small letters made capitals in place, and nothing but spaces after the first space; anything else, an empty value too, is Invalid disk name. GMPW1 returns Z with Register Pair DE at BUFFER.
2719GMPW1
LD A,D 7A
GMPW1: load Register A with Register D, the high byte of the value's word (source: test if user entered MPW).
271A
OR E B3
OR Register A with Register E, the low byte: zero when the value was not given.
271B
If the value was not given (Z) jump to GMPW3 at 273AH, the prompt (source: prompt if not).
271D
INC A 3C
Increment Register A: zero when the bytes of the word ORed to FFH, the FFFFH of the word given with no value (source: or if no operand).
271E
If the word was given alone (Z) jump to GMPW3 at 273AH, the prompt.
2720
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, where the value goes (source: point to buffer).
2723
PUSH HL E5
Push Register Pair HL, 2A00H, for CKMPW, which pops it at 275FH.
2724
LD B,08H 06 08
Load Register B with 08H, at most eight characters (source: init for 8 chars).
2726GMPW2
LD A,(DE) 1A
GMPW2: load Register A with the byte at Register Pair DE, a character of the value in the command line (source: p/u a char).
2727
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return (source: end of line?).
2729
If Register A is the carriage return jump to GMPW4 at 275AH, which fills the rest with spaces.
272B
CP 2CH FE 2C
Compare Register A with 2CH, the comma (source: comma separator?).
272D
If Register A is the comma jump to GMPW4 at 275AH.
272F
CP 22H FE 22
Compare Register A with 22H, the quotation mark that closes a string (source: closing quote?).
2731
If Register A is the quotation mark jump to GMPW4 at 275AH.
2733
INC DE 13
Increment Register Pair DE to the next character of the value (source: bump input pointer).
2734
LD (HL),A 77
Store Register A, the character, at Register Pair HL in BUFFER (source: transfer character).
2735
INC HL 23
Increment Register Pair HL to the next byte of BUFFER (source: bump output pointer).
2736
Decrement Register B and jump back to GMPW2 at 2726H until eight characters have been copied (source: loop until done).
2738
Jump to CKMPW at 275FH with the eight characters; the rest of the value is not read.
273AGMPW3
GMPW3: call CKINDO at 27C7H, which returns NZ with Register Pair HL at its message when a DO file is running (source: can't prompt in DO).
273D
RET NZ C0
If a DO file is running (NZ) return with Register A = 3FH and Register Pair HL at Invalid command during DO processing.
273E
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the prompt at Register Pair HL; it ends with 03H, so the cursor stays after it.
2740
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show the prompt (source: display prompt).
2741
RET NZ C0
If @DSPLY failed (NZ) return with its error number in Register A.
2742
LD BC,0800H 01 00 08
Load Register Pair BC with 0800H: Register B = 08H, at most eight characters, for @KEYIN, which sets Register C from Register B itself (Register C = 00H is not used) (source: init for 8 chars).
2745
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, where the typed text goes (source: point to buffer).
2748
PUSH HL E5
Push Register Pair HL, 2A00H, for CKMPW, which pops it at 275FH.
2749
LD A,09H 3E 09
Load Register A with 09H, SVC 9, @KEYIN, which reads a line of at most Register B characters into the buffer at Register Pair HL (source: get parm input).
274B
RST 28H EF
Call @KEYIN with RST 28H (BOOT/SYS): Register B = the number of characters typed, a carriage return after them; the Carry flag for BREAK.
274C
If BREAK was pressed (Carry) jump to ABORT at 241BH: Command aborted, FFFFH; SAVESP drops the word pushed at 2748H (source: quit on break).
274F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = 2A00H, the start of the text (source: start pointer to reg DE).
2750
LD H,00H 26 00
Load Register H with 00H (source: calculate trailing).
2752
LD L,B 68
Load Register L with Register B, the number of characters typed: Register Pair HL = that count (source: spaces needed for MPW).
2753
ADD HL,DE 19
Add Register Pair DE, 2A00H, to Register Pair HL: the byte after the last character typed, its carriage return.
2754
LD A,08H 3E 08
Load Register A with 08H, the length of the field.
2756
SUB B 90
Subtract Register B, the characters typed, from Register A: the spaces needed.
2757
If eight characters were typed (Z) jump to CKMPW at 275FH (source: go if 8 chars entered).
2759
LD B,A 47
Load Register B with Register A, the number of spaces to fill in (source: set loop count).
275AGMPW4
LD (HL),20H 36 20
GMPW4: store 20H, a space, at Register Pair HL in BUFFER (source: and fill to end).
275C
INC HL 23
Increment Register Pair HL to the next byte (source: with spaces).
275D
Decrement Register B and jump back to GMPW4 at 275AH until the eight bytes are full.
275FCKMPW
POP HL E1
CKMPW: pop Register Pair HL, 2A00H, the start of BUFFER (source: get buffer start).
2760
PUSH HL E5
Push Register Pair HL, 2A00H, again for CKMPW4.
2761
LD B,08H 06 08
Load Register B with 08H, the eight characters to check (source: init loop 8 chars).
2763
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character (source: p/u 1st char).
2764
Jump to CKMPW2 at 2774H: the first character must be a letter (source: & check A-Z).
2766CKMPW1
INC HL 23
CKMPW1: increment Register Pair HL to the next character.
2767
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL.
2768
CP 20H FE 20
Compare Register A with 20H, a space (source: got to a space?).
276A
If Register A is a space jump to CKMPW7 at 278FH, which wants nothing but spaces after it.
276C
CP 30H FE 30
Compare Register A with 30H, the digit 0 (source: less than '0' is error).
276E
If Register A is below 30H (Carry) jump to INVNAM at 2793H.
2770
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9 (source: 0-9 is okay for 2-n).
2772
If Register A is a digit (Carry) jump to CKMPW3 at 2786H: it is good.
2774CKMPW2
CP 41H FE 41
CKMPW2: compare Register A with 41H, the letter A (source: less than "A" is error).
2776
If Register A is below 41H (Carry) jump to INVNAM at 2793H.
2778
CP 5BH FE 5B
Compare Register A with 5BH, the character after the letter Z (source: A-Z is okay).
277A
If Register A is a capital letter (Carry) jump to CKMPW3 at 2786H: it is good.
277C
CP 61H FE 61
Compare Register A with 61H, the small letter a (source: ck convert to upper).
277E
If Register A is 5BH to 60H (Carry) jump to INVNAM at 2793H.
2780
CP 7BH FE 7B
Compare Register A with 7BH, the character after the small letter z.
2782
If Register A is 7BH or above (No Carry) jump to INVNAM at 2793H.
2784
RES 5,(HL) CB AE
Reset bit 5 of the byte at Register Pair HL: the small letter becomes its capital in BUFFER.
2786CKMPW3
CKMPW3: decrement Register B and jump back to CKMPW1 at 2766H until all eight characters are checked (source: loop if more).
2788CKMPW4
POP DE D1
CKMPW4: pop Register Pair DE, 2A00H, the start of BUFFER (source: point to buffer start).
2789
XOR A AF
XOR Register A with itself: Register A = 00H and the Z flag set, the value is good (source: set Z = good).
278A
RET C9
Return Z with Register A = 00H and Register Pair DE at BUFFER, 2A00H.
278BCKMPW5
INC HL 23
CKMPW5: increment Register Pair HL to the next character.
278C
CP (HL) BE
Compare Register A, 20H, with the byte at Register Pair HL: after a space only spaces may follow (source: no imbedded spaces).
278D
If it is not a space jump to INVNAM at 2793H.
278FCKMPW7
CKMPW7: decrement Register B and jump to CKMPW5 at 278BH until the rest of the eight have been checked (source: a space found, now).
2791
Jump to CKMPW4 at 2788H: the value is good (source: must be all spaces).
2793INVNAM
LD HL,28B7H 21 B7 28LD HL,BADNAM$
INVNAM: load Register Pair HL with 28B7H, BADNAM$, Invalid disk name (source: pt to error string).
2796
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, ATTRIB's sign for a message of its own (source: init extended error).
2798
OR A B7
OR Register A with itself: the Z flag is cleared, NZ (source: set NZ).
2799
POP DE D1
Pop Register Pair DE, the 2A00H pushed at 2760H, so that the stack is as GMPW1 found it.
279A
RET C9
Return NZ with Register A = 3FH and Register Pair HL at Invalid disk name.
279BH - GATRD, GATWR and CKINDO
GATRD and GATWR read or write sector 0 of the directory cylinder (DCT+9), the GAT, at GATBUF (2B00H). The write is @WRSSC, with the F8H data mark of a system sector, verified by @VRSEC, which gives error 6 for a good system sector; any other result, also @WRSSC's own error (15 for a write protected diskette), becomes error 21, GAT write error (B155). The read is @RDSSC, its failure error 20, GAT read error. CKINDO tests SFLAG$ bit 5, a DO file running.
279BGATRD
DEFB 0F6H F6
GATRD, 279BH: F6H, the opcode of OR n: entered here it runs as OR 0AFH with the XOR A at 279CH as its operand: Register A is not zero, NZ, the read (source: set NZ for test).
279CGATWR
XOR A AF
GATWR: XOR Register A with itself: Register A = 00H, Z, the write (source: set Z for test).
279D
PUSH DE D5
Push Register Pair DE, which the read and the write give back unchanged.
279E
PUSH HL E5
Push Register Pair HL, which the read and the write give back unchanged.
279F
PUSH AF F5
Push Register Pair AF, the Z flag that chooses the write or the read.
27A0
PUSH IY FD E5
Push Index Register IY, kept over @GTDCT, so the caller keeps its own.
27A2
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which gives the address of the DCT of the drive in Register C (source: DCT to reg IY).
27A4
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the drive's DCT.
27A5
LD D,(IY+09H) FD 56 09
Load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: get dir track).
27A8
POP IY FD E1
Pop Index Register IY, as it was before the CALL of @GTDCT.
27AA
LD HL,2B00H 21 00 2BLD HL,GATBUF
Load Register Pair HL with 2B00H, GATBUF, the buffer of the GAT.
27AD
LD E,L 5D
Load Register E with Register L, 00H: sector 0, the GAT (source: set to sector 0).
27AE
POP AF F1
Pop Register Pair AF, the Z flag of 279BH or 279CH.
27AF
If Z (GATWR) jump to GATRW1 at 27B8H, the write (source: go if GAT write).
27B1
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, which reads the system sector at Register Pair DE of the drive in Register C to Register Pair HL, 2B00H.
27B3
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): Z when read, NZ when not.
27B4
LD A,14H 3E 14
Load Register A with 14H, error 20, GAT read error; LD keeps the flags of @RDSSC (source: init GAT read error).
27B6
Jump to GATRW3 at 27C4H to return with Z or NZ.
27B8GATRW1
LD A,36H 3E 36
GATRW1: load Register A with 36H, SVC 54, @WRSSC, which writes the buffer at Register Pair HL, 2B00H, to the sector at Register Pair DE of the drive in Register C with the system data mark.
27BA
RST 28H EF
Call @WRSSC with RST 28H (SYS0/SYS, which goes on to the drive's driver): Z when written, NZ with the error number.
27BB
If @WRSSC failed (NZ) jump to GATRW2 at 27C0H with its error number, without the verify (source: skip verify if error).
27BD
LD A,32H 3E 32
Load Register A with 32H, SVC 50, @VRSEC, which reads the sector at Register Pair DE back to check it (source: verify the write).
27BF
RST 28H EF
Call @VRSEC with RST 28H (SYS0/SYS, which goes on to the drive's driver): error 6, Attempted to read system data record, when the GAT was written well.
27C0GATRW2
CP 06H FE 06
GATRW2: compare Register A with 06H, the error a good system sector gives: Z when the GAT was written and verified (source: error 6 expected).
27C2
LD A,15H 3E 15
Load Register A with 15H, error 21, GAT write error, for any other result, @WRSSC's error 15 for a write protected diskette too (B155); LD keeps the flags (source: init GAT write error).
27C4GATRW3
POP HL E1
GATRW3: pop Register Pair HL, pushed at 279EH.
27C5
POP DE D1
Pop Register Pair DE, pushed at 279DH; the flags are those of 27B3H or 27C0H.
27C6
RET C9
Return with Z when good, NZ with Register A = 14H or 15H.
27C7CKINDO
PUSH IY FD E5
CKINDO: push Index Register IY, kept over @FLAGS.
27C9
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which gives the address of the system flag table.
27CB
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
27CC
BIT 5,(IY+12H) FD CB 12 6E
Test bit 5 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: a DO file is running (source: ck on DO in effect).
27D0
POP IY FD E1
Pop Index Register IY, as it was before; the flags of the BIT are kept.
27D2
RET Z C8
If no DO file is running (Z) return with Z (source: go back if not in DO).
27D3
LD HL,2832H 21 32 28LD HL,NOINDO$
Load Register Pair HL with 2832H, NOINDO$, Invalid command during DO processing (source: else set error code).
27D6
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, ATTRIB's sign for a message of its own (source: set extended error).
27D8
RET C9
Return NZ (from the BIT) with Register A = 3FH and Register Pair HL at the message (source: & back with NZ).
27D9H - The Messages, PROTS$ and the Parameter Table
The messages ATTRIB shows itself (through EXTERR's @LOGOT, ended by a carriage return), the three prompts (ended by 03H, so the cursor stays after them for @KEYIN), the pairs of protection letters, and the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H, the last byte of the member. PW has no short form, so P is not taken for it; the kinds are not checked (SYS1). PSWDBUF (2902H-2909H), HASHBUF (290AH-290DH), the FCB (290EH-292DH) and, from the next page, BUFFER (2A00H), GATBUF (2B00H) and HITBUF (2C00H) follow with no bytes in the file.
27D9-27EBSPCREQ$
DEFM "File spec required" / DEFB 0DH 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 0D
SPCREQ$, 27D9H-27EBH: the message of SPCREQ (241FH), for a device spec, ended by its carriage return.
27EC-2803NOTDUN$
DEFM "Specifications Required" / DEFB 0DH 53 70 65 63 69 66 69 63 61 74 69 6F 6E 73 20 52 65 71 75 69 72 65 64 0D
NOTDUN$, 27ECH-2803H: the message of NOTDUN (2423H), for the disk form with none of PW, LOCK, UNLOCK and NAME.
2804-2821ATBERR$
DEFM "Attribute specification error" / DEFB 0DH 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 0D
ATBERR$, 2804H-2821H: the message of ATBERR (2427H), for any error in the file form's parameters.
2822-2831PROTS$
DEFM "NOEXREUPWRRNRMFU" 4E 4F 45 58 52 45 55 50 57 52 52 4E 52 4D 46 55
PROTS$, 2822H-2831H: the eight pairs of letters compared at 24AFH, NO, EX, RE, UP, WR, RN, RM, FU, for the protection levels 7 (no access) down to 0 (full); RE also leads to RENAME and, meant to, REMOVE by the third letter (24C8H, B152).
2832-2856NOINDO$
DEFM "Invalid command during DO processing" / DEFB 0DH 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 0D
NOINDO$, 2832H-2856H: the message of CKINDO (27D3H), when a prompt would be needed while a DO file runs.
2857-286EPACKNM$
DEFM "New disk pack name ? " / DEFB 03H 4E 65 77 20 64 69 73 6B 20 70 61 63 6B 20 6E 61 6D 65 20 3F 20 20 20 03
PACKNM$, 2857H-286EH: the prompt for NAME alone (25FDH), three spaces and the 03H that keeps the cursor after it.
286F-2886NEWMPW$
DEFM "New master password ? " / DEFB 03H 4E 65 77 20 6D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20 20 03
NEWMPW$, 286FH-2886H: the prompt for PW alone (263FH), two spaces and the 03H.
2887-289ECURMPW$
DEFM "Master password ? " / DEFB 03H 4D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20 20 20 20 20 20 03
CURMPW$, 2887H-289EH: the prompt for the disk's master password (26F5H), six spaces and the 03H.
289F-28B6BADMPW$
DEFM "Invalid master password" / DEFB 0DH 49 6E 76 61 6C 69 64 20 6D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 0D
BADMPW$, 289FH-28B6H: the message of a wrong master password (2703H) and of any refused password (2711H).
28B7-28C8BADNAM$
DEFM "Invalid disk name" / DEFB 0DH 49 6E 76 61 6C 69 64 20 64 69 73 6B 20 6E 61 6D 65 0D
BADNAM$, 28B7H-28C8H: the message of INVNAM (2793H), shown as it is only for NAME.
28C9-28D8ABORT$
DEFM "Command aborted" / DEFB 0DH 43 6F 6D 6D 61 6E 64 20 61 62 6F 72 74 65 64 0D
ABORT$, 28C9H-28D8H: the message of ABORT (241BH), for BREAK at a prompt.
28D9PRMTBL$
DEFB 80H 80
PRMTBL$, 28D9H: 80H, the mark of a table in the enhanced format, given to @PARAM at 25D5H.
28DA-28DC
DEFB 62H / DEFM "PW" 62 50 57
28DAH-28DCH: type 62H (a flag or a string, no short form, two letters) and the name PW, the new master password.
28DD-28DF
DEFB 00H / DEFW 2639H 00 39 26
28DDH, the response byte of PW (never read), and the address of its value, 2639H, PPARM's operand.
28E0-28E4
DEFB 54H / DEFM "LOCK" 54 4C 4F 43 4B
28E0H-28E4H: type 54H (a flag, a one letter short form, four letters) and the name LOCK.
28E5-28E7
DEFB 00H / DEFW 265CH 00 5C 26
28E5H, the response byte of LOCK (never read), and the address of its value, 265CH, LPARM's operand.
28E8-28EE
DEFB 56H / DEFM "UNLOCK" 56 55 4E 4C 4F 43 4B
28E8H-28EEH: type 56H (a flag, a short form, six letters) and the name UNLOCK.
28EF-28F1
DEFB 00H / DEFW 2666H 00 66 26
28EFH, the response byte of UNLOCK (never read), and the address of its value, 2666H, UPARM's operand.
28F2-28F6
DEFB 74H / DEFM "NAME" 74 4E 41 4D 45
28F2H-28F6H: type 74H (a flag or a string, a short form, four letters) and the name NAME, the new disk name.
28F7-28F9
DEFB 00H / DEFW 25F7H 00 F7 25
28F7H, the response byte of NAME (never read), and the address of its value, 25F7H, NPARM's operand.
28FA-28FD
DEFB 73H / DEFM "MPW" 73 4D 50 57
28FAH-28FDH: type 73H (a flag or a string, a short form, three letters) and the name MPW, the disk's present master password.
28FE-2900
DEFB 00H / DEFW 26F3H 00 F3 26
28FEH, the response byte of MPW (never read), and the address of its value, 26F3H, MPARM's operand.
2901
DEFB 00H 00
2901H: the 00H that ends the table, both for @PARAM's loop that zeroes the response bytes and for @FNDPRM; the last byte of the member.
2400H - Member 5 (PURGE): Entry and the Partspec
SYS1/SYS runs PURGE with request 72H; its header (file offset 0051H: record 0DH, byte A4H) points at member 5, which the overlay loader reads to 2400H-2944H and 2968H-298FH (1389 bytes in seven load blocks; 2945H-2967H, the dates FMPAKD and TOPAKD, the reply buffer LILBUF$ and the name buffer FCB1$, is not loaded) and calls at 2400H with Register Pair HL at the text after the word PURGE. PURGE removes, one by one and normally after a question, every file of a drive that matches a partspec with the wild card $, or every file that does not (a minus sign first), within a range of dates; BOOT/SYS and DIR/SYS never. The FCB (2990H) and BUFFER (2A00H), GATBUF (2B00H) and HITBUF (2C00H) follow the member with no bytes in the file. A BREAK pending at the entry returns FFFFH at once, before the Stack Pointer is kept. The 631 changes: the drive tests at 2450H and 246FH (6.3.0 called PATCH1 and PATCH2 there, with the same effect), the years 2000 to 2011 in the date shown (2654H-265FH) and in a DATE value (27D7H-27DEH), and the order of DEC B and DEC DE in PARSDAT (282FH).
2400PURGE
LD A,6AH 3E 6A
PURGE: PURGE's entry (request 72H): load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it (source: break key down?).
2402
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was.
2403
If BREAK was not pressed jump to BEGINA at 2409H (source: ok if not).
2405
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with 0FFFFH, the return code for a BREAK at the entry (source: else abort).
2408
RET C9
Return through the tail of RST28 (1A77H) with Register Pair HL = FFFFH and nothing shown.
2409BEGINA
LD (2874H),SP ED 73 74 28
BEGINA: store the Stack Pointer into 2874H-2875H, the operand of the LD SP at SAVESP (2873H), so that every exit returns at the depth of the entry (source: save stack pointer).
240D
PUSH HL E5
Push Register Pair HL, the command line pointer after the word PURGE (source: save cmdline ptr).
240E
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which gives the address of the system flag table.
2410
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
2411
PUSH IY FD E5
Push Index Register IY, 006AH, the address of the flag table.
2413
POP DE D1
Pop Register Pair DE: Register Pair DE = 006AH, the flag table (source: flag base to DE).
2414
LD HL,0018H 21 18 00
Load Register Pair HL with 0018H, the offset of YFLAG$ in the flag table (source: year type flag).
2417
ADD HL,DE 19
Add Register Pair DE, 006AH, to Register Pair HL: Register Pair HL = 0082H, YFLAG$, whose bit n is set when the diskette in drive n is dated in the new style.
2418
LD (27B6H),HL 22 B6 27LD (YFLAG1),HL
Store Register Pair HL, 0082H, into 27B6H-27B7H, the operand of the LD A at 27B5H in UNPACK.
241B
LD (263EH),HL 22 3E 26LD (YFLAG2),HL
Store Register Pair HL, 0082H, into 263EH-263FH, the operand of the LD A at 263DH, for the year shown (source: save for date dsply).
241E
POP HL E1
Pop Register Pair HL, the command line pointer (source: restore cmdline ptr).
241FPURGE1
LD A,(HL) 7E
PURGE1: load Register A with the byte at Register Pair HL, a character of the command line (source: bypass cmd line blanks).
2420
INC HL 23
Increment Register Pair HL past the character just read.
2421
CP 20H FE 20
Compare Register A with 20H, a space, which is passed over.
2423
If Register A is a space jump back to PURGE1 at 241FH: the spaces are passed over; Register A then holds the first other character, Register Pair HL the one after it.
2425
LD DE,2939H 11 39 29LD DE,BLANKS
Load Register Pair DE with 2939H, BLANKS, the eleven bytes of the partspec, spaces in the file (source: pt to filespec area).
2428
LD B,08H 06 08
Load Register B with 08H, the eight characters of a name (source: init for file name).
242A
CP 2DH FE 2D
Compare Register A with 2DH, the minus sign that turns the selection round (source: if -, set up flag).
242C
If Register A is not the minus sign jump to PUR0 at 2433H.
242E
LD (256CH),A 32 6C 25
Store Register A, 2DH, into 256CH, the operand of the LD A at MFLG (256BH): the files that do not match are the ones taken.
2431
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the minus sign.
2432
INC HL 23
Increment Register Pair HL past the character after the minus sign.
2433PUR0
PUR0: call PRSPEC at 2779H, which copies the name part of the partspec from Register A and Register Pair HL to Register Pair DE, 2939H-2940H, and returns with Register A = the character that ended it.
2436
CP 2EH FE 2E
Compare Register A with 2EH, the period, taken as the start of the extension too (source: also as extent).
2438
If Register A is the period jump to PUR1A at 243EH.
243A
CP 2FH FE 2F
Compare Register A with 2FH, the slash of an extension (source: ck on file EXT entered).
243C
If Register A is not the slash jump to PUR1 at 2448H: there is no extension (source: jump if no extension).
243EPUR1A
LD DE,2941H 11 41 29
PUR1A: load Register Pair DE with 2941H, the extension part of BLANKS (source: point to ext field).
2441
LD B,03H 06 03
Load Register B with 03H, the three characters of an extension (source: max 3 chars).
2443
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the extension.
2444
INC HL 23
Increment Register Pair HL past the first character of the extension.
2445
Call PRSPEC at 2779H, which copies the extension to Register Pair DE, 2941H-2943H, and returns with Register A = the character that ended it (source: ck on EXT).
2448H - PUR1: the Drive, Then the Parameters
The drive spec is required: anything else after the partspec is Parameter error (error 44), and so is a drive digit outside 0 to 7 (631; 6.3.0 did the same in PATCH1), not Illegal drive number. The drive number is built into the BIT n,A of UNPACK (27B8H) and of the date shown (2640H), which test the drive's bit of YFLAG$. @CKDRV must find the drive ready, else error 32, and not write protected, else error 15 (631; 6.3.0's PATCH2). @PARAM then reads INV, SYS, MPW, QUERY and DATE from PRMTBL$ (2968H).
2448PUR1
CP 3AH FE 3A
PUR1: compare Register A with 3AH, the colon of the drive spec (source: drive entered?).
244A
LD C,00H 0E 00
Load Register C with 00H; LD keeps the flags of the compare (source: init to drive 0).
244C
If there is no colon jump to PRMERRA at 2480H, whose JP NZ goes to PRMERR: Parameter error, the drive spec is required (source: quit if no drive #).
244E
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the drive digit (source: p/u drive #).
244F
INC HL 23
Increment Register Pair HL past it, to the parameters (source: bump to next field).
2450
SUB 30H D6 30
Subtract 30H from Register A, the digit 0: the drive number, 0 to 7, for a digit 0 to 7 (631).
2452
CP 08H FE 08
Compare Register A with 08H: Carry for a drive 0 to 7; a character below the digit 0 gives D0H or above (631: source, ck drive range 0-7).
2454
If Register A is 08H or above (No Carry) jump to PRMERR at 285CH: Parameter error (631).
2457
LD C,A 4F
Load Register C with Register A, the drive number (631).
2458
LD B,C 41
Load Register B with Register C, the drive number (source: set bit instruct).
2459
INC B 04
Increment Register B: the loop at PUR2A runs drive + 1 times (source: always once).
245A
LD A,3FH 3E 3F
Load Register A with 3FH, 47H less 8, for the loop that adds 8 for each drive.
245CPUR2A
ADD A,08H C6 08
PUR2A: add 08H to Register A, once for drive 0 and once more for each drive above it.
245E
Decrement Register B and jump back to PUR2A at 245CH until it is 0: Register A = 47H + 8 x drive, the second byte of BIT n,A for bit n = the drive.
2460
LD (27B9H),A 32 B9 27LD (DVTEST1),A
Store Register A into 27B9H, the second byte of the BIT at 27B8H in UNPACK (source: this is bit x,a).
2463
LD (2641H),A 32 41 26LD (DVTEST2),A
Store Register A into 2641H, the second byte of the BIT at 2640H, for the date shown (source: opcode).
2466
LD A,C 79
Load Register A with Register C, the drive number (source: xfer drive to regA).
2467
LD (26CEH),A 32 CE 26
Store Register A into 26CEH, the operand of the LD C at TSTMPW (26CDH), where every later use of the drive reads it (source: & stuff for later).
246A
LD A,21H 3E 21
Load Register A with 21H, SVC 33, @CKDRV, which tests that the drive in Register C is enabled and has a diskette (source: ck if drive available).
246C
RST 28H EF
Call @CKDRV with RST 28H (SYS2/SYS): Z when ready, with the Carry flag set for a write protected diskette; NZ when not ready.
246D
LD A,20H 3E 20
Load Register A with 20H, error 32, Illegal drive number; LD keeps the flags (source: drive not avail).
246F
If the drive is not ready (NZ) jump to IOERR at 285EH with error 32 (631: source, go on CKDRV error).
2472
LD A,0FH 3E 0F
Load Register A with 0FH, error 15, Write protected disk; LD keeps the flags (631: source, init WP error).
2474
If the diskette is write protected (Carry) jump to IOERR at 285EH with error 15 (631: source, exit if WP).
2477
LD A,51H 3E 51
Load Register A with 51H, SVC 81, @GTDCT, which gives the address of the DCT of the drive in Register C (source: DCT to reg IY).
2479
RST 28H EF
Call @GTDCT with RST 28H (SYS0/SYS): Index Register IY = the drive's DCT, for DCT+9 in GATRD (2758H) and at 24D5H.
247A
LD DE,2968H 11 68 29LD DE,PRMTBL$
Load Register Pair DE with 2968H, PRMTBL$, the parameter table (source: get parms).
247D
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads the parameter list at Register Pair HL by the table at Register Pair DE.
247F
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): Z with each value given stored into the word its entry names (DATE's string as the address of its first character after the quotation mark); NZ (2CH) for a word not in the table or a bad value. With no list after the drive digit (PURGE :12 or :1x with or without a list after it), Z with nothing stored: the rest of the line is not looked at.
2480PRMERRA
PRMERRA: if @PARAM failed, or (from 244CH) there is no drive spec, jump to PRMERR at 285CH: Parameter error (source: jump on error).
2483H - DATPRM: the Range of Dates
DATE="M1/D1/Y1-M2/D2/Y2" gives the first and last date, "M1/D1/Y1-" only the first, "-M2/D2/Y2" only the last, "M1/D1/Y1" one date (taken as both). PAKDAT packs each one into a word (year less 1980 in bits 15-11, month in bits 10-7, day in bits 6-2) in FMPAKD (2945H) and TOPAKD (2947H), and FTFLG (2944H) gets bit 7 for a first date and bit 0 for a last one. A bad date ends PURGE with Bad date format. After the first date only a closing quotation mark or a minus sign is looked at: anything else, a space before the minus sign too, leaves the first date alone, and the rest of the value is not read.
2483DATPRM
LD HL,0000H 21 00 00
DATPRM: load Register Pair HL with the word at 2484H-2485H, the value of DATE stored by @PARAM (0000H in the file): the address of the date text after its opening quotation mark (source: p/u date="from-to").
2486
LD A,H 7C
Load Register A with Register H, the high byte of DATE's value.
2487
OR L B5
OR Register A with Register L: zero when DATE was not given.
2488
If DATE was not given (Z) jump to PUR3 at 24BFH (source: bypass if not entered).
248A
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the date text (source: check for "-to").
248B
CP 2DH FE 2D
Compare Register A with 2DH, the minus sign of a range with no first date.
248D
If Register A is the minus sign jump to CKTO at 24A7H: only the last date is given.
248F
LD A,80H 3E 80
Load Register A with 80H, bit 7 of FTFLG: a first date is given (source: set from bit).
2491
LD (2944H),A 32 44 29LD (FTFLG),A
Store Register A, 80H, into 2944H, FTFLG (00H in the file) (source: note from entered).
2494
Call PAKDAT at 27CEH, which reads the date MM/DD/YY at Register Pair HL and returns its packed word in Register Pair BC, Register Pair HL after it: Z when good (source: pack the date entry).
2497
If the date is bad (NZ) jump to IOERR at 285EH with Register A = 3FH and Register Pair HL at Bad date format (source: quit if bad date).
249A
LD (2945H),BC ED 43 45 29LD (FMPAKD),BC
Store Register Pair BC, the packed first date, into 2945H-2946H, FMPAKD.
249E
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the first date.
249F
CP 22H FE 22
Compare Register A with 22H, the closing quotation mark: a single date.
24A1
If Register A is the quotation mark jump to FRCTO at 24B3H, which makes the same date the last one too.
24A3
CP 2DH FE 2D
Compare Register A with 2DH, the minus sign before a last date (source: check for "-to").
24A5
If Register A is not the minus sign jump to PUR3 at 24BFH: only the first date counts, whatever follows.
24A7CKTO
INC HL 23
CKTO: increment Register Pair HL past the minus sign (source: bypass the '-').
24A8
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after it (source: ck for end of parm).
24A9
CP 22H FE 22
Compare Register A with 22H, the closing quotation mark of "M1/D1/Y1-".
24AB
If Register A is the quotation mark jump to PUR3 at 24BFH: there is no last date (source: go on parm end).
24AD
Call PAKDAT at 27CEH, which reads the last date at Register Pair HL into Register Pair BC: Z when good (source: else pack the date).
24B0
If the date is bad (NZ) jump to IOERR at 285EH with Register A = 3FH and Register Pair HL at Bad date format (source: quit on bad date).
24B3FRCTO
LD A,(2944H) 3A 44 29LD A,(FTFLG)
FRCTO: load Register A with the byte at 2944H, FTFLG.
24B6
OR 01H F6 01
OR Register A with 01H, bit 0 of FTFLG: a last date is given (source: set TO bit).
24B8
LD (2944H),A 32 44 29LD (FTFLG),A
Store Register A into 2944H, FTFLG, with bit 0 set.
24BB
LD (2947H),BC ED 43 47 29LD (TOPAKD),BC
Store Register Pair BC, the packed last date (or the one date), into 2947H-2948H, TOPAKD (source: stuff for later).
24BFH - PUR3 and DOEVER: the Prompts and the Master Password
With QUERY on (its value's low byte not 00H; QUERY is on unless Q=N is given) PURGE needs the keyboard, so inside a DO file it stops at once with Invalid command during <DO> processing; Q=N is needed there. TSTMPW (26CDH) reads the GAT and, unless the master password is PASSWORD, takes MPW or asks for it. Then the HIT is read to HITBUF (2C00H); a failure is HIT read error (22). Index Register IY is made the flag table's address, for the BREAK test at 268FH.
24BFPUR3
LD A,(25DEH) 3A DE 25
PUR3: load Register A with the byte at 25DEH, the low byte of QUERY's value, the operand of the LD DE at QPARM (25DDH), FFH in the file: on (source: query parm used?).
24C2
OR A B7
OR Register A with itself, to test for 00H, Q=N.
24C3
If QUERY is off (Z) jump to DOEVER at 24CBH (source: go if not).
24C5
Call CKINDO at 2767H, which returns NZ with Register Pair HL at its message when a DO file is running (source: invalid command during DO processing).
24C8
If a DO file is running (NZ) jump to IOERR at 285EH with Register A = 3FH: the message is shown and PURGE ends.
24CBDOEVER
DOEVER: call TSTMPW at 26CDH, which reads the GAT and checks the master password (source: ck on master password).
24CE
If TSTMPW failed (NZ) jump to IOERR at 285EH: GAT read error, or 3FH with Register Pair HL at Invalid master password or Invalid command during <DO> processing (source: go if worng).
24D1
LD A,(26CEH) 3A CE 26
Load Register A with the byte at 26CEH, the drive, TSTMPW's operand (source: p/u drive).
24D4
LD C,A 4F
Load Register C with Register A, the drive, for @RDSSC and @DIRRD (SYS10's @REMOVE takes the drive from FCB+6, 26AFH).
24D5
LD D,(IY+09H) FD 56 09
Load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: get DIR cylinder).
24D8
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder, the HIT (source: pt to HIT sector).
24DA
LD HL,2C00H 21 00 2CLD HL,HITBUF
Load Register Pair HL with 2C00H, HITBUF, after the member.
24DD
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which gives the address of the system flag table (source: pt IY => flags).
24DF
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$, from here on.
24E0
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, which reads a system sector to the buffer at Register Pair HL (source: read the HIT).
24E2
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): Z when read, NZ when not.
24E3
LD A,16H 3E 16
Load Register A with 16H, error 22, HIT read error; LD keeps the flags (source: init HIT read error).
24E5
If the HIT was not read (NZ) jump to IOERR at 285EH with error 22 (source: abort on read error).
24E8
Jump to SCNH3 at 2502H with Register Pair HL = 2C00H, the first HIT position.
24EAH - SCNHIT to SCNH4: Walk the HIT
The HIT is walked a directory sector at a time, as SYS7's ATTRIB does: positions L, L+20H ... L+E0H are the eight entries of one directory sector (the DEC's bits 4-0 are the sector less 2, bits 7-5 the entry). Positions 00H and 01H, the first entries of directory sectors 2 and 3, BOOT/SYS and DIR/SYS, are always passed over, and so are the positions not in use. A sector is read with @DIRRD only when it is not the one already in SBUFF$ (SCNH3A's operand 2513H, set to FFH after each @REMOVE, which uses SBUFF$ itself). After the last sector a carriage return is shown and PURGE returns 0000H.
24EASCNHIT
POP HL E1
SCNHIT: pop Register Pair HL, dropped: the address of DIR+0 pushed at 2548H or 2572H, or after a reply other than Y (268AH) the pointer pushed at 25EDH; the entry is not taken.
24EBSCNH1
POP BC C1
SCNH1: pop Register Pair BC, Register B = the DEC of the entry, Register C = the drive, pushed at 250CH (source: rcvr HIT ptr DEC).
24EC
LD H,2CH 26 2C
Load Register H with 2CH, the page of HITBUF (source: pt to hi-order buffer).
24EE
LD L,B 68
Load Register L with Register B, the DEC: Register Pair HL is the HIT position again (source: set lo-order DEC).
24EFSCNH2
LD A,L 7D
SCNH2: load Register A with Register L, the HIT position.
24F0
ADD A,20H C6 20
Add 20H to Register A: the next entry of the same directory sector; the Carry flag is set after the eighth (source: pt to next one in).
24F2
LD L,A 6F
Load Register L with Register A, the next position: after the eighth entry it is the sector less 2 again (source: same dir sector).
24F3
If there was no Carry jump to SCNH3 at 2502H for the next entry of the sector (source: jump if still in sector).
24F5
INC L 2C
Increment Register L to the first position of the next sector (source: bump to next dir sector).
24F6
CP 1FH FE 1F
Compare Register A with 1FH, the last of the 32 sector numbers a HIT can name (source: end of the line?).
24F8
If it was not the last jump to SCNH3 at 2502H for the next sector (source: loop if not).
24FA
LD C,0DH 0E 0D
Load Register C with 0DH, a carriage return, for @DSP.
24FC
LD A,02H 3E 02
Load Register A with 02H, SVC 2, @DSP, which shows the character in Register C (source: write new line & exit).
24FE
RST 28H EF
Call @DSP with RST 28H (BOOT/SYS) to end the line.
24FF
Jump to 2879H in SAVESP, which loads Register Pair HL with 0000H, clears a BREAK and returns; the stack is at the depth of the entry here.
2502SCNH3
LD A,L 7D
SCNH3: load Register A with Register L, the HIT position (source: ignore BOOT & DIR).
2503
AND 0FEH E6 FE
AND Register A with 0FEH: zero for the positions 00H and 01H, BOOT/SYS and DIR/SYS.
2505
If the position is 00H or 01H jump back to SCNH2 at 24EFH: these two are never purged.
2507
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the position's hash (source: p/u HIT hash byte).
2508
OR A B7
OR Register A with itself, to test for 00H, a position not in use.
2509
If the position is not in use jump back to SCNH2 at 24EFH (source: ignore if spare).
250B
LD B,L 45
Load Register B with Register L, the DEC of the entry (source: save DEC).
250C
PUSH BC C5
Push Register Pair BC, Register B = the DEC, Register C = the drive.
250D
LD A,L 7D
Load Register A with Register L, the DEC (source: get record # in L).
250E
AND 0E0H E6 E0
AND Register A with 0E0H: the offset of the entry in its sector.
2510
LD L,A 6F
Load Register L with Register A, the offset, for the address in SBUFF$ at 2523H.
2511
XOR B A8
XOR Register A with Register B, the DEC: Register A = DEC AND 1FH, the directory sector less 2 (source: get sector # in A).
2512SCNH3A
CP 0FFH FE FF
SCNH3A: compare Register A with the byte at 2513H, the sector less 2 of the directory sector in SBUFF$ (FFH in the file and after each @REMOVE) (source: same as what's in core?).
2514
If it is the sector already in SBUFF$ jump to SCNH4 at 2523H (source: bypass if same).
2516
LD (2513H),A 32 13 25
Store Register A, this sector less 2, into 2513H, the operand of SCNH3A's CP (source: update indicator byte).
2519
LD A,57H 3E 57
Load Register A with 57H, SVC 87, @DIRRD, which reads the directory sector of the DEC in Register B on the drive in Register C (source: read this directory).
251B
RST 28H EF
Call @DIRRD with RST 28H (SYS0/SYS): Z with Register Pair HL at the entry in SBUFF$ (1D00H-1DFFH); NZ with error 17.
251C
If @DIRRD failed (NZ) jump to IOERR at 285EH with Register A = 11H, 17, Directory read error (source: quit on read error).
251F
LD A,H 7C
Load Register A with Register H, 1DH, the page of SBUFF$ (source: set SBUFF pointer).
2520
LD (2524H),A 32 24 25
Store Register A into 2524H, the operand of the LD H at SCNH4 (00H in the file).
2523SCNH4
LD H,00H 26 00
SCNH4: load Register H with the byte at 2524H, 1DH: Register Pair HL = the entry, DIR+0, in SBUFF$ (source: pt to dir buf hi-order).
2525
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+0, the attributes byte (source: L set to lo-order).
2526H - The Kind of File and the Name
Unused entries and extended entries are passed over. A SYS file is taken only with SYS given, and then whatever its visibility: SYS without INV takes the invisible SYS files too. Any other invisible file needs INV. Then the eleven characters of the name and extension are compared with the partspec: a $ matches any character, and so does a space of the partspec, so a partspec matches every name that begins with it and an empty extension matches every extension. With the minus sign, the files that do not match are the ones taken.
2526
BIT 4,A CB 67
Test bit 4 of Register A: the entry is in use (source: ignore if not assigned).
2528
If the entry is not in use jump to SCNH1 at 24EBH for the next position.
252A
BIT 7,A CB 7F
Test bit 7 of Register A: an extended directory entry (FXDE) (source: ignore if it's an).
252C
If it is an extended entry jump to SCNH1 at 24EBH (source: extended dir record).
252E
BIT 6,A CB 77
Test bit 6 of Register A: a SYS file (source: jump if not a SYS file).
2530
If it is not a SYS file jump to CKINV at 253CH.
2532SPARM
LD DE,0000H 11 00 00
SPARM: load Register Pair DE with the word at 2533H-2534H, the value of SYS stored by @PARAM (0000H in the file) (source: p/u S-parm).
2535
LD A,D 7A
Load Register A with Register D, the high byte of SYS's value.
2536
OR E B3
OR Register A with Register E: zero when SYS was not given (source: ignore this one if).
2537
If SYS was not given (Z) jump to SCNH1 at 24EBH: a SYS file is passed over (source: S-parm not entered).
253A
Jump to CKNAM at 2548H: a SYS file is taken without the test of INV.
253CCKINV
BIT 3,A CB 5F
CKINV: test bit 3 of Register A: an invisible file (source: jump if visible).
253E
If the file is visible jump to CKNAM at 2548H.
2540IPARM
LD DE,0000H 11 00 00
IPARM: load Register Pair DE with the word at 2541H-2542H, the value of INV stored by @PARAM (0000H in the file) (source: I-parm).
2543
LD A,D 7A
Load Register A with Register D, the high byte of INV's value (source: ignore if I-parm not).
2544
OR E B3
OR Register A with Register E: zero when INV was not given (source: entered as this file).
2545
If INV was not given (Z) jump to SCNH1 at 24EBH: an invisible file is passed over (source: is invisible).
2548CKNAM
PUSH HL E5
CKNAM: push Register Pair HL, the address of DIR+0 (source: save ptr to record).
2549
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address (source: pt to filename in dir).
254A
ADD A,05H C6 05
Add 05H to Register A: the offset of DIR+5, the name.
254C
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+5 in SBUFF$.
254D
LD DE,2939H 11 39 29LD DE,BLANKS
Load Register Pair DE with 2939H, BLANKS, the partspec as typed (source: pt to parsed input).
2550
LD B,0BH 06 0B
Load Register B with 0BH, the eleven characters of the name and extension (source: ck name/ext (11-chars)).
2552SCNH5
LD A,(DE) 1A
SCNH5: load Register A with the byte at Register Pair DE, a character of the partspec.
2553
CP 24H FE 24
Compare Register A with 24H, the wild card $ (source: wild char?).
2555
If Register A is the wild card jump to SCNH6 at 255EH: it matches any character (source: always a match).
2557
CP (HL) BE
Compare Register A with the byte at Register Pair HL, the character of the name (source: not global, char match?).
2558
If they are the same jump to SCNH6 at 255EH (source: ck more if match).
255A
CP 20H FE 20
Compare Register A with 20H, a space: the partspec's character is a space, which matches anything (source: blank = end of ck).
255C
If it is not a space jump to MFLG at 256BH: the name does not match (source: if not blank, no match).
255ESCNH6
INC HL 23
SCNH6: increment Register Pair HL to the next character of the name (source: bump pointers).
255F
INC DE 13
Increment Register Pair DE to the next character of the partspec.
2560
Decrement Register B and jump back to SCNH5 at 2552H until all eleven are compared (source: loop for 11 chars).
2562
LD A,(256CH) 3A 6C 25
Load Register A with the byte at 256CH, the operand of MFLG's LD A: 2DH after a minus sign, 00H in the file (source: bypass if a match but).
2565
OR A B7
OR Register A with itself, to test for 00H: no minus sign was given.
2566
If a minus sign was given (NZ) jump to SCNHIT at 24EAH: a matching file is not taken (source: - exclude given).
2569
Jump to SCNH6A at 2571H: the matching file is taken.
256BMFLG
LD A,00H 3E 00
MFLG: load Register A with the byte at 256CH, 2DH after a minus sign (stored at 242EH), 00H in the file (source: ignore if no match &).
256D
OR A B7
OR Register A with itself, to test for 00H (source: no exclude given).
256E
If no minus sign was given (Z) jump to SCNHIT at 24EAH: a file that does not match is not taken.
2571H - SCNH6A and SCNH6B: the Dates
UNPACK packs the file's date the way PAKDAT packs a typed one, and the two words are compared: with a first date the file must be on it or later, with a last date on it or earlier; a file whose word is 0000H counts as undated and is not taken when DATE is given. The year comes from DIR+19 bits 4-0 on a diskette dated in the new style; there DIR+19 also holds a value for a file that has no date, as the blank password hash 42H that SYS2's @INIT puts into a file never written (B19), so such an undated file is taken as one of 1982 with month and day 0 (B160). On an old style diskette the year is DIR+2 bits 2-0, the year less 1980 modulo 8, compared with the full year typed (B159).
2571SCNH6A
POP HL E1
SCNH6A: pop Register Pair HL, the address of DIR+0 (source: rcvr ptr to DIR+0).
2572
PUSH HL E5
Push Register Pair HL, DIR+0, again for MATCHES.
2573
INC HL 23
Increment Register Pair HL to DIR+1, the month (source: pt to date field).
2574
Call UNPACK at 27A4H, which returns the file's date in Register Pair DE, packed as PAKDAT packs a typed date (source: alter date for cpr).
2577
LD A,(2944H) 3A 44 29LD A,(FTFLG)
Load Register A with the byte at 2944H, FTFLG.
257A
RLCA 07
Rotate Register A left: bit 7, a first date given, into the Carry flag (source: tst fm bit).
257B
If no first date was given (No Carry) jump to SCNH6B at 258DH.
257D
LD A,D 7A
Load Register A with Register D, the high byte of the file's date (source: ignore if no date).
257E
OR E B3
OR Register A with Register E: zero when the file's packed date is 0000H, undated (B160) (source: in DIR for file).
257F
If the file counts as undated (Z) jump to SCNHIT at 24EAH: not taken.
2582
LD HL,(2945H) 2A 45 29LD HL,(FMPAKD)
Load Register Pair HL with the word at 2945H-2946H, FMPAKD, the packed first date (source: p/u user entry).
2585
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the file's date, Register Pair DE = the first date.
2586
Call CPHLDE at 2856H, which compares Register Pair HL with Register Pair DE: the Carry flag when Register Pair HL is lower (source: HL-DE).
2589
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the file's date again; EX keeps the flags.
258A
If the file's date is before the first date (Carry) jump to SCNHIT at 24EAH: not taken (source: go if out of range).
258DSCNH6B
LD A,(2944H) 3A 44 29LD A,(FTFLG)
SCNH6B: load Register A with the byte at 2944H, FTFLG.
2590
RRCA 0F
Rotate Register A right: bit 0, a last date given, into the Carry flag (source: tst TO bit).
2591
If no last date was given (No Carry) jump to MATCHES at 25A1H: the file is taken (source: go if no TOPARM).
2593
LD A,D 7A
Load Register A with Register D, the high byte of the file's date (source: else ck if file is dated).
2594
OR E B3
OR Register A with Register E: zero when the file counts as undated.
2595
If the file counts as undated (Z) jump to SCNHIT at 24EAH: not taken (source: go if no dir date).
2598
LD HL,(2947H) 2A 47 29LD HL,(TOPAKD)
Load Register Pair HL with the word at 2947H-2948H, TOPAKD, the packed last date (source: p/u user's packed date).
259B
Call CPHLDE at 2856H: the Carry flag when the last date, Register Pair HL, is lower than the file's date, Register Pair DE (source: HL-DE).
259E
If the file's date is after the last date (Carry) jump to SCNHIT at 24EAH: not taken (source: go if out of range).
25A1H - MATCHES and DONAM: the Name Line
The file's name is written to FCB1$ (294DH, not in the file) as NAME/EXT:d, the extension and its slash only when there is one, ended by 03H; Register Pair DE keeps the address of that 03H.
25A1MATCHES
POP HL E1
MATCHES: pop Register Pair HL, the address of DIR+0 (source: rcvr pointer to DIRREC).
25A2DONAM
PUSH HL E5
DONAM: push Register Pair HL, DIR+0, again for the question or the purge.
25A3
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address (source: & point to file name).
25A4
ADD A,05H C6 05
Add 05H to Register A: the offset of DIR+5, the name.
25A6
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+5 in SBUFF$.
25A7
LD DE,294DH 11 4D 29LD DE,FCB1$
Load Register Pair DE with 294DH, FCB1$, the buffer of the line shown (source: pt to name/ext buffer).
25AA
LD B,08H 06 08
Load Register B with 08H, at most eight characters of the name (source: max 8-char name).
25ACDONAM1
LD A,(HL) 7E
DONAM1: load Register A with the byte at Register Pair HL, a character of the name (source: move filename into).
25AD
CP 20H FE 20
Compare Register A with 20H, a space, which ends the name (source: buffer until space).
25AF
If Register A is a space jump to DONAME2 at 25B6H (source: or 8 characters).
25B1
LD (DE),A 12
Store Register A, the character, at Register Pair DE in FCB1$.
25B2
INC HL 23
Increment Register Pair HL to the next character of the name.
25B3
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25B4
Decrement Register B and jump back to DONAM1 at 25ACH until eight characters are copied.
25B6DONAME2
LD A,L 7D
DONAME2: load Register A with Register L, the low byte of the address of the character that ended the name (source: point to file ext).
25B7
ADD A,B 80
Add Register B, the characters of the name not copied, to Register A: the offset of DIR+13, the extension.
25B8
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+13 in SBUFF$.
25B9
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the extension (source: is there an extension?).
25BA
CP 20H FE 20
Compare Register A with 20H, a space: no extension.
25BC
If there is no extension jump to DONAM5 at 25CEH (source: bypass if not).
25BE
LD A,2FH 3E 2F
Load Register A with 2FH, the slash before the extension.
25C0
LD (DE),A 12
Store Register A, the slash, at Register Pair DE in FCB1$ (source: stuff ext separator).
25C1
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25C2
LD B,03H 06 03
Load Register B with 03H, at most three characters of the extension (source: init 3-char ext max).
25C4DONAM4
LD A,(HL) 7E
DONAM4: load Register A with the byte at Register Pair HL, a character of the extension (source: transfer up to space).
25C5
CP 20H FE 20
Compare Register A with 20H, a space, which ends the extension (source: or 3 chars).
25C7
If Register A is a space jump to DONAM5 at 25CEH.
25C9
LD (DE),A 12
Store Register A, the character, at Register Pair DE in FCB1$.
25CA
INC HL 23
Increment Register Pair HL to the next character of the extension.
25CB
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25CC
Decrement Register B and jump back to DONAM4 at 25C4H until three characters are copied.
25CEDONAM5
LD A,3AH 3E 3A
DONAM5: load Register A with 3AH, the colon of the drive spec (source: add the drivespec).
25D0
LD (DE),A 12
Store Register A, the colon, at Register Pair DE in FCB1$.
25D1
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25D2
LD A,(26CEH) 3A CE 26
Load Register A with the byte at 26CEH, the drive, TSTMPW's operand (source: p/u drivespec).
25D5
OR 30H F6 30
OR Register A with 30H: the drive number as its digit (source: make it ASCII & stuff).
25D7
LD (DE),A 12
Store Register A, the digit, at Register Pair DE in FCB1$.
25D8
INC DE 13
Increment Register Pair DE to the next byte of FCB1$, where the 03H goes.
25D9
LD A,03H 3E 03
Load Register A with 03H, the ETX that ends a text for @DSPLY and @LOGOT with the cursor kept (source: terminate with ETX).
25DB
LD (DE),A 12
Store Register A, 03H, at Register Pair DE in FCB1$.
25DC
PUSH DE D5
Push Register Pair DE, the address of the 03H (source: save pointer).
25DDH - QPARM: the Question
With QUERY on (the default; Q=N switches it off) the line Purge file: NAME/EXT:d is shown, with + when the file has been changed (DIR+1 bit 6, MOD), then its date in braces as {dd-Mmm-yy} and ? (an undated file, DIR+2 00H, shows {}), and up to three characters are read; Y or y as the first purges the file, anything else, ENTER too, passes it over, and BREAK ends PURGE with FFFFH. The year is shown 80 to 99 and 00 to 11 (631) for the new style; for the old style 80 to 87.
25DDQPARM
LD DE,0FFFFH 11 FF FF
QPARM: load Register Pair DE with the word at 25DEH-25DFH, the value of QUERY stored by @PARAM: FFFFH in the file, on; 0000H for Q=N (source: query each file?).
25E0
LD A,D 7A
Load Register A with Register D, the high byte of QUERY's value.
25E1
OR E B3
OR Register A with Register E: zero for Q=N, any other value asks.
25E2
If QUERY is off (Z) jump to NOPRMPT at 268FH, which purges the file at once (source: not if not Q=N).
25E5
LD HL,28F8H 21 F8 28LD HL,PRGFIL$
Load Register Pair HL with 28F8H, PRGFIL$, Purge file: , ended by 03H.
25E8
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the text at Register Pair HL.
25EA
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show Purge file: (source: purge file?).
25EB
POP DE D1
Pop Register Pair DE, the address of the 03H in FCB1$ (source: rcvr ptr to file buf ETX).
25EC
POP HL E1
Pop Register Pair HL, the address of DIR+0 pushed at 25A2H (source: rcvr ptr to 1st dir byte).
25ED
PUSH DE D5
Push Register Pair DE, the address of the 03H, for the purge (269CH): the date goes over it, and the purge puts a carriage return there.
25EE
INC HL 23
Increment Register Pair HL to DIR+1 (source: pt to MOD bit).
25EF
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL, DIR+1: MOD, the file has been written since its backup (source: test MOD flag).
25F1
If MOD is clear jump to SCDAT1 at 25FBH (source: go if not mod'ed).
25F3
LD A,20H 3E 20
Load Register A with 20H, a space (source: put a space).
25F5
LD (DE),A 12
Store Register A, the space, at Register Pair DE in FCB1$.
25F6
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25F7
LD A,2BH 3E 2B
Load Register A with 2BH, the plus sign of a changed file (source: and the mod sign).
25F9
LD (DE),A 12
Store Register A, the plus sign, at Register Pair DE.
25FA
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
25FBSCDAT1
LD A,20H 3E 20
SCDAT1: load Register A with 20H, a space (source: write a space).
25FD
LD (DE),A 12
Store Register A, the space, at Register Pair DE in FCB1$.
25FE
INC DE 13
Increment Register Pair DE to the next byte of FCB1$, for the left brace.
25FF
INC HL 23
Increment Register Pair HL to DIR+2, the day and the old style year (source: advance to date field).
2600
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the next byte of FCB1$.
2601
LD (HL),7BH 36 7B
Store 7BH, the left brace, at Register Pair HL (source: stuff left brace).
2603
INC HL 23
Increment Register Pair HL to the next byte of FCB1$.
2604
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the next byte of FCB1$, after the brace, Register Pair HL = DIR+2 again.
2605
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+2.
2606
OR A B7
OR Register A with itself, to test for 00H: DIR+2 holds no date.
2607
If DIR+2 is 00H jump to SCDAT4 at 266AH: no date is shown (source: ignore if no date saved).
2609
RRCA 0F
Rotate Register A right, the first of three: the day, bits 7-3, goes to bits 4-0 (source: has date, get day).
260A
RRCA 0F
Rotate Register A right, the second of the three rotations.
260B
RRCA 0F
Rotate Register A right, the third: the day is in bits 4-0.
260C
AND 1FH E6 1F
AND Register A with 1FH: the day, 1 to 31, without the year bits.
260E
LD B,2FH 06 2F
Load Register B with 2FH, one less than the digit 0, for the tens (source: convert day to decimal).
2610SCDAT2
INC B 04
SCDAT2: increment Register B, the tens digit (source: by counting # of 10's).
2611
SUB 0AH D6 0A
Subtract 0AH from Register A (source: sub 10 from day #).
2613
If there was no borrow (No Carry) jump back to SCDAT2 at 2610H: Register B ends as the tens digit, Register A as the units less 10.
2615
ADD A,3AH C6 3A
Add 3AH to Register A: the units digit, 30H-39H (source: cvrt lo order to ASCII).
2617
PUSH AF F5
Push Register Pair AF, the units digit (source: save day low order).
2618
LD A,B 78
Load Register A with Register B, the tens digit (source: stuff day hi order).
2619
LD (DE),A 12
Store Register A, the tens digit, at Register Pair DE in FCB1$.
261A
INC DE 13
Increment Register Pair DE to the next byte (source: bump).
261B
POP AF F1
Pop Register Pair AF, the units digit (source: rcvr lo order day #).
261C
LD (DE),A 12
Store Register A, the units digit, at Register Pair DE (source: stuff low order).
261D
INC DE 13
Increment Register Pair DE to the next byte (source: bump pointer to msg).
261E
LD A,2DH 3E 2D
Load Register A with 2DH, the minus sign between the day and the month (source: init seperator).
2620
LD (DE),A 12
Store Register A, the minus sign, at Register Pair DE (source: and stuff in buffer).
2621
INC DE 13
Increment Register Pair DE to the next byte (source: pt to month field).
2622
PUSH HL E5
Push Register Pair HL, DIR+2 (source: save DIR ptr).
2623
DEC HL 2B
Decrement Register Pair HL to DIR+1 (source: pt to DIR+1 (month+)).
2624
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+1 (source: p/u month etc).
2625
AND 0FH E6 0F
AND Register A with 0FH, dropping the flags in bits 7-4: the month, 1 to 12 (source: strip off flags).
2627
DEC A 3D
Decrement Register A: the month less 1, which three times is the offset of its name in MONTBL (source: mon-1 times 3 indexes string).
2628
LD C,A 4F
Load Register C with Register A, the month less 1 (source: conversion table).
2629
RLCA 07
Rotate Register A left: two times the month less 1.
262A
ADD A,C 81
Add Register C to Register A: three times the month less 1, the offset of the month's name.
262B
LD C,A 4F
Load Register C with Register A, the offset of the month's name.
262C
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the offset.
262E
LD HL,2915H 21 15 29LD HL,MONTBL
Load Register Pair HL with 2915H, MONTBL, the twelve names of three letters.
2631
ADD HL,BC 09
Add Register Pair BC, the offset, to Register Pair HL: the month's name (source: add offset to tbl start).
2632
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC = 0003H, the three letters.
2634
LDIR ED B0
Copy the three letters from Register Pair HL to Register Pair DE in FCB1$ with LDIR (Register Pair BC = 0003H, and 0000H after it) (source: move 3-char month).
2636
LD A,2DH 3E 2D
Load Register A with 2DH, the minus sign between the month and the year (source: suff separator char).
2638
LD (DE),A 12
Store Register A, the minus sign, at Register Pair DE.
2639
INC DE 13
Increment Register Pair DE to the next byte (source: advance to year field).
263A
POP HL E1
Pop Register Pair HL, DIR+2 (source: get ptr to dir+2).
263B
LD C,38H 0E 38
Load Register C with 38H, the digit 8 of 198x (source: init 1980).
263D
LD A,(0000H) 3A 00 00
Load Register A with the byte at 0082H, YFLAG$, the operand stored at 241BH (0000H in the file) (source: year type flag).
2640
BIT 0,A CB 47
DVTEST2: test bit n of Register A, n being the drive, built into 2641H at 2463H (BIT 0,A in the file; the source's label DVTEST2 names the second byte, 2641H): set when the diskette is dated in the new style.
2642
If the diskette is dated in the new style (NZ) jump to NEWDT2 at 2649H (source: using new style).
2644
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+2 (source: get old date).
2645
AND 07H E6 07
AND Register A with 07H: the old style year less 1980, 0 to 7, shown as 80 to 87.
2647
Jump to THERE at 2661H with Register C = 38H (source: make for dsp).
2649NEWDT2
LD A,L 7D
NEWDT2: load Register A with Register L, the low byte of DIR+2's address.
264A
ADD A,11H C6 11
Add 11H to Register A: the offset of DIR+19 (source: pt to new year).
264C
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+19.
264D
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+19 (source: get year).
264E
AND 1FH E6 1F
AND Register A with 1FH: bits 4-0, the year less 1980, 0 to 31.
2650L2650
CP 0AH FE 0A
L2650: compare Register A with 0AH: a year of the decade in Register C (source: 1980's).
2652
If Register A is below 0AH (Carry) jump to THERE at 2661H (source: go if so).
2654
INC C 0C
Increment Register C to the next decade's digit, 39H for 199x (631).
2655
SUB 0AH D6 0A
Subtract 0AH from Register A, a decade (source: sub off decade).
2657
CP 0AH FE 0A
Compare Register A with 0AH (source: must be less).
2659
If Register A is below 0AH (Carry) jump to THERE at 2661H: a year of the 1990s.
265B
SUB 0AH D6 0A
Subtract 0AH from Register A, another decade: the year less 2000 (631).
265D
LD C,30H 0E 30
Load Register C with 30H, the digit 0 of 200x (631).
265F
Jump back to L2650 at 2650H: 2000 to 2009 are shown 00 to 09, 2010 and 2011 as 10 and 11 by one more decade (631).
2661THERE
LD B,A 47
THERE: load Register B with Register A, the year's last digit, 0 to 9 (source: save year).
2662
LD A,C 79
Load Register A with Register C, the decade's digit.
2663
LD (DE),A 12
Store Register A, the decade's digit, at Register Pair DE (source: stuff decade).
2664
INC DE 13
Increment Register Pair DE to the next byte of FCB1$.
2665
LD A,B 78
Load Register A with Register B, the year's last digit.
2666
ADD A,30H C6 30
Add 30H to Register A: its digit (source: make ascii).
2668
LD (DE),A 12
Store Register A, the digit, at Register Pair DE (source: stuff year).
2669
INC DE 13
Increment Register Pair DE to the next byte of FCB1$, where the 03H goes.
266ASCDAT4
LD A,03H 3E 03
SCDAT4: load Register A with 03H, the ETX that ends the line (source: show etx for display).
266C
LD (DE),A 12
Store Register A, 03H, at Register Pair DE: for a name of eight characters with an extension of three, the plus sign and a date it is the 28th byte, at 2968H, one past FCB1$, over the first byte of PRMTBL$ (B161).
266D
LD HL,294DH 21 4D 29LD HL,FCB1$
Load Register Pair HL with 294DH, FCB1$, the line.
2670
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the text at Register Pair HL.
2672
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show the name, the plus sign and the date (source: display filename).
2673
LD HL,2905H 21 05 29LD HL,QMARK$
Load Register Pair HL with 2905H, QMARK$, the closing brace and the question mark, ended by 03H.
2676
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the text at Register Pair HL.
2678
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show } ? (source: display ???).
2679
LD HL,2949H 21 49 29LD HL,LILBUF$
Load Register Pair HL with 2949H, LILBUF$, the reply buffer (not in the file) (source: get response y,n).
267C
LD BC,0300H 01 00 03
Load Register Pair BC with 0300H: Register B = 03H, at most three characters, Register C = 00H, for @KEYIN (source: for yes, no).
267F
LD A,09H 3E 09
Load Register A with 09H, SVC 9, @KEYIN, which reads a line of at most Register B characters into the buffer at Register Pair HL.
2681
RST 28H EF
Call @KEYIN with RST 28H (BOOT/SYS): the reply at 2949H with a carriage return after it; the Carry flag for BREAK.
2682
If BREAK was pressed (Carry) jump to BREAK at 286DH, which ends PURGE with FFFFH (source: abort on BREAK).
2685
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the reply (source: p/u response).
2686
RES 5,A CB AF
Reset bit 5 of Register A: a small letter becomes a capital (source: strip l/c if entered).
2688
CP 59H FE 59
Compare Register A with 59H, the letter Y (source: is it yes?).
268A
If the reply is not Y jump to SCNHIT at 24EAH, which drops the pointer pushed at 25EDH: the file is passed over (source: bypass if not).
268D
EX (SP),HL E3
Exchange Register Pair HL, 2949H, with the word at the Stack Pointer, the address of the 03H: that address in Register Pair HL, 2949H on the stack in its place, where the POP at 26A5H takes it (source: place dummy HL below).
268E
PUSH HL E5
Push Register Pair HL, the address of the 03H, for 269CH (source: pointer).
268FH - NOPRMPT: Purge the File
A BREAK pressed since the last test (KFLAG$ bit 0) ends PURGE with FFFFH; it is tested before each file, so Q=N can be stopped as the manual says. Purging: and the name are shown through @LOGOT, which sends them to the JL device too. The file is removed with @REMOVE (SYS10) through an FCB made here: FCB+0 80H (open), FCB+1 01H (REMOVE access), FCB+6 the drive and FCB+7 the DEC, which is all SYS10 reads; it frees the extents in the GAT, marks the entry and its extended entries free, clears the HIT positions of both and zeroes the FCB. So the master password, not the file's own password or protection level, is what PURGE needs: a file of level NO is purged as any other.
268FNOPRMPT
BIT 0,(IY+0AH) FD CB 0A 46
NOPRMPT: test bit 0 of KFLAG$ (IY+0AH, 0074H), Index Register IY holding 006AH: BREAK has been pressed (source: ck if BREAK bit in).
2693
If BREAK has been pressed jump to BREAK at 286DH: FFFFH, the files purged so far stay purged (source: KFLAG is active).
2696
LD HL,290BH 21 0B 29LD HL,PURGE$
Load Register Pair HL with 290BH, PURGE$, Purging: , ended by 03H.
2699
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
269B
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show Purging: (source: dsply Purging:).
269C
POP HL E1
Pop Register Pair HL, the address of the 03H after the drive spec (source: get pointer where ETX is).
269D
LD (HL),0DH 36 0D
Store 0DH, a carriage return, at Register Pair HL: the line ends after the drive spec, the plus sign and date of the question cut off (source: & replace with CR).
269F
LD HL,294DH 21 4D 29LD HL,FCB1$
Load Register Pair HL with 294DH, FCB1$, the name line.
26A2
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and logs it.
26A4
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the name and log it (source: dsply filename).
26A5
POP HL E1
Pop Register Pair HL, dropped: 2949H after the question (268DH), the address of DIR+0 (25A2H) with Q=N (source: pop dummy or DIRREC ptr).
26A6
POP BC C1
Pop Register Pair BC, Register B = the DEC, Register C = the drive, pushed at 250CH (source: get drive & DEC).
26A7
PUSH BC C5
Push Register Pair BC again, for SCNH1 (24EBH) after the purge.
26A8
LD A,B 78
Load Register A with Register B, the DEC (source: p/u the DEC).
26A9
LD (2997H),A 32 97 29
Store Register A into 2997H, FCB+7 (source: & stuff).
26AC
LD A,(26CEH) 3A CE 26
Load Register A with the byte at 26CEH, the drive, TSTMPW's operand (source: p/u drive).
26AF
LD (2996H),A 32 96 29
Store Register A into 2996H, FCB+6 (source: & stuff).
26B2
LD A,01H 3E 01
Load Register A with 01H, the access level REMOVE (source: set up FCB for remove).
26B4
LD (2991H),A 32 91 29
Store Register A into 2991H, FCB+1: @REMOVE needs an access level below 2.
26B7
LD A,80H 3E 80
Load Register A with 80H, bit 7, an open file (source: show FCB as open).
26B9
LD (2990H),A 32 90 29LD (FCB),A
Store Register A into 2990H, FCB+0: the FCB counts as an open file.
26BC
LD DE,2990H 11 90 29LD DE,FCB
Load Register Pair DE with 2990H, FCB, for @REMOVE (source: remove the file).
26BF
LD A,39H 3E 39
Load Register A with 39H, SVC 57, @REMOVE, which removes the file of the FCB at Register Pair DE.
26C1
RST 28H EF
Call @REMOVE with RST 28H (the SYS0/SYS stub that loads SYS10/SYS): Z when the file is removed, its FCB zeroed; NZ with the error number.
26C2
If @REMOVE failed (NZ) jump to IOERR at 285EH with its error number in Register A (source: jump on error).
26C5
LD A,0FFH 3E FF
Load Register A with 0FFH, no directory sector (source: show we don't have the).
26C7
LD (2513H),A 32 13 25
Store Register A into 2513H, the operand of SCNH3A's CP: @REMOVE has used SBUFF$, so the next entry's sector is read again (source: latest dir record).
26CA
Jump to SCNH1 at 24EBH for the next HIT position (source: loop).
26CDH - TSTMPW, GETMPW and GMPW1: the Master Password
As in ATTRIB (member 4): the GAT is read into GATBUF (2B00H); when its master password hash (GAT+CEH) is that of PASSWORD, 42E0H, nothing is asked and MPW is not looked at. Otherwise the password is MPW="s", or typed at Master password ? (refused inside a DO file), hashed by SYS2/SYS through the request E4H and compared; a difference is Invalid master password. PURGE's GMPW1 does not check the characters: it copies up to eight (to a carriage return, a comma or the closing quotation mark), pads them with spaces and makes small letters capitals, so its messages are only its own and CKINDO's.
26CDTSTMPW
LD C,00H 0E 00
TSTMPW: load Register C with the byte at 26CEH, the drive stored at 2467H (00H in the file) (source: init to drive requested).
26CF
Call GATRD at 2756H, which reads the GAT of the drive in Register C to GATBUF, 2B00H-2BFFH: Z when read, NZ with 14H, 20 (source: read GAT into GATBUF).
26D2
RET NZ C0
If the GAT was not read (NZ) return with error 20, GAT read error (source: back on error).
26D3
LD HL,(2BCEH) 2A CE 2B
Load Register Pair HL with the word at 2BCEH-2BCFH, GAT+CEH, the hash of the disk's master password.
26D6
LD DE,42E0H 11 E0 42LD DE,PASSWORD
Load Register Pair DE with 42E0H, the hash of PASSWORD (source: password="PASSWORD"?).
26D9
XOR A AF
XOR Register A with itself, clearing the Carry flag for the SBC; Register A = 00H.
26DA
SBC HL,DE ED 52
Subtract Register Pair DE, 42E0H, from Register Pair HL with SBC: zero when the master password is PASSWORD.
26DC
RET Z C8
If the master password is PASSWORD return with Z: nothing is asked (source: back if PASSWORD).
26DDPWPARM
LD DE,0000H 11 00 00
PWPARM: load Register Pair DE with the word at 26DEH-26DFH, the value of MPW stored by @PARAM (0000H in the file): the address of the password in the command line, FFFFH for MPW alone (source: p/u MPW string addr).
26E0
LD HL,28ACH 21 AC 28LD HL,MPW$
Load Register Pair HL with 28ACH, MPW$, Master password ?, the prompt when MPW was not given (source: init prompt).
26E3
Call GETMPW at 26F4H, which puts the password into BUFFER and hashes it into Register Pair HL: Z when good (source: hash parm or entry).
26E6
RET NZ C0
If the password was not got (NZ) return with its error: 3FH with Register Pair HL at Invalid command during <DO> processing, or the error of @DSPLY.
26E7
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the hash of the password given (source: xfer haashed MPW to DE).
26E8
LD HL,(2BCEH) 2A CE 2B
Load Register Pair HL with the word at 2BCEH-2BCFH, GAT+CEH, the disk's master password hash (source: grab pack MPW &).
26EB
XOR A AF
XOR Register A with itself, clearing the Carry flag for the SBC (source: check if user entered).
26EC
SBC HL,DE ED 52
Subtract Register Pair DE, the hash given, from Register Pair HL with SBC: zero when the password is the disk's (source: the pack MPW).
26EE
LD HL,28C4H 21 C4 28LD HL,BADMPW$
Load Register Pair HL with 28C4H, BADMPW$, Invalid master password, for IOERR when they differ; LD keeps the flags (source: init error pointer).
26F1
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, PURGE's sign for a message of its own (source: set extended error).
26F3
RET C9
Return with Z when the master password is right, NZ with Register A = 3FH when it is not (source: Z or NZ).
26F4GETMPW
GETMPW: call GMPW1 at 26FBH, which puts the password from Register Pair DE, or typed at the prompt at Register Pair HL, into BUFFER, 2A00H-2A07H, in capitals (source: test if user entered MPW).
26F7
RET NZ C0
If GMPW1 failed (NZ) return with its error to TSTMPW.
26F8
LD A,0E4H 3E E4
Load Register A with 0E4H, the SYS2/SYS request to hash a password (function 60H, HASHPSWD at 1E2EH) (source: hash password (DE) to HL).
26FA
RST 28H EF
Send the request with RST 28H: the dispatcher drops this RST's return address, loads SYS2/SYS and calls it; it hashes the eight characters at Register Pair DE, 2A00H, into Register Pair HL, with Register A = 00H and Z, and returns to the caller of GETMPW (source: ret to what called).
26FBGMPW1
LD A,D 7A
GMPW1: load Register A with Register D, the high byte of MPW's value (source: test if user entered MPW).
26FC
OR E B3
OR Register A with Register E, the low byte: zero when MPW was not given.
26FD
If MPW was not given (Z) jump to GMPW3 at 271CH, the prompt (source: prompt if not).
26FF
INC A 3C
Increment Register A: zero when the bytes of the word ORed to FFH, the FFFFH of MPW given alone (source: or no operand).
2700
If MPW was given alone (Z) jump to GMPW3 at 271CH, the prompt.
2702
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, where the password goes.
2705
PUSH HL E5
Push Register Pair HL, 2A00H, for GMPW5, which pops it at 2741H.
2706
LD B,08H 06 08
Load Register B with 08H, at most eight characters (source: max entry of 8 chars).
2708GMPW2
LD A,(DE) 1A
GMPW2: load Register A with the byte at Register Pair DE, a character of the password in the command line (source: p/u pswd char).
2709
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return (source: end of the line?).
270B
If Register A is the carriage return jump to GMPW4 at 273CH, which fills the rest with spaces (source: space out if so).
270D
CP 2CH FE 2C
Compare Register A with 2CH, the comma (source: comma separator?).
270F
If Register A is the comma jump to GMPW4 at 273CH.
2711
CP 22H FE 22
Compare Register A with 22H, the quotation mark that closes a string (source: closing quote?).
2713
If Register A is the quotation mark jump to GMPW4 at 273CH.
2715
INC DE 13
Increment Register Pair DE to the next character of the password.
2716
LD (HL),A 77
Store Register A, the character, at Register Pair HL in BUFFER (source: xfer the char).
2717
INC HL 23
Increment Register Pair HL to the next byte of BUFFER.
2718
Decrement Register B and jump back to GMPW2 at 2708H until eight characters have been copied (source: loop for 8).
271A
Jump to GMPW5 at 2741H with the eight characters; the rest of the value is not read.
271CGMPW3
GMPW3: call CKINDO at 2767H, which returns NZ with Register Pair HL at its message when a DO file is running (source: can't prompt in DO).
271F
RET NZ C0
If a DO file is running (NZ) return with Register A = 3FH and Register Pair HL at Invalid command during <DO> processing.
2720
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the prompt at Register Pair HL; it ends with 03H, so the cursor stays after it.
2722
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show the prompt (source: display request).
2723
RET NZ C0
If @DSPLY failed (NZ) return with its error number in Register A.
2724
LD BC,0800H 01 00 08
Load Register Pair BC with 0800H: Register B = 08H, at most eight characters, Register C = 00H, for @KEYIN (source: max 8 chars input).
2727
LD HL,2A00H 21 00 2ALD HL,BUFFER
Load Register Pair HL with 2A00H, BUFFER, where the typed text goes (source: pt to buffer).
272A
PUSH HL E5
Push Register Pair HL, 2A00H, for GMPW5, which pops it at 2741H.
272B
LD A,09H 3E 09
Load Register A with 09H, SVC 9, @KEYIN, which reads a line of at most Register B characters into the buffer at Register Pair HL (source: get parm input).
272D
RST 28H EF
Call @KEYIN with RST 28H (BOOT/SYS): Register B = the number of characters typed, a carriage return after them; the Carry flag for BREAK.
272E
If BREAK was pressed (Carry) jump to BREAK at 286DH: FFFFH, SAVESP drops the word pushed at 272AH (source: exit on break).
2731
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = 2A00H, the start of the text (source: buf start to DE).
2732
LD H,00H 26 00
Load Register H with 00H (source: buf len to HL).
2734
LD L,B 68
Load Register L with Register B, the number of characters typed: Register Pair HL = that count.
2735
ADD HL,DE 19
Add Register Pair DE, 2A00H, to Register Pair HL: the byte after the last character typed, its carriage return (source: pt to 1st unused pos).
2736
LD A,08H 3E 08
Load Register A with 08H, the length of the field (source: calculate spaces needed).
2738
SUB B 90
Subtract Register B, the characters typed, from Register A: the spaces needed.
2739
If eight characters were typed (Z) jump to GMPW5 at 2741H (source: ret if none needed).
273B
LD B,A 47
Load Register B with Register A, the number of spaces to fill in (source: set counter for spaces).
273CGMPW4
LD (HL),20H 36 20
GMPW4: store 20H, a space, at Register Pair HL in BUFFER (source: & put them in).
273E
INC HL 23
Increment Register Pair HL to the next byte of BUFFER.
273F
Decrement Register B and jump back to GMPW4 at 273CH until the eight bytes are full.
2741GMPW5
POP HL E1
GMPW5: pop Register Pair HL, 2A00H, the start of BUFFER (source: rcvr pointer to buf).
2742
PUSH HL E5
Push Register Pair HL, 2A00H, again for 2753H.
2743
LD B,08H 06 08
Load Register B with 08H, the eight characters (source: loop through field).
2745GMPW6
LD A,(HL) 7E
GMPW6: load Register A with the byte at Register Pair HL, a character of the password.
2746
CP 61H FE 61
Compare Register A with 61H, the small letter a.
2748
If Register A is below 61H (Carry) jump to GMPW7 at 2750H: not a small letter.
274A
CP 7BH FE 7B
Compare Register A with 7BH, the character after the small letter z.
274C
If Register A is 7BH or above (No Carry) jump to GMPW7 at 2750H: not a small letter.
274E
RES 5,(HL) CB AE
Reset bit 5 of the byte at Register Pair HL: the small letter becomes its capital in BUFFER (source: l/c -> u/c).
2750GMPW7
INC HL 23
GMPW7: increment Register Pair HL to the next character.
2751
Decrement Register B and jump back to GMPW6 at 2745H until all eight are done.
2753
POP DE D1
Pop Register Pair DE, 2A00H, the start of BUFFER, for the hash (source: rcvr ptr to start).
2754
XOR A AF
XOR Register A with itself: Register A = 00H and the Z flag set (source: indicate no error).
2755
RET C9
Return Z with Register A = 00H and Register Pair DE at BUFFER, 2A00H.
2756H - GATRD and CKINDO
GATRD reads sector 0 of the directory cylinder (DCT+9 of the DCT at Index Register IY, set at 2479H), the GAT, to GATBUF with @RDSSC; a failure is GAT read error. CKINDO tests SFLAG$ bit 5, a DO file running.
2756GATRD
PUSH DE D5
GATRD: push Register Pair DE, which the read gives back unchanged.
2757
PUSH HL E5
Push Register Pair HL, which the read gives back unchanged.
2758
LD D,(IY+09H) FD 56 09
Load Register D with DCT+9 (IY+09H), Index Register IY holding the DCT's address: the directory cylinder (source: dir cylinder).
275B
LD HL,2B00H 21 00 2BLD HL,GATBUF
Load Register Pair HL with 2B00H, GATBUF, the buffer of the GAT.
275E
LD E,L 5D
Load Register E with Register L, 00H: sector 0, the GAT (source: set to sector 0).
275F
LD A,55H 3E 55
Load Register A with 55H, SVC 85, @RDSSC, which reads the system sector at Register Pair DE of the drive in Register C to Register Pair HL, 2B00H.
2761
RST 28H EF
Call @RDSSC with RST 28H (SYS0/SYS): Z when read, NZ when not.
2762
POP HL E1
Pop Register Pair HL, pushed at 2757H; POP keeps the flags.
2763
POP DE D1
Pop Register Pair DE, pushed at 2756H; POP keeps the flags.
2764
LD A,14H 3E 14
Load Register A with 14H, error 20, GAT read error; LD keeps the flags of @RDSSC (source: init GAT read error).
2766
RET C9
Return with Z when read, NZ with Register A = 14H (source: Z or NZ).
2767CKINDO
PUSH IY FD E5
CKINDO: push Index Register IY, kept over @FLAGS.
2769
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which gives the address of the system flag table.
276B
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
276C
BIT 5,(IY+12H) FD CB 12 6E
Test bit 5 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: a DO file is running (source: set if DO active).
2770
POP IY FD E1
Pop Index Register IY, as it was before; the flags of the BIT are kept.
2772
RET Z C8
If no DO file is running (Z) return with Z: a prompt may be shown.
2773
LD HL,2885H 21 85 28LD HL,NOINDO$
Load Register Pair HL with 2885H, NOINDO$, Invalid command during <DO> processing.
2776
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, PURGE's sign for a message of its own.
2778
RET C9
Return NZ (from the BIT) with Register A = 3FH and Register Pair HL at the message.
2779H - PRSPEC: Copy the Partspec
Up to Register B characters (eight for the name, three for the extension) are copied from the text to BLANKS: an asterisk puts one $ at its own position and ends the field, the rest keeping its spaces, which match any character as $ does (B166); a $ is kept; digits 0 to 9 are kept; every character from 41H up is taken, small letters made capitals, so signs such as [ or ~ pass too, though no file name can match them. Any other character (a sign below 41H but $ and the digits, a space, the carriage return) ends the field; it is returned in Register A with Register Pair HL past it. After the last character of the field the next one is returned the same way, unlooked at.
2779PRSPEC
CP 2AH FE 2A
PRSPEC: compare Register A, the character, with 2AH, the asterisk.
277B
If Register A is not the asterisk jump to PS4 at 2785H.
277D
LD A,24H 3E 24
Load Register A with 24H, the wild card $ (source: wild card char).
277FPS5
LD (DE),A 12
PS5: store Register A, the $, at Register Pair DE in BLANKS, at the asterisk's position (source: store it).
2780
Decrement Register B and jump back to PS5 at 277FH until it is 0: with no INC DE the $ is stored B times into the same byte, so only the asterisk's position becomes $; the rest of the field keeps its spaces, which match any character as $ does (B166).
2782
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the asterisk (source: p/u terminator).
2783
INC HL 23
Increment Register Pair HL past the character after the asterisk.
2784
RET C9
Return with Register A = the character after the asterisk.
2785PS4
CP 24H FE 24
PS4: compare Register A with 24H, the wild card $ (source: wild character?).
2787
If Register A is $ jump to PRS2 at 279DH to store it (source: always a match).
2789
CP 41H FE 41
Compare Register A with 41H, the letter A (source: ck on filename entry).
278B
If Register A is 41H or above (No Carry) jump to PRS1 at 2793H: taken as a letter, whatever it is (source: jump if possible alpha).
278D
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9 (source: ck on 0-9).
278F
RET NC D0
If Register A is 3AH to 40H (No Carry) return: the field ends at that sign (source: bad if > 9 and < A).
2790
CP 30H FE 30
Compare Register A with 30H, the digit 0, for the characters below it.
2792
RET C D8
If Register A is below 30H (Carry) return: the field ends at that character (source: bad if < 0).
2793PRS1
CP 61H FE 61
PRS1: compare Register A with 61H, the small letter a (source: cvrt to UC if needed).
2795
If Register A is below 61H (Carry) jump to PRS2 at 279DH.
2797
CP 7BH FE 7B
Compare Register A with 7BH, the character after the small letter z.
2799
If Register A is 7BH or above (No Carry) jump to PRS2 at 279DH.
279B
RES 5,A CB AF
Reset bit 5 of Register A: the small letter becomes its capital.
279DPRS2
LD (DE),A 12
PRS2: store Register A, the character, at Register Pair DE in BLANKS (source: xfer char to buffer).
279E
INC DE 13
Increment Register Pair DE to the next byte of the field (source: bump dest ptr).
279F
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character (source: get next char).
27A0
INC HL 23
Increment Register Pair HL past it (source: bump source ptr).
27A1
Decrement Register B and jump back to PRSPEC at 2779H until the field is full (source: loop 8 max).
27A3
RET C9
Return with Register A = the character after the full field.
27A4H - UNPACK: the File's Date as a Word
Register Pair DE gets the date of the directory entry whose DIR+1 Register Pair HL points at, in the form PAKDAT gives a typed date: Register D = the year less 1980 in bits 7-3 and bits 3-1 of the month in bits 2-0, Register E = bit 0 of the month in bit 7 and the day in bits 6-2. The month is DIR+1 bits 3-0, the day DIR+2 bits 7-3; the year DIR+19 bits 4-0 when the drive's YFLAG$ bit says new style (B160), else DIR+2 bits 2-0, modulo 8 (B159).
27A4UNPACK
LD A,(HL) 7E
UNPACK: load Register A with the byte at Register Pair HL, DIR+1 (source: p/u DIR+1).
27A5
AND 0FH E6 0F
AND Register A with 0FH: the month, 1 to 12, 0 for no date (source: mask all but month).
27A7
LD E,00H 1E 00
Load Register E with 00H, for bit 0 of the month.
27A9
SRL A CB 3F
Shift Register A right: bit 0 of the month into the Carry flag, bits 3-1 to bits 2-0.
27AB
RR E CB 1B
Rotate Register E right through the Carry flag: bit 0 of the month into bit 7 of Register E.
27AD
LD D,A 57
Load Register D with Register A, bits 3-1 of the month (source: month to DE).
27AE
INC HL 23
Increment Register Pair HL to DIR+2 (source: pt to day).
27AF
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+2.
27B0
AND 0F8H E6 F8
AND Register A with 0F8H: the day in bits 7-3 (source: mask off year).
27B2
RRCA 0F
Rotate Register A right: the day to bits 6-2 (source: day to bits 2-6).
27B3
OR E B3
OR Register A with Register E, bit 0 of the month in bit 7.
27B4
LD E,A 5F
Load Register E with Register A: the day and bit 0 of the month (source: mon,day in E).
27B5
LD A,(0000H) 3A 00 00
Load Register A with the byte at 0082H, YFLAG$, the operand stored at 2418H (0000H in the file) (source: get YFLAG).
27B8
BIT 0,A CB 47
DVTEST1: test bit n of Register A, n being the drive, built into 27B9H at 2460H (BIT 0,A in the file; the source's label DVTEST1 names the second byte, 27B9H): set when the diskette is dated in the new style.
27BA
If the diskette is dated in the new style (NZ) jump to NEWDT at 27C5H (source: go if new style).
27BC
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+2.
27BD
AND 07H E6 07
AND Register A with 07H: the old style year less 1980, modulo 8, 0 to 7 (B159) (source: get old style date).
27BFSHFTD
RLCA 07
SHFTD: rotate Register A left, the first of three: the year to bits 7-3.
27C0
RLCA 07
Rotate Register A left, the second of the three rotations.
27C1
RLCA 07
Rotate Register A left, the third: the year is in bits 7-3.
27C2
OR D B2
OR Register A with Register D, bits 3-1 of the month in bits 2-0 (source: merge year w/MSbits mon).
27C3
LD D,A 57
Load Register D with Register A: Register Pair DE = the packed date.
27C4
RET C9
Return with Register Pair DE = the file's date, 0000H for a file with no date and no year bits.
27C5NEWDT
LD A,L 7D
NEWDT: load Register A with Register L, the low byte of DIR+2's address (source: pt to new year style).
27C6
ADD A,11H C6 11
Add 11H to Register A: the offset of DIR+19 from DIR+2.
27C8
LD L,A 6F
Load Register L with Register A: Register Pair HL = DIR+19.
27C9
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, DIR+19 (source: get year).
27CA
AND 1FH E6 1F
AND Register A with 1FH: bits 4-0, the year less 1980; nonzero also for an undated file whose DIR+19 holds a password hash (B160) (source: mask mins).
27CC
Jump to SHFTD at 27BFH, which puts the year into Register D (source: store).
27CEH - PAKDAT, PARSDAT and PRSD2: a Typed Date as a Word
A date is MM/DD/YY, two digits to each field and the slash between them; the year 00 to 11 is 2000 to 2011 (631). The month must be 1 to 12 and the day 1 to the month's length in MAXDAYS (28DCH), whose February PAKDAT makes one day longer for every date of a leap year it reads, without making it 28 again, so when the first date is of a leap year the second may be 29 February of any year, and when both are, 30 February (B157). Any year from 12 to 79 is taken as 1980 with no message (B158). The packed word is returned in Register Pair BC, Register Pair HL after the year; anything wrong is Bad date format.
27CEPAKDAT
LD A,(HL) 7E
PAKDAT: load Register A with the byte at Register Pair HL, the first character of the date; not used.
27CF
LD C,2FH 0E 2F
Load Register C with 2FH, the slash that must separate the fields (source: init separator).
27D1
Call PARSDAT at 2823H, which reads the three fields into 294BH (month), 294AH (day) and 2949H (year): Z when good (source: parse entry).
27D4
If a field is bad (NZ) jump to BADFMT at 281CH (source: jump on format error).
27D6
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = 2949H, the year, Register Pair DE = the text after the year.
27D7
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, 2949H, the year, 0 to 99 (631).
27D8
CP 0CH FE 0C
Compare Register A with 0CH, 12, the first year not taken as 20xx (631).
27DA
If the year is 12 or above (No Carry) jump to NOTLP at 27DFH (631).
27DC
ADD A,64H C6 64
Add 64H, 100, to Register A: the years 00 to 11 are 2000 to 2011, 100 to 111 (631).
27DE
LD (HL),A 77
Store Register A, the year, at Register Pair HL, 2949H (631).
27DFNOTLP
AND 03H E6 03
NOTLP: AND Register A with 03H: zero for a leap year (every fourth from 1980 to 2011).
27E1
LD HL,28DDH 21 DD 28
Load Register Pair HL with 28DDH, MAXDAYS+1, the length of February; LD keeps the flags (source: set Feb to have 29 days).
27E4
If the year is not a leap year (NZ) jump to 27E7H (source: if so).
27E6
INC (HL) 34
Increment the byte at Register Pair HL, 28DDH: February is one day longer, each time a leap year date is read (B157).
27E7
LD A,(294BH) 3A 4B 29
Load Register A with the byte at 294BH, the month (source: p/u month).
27EA
DEC A 3D
Decrement Register A: 0 to 11 for the months 1 to 12 (source: range check).
27EB
CP 0CH FE 0C
Compare Register A with 0CH, twelve months: Carry for 0 to 11.
27ED
If the month is 0 or above 12 (No Carry) jump to BADFMT at 281CH (source: go if 0 or >12).
27EF
DEC HL 2B
Decrement Register Pair HL to 28DCH, MAXDAYS, January's length (source: point to Jan entry).
27F0
ADD A,L 85
Add Register L to Register A, the month less 1 (source: index the month).
27F1
LD L,A 6F
Load Register L with Register A, the low byte of the month's entry.
27F2
LD A,H 7C
Load Register A with Register H, the high byte of MAXDAYS's address, 28H.
27F3
ADC A,00H CE 00
Add 00H and the Carry flag to Register A: the high byte with the carry of the addition.
27F5
LD H,A 67
Load Register H with Register A: Register Pair HL = the month's length in MAXDAYS.
27F6
LD A,(294AH) 3A 4A 29
Load Register A with the byte at 294AH, the day (source: p/u day entry).
27F9
DEC A 3D
Decrement Register A: 0 for the first day, FFH for a day 00 (source: reduce for test (0->FF)).
27FA
CP (HL) BE
Compare Register A with the byte at Register Pair HL, the month's length.
27FB
If the day is 0 or more than the length (No Carry) jump to BADFMT at 281CH (source: go if too large (or 0)).
27FD
LD HL,294BH 21 4B 29
Load Register Pair HL with 294BH, the month (source: pt to month).
2800
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the month (source: get month).
2801
LD C,00H 0E 00
Load Register C with 00H, for bit 0 of the month.
2803
SRL B CB 38
Shift Register B right: bit 0 of the month into the Carry flag (source: split month to BC).
2805
RR C CB 19
Rotate Register C right through the Carry flag: bit 0 of the month into bit 7 of Register C.
2807
DEC HL 2B
Decrement Register Pair HL to 294AH, the day.
2808
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the day (source: get day).
2809
RLCA 07
Rotate Register A left, the first of two (source: shift into bits 2-6).
280A
RLCA 07
Rotate Register A left, the second: the day in bits 6-2.
280B
OR C B1
OR Register A with Register C, bit 0 of the month in bit 7.
280C
LD C,A 4F
Load Register C with Register A: the day and bit 0 of the month (source: merge day into C).
280D
DEC HL 2B
Decrement Register Pair HL to 2949H, the year.
280E
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the year, 12 to 111 (source: get year).
280F
SUB 50H D6 50
Subtract 50H, 80, from Register A: the year less 1980 (source: offset only).
2811
If the year is 1980 or later (No Carry) jump to GDATE at 2814H (source: ok if >= 1980).
2813
XOR A AF
XOR Register A with itself: a year from 12 to 79 is taken as 1980 (B158) (source: else use 1980).
2814GDATE
RLCA 07
GDATE: rotate Register A left, the first of three: the year less 1980 to bits 7-3 (source: shift into bits 3-7).
2815
RLCA 07
Rotate Register A left, the second of the three rotations.
2816
RLCA 07
Rotate Register A left, the third: the year is in bits 7-3.
2817
OR B B0
OR Register A with Register B, bits 3-1 of the month in bits 2-0 (source: & merge with month).
2818
LD B,A 47
Load Register B with Register A: Register Pair BC = the packed date.
2819
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the text after the year again.
281A
XOR A AF
XOR Register A with itself: Register A = 00H and the Z flag, the date is good (source: set Z, no error).
281B
RET C9
Return Z with Register Pair BC = the packed date.
281CBADFMT
LD HL,28E8H 21 E8 28LD HL,BADFMT$
BADFMT: load Register Pair HL with 28E8H, BADFMT$, Bad date format (source: init error pointer).
281F
LD A,3FH 3E 3F
Load Register A with 3FH, the extended error, PURGE's sign for a message of its own (source: set extended error).
2821
OR A B7
OR Register A with itself: the Z flag is cleared, NZ.
2822
RET C9
Return NZ with Register A = 3FH and Register Pair HL at Bad date format.
2823PARSDAT
LD DE,294BH 11 4B 29
PARSDAT: load Register Pair DE with 294BH, LILBUF$+2, where the first field goes (source: point to buf end).
2826
LD B,03H 06 03
Load Register B with 03H, the three fields (source: process 3 fields).
2828PRSD1
PUSH DE D5
PRSD1: push Register Pair DE, the place of this field (source: save pointer).
2829
Call PRSD2 at 2838H, which reads two digits at Register Pair HL: Z with the value in Register A (source: get a digit pair).
282C
POP DE D1
Pop Register Pair DE, the place of this field (source: recover pointer).
282D
RET NZ C0
If the two digits are bad (NZ) return NZ (source: ret if bad digit pair).
282E
LD (DE),A 12
Store Register A, the field's value, at Register Pair DE (source: else stuff the value).
282F
DEC B 05
Decrement Register B, the fields left (631: source, loop countdown).
2830
RET Z C8
If the third field is done (Z) return with Z; nothing after the year is read (631).
2831
DEC DE 1B
Decrement Register Pair DE to the place of the next field (631: source, backup the pointer).
2832
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the field (source: ck for valid separator).
2833
INC HL 23
Increment Register Pair HL past it (source: bump pointer).
2834
CP C B9
Compare Register A with Register C, 2FH, the slash (source: separator char required).
2835
If it is the slash jump back to PRSD1 at 2828H for the next field (source: loop if match).
2837
RET C9
Return NZ: a field not followed by a slash is bad (source: else ret bad (NZ)).
2838PRSD2
PRSD2: call PRS4 at 284FH, which reads a digit at Register Pair HL: the Carry flag for 0 to 9 (source: get a digit).
283B
If it is not a digit (No Carry) jump to PRSD3 at 284DH (source: jump if bad digit).
283D
LD E,A 5F
Load Register E with Register A, the first digit (source: multiply by ten).
283E
RLCA 07
Rotate Register A left: two times the digit, as Register A holds 0 to 9.
283F
RLCA 07
Rotate Register A left: four times the digit.
2840
ADD A,E 83
Add Register E, the digit, to Register A: five times the digit.
2841
RLCA 07
Rotate Register A left: ten times the digit, 0 to 90.
2842
LD E,A 5F
Load Register E with Register A, the tens, 0 to 90.
2843
Call PRS4 at 284FH for the second digit (source: get another digit).
2846
If it is not a digit (No Carry) jump to PRSD3 at 284DH (source: jump on bad digit).
2848
ADD A,E 83
Add Register E, the tens, to Register A, the units (source: accumulate new digit).
2849
LD E,A 5F
Load Register E with Register A, the value 0 to 99 (source: save 2-digit value).
284A
XOR A AF
XOR Register A with itself: the Z flag set (source: clear flags).
284B
LD A,E 7B
Load Register A with Register E, the value (source: xfer field value).
284C
RET C9
Return Z with Register A = the value, 0 to 99.
284DPRSD3
OR A B7
PRSD3: OR Register A with itself: NZ, as Register A, a character less 30H, is not 00H here (source: set NZ).
284E
RET C9
Return NZ: the field is bad, it does not begin with two digits.
284FPRS4
LD A,(HL) 7E
PRS4: load Register A with the byte at Register Pair HL, a character of the date (source: p/u a digit &).
2850
INC HL 23
Increment Register Pair HL past it (source: convert to binary).
2851
SUB 30H D6 30
Subtract 30H from Register A, the digit 0: a digit gives 0 to 9.
2853
CP 0AH FE 0A
Compare Register A with 0AH: the Carry flag for a digit 0 to 9.
2855
RET C9
Return with Register A = the digit's value and the Carry flag set, or No Carry for anything else.
2856CPHLDE
LD A,H 7C
CPHLDE: load Register A with Register H, the high byte of the first word.
2857
SUB D 92
Subtract Register D from Register A: the high bytes compared.
2858
RET NZ C0
If the high bytes differ (NZ) return, with the Carry flag set when Register H is lower.
2859
LD A,L 7D
Load Register A with Register L, the low byte of the first word.
285A
SUB E 93
Subtract Register E from Register A: the low bytes compared.
285B
RET C9
Return with the Carry flag set when Register Pair HL is lower than Register Pair DE, Z when they are equal.
285CH - PRMERR, IOERR, BREAK and SAVESP
IOERR shows the short message of an SVC's error number through @ERROR and returns it as the code; the number 3FH is PURGE's own sign that Register Pair HL points at a message of its own, which EXTERR shows with @LOGOT before the code FFFFH. BREAK at a prompt, or pressed during a purge without questions, ends with FFFFH. SAVESP restores the Stack Pointer of the entry, keeps the code in Register Pair HL over @CKBRKC by storing it into the operand of the LD HL at 2879H, and clears a BREAK.
285CPRMERR
LD A,2CH 3E 2C
PRMERR: load Register A with 2CH, error 44, Parameter error (source: parameter error).
285EIOERR
CP 3FH FE 3F
IOERR: compare Register A, the error number, with 3FH, 63, the extended error that PURGE's own routines give with Register Pair HL at a message (source: extended error?).
2860
If Register A is 3FH jump to EXTERR at 2880H, which shows the message at Register Pair HL with @LOGOT.
2862
LD L,A 6F
Load Register L with Register A, the error number.
2863
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
2865
OR 0C0H F6 C0
OR Register A with 0C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: abbrev & return).
2867
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
2868
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message.
286A
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short message of Register C.
286B
Jump to SAVESP at 2873H, which restores the Stack Pointer of the entry and returns with Register Pair HL = the error number.
286DBREAK
LD A,6AH 3E 6A
BREAK: load Register A with 6AH, SVC 106, @CKBRKC, which clears the BREAK (source: clear break bit).
286F
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS) to clear the BREAK.
2870ERREXIT
LD HL,0FFFFH 21 FF FF
ERREXIT: load Register Pair HL with 0FFFFH, the return code after a BREAK or a message of PURGE's own.
2873SAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 2874H-2875H, the value stored at 2409H (0000H in the file), the depth of the entry (source: restore the stack).
2876
LD (287AH),HL 22 7A 28LD (RETCOD),HL
Store Register Pair HL, the return code, into 287AH-287BH, the operand of the LD HL at 2879H, so that @CKBRKC cannot lose it.
2879
LD HL,0000H 21 00 00
Load Register Pair HL with the word at 287AH-287BH (0000H in the file): the return code stored at 2876H; 0000H when the end of the HIT jumps here from 24FFH.
287C
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, which tests for a BREAK and clears it.
287E
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): a pending BREAK is cleared, so that it does not end the next command too.
287F
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, or to the caller of @CMNDR, with Register Pair HL = 0000H, FFFFH or the error number.
2880EXTERR
LD A,0CH 3E 0C
EXTERR: load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
2882
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message at Register Pair HL.
2883
Jump to ERREXIT at 2870H: the return code FFFFH.
2885H - The Messages, the Tables and the Parameter Table
The messages PURGE shows itself (through EXTERR's @LOGOT), the prompt and the parts of the question (ended by 03H), the lengths of the months, their names, the partspec BLANKS and FTFLG. 2945H-2967H (FMPAKD, TOPAKD, LILBUF$ and FCB1$) are not in the file: the member's last load block starts at 2968H with the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H. The FCB (2990H-29AFH) and the buffers from 2A00H follow with no bytes in the file.
2885-28ABNOINDO$
DEFM "Invalid command during <DO> processing" / DEFB 0DH 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 0D
NOINDO$, 2885H-28ABH: the message of CKINDO (2773H), when QUERY is on or a prompt is needed while a DO file runs.
28AC-28C3MPW$
DEFM "Master password ? " / DEFB 03H 4D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20 20 20 20 20 20 03
MPW$, 28ACH-28C3H: the prompt for the disk's master password (26E0H), six spaces and the 03H that keeps the cursor after it.
28C4-28DBBADMPW$
DEFM "Invalid master password" / DEFB 0DH 49 6E 76 61 6C 69 64 20 6D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 0D
BADMPW$, 28C4H-28DBH: the message of a wrong master password (26EEH).
28DC-28E7MAXDAYS
DEFB 1FH, 1CH, 1FH, 1EH, 1FH, 1EH, 1FH, 1FH, 1EH, 1FH, 1EH, 1FH 1F 1C 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
MAXDAYS, 28DCH-28E7H: the lengths of the twelve months, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, for the day test at 27FAH; February (28DDH) is made one longer for each leap year date read (27E6H, B157).
28E8-28F7BADFMT$
DEFM "Bad date format" / DEFB 0DH 42 61 64 20 64 61 74 65 20 66 6F 72 6D 61 74 0D
BADFMT$, 28E8H-28F7H: the message of BADFMT (281CH), for a bad DATE value.
28F8-2904PRGFIL$
DEFM "Purge file: " / DEFB 03H 50 75 72 67 65 20 66 69 6C 65 3A 20 03
PRGFIL$, 28F8H-2904H: the start of the question (25E5H).
2905-290AQMARK$
DEFM "} ? " / DEFB 03H 7D 20 3F 20 20 03
QMARK$, 2905H-290AH: the end of the question after the date (2673H), with the closing brace even for an undated file.
290B-2914PURGE$
DEFM "Purging: " / DEFB 03H 50 75 72 67 69 6E 67 3A 20 03
PURGE$, 290BH-2914H: shown through @LOGOT before the name of each file purged (2696H).
2915-2938MONTBL
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
MONTBL, 2915H-2938H: the names of the months, three letters each, for the date shown (262EH).
2939-2943BLANKS
DEFM " " 20 20 20 20 20 20 20 20 20 20 20
BLANKS, 2939H-2943H: the partspec, eight characters of the name and three of the extension, spaces in the file; written by PRSPEC (279DH, 277FH) and compared at 2552H.
2944FTFLG
DEFB 00H 00
FTFLG, 2944H: 00H in the file; bit 7 a first date given (2491H), bit 0 a last date (24B8H); read at 2577H and 258DH. It is the last byte of the member's sixth load block.
2945-2946FMPAKD
DEFS 2
FMPAKD, 2945H-2946H: not in the file; the packed first date, stored at 249AH, read at 2582H.
2947-2948TOPAKD
DEFS 2
TOPAKD, 2947H-2948H: not in the file; the packed last date, stored at 24BBH, read at 2598H.
2949-294CLILBUF$
DEFS 4
LILBUF$, 2949H-294CH: not in the file; PARSDAT's fields (2949H the year, 294AH the day, 294BH the month) and then the reply to the question, read by @KEYIN (2681H), three characters and the carriage return.
294D-2967FCB1$
DEFS 27
FCB1$, 294DH-2967H: not in the file; the line NAME/EXT:d, the plus sign and the date, built at 25A7H-266CH and shown at 2672H and 26A4H.
2968PRMTBL$
DEFB 80H 80
PRMTBL$, 2968H: 80H, the mark of a table in the enhanced format, given to @PARAM at 247AH; the first byte of the last load block. The question of a file with a name of eight characters, an extension of three, the plus sign and a date writes its 03H here (266CH, B161).
2969-296C
DEFB 53H / DEFM "INV" 53 49 4E 56
2969H-296CH: type 53H (a flag, a one letter short form, three letters) and the name INV.
296D-296F
DEFB 00H / DEFW 2541H 00 41 25
296DH, the response byte of INV (never read), and the address of its value, 2541H, IPARM's operand.
2970-2973
DEFB 53H / DEFM "SYS" 53 53 59 53
2970H-2973H: type 53H (a flag, a short form, three letters) and the name SYS.
2974-2976
DEFB 00H / DEFW 2533H 00 33 25
2974H, the response byte of SYS (never read), and the address of its value, 2533H, SPARM's operand.
2977-297A
DEFB 73H / DEFM "MPW" 73 4D 50 57
2977H-297AH: type 73H (a flag or a string, a short form, three letters) and the name MPW, the disk's master password.
297B-297D
DEFB 00H / DEFW 26DEH 00 DE 26
297BH, the response byte of MPW (never read), and the address of its value, 26DEH, PWPARM's operand.
297E-2983
DEFB 55H / DEFM "QUERY" 55 51 55 45 52 59
297EH-2983H: type 55H (a flag, a short form, five letters) and the name QUERY.
2984-2986
DEFB 00H / DEFW 25DEH 00 DE 25
2984H, the response byte of QUERY (never read), and the address of its value, 25DEH, QPARM's operand, FFFFH in the file.
2987-298B
DEFB 34H / DEFM "DATE" 34 44 41 54 45
2987H-298BH: type 34H (a string, a short form, four letters) and the name DATE; the kinds are not checked (SYS1), so DATE given as a flag gives the value FFFFH, read as a text at FFFFH, which is Bad date format.
298C-298E
DEFB 00H / DEFW 2484H 00 84 24
298CH, the response byte of DATE (never read), and the address of its value, 2484H, DATPRM's operand.
298F
DEFB 00H 00
298FH: the 00H that ends the table, both for @PARAM's loop that zeroes the response bytes and for @FNDPRM; the last byte of the member.
2400H - Member 6 (DUMP): Entry, the File Spec and the Addresses
SYS1/SYS runs DUMP with request 71H; its header (file offset 0059H: record 13H, byte 30H) points at member 6, which the overlay loader reads to 2400H-25F5H, 502 bytes in two load blocks (256 and 246), and calls at 2400H with Register Pair HL at the text after the word DUMP. DUMP writes the memory from START to END into a file, as a load module (default extension /LMF) or, with ASCII, as the bytes alone (default /TXT). It does not keep the Stack Pointer: every exit is a RET at the depth of the entry, with 0000H, FFFFH after BREAK or a message of its own, or the error number after its short message. The entry reads the file spec (a device is refused), takes the address of @EXIT from the SVC table as the default transfer address, reads the parameters and checks the addresses: END must not be below START, and START must be 3000H or more. START is 3000H and END 2FFFH when not given, so END must always be given. The source has no 631 change.
2400DUMP
LD A,6AH 3E 6A
DUMP: load Register A with 6AH, SVC 106, @CKBRKC, which tests for a pending BREAK and clears it (source: break key down?).
2402
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): Z when BREAK was not pressed, NZ when it was.
2403
If BREAK was not pressed jump to BEGINA at 2409H, which reads the file spec (source: ok if not).
2405
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code of a command ended by BREAK, with no message (source: else abort).
2408
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, which CLEANUP left under SYS1's entry, or to the caller of @CMNDR, with Register Pair HL = FFFFH.
2409BEGINA
LD DE,261CH 11 1C 26LD DE,FCB1
BEGINA: load Register Pair DE with 261CH, FCB1, the file's FCB above the member (no bytes in the file), where @FSPEC puts the file spec (source: fetch the filespec).
240C
LD A,4EH 3E 4E
Load Register A with 4EH, SVC 78, @FSPEC, which copies a file or device spec from the text at Register Pair HL into the buffer at Register Pair DE.
240E
RST 28H EF
Call @FSPEC with RST 28H (SYS1/SYS) to read the spec into FCB1 at 261CH; Register Pair HL moves past it, to the parameters.
240F
If @FSPEC returned NZ (no spec on the line, or one it cannot read) jump to SPCREQ at 256EH: File spec required (source: jump on error).
2412
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, 261CH, the first character of the spec in FCB1 (source: cannot be a device).
2413
CP 2AH FE 2A
Compare Register A with 2AH, the asterisk that begins a device spec such as the one of the printer, PR.
2415
If the spec is a device jump to SPCREQ at 256EH: a device is refused with File spec required (source: quit if device).
2418
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which returns the address of the system flag table (source: get system flag table).
241A
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH, FLGTAB$.
241B
PUSH HL E5
Save Register Pair HL, the place in the command line after the file spec, on the stack (source: save cmdline ptr).
241C
LD H,(IY+1AH) FD 66 1A
Load Register H with the byte at Index Register IY + 1AH (IY+1AH, 0084H; Index Register IY holds 006AH): 01H, the high byte of SVCTAB$, the SVC table at 0100H (source: p/u SVC table MSB).
241F
LD L,2CH 2E 2C
Load Register L with 2CH, twice 22: Register Pair HL = 012CH, the word of SVC 22, @EXIT, in the SVC table (source: point to @EXIT entry).
2421
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, 012CH, the low byte of the address of @EXIT (0BH in the release).
2422
INC L 2C
Increment Register L to 2DH: Register Pair HL = 012DH, the high byte of the word.
2423
LD H,(HL) 66
Load Register H with the byte at Register Pair HL, 012DH, the high byte of the address of @EXIT (1BH in the release).
2424
LD L,A 6F
Load Register L with Register A: Register Pair HL = the address of @EXIT, 1B0BH in the release.
2425
LD (2540H),HL 22 40 25
Store Register Pair HL into 2540H-2541H, the operand of TPARM's LD HL at 253FH: the transfer address written when TRA is not given is @EXIT, a return to the system (source: init transfer to @EXIT).
2428
POP HL E1
Restore Register Pair HL, the place in the command line after the file spec, from the stack.
2429
LD DE,25BDH 11 BD 25LD DE,PRMTBL$
Load Register Pair DE with 25BDH, PRMTBL$, the parameter table (source: get the parms).
242C
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads a parameter list in parentheses at Register Pair HL against the table at Register Pair DE.
242E
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): with a list each response byte is first set to 00H, and each parameter given stores its value at the address in its entry and sets its response byte.
242F
If @PARAM returned NZ (a word not in the table or a bad value) jump to PRMERR at 255AH: Parameter error (source: jump on parm error).
2432
LD HL,(24E0H) 2A E0 24
Load Register Pair HL with the word at 24E0H-24E1H, the operand of EPARM's LD HL: END, 2FFFH when not given (source: ck on end > start).
2435
LD BC,(24DAH) ED 4B DA 24
Load Register Pair BC with the word at 24DAH-24DBH, the operand of SPARM's LD HL: START, 3000H when not given.
2439
XOR A AF
Exclusive OR Register A with itself: Register A = 00H and the Carry flag cleared for the SBC.
243A
SBC HL,BC ED 42
Subtract Register Pair BC, START, from Register Pair HL, END: Carry when END is below START.
243C
If END is below START jump to ENLTST at 256AH: START or END error. As END is 2FFFH when not given, a DUMP without END ends here when START is 3000H or more, and at STLT30 when it is lower (source: jump on start < end).
243F
LD HL,3000H 21 00 30LD HL,SINIT
Load Register Pair HL with 3000H, MINCOR$, the lowest address that may be dumped (source: pt to lowest possible).
2442
DEC HL 2B
Decrement Register Pair HL to 2FFFH, so that the SBC gives No Carry for a START of 2FFFH or less (source: reduce for compare).
2443
SBC HL,BC ED 42
Subtract Register Pair BC, START, from Register Pair HL, 2FFFH, with the Carry flag clear from the SBC at 243AH: No Carry when START is 2FFFH or less (source: ck on start > minimum).
2445
If START is below 3000H jump to STLT30 at 2566H: Start less than X'3000'. The member, its FCBs and its buffer lie below 3000H, so they are never dumped (source: jump if start < minimum).
2448H - APARM: the Name Record, the Extension, the LRL and the Open
Without ASCII DUMP copies up to six letters and digits of the file's name (@FSPEC has made them capitals) into NAMFLD (2616H), filled out with spaces, for the name record of the load module, and gives the spec the extension LMF when it has none; with ASCII it gives TXT. The manual names /CIM, the extension of LDOS 5. ASCII is tested here as a 16 bit word (any value but 0000H), but later only by its low byte (24BDH, 24F5H, 2517H; B133). LRL, a parameter the manual does not name, may be 0 to 256, 0 and 256 both meaning 256 (the default); a larger value is a Parameter error. @INIT opens the file or makes it, on the first drive with room when no drive is given; an existing file is written over from its start, but one with another LRL gives error 42 and is not dumped (B134). DUMP then shows Dumping: and the name through @LOGOT and, for a load module, writes the name record: 05H, 06H and the six characters.
2448APARM
LD BC,0000H 01 00 00
APARM: load Register Pair BC with the value of the ASCII parameter; the operand at 2449H-244AH (0000H in the file) is FFFFH when ASCII is given as a flag, 0000H for ASCII=N, and any number given otherwise (source: ASCII txt or code cim).
244B
LD A,B 78
Load Register A with Register B, the high byte of the ASCII word.
244C
OR C B1
OR Register A with Register C, the low byte: Z only when the word is 0000H, ASCII not given (or given as N, NO or OFF).
244D
If ASCII was given jump to DUMPTXT at 247AH, which uses the extension TXT; an ASCII dump has no name record (source: go if ASCII).
244F
LD DE,2616H 11 16 26LD DE,NAMFLD
Load Register Pair DE with 2616H, NAMFLD, the six bytes for the name record, above the member (no bytes in the file) (source: get up to a 6 character).
2452
LD HL,261CH 21 1C 26LD HL,FCB1
Load Register Pair HL with 261CH, FCB1, where the file spec begins with its name (source: filename to stuff).
2455
LD B,06H 06 06
Load Register B with 06H, the length of the name record's name, the count of the loop (source: as file header).
2457
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character of the spec in FCB1 (261CH-2621H).
2458
CP 30H FE 30
Compare Register A with 30H, the digit 0: a character below it (the slash, the period, the exclamation mark or the 03H that ends the spec) ends the name (source: stop on non-alpha).
245A
If Register A is below 30H jump to 246FH, which fills the rest of NAMFLD with spaces.
245C
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9 (source: use if 0-9).
245E
If Register A is a digit jump to 2468H, which copies it.
2460
CP 41H FE 41
Compare Register A with 41H, the letter A: the colon and the signs up to 40H end the name (source: ck on A-Z).
2462
If Register A is below 41H jump to 246FH, which fills the rest of NAMFLD with spaces.
2464
CP 5BH FE 5B
Compare Register A with 5BH, the character after the letter Z.
2466
If Register A is not a capital letter jump to 246FH, which fills the rest with spaces; @FSPEC has already made small letters capitals (source: exit if not A-Z).
2468
LD (DE),A 12
Store Register A, the letter or digit, into the byte at Register Pair DE, the next byte of NAMFLD (source: xfer this char).
2469
INC HL 23
Increment Register Pair HL to the next character of the spec (source: bump input ptr).
246A
INC DE 13
Increment Register Pair DE to the next byte of NAMFLD (source: and output pointer).
246B
Decrement Register B and, while it is not zero, jump back to 2457H for the next character: at most six are copied (source: loop 6 chars max).
246D
Six characters were copied: jump to 2475H, which takes the extension LMF.
246F
LD A,20H 3E 20
Load Register A with 20H, a space, to fill NAMFLD out to six characters (source: place blanks to).
2471
LD (DE),A 12
Store Register A, the space, into the byte at Register Pair DE, the next byte of NAMFLD (source: fill out to 6 chars).
2472
INC DE 13
Increment Register Pair DE to the next byte of NAMFLD.
2473
Decrement Register B and, while it is not zero, jump back to 246FH for the next space.
2475
LD HL,25B7H 21 B7 25LD HL,LMFEXT
Load Register Pair HL with 25B7H, LMFEXT, the three letters LMF, the default extension of a load module (source: use /LMF extension).
2478
Jump to DUMPCIM at 247DH, over the LD of the TXT extension.
247ADUMPTXT
LD HL,25BAH 21 BA 25LD HL,TXTEXT
DUMPTXT: load Register Pair HL with 25BAH, TXTEXT, the three letters TXT, the default extension of an ASCII dump (source: use /TXT extension).
247DDUMPCIM
LD DE,261CH 11 1C 26LD DE,FCB1
DUMPCIM: load Register Pair DE with 261CH, FCB1, the file spec (source: default the EXT).
2480
LD A,4FH 3E 4F
Load Register A with 4FH, SVC 79, @FEXT, which gives the spec in the FCB at Register Pair DE the extension at Register Pair HL when it has none.
2482
RST 28H EF
Call @FEXT with RST 28H (SYS1/SYS): a spec with its own extension keeps it, so DUMP ROUTINE/CMD writes ROUTINE/CMD.
2483LPARM
LD BC,0000H 01 00 00
LPARM: load Register Pair BC with the value of the LRL parameter; the operand at 2484H-2485H (0000H in the file) is set by @PARAM (source: p/u LRL).
2486
LD A,B 78
Load Register A with Register B, the high byte of LRL (source: test for > 256).
2487
OR A B7
Set the flags from Register A, the high byte (source: if hi-order = 0).
2488
If the high byte is 00H jump to LP1 at 2492H, which uses the low byte as the record length (source: just use lo-order).
248A
DEC A 3D
Decrement Register A, the high byte: Z only when it was 01H, LRL from 256 to 511 (source: test hi-order = 1).
248B
If the high byte was not 01H (LRL of 512 or more, or LRL alone, FFFFH) jump to PRMERR at 255AH: Parameter error.
248E
OR C B1
OR Register A, 00H, with Register C, the low byte: Z only for LRL=256 (source: p/u lo-order).
248F
If LRL is 257 to 511 jump to PRMERR at 255AH: Parameter error (source: lo-order must be 0).
2492LP1
OR C B1
LP1: OR Register A, 00H, with Register C, the low byte of LRL: 00H for 0 or 256 (both 256 bytes a record), else 1 to 255 (source: merge lo-order).
2493
LD B,A 47
Load Register B with Register A, the record length for @INIT (00H = 256).
2494
LD HL,2700H 21 00 27LD HL,BUFFER
Load Register Pair HL with 2700H, BUFFER, the file's 256 byte buffer, the page after the FCBs (no bytes in the file) (source: pt to buffer).
2497
LD A,3AH 3E 3A
Load Register A with 3AH, SVC 58, @INIT, which opens an existing file or makes a new one (source: init the file).
2499
RST 28H EF
Call @INIT with RST 28H (SYS2/SYS) for FCB1 at Register Pair DE, 261CH, the buffer at Register Pair HL and the LRL in Register B.
249A
If @INIT returned NZ (no room, write protected, error 42 for an existing file of another LRL and so on) jump to IOERR at 255CH (source: quit on init error).
249D
LD BC,(2622H) ED 4B 22 26
Load Register Pair BC with the word at 2622H-2623H, FCB1+6 (the drive, Register C) and FCB1+7 (the DEC, Register B) of the open file (source: p/u DEC and drive).
24A1
LD DE,25F6H 11 F6 25LD DE,FCB2
Load Register Pair DE with 25F6H, FCB2, the 32 bytes after the message Dumping: (no bytes in the file), where the name goes (source: point to FCB area).
24A4
PUSH DE D5
Save Register Pair DE, 25F6H, on the stack for the scan below.
24A5
LD A,50H 3E 50
Load Register A with 50H, SVC 80, @FNAME, which writes the name of the file of drive Register C, DEC Register B to Register Pair DE (source: fetch the name).
24A7
RST 28H EF
Call @FNAME with RST 28H (SYS3/SYS): NAME/EXT:d and 03H into FCB2 at 25F6H.
24A8
POP HL E1
Restore Register Pair HL from the stack: 25F6H, the start of the name.
24A9
If @FNAME returned NZ (a directory read error) jump to IOERR at 255CH with the file left open (source: quit on error).
24AC
LD A,20H 3E 20
Load Register A with 20H, a space: the name's characters are all above it, the 03H after it is below (source: scan until ETX char).
24AEFNLP
INC HL 23
FNLP: increment Register Pair HL to the next character of the name.
24AF
CP (HL) BE
Compare Register A, 20H, with the byte at Register Pair HL: Carry while the byte is above 20H.
24B0
If the byte at Register Pair HL is above 20H jump back to FNLP at 24AEH.
24B2
LD (HL),0DH 36 0D
Store 0DH into the byte at Register Pair HL, over the 03H, so that the name ends the line of the message (source: replace with CR).
24B4
LD HL,25EDH 21 ED 25LD HL,DUMP$
Load Register Pair HL with 25EDH, DUMP$, the text Dumping: followed by the name in FCB2.
24B7
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
24B9
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show Dumping: and the name (source: display Dumping).
24BA
LD DE,261CH 11 1C 26LD DE,FCB1
Load Register Pair DE with 261CH, FCB1, the open file, for every @PUT from here on (source: get dump FCB).
24BD
LD A,(2449H) 3A 49 24
Load Register A with the byte at 2449H, the low byte of the ASCII word, the operand of APARM's LD BC (source: ck if ASCII parm used).
24C0
OR A B7
Set the flags from Register A, the low byte of ASCII: NZ when ASCII was given (FFH), but Z for a value such as 256 whose low byte is 00H (B133).
24C1
If the low byte of ASCII is not 00H jump to SPARM at 24D9H: no name record (source: and go if so).
24C3
LD A,05H 3E 05
Load Register A with 05H, the type of the name record of a load module (source: name header).
24C5
Call PUTOUT at 2553H to write Register A, 05H, to the file.
24C8
LD A,06H 3E 06
Load Register A with 06H, the length of the name record (source: name length).
24CA
Call PUTOUT at 2553H to write Register A, 06H, to the file.
24CD
LD B,06H 06 06
Load Register B with 06H, the count of the name's characters (source: init loop).
24CF
LD HL,2616H 21 16 26LD HL,NAMFLD
Load Register Pair HL with 2616H, NAMFLD, the name made at 2457H-2473H.
24D2
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character of NAMFLD.
24D3
INC HL 23
Increment Register Pair HL to the next character of NAMFLD.
24D4
Call PUTOUT at 2553H to write Register A, the character, to the file (source: output the filename).
24D7
Decrement Register B and, while it is not zero, jump back to 24D2H for the next character of the name.
24D9H - SPARM: the Load Blocks, the Transfer Record or the ETX, and the Close
DUMP writes the memory from START to END in blocks of at most 254 bytes: a load module puts the header of a load block (01H, the length plus 2, the load address) in front of each, so that a full block's length byte is 00H, which the system loader reads as 254 bytes of data; an ASCII dump writes the bytes alone. END may be FFFFH: the count END+1-START is then worked out modulo 65536 and comes right. A load module ends with the transfer record, 02H, 02H and the address of TRA (@EXIT when not given). An ASCII dump ends with the ETX byte only when ETX is given: as a number its low byte, as a string its first character (the closing quote, 22H, for ETX=""), as a flag 03H, even for ETX=OFF or ETX=N (B132); with no ETX parameter no byte is written (B131), though the manual says an ASCII dump always ends with an ETX, 03H by default. ETX and TRA are ignored, with no message, for the other kind of dump. Then the file is closed; the end of file is where the dump ended, so a longer file written over is made shorter.
24D9SPARM
LD HL,3000H 21 00 30LD HL,SINIT
SPARM: load Register Pair HL with the value of START, the address of the first byte to dump; the operand at 24DAH-24DBH (3000H in the file) is set by @PARAM (source: p/u starting addr).
24DC
PUSH HL E5
Save Register Pair HL, the address of the next byte to dump, on the stack (source: ck on write of).
24DD
LD B,H 44
Load Register B with Register H, the high byte of the next address (source: last byte written).
24DE
LD C,L 4D
Load Register C with Register L: Register Pair BC = the next address to dump.
24DFEPARM
LD HL,2FFFH 21 FF 2F
EPARM: load Register Pair HL with the value of END, the last byte to dump; the operand at 24E0H-24E1H (2FFFH in the file) is set by @PARAM (source: where to end).
24E2
INC HL 23
Increment Register Pair HL to END+1, the first byte not dumped (0000H for an END of FFFFH).
24E3
XOR A AF
Exclusive OR Register A with itself: Register A = 00H and the Carry flag cleared for the SBC.
24E4
SBC HL,BC ED 42
Subtract Register Pair BC, the next address, from Register Pair HL, END+1: Register Pair HL = the bytes still to write, modulo 65536.
24E6
If no bytes are left jump to 2516H, which ends the file (source: go if at end).
24E8
LD B,0FEH 06 FE
Load Register B with FEH, 254, the bytes of a full block (source: 254-byte blocks).
24EA
LD A,H 7C
Load Register A with Register H, the high byte of the count still to write (source: a full sector left).
24EB
OR A B7
Set the flags from Register A, the high byte of the count (source: to write?).
24EC
If 256 bytes or more are left jump to 24F4H with Register B = FEH, a full block.
24EE
LD A,L 7D
Load Register A with Register L, the count of bytes left, 1 to FFH.
24EF
CP 0FFH FE FF
Compare Register A with FFH: No Carry for 255 bytes left, more than a block.
24F1
If 255 bytes are left jump to 24F4H with Register B = FEH: a full block now, one byte in the next (source: if less than full).
24F3
LD B,L 45
Load Register B with Register L, the 1 to 254 bytes left: the last block is shorter (source: reset len).
24F4
POP HL E1
Restore Register Pair HL, the address of the next byte to dump, from the stack.
24F5
LD A,(2449H) 3A 49 24
Load Register A with the byte at 2449H, the low byte of the ASCII word, the operand of APARM's LD BC.
24F8
OR A B7
Set the flags from Register A, the low byte of ASCII (B133).
24F9
If the low byte of ASCII is not 00H jump to 250DH, which writes the bytes alone, with no header of a load block (source: bypass if TXT).
24FB
INC A 3C
Increment Register A, 00H, to 01H, the type of a load block (source: init start of block).
24FC
Call PUTOUT at 2553H to write Register A, 01H, to the file.
24FF
LD A,B 78
Load Register A with Register B, the bytes of this block (source: get block length).
2500
ADD A,02H C6 02
Add 02H to Register A, for the two bytes of the load address: a full block of FEH gives 00H, which the loader reads as 254 bytes after the address (source: add 2 for load address).
2502
Call PUTOUT at 2553H to write Register A, the length byte, to the file (source: and put it out).
2505
LD A,L 7D
Load Register A with Register L, the low byte of the block's load address.
2506
Call PUTOUT at 2553H to write Register A, the low byte of the address, to the file (source: lo-order load address).
2509
LD A,H 7C
Load Register A with Register H, the high byte of the block's load address.
250A
Call PUTOUT at 2553H to write Register A, the high byte of the address, to the file (source: hi-order load address).
250D
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next byte of memory to dump (source: write a load block).
250E
INC HL 23
Increment Register Pair HL to the next byte of memory.
250F
Call PUTOUT at 2553H to write Register A, the byte of memory, to the file.
2512
Decrement Register B and, while it is not zero, jump back to 250DH for the next byte of the block.
2514
Jump back to 24DCH for the next block, with Register Pair HL at the next byte to dump (source: loop for more).
2516
POP HL E1
Restore Register Pair HL from the stack, the address pushed at 24DCH, to keep the stack level with the entry's (source: stack integrity).
2517
LD A,(2449H) 3A 49 24
Load Register A with the byte at 2449H, the low byte of the ASCII word, the operand of APARM's LD BC (source: no TRAADR if TXT).
251A
OR A B7
Set the flags from Register A, the low byte of ASCII (B133) (source: or TRAADR if not TXT).
251B
If the low byte of ASCII is 00H, a load module, jump to TRAADR at 2535H, which writes the transfer record.
251DETXPARM
LD BC,0003H 01 03 00
ETXPARM: load Register Pair BC with the value of ETX; the operand at 251EH-251FH (0003H in the file, never used as such) is set by @PARAM: a number, a string's address or a flag's 0000H or FFFFH (source: p/u etx character).
2520
LD A,C 79
Load Register A with Register C, the low byte of the ETX value, the byte written for a number.
2521
LD HL,25E9H 21 E9 25LD HL,ETXRESP
Load Register Pair HL with 25E9H, ETXRESP, the response byte of ETX in the parameter table.
2524
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL, 25E9H: set when ETX was given a number (source: value input means).
2526
If ETX was a number jump to PUTETX at 2547H, which writes Register A, its low byte (source: put the ETX given).
2528
LD A,(BC) 0A
Load Register A with the byte at Register Pair BC, the first character of the string when ETX was given one (Register Pair BC holds its address in INBUF$); for a flag the byte is read and then not used (source: in case string).
2529
BIT 5,(HL) CB 6E
Test bit 5 of the byte at Register Pair HL, 25E9H: set when ETX was given any string, even an empty one, whose address @PARAM gives as that of its closing quote (B132) (source: string input puts the).
252B
If ETX was a string jump to PUTETX at 2547H, which writes Register A, its first character (source: entered char).
252D
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL, 25E9H: set when ETX was given as a flag, with no value, with an empty value (ETX=) or with Y, N, ON, OFF, YES or NO (source: flag input gives ETX=3).
252F
If ETX was not given (response byte 00H) jump to CLSFIL at 254AH: the file is closed with no ETX byte, contrary to the manual (B131) (source: if ETX=on).
2531
LD A,03H 3E 03
Load Register A with 03H, the ETX byte written for ETX given as a flag; the value word in Register Pair BC is not looked at, so ETX=OFF writes it too (B132).
2533
Jump to PUTETX at 2547H, which writes Register A, 03H, and closes the file.
2535TRAADR
LD A,02H 3E 02
TRAADR: load Register A with 02H, the type of the transfer record (source: put traadr header).
2537
Call PUTOUT at 2553H to write Register A, 02H, to the file.
253A
LD A,02H 3E 02
Load Register A with 02H, the length of the transfer record, the two bytes of the address.
253C
Call PUTOUT at 2553H to write Register A, 02H, to the file.
253FTPARM
LD HL,0000H 21 00 00
TPARM: load Register Pair HL with the transfer address; the operand at 2540H-2541H (0000H in the file) is set to the address of @EXIT at 2425H, then to TRA's value by @PARAM when TRA is given (source: p/u transfer address).
2542
LD A,L 7D
Load Register A with Register L, the low byte of the transfer address.
2543
Call PUTOUT at 2553H to write Register A, the low byte of the transfer address, to the file (source: tra lo-order).
2546
LD A,H 7C
Load Register A with Register H, the high byte of the transfer address.
2547PUTETX
PUTETX: call PUTOUT at 2553H to write Register A, the high byte of the transfer address or the ETX byte, to the file (source: tra hi-order or ETX).
254ACLSFIL
LD A,3CH 3E 3C
CLSFIL: load Register A with 3CH, SVC 60, @CLOSE, which closes the file of the FCB at Register Pair DE, 261CH (source: close 'er up).
254C
RST 28H EF
Call @CLOSE with RST 28H (SYS3/SYS): the last sector is written and the end of file, where the last @PUT left it, goes into the directory entry.
254D
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code for no error; the LD leaves the flags of @CLOSE.
2550
RET Z C8
If @CLOSE returned Z return through the tail of RST28 (1A77H) with Register Pair HL = 0000H (source: back on no error).
2551
Jump to IOERR at 255CH with Register A = the error of @CLOSE (source: go on error).
2553H - PUTOUT, PRMERR, IOERR and the Messages
PUTOUT writes one byte with @PUT; on an error it drops its own return address and goes on into IOERR through a DB 21H that hides PRMERR's LD A,2CH, so that Register A keeps @PUT's error number. IOERR shows the short message of the error through @ERROR and returns with Register Pair HL = the error number; the file is left open, as after every error past the @INIT. STLT30, ENLTST and SPCREQ show a message of DUMP's own through @LOGOT, chained by DDH bytes that make the next LD HL an LD IX, and return with FFFFH. Every one of these exits returns at the depth of the entry, as DUMP calls PUTOUT only from that depth.
2553PUTOUT
LD C,A 4F
PUTOUT: load Register C with Register A, the byte to write, for @PUT (source: xfer the char).
2554
LD A,04H 3E 04
Load Register A with 04H, SVC 4, @PUT, which writes the byte in Register C to the file or device of the control block at Register Pair DE (source: test each byte transfer).
2556
RST 28H EF
Call @PUT with RST 28H (BOOT/SYS, which goes on to @BYTEIO in SYS0/SYS for a file) for FCB1 at Register Pair DE, 261CH.
2557
RET Z C8
If @PUT returned Z return to the caller: the byte is written (source: back if no error).
2558
POP HL E1
Restore Register Pair HL from the stack, dropping PUTOUT's return address: IOERR then returns from DUMP itself (source: pop the RET addr).
2559
DEFB 21H 21
2559H: the first byte of an LD HL,nnnn that swallows PRMERR's LD A,2CH (255AH-255BH), so that a write error goes on to IOERR with @PUT's error number in Register A (source: skip LD A instruction).
255APRMERR
LD A,2CH 3E 2C
PRMERR: load Register A with 2CH, error 44, Parameter error (source: Parameter Error).
255CIOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number (source: error code to HL).
255D
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
255F
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: abbrev and return).
2561
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
2562
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message (source: show the error).
2564
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short error message.
2565
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or the caller of @CMNDR, with Register Pair HL = the error number.
2566STLT30
LD HL,258CH 21 8C 25LD HL,STLT30$
STLT30: load Register Pair HL with 258CH, STLT30$, Start less than X'3000'.
2569
DEFB 0DDH DD
2569H: the DDH that makes the next LD HL,2578H an LD IX,2578H, so that STLT30 keeps Register Pair HL at its own message; Index Register IX is changed (2578H, then 25A4H) and not used after.
256AENLTST
LD HL,2578H 21 78 25LD HL,ENLTST$
ENLTST: load Register Pair HL with 2578H, ENLTST$, START or END error.
256D
DEFB 0DDH DD
256DH: the DDH that makes the next LD HL,25A4H an LD IX,25A4H, so that STLT30 and ENLTST keep Register Pair HL at their message; Index Register IX is left at 25A4H and not used after.
256ESPCREQ
LD HL,25A4H 21 A4 25LD HL,SPCREQ$
SPCREQ: load Register Pair HL with 25A4H, SPCREQ$, File spec required.
2571
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
2573
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message.
2574
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code after a message of the command's own.
2577
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or the caller of @CMNDR, with Register Pair HL = FFFFH.
2578H - The Messages, the Extensions and the Parameter Table
The three messages of STLT30, ENLTST and SPCREQ, each ended by a carriage return; the two default extensions; the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H; then the start of the line Dumping: . FCB2 (25F6H-2615H), NAMFLD (2616H-261BH), FCB1 (261CH-263BH) and BUFFER (2700H-27FFH) follow the member and have no bytes in the file. ETX has no short form; the kinds of the entries are not checked by @PARAM (SYS1), so a flag or a string is taken for any of them.
2578-258BENLTST$
DEFM "START or END error " / DEFB 0DH 53 54 41 52 54 20 6F 72 20 45 4E 44 20 65 72 72 6F 72 20 0D
ENLTST$, 2578H-258BH: the message of ENLTST (256AH), with a space before its carriage return.
258C-25A3STLT30$
DEFM "Start less than X'3000'" / DEFB 0DH 53 74 61 72 74 20 6C 65 73 73 20 74 68 61 6E 20 58 27 33 30 30 30 27 0D
STLT30$, 258CH-25A3H: the message of STLT30 (2566H), ended by its carriage return.
25A4-25B6SPCREQ$
DEFM "File spec required" / DEFB 0DH 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 0D
SPCREQ$, 25A4H-25B6H: the message of SPCREQ (256EH), ended by its carriage return.
25B7-25B9LMFEXT
DEFM "LMF" 4C 4D 46
LMFEXT, 25B7H-25B9H: the default extension of a load module, given to @FEXT at 2475H.
25BA-25BCTXTEXT
DEFM "TXT" 54 58 54
TXTEXT, 25BAH-25BCH: the default extension of an ASCII dump, given to @FEXT at 247AH.
25BDPRMTBL$
DEFB 80H 80
PRMTBL$, 25BDH: 80H, the mark of a table in the enhanced format (2429H).
25BE-25C3
DEFB 95H / DEFM "START" 95 53 54 41 52 54
25BEH-25C3H: type 95H (a number, a one letter short form, five letters) and the name START, S for short.
25C4-25C6
DEFB 00H / DEFW 24DAH 00 DA 24
25C4H, the response byte of START (never read), and the address of its value, 24DAH, SPARM's operand.
25C7-25CA
DEFB 93H / DEFM "END" 93 45 4E 44
25C7H-25CAH: type 93H (a number, a short form, three letters) and the name END, E for short.
25CB-25CD
DEFB 00H / DEFW 24E0H 00 E0 24
25CBH, the response byte of END (never read), and the address of its value, 24E0H, EPARM's operand.
25CE-25D1
DEFB 93H / DEFM "TRA" 93 54 52 41
25CEH-25D1H: type 93H (a number, a short form, three letters) and the name TRA, T for short.
25D2-25D4
DEFB 00H / DEFW 2540H 00 40 25
25D2H, the response byte of TRA (never read), and the address of its value, 2540H, TPARM's operand.
25D5-25DA
DEFB 55H / DEFM "ASCII" 55 41 53 43 49 49
25D5H-25DAH: type 55H (a flag, a short form, five letters) and the name ASCII, A for short.
25DB-25DD
DEFB 00H / DEFW 2449H 00 49 24
25DBH, the response byte of ASCII (never read), and the address of its value, 2449H, APARM's operand.
25DE-25E1
DEFB 93H / DEFM "LRL" 93 4C 52 4C
25DEH-25E1H: type 93H (a number, a short form, three letters) and the name LRL, L for short; the manual does not name this parameter.
25E2-25E4
DEFB 00H / DEFW 2484H 00 84 24
25E2H, the response byte of LRL (never read), and the address of its value, 2484H, LPARM's operand.
25E5-25E8
DEFB 83H / DEFM "ETX" 83 45 54 58
25E5H-25E8H: type 83H (a number, no short form, three letters) and the name ETX.
25E9-25EB
DEFB 00H / DEFW 251EH 00 1E 25
ETXRESP, 25E9H, the response byte of ETX (read at 2524H-252DH), and the address of its value, 251EH, ETXPARM's operand.
25EC
DEFB 00H 00
25ECH: the 00H that ends the table, both for @PARAM's loop that zeroes the response bytes and for @FNDPRM (source: NOP).
25ED-25F5DUMP$
DEFM "Dumping: " 44 75 6D 70 69 6E 67 3A 20
DUMP$, 25EDH-25F5H: the start of the line shown at 24B9H, the last bytes of the member; it has no end mark and runs into the name that @FNAME writes into FCB2 at 25F6H.
2400H - Member 7 (CREATE): Entry, Close and SHRINK
SYS1/SYS runs CREATE with request 13H; its header (file offset 0061H: record 15H, byte 31H) points at member 7, which the overlay loader reads to 2400H-2588H and 2598H-25C2H (436 bytes in three load blocks; 2589H-2597H, the name buffer, is not loaded) and calls at 2400H with Register Pair HL at the text after the word CREATE. CREATE opens or makes the file, takes space for the records asked for by writing the last of them, marks the entry CREATED (DIR+1 bit 7, so that closing does not free the granules past the end of file) and, before the close, sets the end of file back to what it was when the file was opened: a new file stays empty, with its space taken (but see B129). The 631 changes: the Stack Pointer saved before the BREAK test, Register Pair BC loaded before the close so that it is kept for CLRCRE's @DIRRD, and the SHRINK parameter, for which the code that sets the CREATED bit became the routine SETCRE.
2400
LD (251EH),SP ED 73 1E 25
CREATE: store the Stack Pointer into 251EH-251FH, the operand of the LD SP at SAVESP (251DH), before anything else, so that every error exit returns at the depth of the entry (631) (source: save SP address).
2404
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, which tests for a pending BREAK and clears it (631) (source: BREAK key down).
2406
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): NZ when BREAK was pressed.
2407
If BREAK was pressed jump to ABORT at 2554H, which returns FFFFH through SAVESP.
240A
Call CREATCD at 2432H, which makes the file; it returns here when the space is taken (and filled), with the file still open and Register Pair DE = 25C2H, the FCB.
240DERN
LD HL,0000H 21 00 00
ERN: load Register Pair HL with the ERN the file had when @INIT opened it, 0000H for a new file; the operand at 240EH-240FH (0000H in the file) is set at 24AAH (source: p/u ERN).
2410
LD (25CEH),HL 22 CE 25
Store Register Pair HL into 25CEH-25CFH, FCB+12 and FCB+13, the ending record number: writing the records moved it on, and the close takes this one, except after a FILL with an LRL below 256 that ends inside a sector, when @CLOSE's write of that sector moves it on again (B129).
2413OFFSET
LD A,00H 3E 00
OFFSET: load Register A with the end of file offset the file had when opened; the operand at 2414H (00H in the file) is set at 24B0H (source: p/u offset byte).
2415
LD (25CAH),A 32 CA 25
Store Register A into 25CAH, FCB+8, the end of file offset, so that the file's end of file is what it was before CREATE.
2418
LD DE,25C2H 11 C2 25LD DE,FCB
Load Register Pair DE with 25C2H, the FCB (source: DE to FCB).
241B
LD BC,(25C8H) ED 4B C8 25
Load Register Pair BC with the word at 25C8H-25C9H, FCB+6 (the drive, Register C) and FCB+7 (the DEC, Register B), which @CLOSE keeps for the @DIRRD of CLRCRE (631).
241F
LD A,3CH 3E 3C
Load Register A with 3CH, SVC 60, @CLOSE, which closes the file of the FCB at Register Pair DE.
2421
RST 28H EF
Call @CLOSE with RST 28H (SYS3/SYS) for the FCB at Register Pair DE: it first writes a sector still only in the buffer (RWRIT@), then puts the end of file into the directory entry; the CREATED bit set at 24E7H keeps the granules past it. @CLOSE does not use Register Pair BC, which it keeps.
2422
If @CLOSE returned NZ jump to IOERR at 2514H (source: NZ I/O error).
2425SHRINK
LD DE,0000H 11 00 00
SHRINK: load Register Pair DE with the word of the SHRINK parameter; the operand at 2426H-2427H (0000H in the file) is FFFFH when SHRINK is given (631).
2428
LD A,D 7A
Load Register A with Register D, the high byte of the SHRINK word.
2429
AND E A3
AND Register A with Register E, the low byte: FFH only when the word is FFFFH.
242A
INC A 3C
Increment Register A: 00H and the Z flag only for FFFFH, SHRINK given without a value (or with Y or ON).
242B
If SHRINK was given call CLRCRE at 2521H, which turns the SET at 252CH into a RES and clears the CREATED bit of the closed file's entry: its next close frees the space past its end of file (631) (source: clear create flag).
242E
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code for no error (631).
2431
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, which CLEANUP left under SYS1's entry, or to the caller of @CMNDR, with Register Pair HL = 0000H.
2432H - CREATCD: the File Spec and the Parameters
CREATCD reads the file spec with @FSPEC (none: File spec required) and the parameters SIZE, REC, LRL, FILL and SHRINK with @PARAM. The space is given either as REC, a number of records of LRL bytes, or as SIZE, a number of K (1024 bytes, four sectors), which may not be given with REC or LRL (Parameter error). With neither, or with 0, the command gives Parameter error: CREATE MAIL/DAT:3, the manual's example of a file made with no space, is refused (6.2 and 6.3.0 have the same test). SIZE is multiplied by 4 into a 16 bit count, so SIZE=16384 and more wrap round (B123). LRL may be 0 to 256, 0 and 256 both meaning 256.
2432CREATCD
LD DE,25C2H 11 C2 25LD DE,FCB
CREATCD: load Register Pair DE with 25C2H, the FCB, where @FSPEC puts the file spec (source: fetch filespec).
2435
LD A,4EH 3E 4E
Load Register A with 4EH, SVC 78, @FSPEC, which copies a file or device spec from the text at Register Pair HL into the buffer at Register Pair DE.
2437
RST 28H EF
Call @FSPEC with RST 28H (SYS1/SYS) to read the spec into the FCB at 25C2H; Register Pair HL moves past it, to the parameters.
2438
If @FSPEC returned NZ (no spec on the line, or one it cannot read) jump to SPCREQ at 254AH: File spec required (source: quit on bad name).
243B
LD DE,2598H 11 98 25LD DE,PRMTBL$
Load Register Pair DE with 2598H, PRMTBL$, the parameter table (source: get parms).
243E
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads a parameter list in parentheses at Register Pair HL against the table at Register Pair DE.
2440
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): with a list each response byte is first set to 00H, and each parameter given stores its value at the address in its entry and sets its response byte.
2441
If @PARAM returned NZ (a word not in the table or a bad value, error 44) jump to IOERR at 2514H (source: jump on parm error).
2444
LD A,(25ACH) 3A AC 25LD A,(LRESP)
Load Register A with the byte at 25ACH, LRESP, the response byte of LRL: not 00H when LRL was given (source: p/u LRL response).
2447
LD B,A 47
Load Register B with Register A, the LRL response.
2448
LD A,(25A5H) 3A A5 25LD A,(RRESP)
Load Register A with the byte at 25A5H, RRESP, the response byte of REC (source: p/u REC response).
244B
OR B B0
OR Register A with Register B: not 00H when LRL or REC was given (source: either specified).
244C
If neither LRL nor REC was given jump to RPARM at 2455H: SIZE is allowed.
244E
LD A,(259EH) 3A 9E 25LD A,(SRESP)
Load Register A with the byte at 259EH, SRESP, the response byte of SIZE (source: size can't be used with REC or LRL).
2451
OR A B7
OR Register A with itself: NZ when SIZE was given too.
2452
If SIZE was given with LRL or REC jump to PRMERR at 2512H: Parameter error.
2455RPARM
LD BC,0000H 01 00 00
RPARM: load Register Pair BC with the number of records; the operand at 2456H-2457H (0000H in the file) is the value of REC, or SIZE times 4 from 2466H (source: p/u number of records).
2458
LD A,B 78
Load Register A with Register B, the high byte of the record count.
2459
OR C B1
OR Register A with Register C, the low byte: Z when the count is 0 (REC not given, or REC=0).
245A
If a record count was given jump to LPARM at 2469H.
245CSPARM
LD HL,0000H 21 00 00
SPARM: load Register Pair HL with the value of SIZE in K; the operand at 245DH-245EH is 0000H in the file (source: p/u size parm).
245F
LD A,H 7C
Load Register A with Register H, the high byte of the size.
2460
OR L B5
OR Register A with Register L, the low byte: Z when SIZE was not given or was 0.
2461
If no size was given either jump to PRMERR at 2512H: Parameter error; CREATE always needs REC or SIZE (source: err if size not entered).
2464
ADD HL,HL 29
Add Register Pair HL to itself: the size times 2 (source: x 2).
2465
ADD HL,HL 29
Add Register Pair HL to itself again: the size times 4, the number of 256 byte records in that many K; the 16 bits keep only (SIZE x 4) modulo 65536, which is (SIZE modulo 16384) x 4 (B123).
2466
LD (2456H),HL 22 56 24
Store Register Pair HL into 2456H-2457H, RPARM's operand: the size becomes the record count, read at 24BBH and 24FDH (source: pretend it's rec input).
2469LPARM
LD BC,0000H 01 00 00
LPARM: load Register Pair BC with the value of LRL; the operand at 246AH-246BH (0000H in the file) is set by @PARAM (source: p/u LRL).
246C
LD A,B 78
Load Register A with Register B, the high byte of the LRL (source: test for more than 256).
246D
OR A B7
OR Register A with itself: Z when the LRL is 0 to 255.
246E
If the high byte is 00H jump to LP1 at 2478H and use the low byte (source: just use lo-order).
2470
DEC A 3D
Decrement Register A: Z only when the high byte was 01H (source: test hi-order = 1).
2471
If the high byte was more than 01H jump to PRMERR at 2512H: Parameter error.
2474
OR C B1
OR Register A, now 00H, with Register C, the low byte (source: p/u lo-order).
2475
If the low byte is not 00H (an LRL of 257 to 511) jump to PRMERR at 2512H: only 256 passes (source: lo-order must be 0).
2478LP1
OR C B1
LP1: OR Register A with Register C: Register A = the LRL's low byte, 00H for an LRL of 0 or 256 (source: merge lo-order).
2479H - Open the File and Take the Space
@INIT opens the file, or makes it when it does not exist (on the first drive with room when no drive is given), with the LRL from Register B; an existing file with another LRL gives error 42. CREATE shows Creating: and the name, keeps the ERN and end of file offset for the close (240DH, 2413H) and compares the file's records (@LOF) with the count asked for: a file that already has as many records or more (an equal number too) is refused with File exists larger, and is left open. Otherwise it positions to the last record asked for and writes it, so that @WRITE allocates every granule up to it: with an LRL of 256 a sector of E5H, with a smaller LRL one E5H and the rest of the record as the sector held it, as the buffer at 2600H is also the FCB's buffer, into which @WRITE reads the sector. Then it rewinds and marks the directory entry CREATED (SETCRE). @POSN past the end of file always returns error 29, so its result must not be tested; @LOF's is not tested either. An error after the @INIT leaves the file open and, when it was new, in the directory; when the diskette runs out of room the file keeps every granule it took (B130).
2479
LD DE,25C2H 11 C2 25LD DE,FCB
Load Register Pair DE with 25C2H, the FCB that @FSPEC filled (source: open the file).
247C
LD HL,2600H 21 00 26LD HL,BUFFER
Load Register Pair HL with 2600H, the 256 byte buffer for the file, after the member.
247F
LD B,A 47
Load Register B with Register A, the LRL: 00H for 256 (the default) (source: LRL = 256, or user entry).
2480
LD A,3AH 3E 3A
Load Register A with 3AH, SVC 58, @INIT, which opens an existing file or makes a new one.
2482
RST 28H EF
Call @INIT with RST 28H (SYS2/SYS) for the FCB at Register Pair DE, the buffer at Register Pair HL and the LRL in Register B. A device spec is opened too: the FCB becomes a DCB routed to the device (SYS2's DEVOPEN), FCB+0 = 10H (B125).
2483
If @INIT returned NZ (no room, write protected, error 42 for another LRL and so on) jump to IOERR at 2514H (source: jump on init error).
2486
LD DE,2589H 11 89 25LD DE,FILESP
Load Register Pair DE with 2589H, FILESP, the 15 byte buffer for the name that is shown (source: DE to filespec).
2489
LD BC,(25C8H) ED 4B C8 25
Load Register Pair BC with the word at 25C8H-25C9H: FCB+6 (Register C, the drive) and FCB+7 (Register B, the DEC of the entry), or the two letters of a device (source: p/u drive number, DEC).
248D
LD A,(25C2H) 3A C2 25LD A,(FCB)
Load Register A with the byte at 25C2H, FCB+0: bit 7 set for an open file, clear for a device (source: p/u to test device/file).
2490
Call $FNAME at 2534H, which writes the name of the file or device into FILESP at Register Pair DE, ended by 03H.
2493
If $FNAME returned NZ (@FNAME failed) jump to IOERR at 2514H (source: leave on error).
2496
LD HL,257FH 21 7F 25LD HL,CREATE$
Load Register Pair HL with 257FH, CREATE$, Creating: , which runs into FILESP (2589H) up to its 03H.
2499
LD A,0AH 3E 0A
Load Register A with 0AH, SVC 10, @DSPLY, which shows the text at Register Pair HL up to 03H or a carriage return.
249B
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS): Creating: and the name, with no carriage return after the 03H.
249C
If @DSPLY returned NZ jump to IOERR at 2514H (source: quit on dsply error).
249F
LD C,0DH 0E 0D
Load Register C with 0DH, the carriage return that ends the line (source: end line).
24A1
LD A,02H 3E 02
Load Register A with 02H, SVC 2, @DSP, which shows the character in Register C.
24A3
RST 28H EF
Call @DSP with RST 28H (BOOT/SYS) to end the line.
24A4
If @DSP returned NZ jump to IOERR at 2514H, the error number in Register A.
24A7
LD HL,(25CEH) 2A CE 25
Load Register Pair HL with the word at 25CEH-25CFH, FCB+12 and FCB+13, the file's ending record number as @INIT left it: 0000H for a new file (source: p/u ERN).
24AA
LD (240EH),HL 22 0E 24
Store Register Pair HL into 240EH-240FH, the operand of ERN (240DH), which puts it back before the close.
24AD
LD A,(25CAH) 3A CA 25
Load Register A with the byte at 25CAH, FCB+8, the end of file offset (source: p/u offset byte).
24B0
LD (2414H),A 32 14 24
Store Register A into 2414H, the operand of OFFSET (2413H).
24B3BIGGER
LD DE,25C2H 11 C2 25LD DE,FCB
BIGGER: load Register Pair DE with 25C2H, the FCB (source: DE to FCB+0).
24B6
LD A,40H 3E 40
Load Register A with 40H, SVC 64, @LOF, which returns in Register Pair BC the number of records in the file.
24B8
RST 28H EF
Call @LOF with RST 28H (SYS0/SYS): Register Pair BC = the records up to the end of file (not the space allocated); its result is not tested, and for a device CKOPEN@ refuses the FCB with error 38 (source: get length of file).
24B9
LD H,B 60
Load Register H with Register B, the high byte of the record count (source: move len to HL).
24BA
LD L,C 69
Load Register L with Register C: Register Pair HL = the records the file has.
24BB
LD BC,(2456H) ED 4B 56 24
Load Register Pair BC with the word at 2456H-2457H, the records asked for (REC, or SIZE times 4) (source: p/u number of records).
24BF
XOR A AF
Clear Register A to 00H and the Carry flag for the SBC (source: clear carry).
24C0
PUSH HL E5
Save Register Pair HL, the records the file has, on the stack (source: save ERN).
24C1
SBC HL,BC ED 42
Subtract Register Pair BC from Register Pair HL: No Carry when the file already has as many records as asked for, or more (source: is new ERN more than old ERN).
24C3
POP HL E1
Restore Register Pair HL, the records the file has, from the stack; the POP leaves the flags.
24C4
If the file has as many records or more jump to BADSIZ at 254EH: File exists larger, also for an equal size, with the file left open (source: go if not).
24C7
DEC BC 0B
Decrement Register Pair BC to the number of the last record asked for, counting from 0 (source: reduce to offset from 0).
24C8
LD A,42H 3E 42
Load Register A with 42H, SVC 66, @POSN, which positions the file at record Register Pair BC.
24CA
RST 28H EF
Call @POSN with RST 28H (SYS0/SYS) to position at the last record; for a record past the end of file it returns NZ with error 29, which is why its result is not tested (source: position to new ERN).
24CB
LD HL,2600H 21 00 26LD HL,BUFFER
Load Register Pair HL with 2600H, the FCB's buffer (source: buffer area).
24CE
LD DE,2601H 11 01 26
Load Register Pair DE with 2601H, the byte after it, for an LDIR that spreads the first byte over the buffer (source: format a sector).
24D1
LD BC,00FFH 01 FF 00
Load Register Pair BC with 00FFH, 255 bytes to copy.
24D4
LD (HL),0E5H 36 E5
Store E5H into the byte at Register Pair HL, 2600H, the first byte of the record to write (source: format a sector).
24D6
LDIR ED B0
Copy Register Pair BC = 255 bytes from Register Pair HL to Register Pair DE with LDIR: 2600H-26FFH all E5H; Register Pair HL ends at 26FFH.
24D8
LD DE,25C2H 11 C2 25LD DE,FCB
Load Register Pair DE with 25C2H, the FCB (source: write the new ERN sector).
24DB
DEC H 25
Decrement Register H: Register Pair HL from 26FFH to 25FFH.
24DC
INC HL 23
Increment Register Pair HL to 2600H, the buffer's first byte, the record to write (source: set HL = buffer start).
24DD
Call WRITE at 250DH to write the last record: @WRITE allocates the granules up to it, and the end of file moves past it; with an LRL below 256 the record taken from 2600H is one E5H and the rest of what @WRITE read into that buffer (source: write the last record).
24E0
LD A,44H 3E 44
Load Register A with 44H, SVC 68, @REW, which positions the file at record 0.
24E2
RST 28H EF
Call @REW with RST 28H (SYS0/SYS) for the FCB at Register Pair DE, for the FILL that may follow (source: rewind file).
24E3
LD BC,(25C8H) ED 4B C8 25
Load Register Pair BC with the word at 25C8H-25C9H, FCB+6 (Register C, the drive) and FCB+7 (Register B, the DEC), for @DIRRD (source: get drive number and DEC).
24E7
Call SETCRE at 2526H, which sets DIR+1 bit 7, CREATED, in the file's directory entry (631) (source: set create flag in directory).
24EAH - FILL and the Exits
Without FILL the work is done. With FILL the buffers 2600H-27FFH are filled with the low byte of its value and the records asked for are written from record 0, so that the file's space holds that byte; the end of file is then put back (240DH), so the filled records lie past it. FILL given alone fills with FFH, FILL=N (or OFF, NO) with 00H, FILL="A" with the low byte of the string's address, and FILL=256 not at all (B124). On an existing file the fill writes over the records it already had, from record 0 (B126). With an LRL below 256 the last filled sector may still be only in the buffer at the close, whose write of it moves the end of file (B129). WRITE writes one record and goes to IOERR on an error, through a DB 21H that hides PRMERR's LD A,2CH; SPCREQ and BADSIZ show their message through @LOGOT and leave with FFFFH.
24EAFILL
LD BC,0100H 01 00 01
FILL: load Register Pair BC with the value of FILL; the operand at 24EBH-24ECH is 0100H in the file, kept when FILL is not given (source: p/u FILL parm).
24ED
DEC B 05
Decrement Register B: Z only when the high byte was 01H, FILL not given (or FILL=256 to 511).
24EE
RET Z C8
Return to 240DH when there is no fill: the file is closed there.
24EF
PUSH DE D5
Save Register Pair DE, the FCB, on the stack (source: save FCB pointer).
24F0
LD HL,2600H 21 00 26LD HL,BUFFER
Load Register Pair HL with 2600H, the FCB's buffer (source: I/O buffer).
24F3
LD (HL),C 71
Store Register C, the low byte of FILL, into the byte at Register Pair HL, 2600H: FFH for FILL alone, 00H for FILL=N (source: byte to xfer).
24F4
LD DE,2601H 11 01 26
Load Register Pair DE with 2601H, the next byte.
24F7
LD BC,01FFH 01 FF 01
Load Register Pair BC with 01FFH, 511 bytes, the rest of both buffers (source: hit both buffers).
24FA
LDIR ED B0
Copy Register Pair BC = 511 bytes from Register Pair HL to Register Pair DE with LDIR: 2600H-27FFH all hold the fill byte (source: xfer into buffer).
24FC
POP DE D1
Restore Register Pair DE, the FCB, from the stack (source: restore FCB pointer).
24FD
LD BC,(2456H) ED 4B 56 24
Load Register Pair BC with the word at 2456H-2457H, the number of records asked for (source: p/u last record).
2501
LD HL,2700H 21 00 27LD HL,UBUFF
Load Register Pair HL with 2700H, the record buffer for an LRL below 256 (source: user buffer).
2504WRLOOP
LD A,B 78
WRLOOP: load Register A with Register B, the high byte of the records still to write (source: is rec cnt = 0).
2505
OR C B1
OR Register A with Register C, the low byte: Z when no record is left.
2506
RET Z C8
Return to 240DH when every record has been written (source: yes, done).
2507
Call WRITE at 250DH to write the next record, from 2700H for an LRL below 256 or the FCB's buffer at 2600H for 256; a Disk space full here leaves the file open with every granule it took (B130) (source: write record).
250A
DEC BC 0B
Decrement Register Pair BC, the records still to write (source: dec one).
250B
Jump back to WRLOOP at 2504H (source: do til BC = 0).
250DWRITE
LD A,4BH 3E 4B
WRITE: load Register A with 4BH, SVC 75, @WRITE, which writes the next record (through @VER when VERIFY is on) (source: write buffer).
250F
RST 28H EF
Call @WRITE with RST 28H (SYS0/SYS) for the FCB at Register Pair DE.
2510
RET Z C8
Return if @WRITE returned Z (source: good, RETurn).
2511
DEFB 21H 21
2511H: the first byte of an LD HL,nnnn that swallows PRMERR's LD A,2CH (2512H-2513H), so that a write error goes on to IOERR with its own number in Register A (source: skip LD A instruction).
2512PRMERR
LD A,2CH 3E 2C
PRMERR: load Register A with 2CH, error 44, Parameter error.
2514IOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number (source: save error number in HL).
2515
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
2517
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: short error message).
2519
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
251A
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message.
251C
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short error message; the file stays open.
251DSAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 251EH-251FH, the value stored at 2400H (0000H in the file) (source: p/u original SP).
2520
RET C9
Return through the tail of RST28 (1A77H) to @EXIT or to the caller of @CMNDR with Register Pair HL = the error number, or FFFFH from ABORT (source: done, RETurn).
2521H - CLRCRE, SETCRE and $FNAME
SETCRE reads the file's directory entry with @DIRRD, sets bit 7 of DIR+1, CREATED (DIR shows S: rather than S= for such a file, and @CLOSE keeps the granules past the end of file), and writes the entry back with @DIRWR. CLRCRE, for SHRINK, first turns the SET 7,(HL) at 252CH into RES 7,(HL) by storing BEH into its second byte. $FNAME puts the name to show into FILESP: @FNAME for a file, an asterisk and the two letters at FCB+6 and FCB+7 for a device.
2521CLRCRE
LD A,0BEH 3E BE
CLRCRE: load Register A with BEH, the second byte of RES 7,(HL) (631).
2523
LD (252DH),A 32 2D 25LD (CREFLG),A
Store Register A into 252DH, the second byte of the SET 7,(HL) at 252CH: it becomes RES 7,(HL), and CLRCRE falls into SETCRE (631).
2526SETCRE
LD A,57H 3E 57
SETCRE: load Register A with 57H, SVC 87, @DIRRD, which reads the directory entry of drive Register C, DEC Register B (631).
2528
RST 28H EF
Call @DIRRD with RST 28H (SYS0/SYS): Register Pair HL = the entry in the directory buffer.
2529
If @DIRRD returned NZ jump to IOERR at 2514H, the error number in Register A (631).
252B
INC HL 23
Increment Register Pair HL to DIR+1, the byte of the CREATED bit, the date flags and the month (631).
252C
SET 7,(HL) CB FE
Set bit 7 of the byte at Register Pair HL, DIR+1: CREATED; RES 7,(HL) after CLRCRE has changed the byte at 252DH (631).
252E
LD A,58H 3E 58
Load Register A with 58H, SVC 88, @DIRWR, which writes the directory sector back for drive Register C, DEC Register B (631).
2530
RST 28H EF
Call @DIRWR with RST 28H (SYS0/SYS) to write the changed entry.
2531
If @DIRWR returned NZ jump to IOERR at 2514H, the error number in Register A (631).
2533
RET C9
Return to 24EAH (SETCRE) or to 242EH (CLRCRE) (631).
2534$FNAME
BIT 7,A CB 7F
$FNAME: test bit 7 of Register A, FCB+0: set for an open file, clear for a device (source: test device/file).
2536
If bit 7 is clear (a device) jump to FNAME1 at 253CH (source: go if device).
2538
LD A,50H 3E 50
Load Register A with 50H, SVC 80, @FNAME, which writes the name of the file of drive Register C, DEC Register B to Register Pair DE.
253A
RST 28H EF
Call @FNAME with RST 28H (SYS3/SYS): NAME/EXT:d and 03H into FILESP at 2589H.
253B
RET C9
Return to 2493H with the flags of @FNAME: NZ for a DEC beyond the directory (error 16) or a directory read error (17).
253CFNAME1
LD A,2AH 3E 2A
FNAME1: load Register A with 2AH, the asterisk of a device spec (source: stuff device indicator).
253E
LD (DE),A 12
Store Register A into the byte at Register Pair DE, FILESP's first byte.
253F
INC DE 13
Increment Register Pair DE to the next byte of FILESP.
2540
LD A,C 79
Load Register A with Register C, FCB+6, the first letter of the device (source: stuff 1st character).
2541
LD (DE),A 12
Store Register A into the byte at Register Pair DE.
2542
INC DE 13
Increment Register Pair DE to the next byte of FILESP.
2543
LD A,B 78
Load Register A with Register B, FCB+7, the second letter (source: stuff 2nd character).
2544
LD (DE),A 12
Store Register A into the byte at Register Pair DE.
2545
INC DE 13
Increment Register Pair DE to the byte after the name.
2546
LD A,03H 3E 03
Load Register A with 03H, the end mark that @DSPLY stops at (source: stuff ETX).
2548
LD (DE),A 12
Store Register A into the byte at Register Pair DE, after the name.
2549
RET C9
Return to 2493H with the Z flag of the BIT at 2534H: CREATE goes on with the device; @LOF then refuses the FCB and leaves Register Pair BC = the second letter and 0DH, 520DH for PR, taken as the file's records (B125).
254AH - SPCREQ, BADSIZ, ABORT and the Data
Two messages shown through @LOGOT, then ABORT's FFFFH; the texts, the name buffer FILESP (not in the file), the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), and the first byte of the FCB; its other 31 bytes follow the member and have no row. The kinds are not checked (SYS1), so a string given to FILL is taken too.
254ASPCREQ
LD HL,2559H 21 59 25LD HL,SPCREQ$
SPCREQ: load Register Pair HL with 2559H, SPCREQ$, File spec required.
254D
DEFB 0DDH DD
254DH: the DDH that makes the next LD HL,256CH an LD IX,256CH, so that SPCREQ keeps Register Pair HL at its own message; Index Register IX is changed and not used after.
254EBADSIZ
LD HL,256CH 21 6C 25LD HL,BADSIZ$
BADSIZ: load Register Pair HL with 256CH, BADSIZ$, File exists larger.
2551
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and sends it to the JL device too.
2553
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message (source: log error message).
2554ABORT
LD HL,0FFFFH 21 FF FF
ABORT: load Register Pair HL with FFFFH, the return code after a message of the member's own or a BREAK (631) (source: set abort code).
2557
Jump to SAVESP at 251DH, which restores the Stack Pointer of the entry and returns.
2559-256BSPCREQ$
DEFM "File spec required" / DEFB 0DH 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 0D
SPCREQ$, 2559H-256BH: the message of SPCREQ (254AH), ended by its carriage return.
256C-257EBADSIZ$
DEFM "File exists larger" / DEFB 0DH 46 69 6C 65 20 65 78 69 73 74 73 20 6C 61 72 67 65 72 0D
BADSIZ$, 256CH-257EH: the message of BADSIZ (254EH), ended by its carriage return.
257F-2588CREATE$
DEFM "Creating: " 43 72 65 61 74 69 6E 67 3A 20
CREATE$, 257FH-2588H: the start of the line shown at 2496H; it has no end mark and runs into FILESP.
2589-2597FILESP
DEFS 15
FILESP, 2589H-2597H: 15 bytes not in the file (the member's third load block starts at 2598H); $FNAME writes the name and its 03H here (2490H).
2598PRMTBL$
DEFB 80H 80
PRMTBL$, 2598H: 80H, the mark of a table in the enhanced format (243BH).
2599-259D
DEFB 94H / DEFM "SIZE" 94 53 49 5A 45
2599H-259DH: type 94H (a number, a one letter short form, four letters) and the name SIZE.
259E-25A0SRESP
DEFB 00H / DEFW 245DH 00 5D 24
SRESP, 259EH, the response byte of SIZE (read at 244EH), and the address of its value, 245DH, SPARM's operand.
25A1-25A4
DEFB 93H / DEFM "REC" 93 52 45 43
25A1H-25A4H: type 93H (a number, a short form, three letters) and the name REC.
25A5-25A7RRESP
DEFB 00H / DEFW 2456H 00 56 24
RRESP, 25A5H, the response byte of REC (read at 2448H), and the address of its value, 2456H, RPARM's operand.
25A8-25AB
DEFB 93H / DEFM "LRL" 93 4C 52 4C
25A8H-25ABH: type 93H (a number, a short form, three letters) and the name LRL.
25AC-25AELRESP
DEFB 00H / DEFW 246AH 00 6A 24
LRESP, 25ACH, the response byte of LRL (read at 2444H), and the address of its value, 246AH, LPARM's operand.
25AF-25B3
DEFB 0D4H / DEFM "FILL" D4 46 49 4C 4C
25AFH-25B3H: type D4H (a flag or a number, a short form, four letters) and the name FILL.
25B4-25B6FRESP
DEFB 00H / DEFW 24EBH 00 EB 24
FRESP, 25B4H, the response byte of FILL (never read), and the address of its value, 24EBH, FILL's operand.
25B7-25BD
DEFB 46H / DEFM "SHRINK" 46 53 48 52 49 4E 4B
25B7H-25BDH: type 46H (a flag, no short form, six letters) and the name SHRINK (631).
25BE-25C0
DEFB 00H / DEFW 2426H 00 26 24
25BEH, the response byte of SHRINK (never read), and the address of its value, 2426H, SHRINK's operand (631).
25C1
DEFB 00H 00
25C1H: the 00H that ends the table, both for @PARAM's loop that zeroes the response bytes and for @FNDPRM.
25C2FCB
DEFB 00H 00
FCB, 25C2H: the first byte of the 32 byte FCB, the last byte of the member; FCB+1 to FCB+31 (25C3H-25E1H) follow the member with no bytes in the file.
2400H - Member 8 (AUTO): Entry and Exit
SYS1/SYS runs AUTO with request 11H; its header (file offset 0069H: record 16H, byte F4H) points at member 8, which the overlay loader reads to 2400H-24A9H, one load block of 170 bytes, and calls at 2400H with Register Pair HL at the text after the word AUTO. AUTO writes, shows or runs the command kept in sector 2 of cylinder 0 of a diskette (the start of INBUF$, 0420H, once BOOT/SYS is loaded), which SYS0/SYS runs at start-up. The entry keeps the Stack Pointer for the exits, tests no BREAK and calls no @CKBRKC. Its one 631 change: the JR C,ILDRIVE after the SUB 30H at SKIPINC (2461H) is dropped, as the CP 08H after it catches a character below the digit 0 as well.
2400AUTO
LD (240BH),SP ED 73 0B 24
AUTO: AUTO's entry (request 11H): store the Stack Pointer into 240BH-240CH, the operand of the LD SP at SAVESP (240AH), so that every exit returns at the depth of the entry (source: save SP address).
2404
Call PARSE at 240EH, which does the command and returns to 2407H when it is done without an error.
2407
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code for no error (source: set no error); after AUTO = through @CMNDR this replaces whatever the kept command returned (B128).
240ASAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 240BH-240CH, the value stored at 2400H (0000H in the file); IOERR jumps here at 24A7H with Register Pair HL = the error number.
240D
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, which CLEANUP left under SYS1's entry, or to the caller of @CMNDR, with Register Pair HL = 0000H or the error number.
240EH - PARSE: The Three Forms
The first character after the spaces chooses the form: a question mark shows the command kept on the diskette, an equals sign runs it, anything else is the new command to write (with no command a carriage return is written, which removes the kept one). A drive spec :d may come first; with none drive 0 is used.
240EPARSE
DEC HL 2B
PARSE: decrement Register Pair HL by one, so that the INC at 240FH comes back to the first character after the word AUTO (source: back one).
240FPARSE2
INC HL 23
PARSE2: increment Register Pair HL to the next character of the command line (source: bump buff ptr).
2410
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character of the command line.
2411
CP 20H FE 20
Compare Register A with 20H, a space, which is passed over before the form.
2413
If Register A is a space jump back to 240FH, PARSE2, for the next character: the spaces before the form are passed over.
2415
CP 3FH FE 3F
Compare Register A with 3FH, the question mark (source: display auto buffer).
2417
If Register A is the question mark jump to DISAUTO at 2422H, which shows the command kept on the diskette.
2419
CP 3DH FE 3D
Compare Register A with 3DH, the equals sign (source: execute auto buffer).
241B
If Register A is the equals sign jump to EXAUTO at 242CH, which runs the command kept on the diskette.
241D
Call GETDRV at 2451H with Register A = the first character: a colon and a digit choose the drive (stored at 2494H) and move Register Pair HL to the command after them; anything else leaves drive 0 and Register Pair HL at the first character.
2420
Jump to WRBUFF at 246DH, which reads sector 2, puts the new command into it from Register Pair HL and writes it back, then returns to 2407H (source: write new auto and RETurn).
2422H - DISAUTO and EXAUTO: Show or Run the Kept Command
AUTO ? reads sector 2 and gives the kept command to @LOGOT, so that it is shown and also sent to the JL log; an empty command shows as an empty line. AUTO = reads it and runs it: a leading asterisk (the form that SYS0/SYS runs with BREAK disabled) is passed over and SFLAG$ bit 4 is set, which disables the BREAK key until SYSTEM (BREAK=ON); then the command goes to @CMNDI, which never returns, or to @CMNDR when AUTO itself was run by @CMNDR.
2422DISAUTO
DISAUTO: call GETAUTO at 2447H, which takes the drive spec after the question mark, reads sector 2 and returns Register Pair HL = 2520H, the kept command in the sector buffer.
2425
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL to its carriage return and sends it to the JL device too.
2427
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the kept command at 2520H (source: display it).
2428
If @LOGOT returned NZ jump to IOERR at 249EH with Register A = the error number (source: NZ I/O error).
242B
RET C9
Return to 2407H, the code after the CALL at 2404H: the command ends with 0000H (source: Z done).
242CEXAUTO
EXAUTO: call GETAUTO at 2447H, which takes the drive spec after the equals sign, reads sector 2 and returns Register Pair HL = 2520H, the kept command.
242F
LD A,65H 3E 65
Load Register A with 65H, SVC 101, @FLAGS, which points Index Register IY to FLGTAB$ (006AH).
2431
RST 28H EF
Call @FLAGS with RST 28H (SYS0/SYS): Index Register IY = 006AH for the flag tests below.
2432
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, 2520H, the first character of the kept command (source: p/u first character).
2433
CP 2AH FE 2A
Compare Register A with 2AH, the asterisk that marks a command to be run with BREAK disabled (source: non-BREAKable auto).
2435
If Register A is not the asterisk jump to DOAUTO at 243CH, which runs the command as it is.
2437
INC HL 23
Increment Register Pair HL past the asterisk to the command itself (source: bump to next char).
2438
SET 4,(IY+12H) FD CB 12 E6
Set bit 4 of SFLAG$ (IY+12H, 007CH), Index Register IY holding 006AH: the BREAK key is disabled, as SYS0/SYS does for such a command at start-up; it stays so until SYSTEM (BREAK=ON) (source: disable BREAK).
243CDOAUTO
BIT 1,(IY+02H) FD CB 02 4E
DOAUTO: test bit 1 of CFLAG$ (IY+02H, 006CH), Index Register IY holding 006AH: set while a command given to @CMNDR runs (source: if CMNDR executing, then exit via CMNDR).
2440
LD A,19H 3E 19
Load Register A with 19H, SVC 25, @CMNDR, for the case of AUTO run by @CMNDR; the LD leaves the flags of the BIT.
2442
If bit 1 is set jump to 0028H, the RST 28H vector (the source's RST28 is its own EQU 28H, not the dispatcher RST28 at 1A5BH), with Register A = 19H: @CMNDR runs the kept command at Register Pair HL and returns to the address on the stack, 2407H in this member. A command that loads over 2400H, such as a library command, has overwritten that code by then (B122).
2445
DEC A 3D
Decrement Register A from 19H to 18H, SVC 24, @CMNDI (source: else readjust to CMNDI and exit).
2446
RST 28H EF
Call @CMNDI with RST 28H (SYS1/SYS): it copies the kept command at Register Pair HL to INBUF$ and runs it as if typed at LS-DOS Ready; it does not return.
2447H - GETAUTO and GETDRV: The Drive and Sector 2
GETAUTO moves past the question mark or equals sign, takes a drive spec with GETDRV and reads sector 2 of that drive; it returns Register Pair HL at the command in the buffer (2520H) and Register Pair DE at the command line. The :d must follow the ? or = with no space (AUTO ? :1 uses drive 0), and after the word AUTO it must be set off by a space: in AUTO:1 BASIC, SYS1's @FSPEC takes :1 as the drive of the command word and AUTO writes BASIC on drive 0. GETDRV takes :d with d from 0 to 7 (any other character after the colon gives Illegal drive number, error 32) and stores the drive into the operand at 2494H, 00H in the file, so that drive 0 is used with no spec. After the digit it moves over one more character unless it is the end of the line, whatever that character is, so the command must be separated from :d by a space (B121); AUTO :1 ? writes the question mark as the command.
2447GETAUTO
INC HL 23
GETAUTO: increment Register Pair HL past the question mark or the equals sign (source: bump to next char).
2448
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of a drive spec if there is one.
2449
Call GETDRV at 2451H: a colon and a digit in Register A and after it choose the drive.
244C
Call RDBOOT at 2482H to read sector 2 of the drive into 2500H-25FFH; it returns Register Pair DE = 2520H, the command kept in the sector, and Register Pair HL kept.
244F
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = 2520H, the kept command, and Register Pair DE = the place in the command line (source: pt HL to auto buffer).
2450
RET C9
Return to DISAUTO or EXAUTO with Register Pair HL at the kept command.
2451GETDRV
CP 0EH FE 0E
GETDRV: compare Register A with 0EH: a control character such as the carriage return that ends the line is below it (source: no drivespec).
2453
RET C D8
Return if Register A is below 0EH: no drive spec, drive 0 (the 00H at 2494H) is used.
2454
CP 3AH FE 3A
Compare Register A with 3AH, the colon that begins a drive spec (source: drivespec indicator).
2456
RET NZ C0
Return if Register A is not the colon: drive 0, with Register Pair HL still at that character.
2457
INC HL 23
Increment Register Pair HL to the character after the colon, the drive digit.
2458
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the drive digit (source: p/u drive number).
2459
INC HL 23
Increment Register Pair HL to the character after the digit (source: position to command).
245A
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character after the drive digit.
245B
CP 0EH FE 0E
Compare Register A with 0EH, to find the end of the line, a carriage return, after the drive spec.
245D
If Register A is below 0EH (the line ends after :d) jump to SKIPINC at 2460H and leave Register Pair HL on it.
245F
INC HL 23
Increment Register Pair HL over the character after the digit, which the source takes to be the space before the command; any other character is skipped as well, so AUTO :1BASIC keeps ASIC, and an asterisk right after the digit is lost, so the command is kept as breakable (B121).
2460SKIPINC
LD A,B 78
SKIPINC: load Register A with Register B, the drive digit.
2461
SUB 30H D6 30
Subtract 30H, the digit 0, from Register A: the drive number; a character below 0 gives D0H or more, which the CP 08H at 2466H refuses (6.3.1 dropped the JR C that followed in 6.3.0).
2463
LD (2494H),A 32 94 24
Store Register A, the drive number, into 2494H, the operand of the LD C at DRIVE (2493H), where BOOTIO takes it.
2466
CP 08H FE 08
Compare Register A with 08H, one more than the highest drive number (source: greater than 7).
2468
RET C D8
Return if Register A is below 08H: the drive is 0 to 7.
2469ILDRIVE
LD A,20H 3E 20
ILDRIVE: load Register A with 20H, error 32, Illegal drive number.
246B
Jump to IOERR at 249EH with Register A = 20H: the error is shown and the command ends through SAVESP.
246DH - WRBUFF, RDBOOT and BOOTIO: Read and Write Sector 2
WRBUFF reads sector 2 and copies the command line, from its first character that is not a space to the first byte below 0EH (the carriage return, kept), into the sector at 2520H, then writes the sector back. There is no length test, and none is needed: a typed line holds at most 79 characters, so after AUTO and a space the command is at most 74, the manual's figure, and ends by 256AH, before the copy of DCT$ (0470H in memory) that the sector holds at offset 70H; a line of 79 characters given to @CMNDI or @CMNDR keeps the 03H that SYS1 stores at 046FH as its end. RDBOOT checks the drive with @CKDRV (any failure, a drive with no diskette too, gives Illegal drive number) and reads; a write protected diskette is found only by @WRSEC (error 15). The sector is not tested to be an LS-DOS boot sector.
246DWRBUFF
WRBUFF: call RDBOOT at 2482H to read sector 2 of the drive into 2500H-25FFH; it returns Register Pair DE = 2520H and Register Pair HL kept at the command line.
2470
DEC HL 2B
Decrement Register Pair HL by one, so that the INC at 2471H comes back to the same character (source: skip leading spaces).
2471SKPSPCS
INC HL 23
SKPSPCS: increment Register Pair HL to the next character of the command line.
2472
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character.
2473
CP 20H FE 20
Compare Register A with 20H, a space, which is passed over before the command.
2475
If Register A is a space jump back to SKPSPCS at 2471H: the spaces before the command are not kept.
2477XFLP
LD A,(HL) 7E
XFLP: load Register A with the byte at Register Pair HL, the next character to copy (source: p/u byte).
2478
LDI ED A0
Copy the byte at Register Pair HL to Register Pair DE with LDI, which increments Register Pair HL and Register Pair DE and decrements Register Pair BC, a count not used here.
247A
CP 0EH FE 0E
Compare Register A, the byte just copied, with 0EH: a byte below it ends the command (source: EOL).
247C
If Register A is 0EH or more jump back to XFLP at 2477H: the carriage return (or 03H) is copied and ends the loop.
247EWRBOOT
LD A,35H 3E 35
WRBOOT: load Register A with 35H, SVC 53, @WRSEC, to write the sector back (source: write sector SVC number).
2480
Jump to BOOTIO at 248FH, which writes the buffer at 2500H to cylinder 0 sector 2 of the drive.
2482RDBOOT
LD A,(2494H) 3A 94 24
RDBOOT: load Register A with the byte at 2494H, the drive number that GETDRV stored (00H in the file).
2485
LD C,A 4F
Load Register C with Register A, the drive number, for @CKDRV.
2486
LD A,21H 3E 21
Load Register A with 21H, SVC 33, @CKDRV, which tests that the drive is enabled and holds a diskette (source: drive alive).
2488
RST 28H EF
Call @CKDRV with RST 28H (SYS2/SYS) for the drive in Register C; its Carry flag for a write protected diskette is not looked at.
2489
LD A,20H 3E 20
Load Register A with 20H, error 32, Illegal drive number, for the jump below; the LD leaves the flags of @CKDRV.
248B
If @CKDRV returned NZ (no drive, no diskette, or its GAT could not be read) jump to IOERR at 249EH with Register A = 20H: Illegal drive number in every case.
248D
LD A,31H 3E 31
Load Register A with 31H, SVC 49, @RDSEC, to read the sector (source: A = @RDSEC SVC number).
248FBOOTIO
PUSH HL E5
BOOTIO: save Register Pair HL, the place in the command line, on the stack (source: save command ptr).
2490
LD HL,2500H 21 00 25LD HL,BUFF
Load Register Pair HL with 2500H, the sector buffer, the 256 bytes after the member's code.
2493DRIVE
LD C,00H 0E 00
DRIVE: load Register C with the drive number; the operand at 2494H (00H in the file) is set by GETDRV at 2463H.
2495
LD DE,0002H 11 02 00LD DE,SECTOR
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2, the sector of BOOT/SYS that holds the kept command at offset 20H.
2498
RST 28H EF
Call @RDSEC or @WRSEC with RST 28H (SYS0/SYS), Register A = 31H or 35H, to read or write the sector at Register Pair HL, 2500H.
2499
POP HL E1
Restore Register Pair HL, the place in the command line, from the stack.
249A
LD DE,2520H 11 20 25
Load Register Pair DE with 2520H, the kept command at offset 20H of the sector (source: DE to auto command buff).
249D
RET Z C8
Return if the read or write gave Z, with Register Pair DE = 2520H.
249EIOERR
LD L,A 6F
IOERR: load Register L with Register A, the error number (source: set HL = error number).
249F
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the error number, the command's return code.
24A1
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone.
24A3
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR.
24A4
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message.
24A6
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short error message.
24A7
Jump to SAVESP at 240AH, which restores the Stack Pointer of the entry and returns with Register Pair HL = the error number.
2400H - Member 9 (BUILD): Entry, Exits and Messages
SYS1/SYS runs BUILD with request 33H; its header (file offset 0071H: record 17H, byte A5H) points at member 9, which the overlay loader reads to 2400H-25D4H and 25E4H-261DH (527 bytes in three load blocks; 25D5H-25E3H, the name buffer FILEBUF, is not loaded) and calls at 2400H with Register Pair HL at the text after the word BUILD. BUILD makes a file from lines typed at the keyboard (or read from a running JCL file, as @KEYIN takes its keys from there): it keeps every line in memory from 2800H up and writes them all with @PUT when the input ends. The entry saves the Stack Pointer before it tests BREAK (631), so that every exit returns through SAVESP, which also clears a BREAK still pending (the BREAK that ended the input) with @CKBRKC. Its 631 change is only that order: 6.3.0 tested BREAK first and returned at once.
2400START
LD (2410H),SP ED 73 10 24
START: store the Stack Pointer into 2410H-2411H, the operand of the LD SP at SAVESP (240FH), before anything else, so that every exit returns at the depth of the entry (631) (source: save SP address).
2404
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, which tests for a pending BREAK and clears it (631) (source: break key down?).
2406
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS): NZ when BREAK was pressed.
2407
If BREAK was pressed jump to ABORT at 2433H, which returns FFFFH through SAVESP (631).
2409
Call BUILD at 2438H, which reads the lines and writes the file; it returns here only when the file is written and closed (source: build a file).
240C
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code for no error (source: set no error).
240FSAVESP
LD SP,0000H 31 00 00
SAVESP: load the Stack Pointer with the word at 2410H-2411H, the value stored at 2400H (0000H in the file): every exit comes here, from inside any call (source: p/u original SP addr.).
2412
LD A,6AH 3E 6A
Load Register A with 6AH, SVC 106, @CKBRKC, to clear a BREAK still pending, so that the BREAK that ended the input does not stop the next command.
2414
RST 28H EF
Call @CKBRKC with RST 28H (BOOT/SYS); it keeps Register Pair HL, the return code, and its result is not looked at.
2415
RET C9
Return through the tail of RST28 (1A77H) to @EXIT, which CLEANUP left under SYS1's entry, or to the caller of @CMNDR, with Register Pair HL = 0000H, FFFFH or the error number (source: exit with retcode).
2416IOERR
LD H,00H 26 00
IOERR: load Register H with 00H, the high byte of the return code (source: set HL = error #).
2418
LD L,A 6F
Load Register L with Register A, the error number: Register Pair HL = the error number.
2419
OR 0C0H F6 C0
OR Register A with C0H: bit 7 asks @ERROR to return, bit 6 for the short message alone (source: short error mess and RET).
241B
LD C,A 4F
Load Register C with Register A, the error number with bits 7 and 6, for @ERROR (source: stuff in C).
241C
LD A,1AH 3E 1A
Load Register A with 1AH, SVC 26, @ERROR, which shows an error message (source: display error).
241E
RST 28H EF
Call @ERROR with RST 28H (the SYS0/SYS stub that loads SYS4/SYS) to show the short error message.
241F
Jump to SAVESP at 240FH, which restores the Stack Pointer of the entry and returns with Register Pair HL = the error number (source: abort).
2421BADIGS
LD HL,2594H 21 94 25LD HL,BADIGS$
BADIGS: load Register Pair HL with 2594H, BADIGS$, Bad hex digit encountered.
2424
DEFB 0DDH DD
2424H: the DDH that makes the next LD HL,2580H an LD IX,2580H, so that BADIGS keeps Register Pair HL at its own message; Index Register IX is changed and not used after.
2425ODDIGS
LD HL,2580H 21 80 25LD HL,ODDIGS$
ODDIGS: load Register Pair HL with 2580H, ODDIGS$, Odd # of hex digits.
2428
DEFB 0DDH DD
2428H: the DDH that makes the next LD HL,25AEH an LD IX,25AEH, so that BADIGS and ODDIGS keep Register Pair HL at their message.
2429SPCREQ
LD HL,25AEH 21 AE 25LD HL,SPCREQ$
SPCREQ: load Register Pair HL with 25AEH, SPCREQ$, File spec required.
242C
DEFB 0DDH DD
242CH: the DDH that makes the next LD HL,25C1H an LD IX,25C1H, so that the three messages above keep Register Pair HL at theirs.
242DEXISTS
LD HL,25C1H 21 C1 25LD HL,EXISTS$
EXISTS: load Register Pair HL with 25C1H, EXISTS$, File already exists.
2430
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows the text at Register Pair HL and, when JL is not NIL, also logs it there after the time.
2432
RST 28H EF
Call @LOGOT with RST 28H (BOOT/SYS) to show the message (source: log error message).
2433ABORT
LD HL,0FFFFH 21 FF FF
ABORT: load Register Pair HL with FFFFH, the return code after a BREAK pending at the entry or a message of the command's own; a BREAK that ends the input returns 0000H (source: set abort code).
2436
Jump to SAVESP at 240FH, which restores the Stack Pointer of the entry and returns with Register Pair HL = FFFFH.
2438H - BUILD: the File Spec, the Parameters and the Extension
BUILD reads the file spec with @FSPEC (none: File spec required) and gives it the extension JCL when it has none (a slash alone keeps it without one, as the manual says), then reads HEX and APPEND with @PARAM. It looks for the slash in the spec: an extension of KSM makes BUILD prompt A=> to Z=> for the 26 lines of a KSM file (the manual shows A>), and an extension of JCL limits a line to 79 characters instead of 255. A device spec passes @FSPEC too and is given the JCL extension, so its lines are limited to 79 characters. The loop's test for 0DH (2455H) never matches, as the spec ends with 03H, and its jump would pop a word that was never pushed; @FEXT always leaves a slash in the spec, so the loop always ends at it (B136).
2438BUILD
LD DE,261DH 11 1D 26LD DE,FCB1
BUILD: load Register Pair DE with 261DH, FCB1, the file's FCB (only its first byte is in the file), where @FSPEC puts the file spec (source: DE => FCB).
243B
LD A,4EH 3E 4E
Load Register A with 4EH, SVC 78, @FSPEC, which copies a file or device spec from the text at Register Pair HL into the buffer at Register Pair DE.
243D
RST 28H EF
Call @FSPEC with RST 28H (SYS1/SYS) to read the spec into FCB1 at 261DH; Register Pair HL moves past it, to the parameters (source: legal filespec?).
243E
If @FSPEC returned NZ (no spec on the line, or one it cannot read) jump to SPCREQ at 2429H: File spec required (source: no, Filespec req).
2440
PUSH HL E5
Save Register Pair HL, the place in the command line after the spec, on the stack (source: save cmd buf ptr).
2441
LD HL,2602H 21 02 26LD HL,JCLEXT
Load Register Pair HL with 2602H, JCLEXT, the three letters JCL, the default extension (source: HL => JCL).
2444
LD A,4FH 3E 4F
Load Register A with 4FH, SVC 79, @FEXT, which gives the spec in the FCB at Register Pair DE the extension at Register Pair HL when it has none.
2446
RST 28H EF
Call @FEXT with RST 28H (SYS1/SYS) for FCB1 at Register Pair DE, 261DH: a spec with no extension becomes NAME/JCL; a device spec such as PR, after its asterisk, becomes PR/JCL (source: fetch extension).
2447
POP HL E1
Restore Register Pair HL, the place in the command line after the spec, from the stack (source: rcvr command ptr).
2448
LD DE,260AH 11 0A 26LD DE,PRMTBL$
Load Register Pair DE with 260AH, PRMTBL$, the parameter table (source: DE => parameter table).
244B
LD A,11H 3E 11
Load Register A with 11H, SVC 17, @PARAM, which reads a parameter list in parentheses at Register Pair HL against the table at Register Pair DE.
244D
RST 28H EF
Call @PARAM with RST 28H (SYS1/SYS): HEX and APPEND store FFFFH into their value words when given (source: get any parameters).
244E
If @PARAM returned NZ (a word not in the table or a bad value) jump to IOERR at 2416H with Register A = 2CH, Parameter error (source: quit on parm error).
2450
LD HL,261DH 21 1D 26LD HL,FCB1
Load Register Pair HL with 261DH, FCB1, the start of the spec (source: point to start of FCB).
2453SLASH?
LD A,(HL) 7E
SLASH?: load Register A with the byte at Register Pair HL, the next character of the spec (source: p/u a char).
2454
INC HL 23
Increment Register Pair HL to the character after it (source: and bump pointer).
2455
CP 0DH FE 0D
Compare Register A with 0DH, a carriage return; the spec in the FCB ends with 03H, so this is never true (B136) (source: end of line?).
2457
If Register A is 0DH jump to NOTKSM at 2474H, whose POP would take a word not pushed on this path (B136); never taken (source: yes, not a KSM file).
2459
CP 2FH FE 2F
Compare Register A with 2FH, the slash before the extension (source: start of EXT?).
245B
If Register A is not the slash jump back to SLASH? at 2453H; @FEXT has made sure there is one (source: loop if not).
245D
PUSH HL E5
Save Register Pair HL, the first character of the extension, on the stack for NOTKSM (source: HL => extension).
245E
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the extension (source: p/u character).
245F
INC HL 23
Increment Register Pair HL to the second character of the extension (source: bump ptr).
2460
CP 4BH FE 4B
Compare Register A with 4BH, the letter K (source: match K?).
2462
If the first character is not K jump to NOTKSM at 2474H.
2464
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the second character of the extension.
2465
INC HL 23
Increment Register Pair HL to the third character of the extension.
2466
CP 53H FE 53
Compare Register A with 53H, the letter S (source: match S?).
2468
If the second character is not S jump to NOTKSM at 2474H.
246A
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the third character of the extension.
246B
CP 4DH FE 4D
Compare Register A with 4DH, the letter M (source: match M?).
246D
If the third character is not M jump to NOTKSM at 2474H.
246F
LD A,0FFH 3E FF
Load Register A with FFH, the mark of a KSM file.
2471
LD (24DAH),A 32 DA 24
Store Register A, FFH, into 24DAH, the operand of the LD A at KSM? (24D9H), so that the input prompts the letters A to Z (source: stuff KSM indicator).
2474NOTKSM
POP HL E1
NOTKSM: restore Register Pair HL from the stack: the first character of the extension (source: HL => extension field).
2475
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the extension (source: ck if EXT is JCL).
2476
INC HL 23
Increment Register Pair HL to the second character of the extension.
2477
CP 4AH FE 4A
Compare Register A with 4AH, the letter J (source: match J?).
2479
If the first character is not J jump to INIT at 248BH.
247B
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the second character of the extension.
247C
INC HL 23
Increment Register Pair HL to the third character of the extension.
247D
CP 43H FE 43
Compare Register A with 43H, the letter C (source: match C?).
247F
If the second character is not C jump to INIT at 248BH.
2481
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the third character of the extension.
2482
CP 4CH FE 4C
Compare Register A with 4CH, the letter L (source: match L?).
2484
If the third character is not L jump to INIT at 248BH.
2486
LD A,4FH 3E 4F
Load Register A with 4FH, 79, the longest line SYS1 takes as a command (CPL less 1) (source: max 79 cpl on JCL).
2488
LD (24F1H),A 32 F1 24
Store Register A, 4FH, into 24F1H, the high byte of the operand of the LD BC at LINLEN (24EFH): Register B, the length given to @KEYIN, becomes 79 instead of 255.
248BH - INIT: Open the File, APPEND and the Message
@INIT opens the file, or makes it on the first drive with room when no drive is given, with an LRL of 256; its Carry flag tells a new file from an existing one. An existing file of another LRL is refused by @INIT with error 42 before BUILD's own test, with or without APPEND, and its FCB is left open (B141). $FNAME puts the name into FILEBUF. An existing file without APPEND is closed again and refused with File already exists; with APPEND, @PEOF positions it to its end of file (its result is not tested) and the message is Appending: , an asterisk, KI to and the name; a new file shows Building: and the name. A device spec is opened by @INIT as a device with the Carry flag clear, like an existing file: without APPEND BUILD gives File already exists, with APPEND it sends the text to the device at the end (B137).
248BINIT
LD HL,2700H 21 00 27LD HL,IOBUF
INIT: load Register Pair HL with 2700H, IOBUF, the file's 256 byte buffer, the page after the FCB (no bytes in the file) (source: HL => I/O buffer).
248E
LD DE,261DH 11 1D 26LD DE,FCB1
Load Register Pair DE with 261DH, FCB1, the file spec (source: DE => FCB).
2491
LD B,00H 06 00
Load Register B with 00H, an LRL of 256 (source: B = LRL = 256).
2493
LD A,3AH 3E 3A
Load Register A with 3AH, SVC 58, @INIT, which opens an existing file or makes a new one (source: init the file).
2495
RST 28H EF
Call @INIT with RST 28H (SYS2/SYS) for FCB1 at Register Pair DE, the buffer at Register Pair HL and the LRL in Register B: Z and Carry for a new file, Z and No Carry for an existing file of LRL 256 or a device, NZ with 2AH for an existing file of another LRL.
2496
If @INIT returned NZ (no room, write protected, error 42 for an existing file of another LRL, its FCB left open, B141, and so on) jump to IOERRA at 24BDH, which goes on to IOERR (source: jump on error).
2498
PUSH AF F5
Save Register Pair AF on the stack: the Carry flag of @INIT, set for a new file (source: save Carry).
2499
LD DE,25D5H 11 D5 25LD DE,FILEBUF
Load Register Pair DE with 25D5H, FILEBUF, the 15 bytes not in the file where the name to show goes (source: DE => filespec).
249C
LD BC,(2623H) ED 4B 23 26
Load Register Pair BC with the word at 2623H-2624H, FCB1+6 (Register C, the drive, or the first letter of a device) and FCB1+7 (Register B, the DEC, or the second letter) (source: B = DEC, C = drive #).
24A0
LD A,(261DH) 3A 1D 26LD A,(FCB1)
Load Register A with the byte at 261DH, FCB1+0: bit 7 set for an open file, clear for a device (10H) (source: p/u to test device/file).
24A3
Call $FNAME at 256AH, which writes the name of the file or device into FILEBUF at Register Pair DE.
24A6
If $FNAME returned NZ (@FNAME found the DEC past the directory, error 16, or could not read the directory) jump to IOERRA at 24BDH with the file left open.
24A8
POP AF F1
Restore Register Pair AF from the stack: the flags of @INIT, Carry for a new file (source: F = status from @INIT).
24A9
LD HL,25E4H 21 E4 25LD HL,BMESS1
Load Register Pair HL with 25E4H, BMESS1, Building: (source: default Building).
24AC
If @INIT made a new file jump to SETBUF at 24C6H to show Building: and the name; LD leaves the flags (source: jump if new file).
24AEAPPEND
LD BC,0000H 01 00 00
APPEND: load Register Pair BC with the value of the APPEND parameter; the operand at 24AFH-24B0H (0000H in the file) is FFFFH when APPEND is given (source: p/u APPEND parameter).
24B1
LD DE,261DH 11 1D 26LD DE,FCB1
Load Register Pair DE with 261DH, FCB1, the open file or device (source: DE => FCB).
24B4
INC C 0C
Increment Register C, the low byte of the APPEND word: Z only when it was FFH, APPEND given (source: specified?).
24B5
If APPEND was given jump to APP1 at 24C0H, which positions to the end of the file (source: go if so).
24B7
LD A,3CH 3E 3C
Load Register A with 3CH, SVC 60, @CLOSE, which closes the file of the FCB at Register Pair DE (source: close to reset open bit).
24B9
RST 28H EF
Call @CLOSE with RST 28H (SYS3/SYS) for FCB1 at Register Pair DE, 261DH: the existing file, opened by @INIT and not written, is closed again; a device is closed by CLOSDEV.
24BA
If @CLOSE returned Z jump to EXISTS at 242DH: File already exists, and FFFFH, for an existing file or a device given without APPEND (B137) (source: quit with file exists).
24BDIOERRA
IOERRA: jump to IOERR at 2416H with Register A = the error number (source: or if error on close).
24C0APP1
LD A,41H 3E 41
APP1: load Register A with 41H, SVC 65, @PEOF, which positions the file of the FCB at Register Pair DE to its end of file (source: position to EOF).
24C2
RST 28H EF
Call @PEOF with RST 28H (SYS0/SYS) for FCB1 at Register Pair DE, 261DH; its result is not tested: Z with Register A = 00H when the end of file lies inside a sector, NZ with 1CH when it is on a sector boundary or the file is empty, NZ with 26H (File not open) for a device.
24C3
LD HL,25EFH 21 EF 25LD HL,BMESS2
Load Register Pair HL with 25EFH, BMESS2, Appending: , an asterisk, KI to (source: Appending KI to).
24C6SETBUF
SETBUF: call DSPLY at 2550H to show the message at Register Pair HL, 25E4H (Building: ) or 25EFH (Appending: ), ended by its 03H so that the cursor stays on the line (source: display message).
24C9
LD HL,25D5H 21 D5 25LD HL,FILEBUF
Load Register Pair HL with 25D5H, FILEBUF, the name of the file or device (source: filename buffer).
24CC
Call DSPLY at 2550H to show the name at Register Pair HL, 25D5H, ended by its 03H.
24CF
LD C,0DH 0E 0D
Load Register C with 0DH, a carriage return, to end the line (source: end line).
24D1
LD A,02H 3E 02
Load Register A with 02H, SVC 2, @DSP, which shows the character in Register C.
24D3
RST 28H EF
Call @DSP with RST 28H (BOOT/SYS) to end the message line.
24D4
If @DSP returned NZ jump to IOERRA at 24BDH, which goes on to IOERR.
24D6
LD HL,2800H 21 00 28LD HL,BUFFER
Load Register Pair HL with 2800H, BUFFER, the start of the text in memory, after IOBUF; the text grows upward from here with no limit (B139) (source: HL => input buffer).
24D9H - KSM?, LINLEN and HPARM: the Lines
For a KSM file each line is prompted with its letter, A=> to Z=>, and the input ends after Z. Each line is read by @KEYIN, at most 255 characters (79 for a JCL file), at Register Pair HL, the end of the text so far, where @KEYIN also puts the 0DH that ends it. Without HEX the line and its 0DH stay in memory; with HEX its characters are taken as pairs of hex digits and the bytes replace them, with no 0DH (the manual's packed format). BREAK, or the EOF key, ends the input only as the first key of a line; on a line with characters it ends the line as ENTER does. Any other error of @KEYIN ends BUILD through IOERR, the text lost. With HEX an odd number of digits gives Odd # of hex digits and a character that CVRTHEX does not take (B140) Bad hex digit encountered; BUILD then stops with the text not written, the file open and, when it was new, empty in the directory, as the manual says (the build will abort). An empty line with HEX does the same (B138). The text in memory has no upper limit (B139). HEX is tested by the low byte of its word only (24FCH), as APPEND is (24B4H), so HEX=255 counts as given and HEX=256 does not.
24D9KSM?
LD A,00H 3E 00
KSM?: load Register A with the KSM mark; the operand at 24DAH (00H in the file) is FFH for an extension of KSM, stored at 2471H (source: not zero if KSM).
24DB
OR A B7
Set the flags from Register A, the KSM mark: Z when the file is not a KSM file.
24DC
If the file is not a KSM file jump to LINLEN at 24EFH to read the next line (source: Z, not a KSM).
24DEKSM1
PUSH HL E5
KSM1: save Register Pair HL, the end of the text so far, on the stack (source: save text pointer).
24DF
LD HL,2605H 21 05 26LD HL,LETBUF
Load Register Pair HL with 2605H, LETBUF, the letter of the prompt (40H in the file, the character before A) (source: A=>).
24E2
INC (HL) 34
Increment the byte at Register Pair HL, 2605H, to the next letter: A for the first line (source: increment letter).
24E3
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the letter (source: p/u letter).
24E4
CP 5BH FE 5B
Compare Register A with 5BH, the character after Z (source: go past Z?).
24E6
If the letter is not past Z jump to DISSTR at 24EBH, which shows the prompt (source: no, display string).
24E8
POP HL E1
Restore Register Pair HL from the stack, the end of the text: all 26 lines are in (source: recover text ptr).
24E9
Jump to GOTEND at 2527H, which writes the text (source: finished).
24EBDISSTR
DISSTR: call DSPLY at 2550H to show the prompt at Register Pair HL, 2605H: the letter and => with a space, ended by its 03H (source: display string).
24EE
POP HL E1
Restore Register Pair HL from the stack, the end of the text so far, where the line goes (source: recover text ptr).
24EFLINLEN
LD BC,0FF00H 01 00 FF
LINLEN: load Register Pair BC with FF00H: Register B = 255, the most characters of a line (4FH, 79, for a JCL file, stored into 24F1H at 2488H), Register C = 00H (source: 255 or 79 (JCL)).
24F2
LD A,09H 3E 09
Load Register A with 09H, SVC 9, @KEYIN, which reads a line of at most Register B characters into the buffer at Register Pair HL.
24F4
RST 28H EF
Call @KEYIN with RST 28H (BOOT/SYS): the line and a 0DH at Register Pair HL, Register B = the characters typed; Carry for BREAK, NZ and the error in Register A for an error of the input (source: input line).
24F5
If BREAK ended the line jump to GOTBRK at 2523H, which ends the input when the line is empty (source: exit on BREAK).
24F7
If @KEYIN returned NZ jump to TSTEOF at 251EH, which takes 1CH, the EOF key, like BREAK and any other error as an error (source: ck if EOF key used).
24F9HPARM
LD DE,0000H 11 00 00
HPARM: load Register Pair DE with the value of the HEX parameter; the operand at 24FAH-24FBH (0000H in the file) is FFFFH when HEX is given (source: p/u HEX parameter).
24FC
INC E 1C
Increment Register E, the low byte of the HEX word: Z only when it was FFH, HEX given (source: specified?).
24FD
If HEX was not given jump to NOTHEX at 2517H, which keeps the line as typed (source: no, ASCII input).
24FF
LD D,H 54
Load Register D with Register H: Register Pair DE is to point at the line, to read its digits (source: point DE => input).
2500
LD E,L 5D
Load Register E with Register L: Register Pair DE = Register Pair HL, the start of the line; the bytes are stored from Register Pair HL behind the digits read.
2501HP1
HP1: call CVRTHEX at 2557H to turn the character at Register Pair DE into a value 00H to 0FH in Register A; on an empty line it reads the 0DH and gives Bad hex digit encountered (B138) (source: convert char at DE).
2504
DEC B 05
Decrement Register B, the characters of the line still to read (source: decrement count).
2505
If no character is left for the second digit jump to ODDIGS at 2425H: Odd # of hex digits (source: done? odd # of digits).
2508
RLCA 07
Rotate Register A left, the first of four rotations that move the digit into the high nibble (source: shift to hi-order nybble).
2509
RLCA 07
Rotate Register A left, the second of the four rotations of the first digit.
250A
RLCA 07
Rotate Register A left, the third of the four rotations of the first digit.
250B
RLCA 07
Rotate Register A left, the fourth: Register A = the digit times 16.
250C
LD C,A 4F
Load Register C with Register A, the high nibble of the byte (source: save in C).
250D
Call CVRTHEX at 2557H to turn the next character at Register Pair DE into the low nibble in Register A (source: convert char at DE).
2510
OR C B1
OR Register A with Register C, the high nibble: Register A = the byte of the pair (source: OR with hi-order nibble).
2511
LD (HL),A 77
Store Register A, the byte, into the byte at Register Pair HL, over the digits already read (source: stuff in buffer).
2512
INC HL 23
Increment Register Pair HL to the next byte of the text (source: bump conv input ptr).
2513
Decrement Register B and, while it is not zero, jump back to HP1 at 2501H for the next pair (source: B hex digits).
2515
The line is converted: jump back to KSM? at 24D9H for the next line, Register Pair HL after its bytes, with no 0DH (source: done conv, back to loop).
2517NOTHEX
LD C,B 48
NOTHEX: load Register C with Register B, the characters typed (source: advance memory buffer).
2518
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the characters typed (source: to end of this line).
251A
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL = the 0DH that @KEYIN put after the line (source: HL => end of line).
251B
INC HL 23
Increment Register Pair HL past the 0DH, which stays in the text (source: bump to 1st free posn).
251C
Jump back to KSM? at 24D9H for the next line (source: loop for input).
251ETSTEOF
CP 1CH FE 1C
TSTEOF: compare Register A, the error of @KEYIN, with 1CH, End of file encountered, which the keyboard gives for the EOF key (source: EOF?).
2520
If it is another error jump to IOERR at 2416H: BUILD ends with the text not written (source: real error if not).
2523GOTBRK
LD A,B 78
GOTBRK: load Register A with Register B, the characters typed before BREAK or the EOF key (source: any characters?).
2524
OR A B7
Set the flags from Register A, the count of characters typed: Z for an empty line.
2525
If the line holds characters jump back to HPARM at 24F9H: it is taken as if ENTER had ended it, kept with the 0DH that @KEYIN put after it, or converted with HEX, and the input goes on (source: yes, continue build).
2527H - GOTEND: Write the Text and Close; DSPLY, CVRTHEX and $FNAME
The text, from 2800H to the end the input reached, is written a byte at a time with @PUT, then the file is closed; an error of @PUT stops the writing, the file is still closed, and the error of @PUT is shown; when @CLOSE fails as well, only its error is shown. DSPLY shows a text with @DSPLY and goes to IOERR on an error. CVRTHEX turns a hex digit into its value; after the SUB 30H and the RES 5 that makes small letters capitals, its one test, below 10H after the SUB 07H, also takes the signs 3AH-40H and 5BH-60H and the letters W, X, Y and Z as digits (B140). $FNAME writes the name of the open file with @FNAME, or an asterisk, the two letters and 03H for a device.
2527GOTEND
LD (252EH),HL 22 2E 25
GOTEND: store Register Pair HL, the first byte after the text, into 252EH-252FH, the operand of the LD DE at ENDTXT (252DH) (source: save buffer posn).
252A
LD HL,2800H 21 00 28LD HL,BUFFER
Load Register Pair HL with 2800H, BUFFER, the first byte of the text (source: HL => start of input).
252DENDTXT
LD DE,0000H 11 00 00
ENDTXT: load Register Pair DE with the first byte after the text; the operand at 252EH-252FH (0000H in the file) is set at 2527H (source: DE => last used address).
2530
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the end, Register Pair DE = the next byte to write (source: swap for math).
2531
XOR A AF
Exclusive OR Register A with itself: Register A = 00H and the Carry flag cleared for the SBC (source: clear carry).
2532
SBC HL,DE ED 52
Subtract Register Pair DE, the next byte to write, from Register Pair HL, the end: Z when every byte is written (source: any more text to write?).
2534
If the text is all written jump to ATEND at 2541H with Z (source: no, don't write any).
2536
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL back: Register Pair HL = the next byte to write (source: HL => byte to output).
2537
LD DE,261DH 11 1D 26LD DE,FCB1
Load Register Pair DE with 261DH, FCB1, the open file (source: DE => FCB).
253A
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL, the next byte of the text, for @PUT (source: p/u a char).
253B
INC HL 23
Increment Register Pair HL to the byte after it (source: bump ptr).
253C
LD A,04H 3E 04
Load Register A with 04H, SVC 4, @PUT, which writes the byte in Register C to the file or device of the control block at Register Pair DE (source: output char).
253E
RST 28H EF
Call @PUT with RST 28H (BOOT/SYS, which goes on to @BYTEIO in SYS0/SYS for a file) for FCB1 at Register Pair DE, 261DH.
253F
If @PUT returned Z jump back to ENDTXT at 252DH for the next byte; NZ goes on to ATEND with the error in Register A (source: loop for more if i/o OK).
2541ATEND
PUSH AF F5
ATEND: save Register Pair AF on the stack: Z when all was written, or NZ and the error of @PUT (source: save error code if any).
2542
LD DE,261DH 11 1D 26LD DE,FCB1
Load Register Pair DE with 261DH, FCB1, the open file (source: DE => FCB).
2545
LD A,3CH 3E 3C
Load Register A with 3CH, SVC 60, @CLOSE, which closes the file of the FCB at Register Pair DE (source: close the file).
2547
RST 28H EF
Call @CLOSE with RST 28H (SYS3/SYS) for FCB1 at Register Pair DE, 261DH: the last sector is written and the end of file, where the last @PUT left it, goes into the directory entry.
2548
If @CLOSE returned NZ jump to IOERR at 2416H with its error (source: can't, I/O error).
254B
POP AF F1
Restore Register Pair AF from the stack: the result of the writing (source: recover error code).
254C
RET Z C8
If every byte was written return to 240CH with Z, the file built (source: ok, return).
254D
Jump to IOERR at 2416H with Register A = the error of @PUT (source: NZ, I/O error).
2550DSPLY
LD A,0AH 3E 0A
DSPLY: load Register A with 0AH, SVC 10, @DSPLY, which shows the text at Register Pair HL up to its 03H or 0DH.
2552
RST 28H EF
Call @DSPLY with RST 28H (BOOT/SYS) to show the text at Register Pair HL (source: display line).
2553
RET Z C8
If @DSPLY returned Z return to the caller (source: back if good).
2554
Jump to IOERR at 2416H with the error in Register A; SAVESP drops the return address left on the stack (source: else abort).
2557CVRTHEX
LD A,(DE) 1A
CVRTHEX: load Register A with the byte at Register Pair DE, the next character of the line (source: get a char).
2558
INC DE 13
Increment Register Pair DE to the character after it (source: bump ptr).
2559
SUB 30H D6 30
Subtract 30H from Register A, the character: the digits 0 to 9 become 00H to 09H (source: convert to binary).
255B
If the character was below 30H (a space, a sign or the 0DH that ends the line) jump to BADIGSA at 2567H (source: can't be < 0).
255D
CP 0AH FE 0A
Compare Register A with 0AH: Carry for the digits 0 to 9 (source: numeric character?).
255F
RET C D8
Return with the value of a digit 0 to 9 in Register A (source: yes, return).
2560
RES 5,A CB AF
Reset bit 5 of Register A, so that a to f (31H to 36H after the SUB) become A to F (11H to 16H); it also turns P to _ (20H to 2FH after the SUB) into 00H to 0FH (source: no, convert to U/C).
2562
SUB 07H D6 07
Subtract 07H from Register A: A to F become 0AH to 0FH; the signs 3AH-40H become 03H to 09H, the letters W to Z 00H to 03H and the signs 5BH-60H 04H to 09H (source: adjust A-F to be 10-15).
2564
CP 10H FE 10
Compare Register A with 10H, the only test of the value: Carry for 00H to 0FH, so the signs and letters above are taken as digits too (B140) (source: legal hex digit?).
2566
RET C D8
Return with the value 00H to 0FH in Register A (source: yes, return).
2567BADIGSA
BADIGSA: jump to BADIGS at 2421H: Bad hex digit encountered, with the file left open and the text not written (source: no, bad hex digit).
256A$FNAME
BIT 7,A CB 7F
$FNAME: test bit 7 of Register A, FCB1+0: set for an open file, clear for a device (10H) (source: test device/file).
256C
If the FCB is a device jump to FNAME1 at 2572H, which writes its name (source: go if device).
256E
LD A,50H 3E 50
Load Register A with 50H, SVC 80, @FNAME, which writes the name of the file of drive Register C, DEC Register B to Register Pair DE.
2570
RST 28H EF
Call @FNAME with RST 28H (SYS3/SYS): NAME/EXT:d and 03H into FILEBUF at 25D5H, at most 15 bytes.
2571
RET C9
Return to 24A6H with the flags of @FNAME: NZ for a DEC past the directory (error 16) or a directory read error.
2572FNAME1
LD A,2AH 3E 2A
FNAME1: load Register A with 2AH, the asterisk that begins a device name (source: stuff device indicator).
2574
LD (DE),A 12
Store Register A, the asterisk, into the byte at Register Pair DE, 25D5H, the first byte of FILEBUF.
2575
INC DE 13
Increment Register Pair DE to 25D6H, the next byte of FILEBUF.
2576
LD A,C 79
Load Register A with Register C, FCB1+6, the first letter of the device name (source: stuff 1st character).
2577
LD (DE),A 12
Store Register A, the first letter, into the byte at Register Pair DE, 25D6H.
2578
INC DE 13
Increment Register Pair DE to 25D7H, the next byte of FILEBUF.
2579
LD A,B 78
Load Register A with Register B, FCB1+7, the second letter of the device name (source: stuff 2nd character).
257A
LD (DE),A 12
Store Register A, the second letter, into the byte at Register Pair DE, 25D7H.
257B
INC DE 13
Increment Register Pair DE to 25D8H, the last byte of the name in FILEBUF.
257C
LD A,03H 3E 03
Load Register A with 03H, the end mark of the name for @DSPLY (source: stuff ETX).
257E
LD (DE),A 12
Store Register A, 03H, into the byte at Register Pair DE, 25D8H, the end of the name.
257F
RET C9
Return to 24A6H with Z, from the BIT test at 256AH.
2580H - The Messages, FILEBUF, the Prompts and the Parameter Table
The four messages shown through @LOGOT, each ended by a carriage return; FILEBUF, 15 bytes not in the file (the member's second load block ends at 25D4H, the third starts at 25E4H); the two texts of the message line and the KSM prompt, ended by 03H so that the cursor stays on the line; the default extension; the parameter table in the enhanced format of LS-DOS 6 (80H, then for each entry a type byte with the name length in bits 3-0, bit 4 for a one letter short form, bits 7-5 the kinds of value, number, flag and string, the name, a response byte and the address of the value word), ended by 00H; and the first byte of the FCB, whose other 31 bytes follow the member with no bytes in the file.
2580-2593ODDIGS$
DEFM "Odd # of hex digits" / DEFB 0DH 4F 64 64 20 23 20 6F 66 20 68 65 78 20 64 69 67 69 74 73 0D
ODDIGS$, 2580H-2593H: the message of ODDIGS (2425H), ended by its carriage return.
2594-25ADBADIGS$
DEFM "Bad hex digit encountered" / DEFB 0DH 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 0D
BADIGS$, 2594H-25ADH: the message of BADIGS (2421H), ended by its carriage return.
25AE-25C0SPCREQ$
DEFM "File spec required" / DEFB 0DH 46 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 0D
SPCREQ$, 25AEH-25C0H: the message of SPCREQ (2429H), ended by its carriage return.
25C1-25D4EXISTS$
DEFM "File already exists" / DEFB 0DH 46 69 6C 65 20 61 6C 72 65 61 64 79 20 65 78 69 73 74 73 0D
EXISTS$, 25C1H-25D4H: the message of EXISTS (242DH), ended by its carriage return; the last byte of the second load block.
25D5-25E3FILEBUF
DEFS 15
FILEBUF, 25D5H-25E3H: 15 bytes not in the file; $FNAME writes the name of the file and its 03H here (24A3H), shown at 24CCH.
25E4-25EEBMESS1
DEFM "Building: " / DEFB 03H 42 75 69 6C 64 69 6E 67 3A 20 03
BMESS1, 25E4H-25EEH: the start of the line for a new file (24A9H), ended by 03H so that the name follows on the same line.
25EF-2601BMESS2
DEFM "Appending: *KI to " / DEFB 03H 41 70 70 65 6E 64 69 6E 67 3A 20 2A 4B 49 20 74 6F 20 03
BMESS2, 25EFH-2601H: the start of the line for APPEND (24C3H), ended by 03H so that the name follows on the same line.
2602-2604JCLEXT
DEFM "JCL" 4A 43 4C
JCLEXT, 2602H-2604H: the default extension, given to @FEXT at 2441H.
2605-2609LETBUF
DEFB 40H / DEFM "=> " / DEFB 03H 40 3D 3E 20 03
LETBUF, 2605H-2609H: the KSM prompt: the letter (40H in the file, the character before A, stepped at 24E2H), then an equals sign, a greater than sign and a space, ended by 03H.
260APRMTBL$
DEFB 80H 80
PRMTBL$, 260AH: 80H, the mark of a table in the enhanced format (2448H).
260B-260E
DEFB 53H / DEFM "HEX" 53 48 45 58
260BH-260EH: type 53H (a flag, a one letter short form, three letters) and the name HEX, H for short.
260F-2611
DEFB 00H / DEFW 24FAH 00 FA 24
260FH, the response byte of HEX (never read), and the address of its value, 24FAH, HPARM's operand.
2612-2618
DEFB 56H / DEFM "APPEND" 56 41 50 50 45 4E 44
2612H-2618H: type 56H (a flag, a short form, six letters) and the name APPEND, A for short.
2619-261B
DEFB 00H / DEFW 24AFH 00 AF 24
2619H, the response byte of APPEND (never read), and the address of its value, 24AFH, APPEND's operand.
261C
DEFB 00H 00
261CH: the 00H that ends the table, both for @PARAM's loop that zeroes the response bytes and for @FNDPRM.
261DFCB1
DEFB 00H 00
FCB1, 261DH: the first byte of the 32 byte FCB, the last byte of the member; FCB1+1 to FCB1+31 (261EH-263CH) follow the member with no bytes in the file.