5200H - The Routine Table
Data: SYS12/SYS's table of routines 2-14, one word each, used by SYS0/SYS's overlay request handler (its 49C9H-49DCH) for the request codes B2H-BEH. CMNDI@ takes the codes of the library commands from SYS1/SYS's table (51BCH-51DFH): AUTO B3H, BREAK B4H, CLOCK B5H, DATE B6H, DEBUG B7H, ERROR B8H, I B9H, LIB BAH, PAUSE BBH, SCREEN BCH, TIME BDH, VERIFY BEH. No file of the diskette requests B2H.
5200-5201
DEFW 521AH 1A 52
Routine 2: 521AH, XOR A and RET, which SYS0/SYS's record locator requests when it loads SYS12/SYS back (its 4D55H-4D62H).
5202-5203
DEFW 521CH 1C 52
Routine 3: 521CH, AUTO (B3H): the automatic command of a diskette.
5204-5205
DEFW 54CEH CE 54
Routine 4: 54CEH, BREAK (B4H): the BREAK key on or off.
5206-5207
DEFW 54A5H A5 54
Routine 5: 54A5H, CLOCK (B5H): the time display on or off.
5208-5209
DEFW 527EH 7E 52
Routine 6: 527EH, DATE (B6H): show or set the date.
520A-520B
DEFW 54B6H B6 54
Routine 7: 54B6H, DEBUG (B7H): DEBUG on or off.
520C-520D
DEFW 53B0H B0 53
Routine 8: 53B0H, ERROR (B8H): the message of an error code.
520E-520F
DEFW 53CAH CA 53
Routine 9: 53CAH, I (B9H): have the diskettes logged again.
5210-5211
DEFW 542FH 2F 54
Routine 10: 542FH, LIB (BAH): the list of the library commands.
5212-5213
DEFW 546BH 6B 54
Routine 11: 546BH, PAUSE (BBH): wait for ENTER.
5214-5215
DEFW 5481H 81 54
Routine 12: 5481H, SCREEN (BCH): the screen to the printer or another device.
5216-5217
DEFW 5365H 65 53
Routine 13: 5365H, TIME (BDH): show or set the time.
5218-5219
DEFW 54C2H C2 54
Routine 14: 54C2H, VERIFY (BEH): the read back after a write on or off.
521AH - Routine 2
Nothing to do when SYS0/SYS's record locator brings SYS12/SYS back.
521A
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: routine 2 has no work to do.
521B
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH) with Register A = 00H.
521CH - AUTO
Routine 3, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. A line that starts with a drive (:d) sets the AUTO command of that drive's diskette, else of drive 0; the rest of the line, up to 32 characters with its 0DH, goes into the GAT at +E0H, padded with spaces (a line of 32 characters or more is cut and ended with 0DH), and the GAT is written back. AUTO alone clears the command. The drive must be ready (08H) and not write protected (0FH). The 0DH stored at SYS1/SYS's command pointer keeps CMNDI@ from running a ; in the AUTO text as a further command.
521C
LD DE,5653H 11 53 56
Point Register Pair DE to 5653H, a work area for the file control block FSPEC@ fills.
521F
PUSH HL E5
Save Register Pair HL, the start of the text, to the top of the stack.
5220
GOSUB to 441CH, FSPEC@, to take a file specification from the text at Register Pair HL into the block at Register Pair DE: the NZ FLAG when there is none.
5223
LD C,00H 0E 00
Load Register C with 00H, drive 0, the drive when none is given.
5225
If the NZ FLAG is set (no specification), JUMP to 5236H: the whole text is the command, for drive 0.
5227
LD A,(DE) 1A
Load Register A with the first character of the specification at Register Pair DE.
5228
CP 3AH FE 3A
Compare Register A against 3AH, the colon of a drive.
522A
If the NZ FLAG is set (not a drive), JUMP to 5236H: the whole text is the command, for drive 0.
522C
EX (SP),HL E3
Exchange the top of the Stack Pointer with Register Pair HL: Register Pair HL = the start of the text, and the stack keeps the text after the drive, the command.
522D
GOSUB to 447FH, LOCDEV@, to find the drive at Register Pair HL: Register A = 08H plus the drive, the NZ FLAG when it is not one.
5230
If the NZ FLAG is set (no such drive), JUMP to 54DAH to post error 20H, Improper drive number.
5233
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
5235
LD C,A 4F
Load Register C with Register A, the drive for DISKIO%.
5236
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready and writable.
5238
GOSUB to 4485H, DISKIO%, function 0 DCHECK: the NZ FLAG when the drive is not ready, the C FLAG when its diskette is write protected.
523B
If the NZ FLAG is set (not ready), JUMP to 54E9H to post error 08H, Drive not available.
523E
If the C FLAG is set (write protected), JUMP to 54ECH to post error 0FH, Write protected disk.
5241
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
5243
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, for the GAT.
5246
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5248
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read the GAT of the drive in Register C to Register Pair HL (4200H).
524B
POP DE D1
Restore Register Pair DE with the command text from the top of the stack.
524C
If the NZ FLAG is set (the read failed), JUMP to 54EEH to post the error in Register A.
524F
LD B,20H 06 20
Load Register B with 20H, the 32 characters of the AUTO field.
5251
LD HL,42E0H 21 E0 42
Point Register Pair HL to 42E0H, +E0H of the GAT in the buffer, the AUTO command.
5254
LD A,(DE) 1A
Load Register A with the next character of the command at Register Pair DE.
5255
LD (HL),A 77
Store Register A into the AUTO field at Register Pair HL.
5256
INC DE 13
INCrement Register Pair DE by 1, the next character of the command.
5257
INC HL 23
INCrement Register Pair HL by 1, the next byte of the field.
5258
CP 0DH FE 0D
Compare Register A against 0DH, the end of the command line.
525A
If the Z FLAG is set (the end), JUMP to 5263H to fill the rest of the field with spaces.
525C
DECrement Register B and, if it is not zero, JUMP back to 5254H for the next character (DJNZ).
525E
DEC HL 2B
DECrement Register Pair HL by 1, back to the last byte of the full field.
525F
LD (HL),0DH 36 0D
Store 0DH over the last byte of the field at Register Pair HL: a command of 32 characters or more is cut to 31.
5261
JUMP to 526BH to write the GAT with the new AUTO field back.
5263
DEC B 05
DECrement Register B by 1, for the 0DH just stored: the bytes left in the field.
5264
If the Z FLAG is set (the field is full), JUMP to 526BH.
5266
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL, after the command.
5268
INC HL 23
INCrement Register Pair HL by 1, the next byte of the field.
5269
DECrement Register B and, if it is not zero, JUMP back to 5266H for the next space (DJNZ).
526B
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
526D
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, which holds the GAT with its new AUTO field.
5270
LD A,07H 3E 07
Load Register A with 07H, the DISKIO% function SWRITE, which writes a sector of the directory cylinder.
5272
GOSUB to 4485H, DISKIO%, function 7 SWRITE, to write the GAT at Register Pair HL (4200H) back to the drive in Register C.
5275
If the NZ FLAG is set (the write failed), JUMP to 54EEH to post the error in Register A.
5278
LD HL,(4310H) 2A 10 43
Load Register Pair HL with SYS1/SYS's command pointer from 4310H, the start of this command in the line.
527B
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL, so that the command level finds the end of the line here and does not run the rest of it.
527D
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
527EH - DATE
Routine 6. With a text, up to three numbers MM/DD/YY (any character that is not a digit separates them) are stored, each modulo 100, into DATE$ (4044H year, 4045H day, 4046H month) and into the date the start-up saved at 4315H; a number that is not given keeps its old value, and the values are not checked. Without a text the date is shown as Www - Mmm d, 19yy - n: the weekday, the month's name, the day, the year as 1900 plus DATE$'s year, and the day of the year.
527E
LD DE,4044H 11 44 40
Point Register Pair DE to 4044H, DATE$: the year, the day and the month.
5281
GOSUB to 55B2H to test the character at Register Pair HL: the C FLAG at the end of the line, else Register Pair HL moves past it.
5284
DEC HL 2B
DECrement Register Pair HL by 1, back to the character tested (the flags are kept).
5285
If the C FLAG is set (no date given), JUMP to 5292H to show the date.
5287
PUSH HL E5
Save Register Pair HL, the date text, to the top of the stack.
5288
GOSUB to 537CH to set DATE$ at Register Pair DE (4044H) from the numbers at Register Pair HL.
528B
POP HL E1
Restore Register Pair HL, the date text, from the top of the stack.
528C
LD DE,4315H 11 15 43
Point Register Pair DE to 4315H, the date the start-up saved, which is set the same way.
528F
JUMP to 537CH to set the saved date at Register Pair DE (4315H) from the numbers at Register Pair HL; its RETurn ends DATE.
5292
LD DE,5653H 11 53 56
Point Register Pair DE to 5653H, the buffer the date text is built in.
5295
GOSUB to 5307H to count the days from 1 January 1900 to the date in DATE$ into Register Pair HL.
5298
LD A,07H 3E 07
Load Register A with 07H, the days of a week.
529A
GOSUB to 444EH, DIVD@, to divide Register Pair HL by Register A (07H): Register A returns the remainder, the weekday (0 Sunday).
529D
LD HL,560EH 21 0E 56
Point Register Pair HL to 560EH, the names of the weekdays, three letters each.
52A0
LD B,A 47
Load Register B with Register A, the weekday.
52A1
RLCA 07
Rotate Register A left (RLCA): the weekday times 2.
52A2
ADD A,B 80
ADD Register B to Register A: the weekday times 3, the offset of its name.
52A3
ADD A,L 85
ADD Register L to Register A: the low byte of the name's address.
52A4
LD L,A 6F
Load Register L with Register A, the low byte of the name's address in Register Pair HL.
52A5
If the NC FLAG is set (no carry), JUMP to 52A8H.
52A7
INC H 24
INCrement Register H by 1, for the carry into the high byte.
52A8
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three letters of a name.
52AB
LDIR ED B0
Copy the weekday's name from Register Pair HL to the buffer at Register Pair DE by LDIR, with Register Pair BC as the count.
52AD
GOSUB to 5359H to add a space, a hyphen and a space at Register Pair DE.
52B0
LD A,(4046H) 3A 46 40
Load Register A with the month from 4046H, +02H of DATE$.
52B3
OR A B7
OR Register A with itself, to set the Z FLAG for month 0.
52B4
If the Z FLAG is set (month 0), JUMP to 52B7H, which takes the first name.
52B6
DEC A 3D
DECrement Register A by 1: the months are numbered from 1, the names from 0.
52B7
LD HL,5623H 21 23 56
Point Register Pair HL to 5623H, the names of the months, three letters each.
52BA
LD B,A 47
Load Register B with Register A, the month less 1.
52BB
RLCA 07
Rotate Register A left (RLCA): the month less 1 times 2.
52BC
ADD A,B 80
ADD Register B to Register A: the month less 1 times 3, the offset of its name.
52BD
ADD A,L 85
ADD Register L to Register A: the low byte of the name's address.
52BE
LD L,A 6F
Load Register L with Register A, the low byte of the name's address in Register Pair HL.
52BF
If the NC FLAG is set (no carry), JUMP to 52C2H.
52C1
INC H 24
INCrement Register H by 1, for the carry into the high byte.
52C2
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three letters of a name.
52C5
LDIR ED B0
Copy the month's name from Register Pair HL to the buffer at Register Pair DE by LDIR, with Register Pair BC as the count.
52C7
LD A,20H 3E 20
Load Register A with 20H, the space after the month's name.
52C9
LD (DE),A 12
Store Register A (20H) in the buffer at Register Pair DE.
52CA
INC DE 13
INCrement Register Pair DE by 1, past the space.
52CB
LD A,(4045H) 3A 45 40
Load Register A with the day from 4045H, +01H of DATE$.
52CE
OR A B7
OR Register A with itself, to set the Z FLAG for day 0.
52CF
If the NZ FLAG is set (a day), JUMP to 52D2H.
52D1
INC A 3C
INCrement Register A by 1: day 0 is shown as 1.
52D2
LD L,A 6F
Load Register L with Register A, the day of the month.
52D3
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the day.
52D5
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the day, Register Pair HL = the buffer.
52D6
GOSUB to 5560H to put the number in Register Pair DE into the buffer at Register Pair HL as decimal digits; Register Pair DE returns after them.
52D9
LD A,2CH 3E 2C
Load Register A with 2CH, the comma after the day.
52DB
LD (DE),A 12
Store Register A (2CH) in the buffer at Register Pair DE.
52DC
INC DE 13
INCrement Register Pair DE by 1, past the comma.
52DD
LD A,20H 3E 20
Load Register A with 20H, the space before the year.
52DF
LD (DE),A 12
Store Register A (20H) in the buffer at Register Pair DE.
52E0
INC DE 13
INCrement Register Pair DE by 1, past the space.
52E1
LD HL,076CH 21 6C 07
Load Register Pair HL with 076CH, 1900: the year is shown as 1900 plus DATE$'s year.
52E4
LD A,(4044H) 3A 44 40
Load Register A with the year from 4044H, DATE$ (0-99).
52E7
ADD A,L 85
ADD Register L to Register A: the low byte of 1900 plus the year.
52E8
LD L,A 6F
Load Register L with Register A, the low byte in Register Pair HL.
52E9
If the NC FLAG is set (no carry), JUMP to 52ECH.
52EB
INC H 24
INCrement Register H by 1, for the carry into the high byte.
52EC
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the year, Register Pair HL = the buffer.
52ED
GOSUB to 5560H to put the year in Register Pair DE into the buffer at Register Pair HL as decimal digits.
52F0
GOSUB to 5359H to add a space, a hyphen and a space at Register Pair DE.
52F3
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, to count the days of this year only.
52F6
GOSUB to 5324H to add the days of the months and the day of DATE$ to Register Pair HL, less 1.
52F9
INC HL 23
INCrement Register Pair HL by 1: the day of the year, from 1.
52FA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the day of the year, Register Pair HL = the buffer.
52FB
GOSUB to 5560H to put the day of the year in Register Pair DE into the buffer at Register Pair HL as decimal digits.
52FE
LD A,0DH 3E 0D
Load Register A with 0DH, the end of the text for DSPLY@.
5300
LD (DE),A 12
Store Register A (0DH) in the buffer at Register Pair DE.
5301
LD HL,5653H 21 53 56
Point Register Pair HL to 5653H, the date text.
5304
JUMP to 4467H, DSPLY@, to show the text at Register Pair HL; its RETurn ends DATE.
5307H - Days since 1900
Returns Register Pair HL = the days from 1 January of year 0 to the date in DATE$, from 0: 365 for each year before DATE$'s year plus one for each of them that is divisible by 4 (year 0 included), then 5324H adds the months and the day (with 29 February in a year divisible by 4). Day 0 is counted as a Sunday, so the weekday is right for the years 1901 to 1999. 5324H alone, with Register Pair HL = 0000H, gives the day of the year less 1. Register Pair DE is kept.
5307
PUSH DE D5
Save Register Pair DE, the buffer, to the top of the stack.
5308
LD A,(4044H) 3A 44 40
Load Register A with the year from 4044H, DATE$.
530B
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the count of the days.
530E
OR A B7
OR Register A with itself, to set the Z FLAG for year 0.
530F
If the Z FLAG is set (year 0), JUMP to 5323H: no years before it.
5311
DEC A 3D
DECrement Register A by 1, the last year before DATE$'s.
5312
LD B,A 47
Load Register B with Register A, the year counted down to 0.
5313
LD A,B 78
Load Register A with Register B, the year being counted.
5314
AND 03H E6 03
AND Register A with 03H: the Z FLAG for a year divisible by 4, a leap year.
5316
If the NZ FLAG is set (not a leap year), JUMP to 5319H.
5318
INC HL 23
INCrement Register Pair HL by 1, for 29 February of the leap year.
5319
LD DE,016DH 11 6D 01
Load Register Pair DE with 016DH, the 365 days of a year.
531C
ADD HL,DE 19
ADD Register Pair DE (365) to Register Pair HL.
531D
DEC B 05
DECrement Register B by 1, the year before, counted down to FFH.
531E
LD A,FFH 3E FF
Load Register A with FFH, which Register B reaches after year 0.
5320
CP B B8
Compare Register A (FFH) against Register B: the Z FLAG when every year is counted.
5321
If the NZ FLAG is set (years are left), JUMP back to 5313H for the next one.
5323
POP DE D1
Restore Register Pair DE, the buffer, from the top of the stack.
5324
PUSH DE D5
Save Register Pair DE to the top of the stack.
5325
LD A,(4046H) 3A 46 40
Load Register A with the month from 4046H, +02H of DATE$.
5328
OR A B7
OR Register A with itself, to set the Z FLAG for month 0.
5329
If the NZ FLAG is set (a month), JUMP to 532CH.
532B
INC A 3C
INCrement Register A by 1: month 0 is taken as January.
532C
DEC A 3D
DECrement Register A by 1: the months before this one.
532D
LD B,A 47
Load Register B with Register A, the count of the months to add.
532E
If the Z FLAG is set (January), JUMP to 534AH to add the day.
5330
LD DE,5647H 11 47 56
Point Register Pair DE to 5647H, the days of each month.
5333
PUSH AF F5
Save Register Pair AF, the months before, to the top of the stack.
5334
LD A,(DE) 1A
Load Register A with the days of the month at Register Pair DE.
5335
INC DE 13
INCrement Register Pair DE by 1, the next month.
5336
ADD A,L 85
ADD Register L to Register A: the low byte of the count plus the month's days.
5337
LD L,A 6F
Load Register L with Register A, the low byte of the count in Register Pair HL.
5338
If the NC FLAG is set (no carry), JUMP to 533BH.
533A
INC H 24
INCrement Register H by 1, for the carry into the high byte.
533B
DECrement Register B and, if it is not zero, JUMP back to 5334H for the next month (DJNZ).
533D
POP AF F1
Restore Register Pair AF, the months before, from the top of the stack.
533E
CP 02H FE 02
Compare Register A against 02H: the C FLAG when the date is in January or February.
5340
If the C FLAG is set (January or February), JUMP to 534AH: no 29 February to add.
5342
LD A,(4044H) 3A 44 40
Load Register A with the year from 4044H, DATE$.
5345
AND 03H E6 03
AND Register A with 03H: the Z FLAG for a year divisible by 4.
5347
If the NZ FLAG is set (not a leap year), JUMP to 534AH.
5349
INC HL 23
INCrement Register Pair HL by 1, for 29 February.
534A
LD A,(4045H) 3A 45 40
Load Register A with the day from 4045H, +01H of DATE$.
534D
OR A B7
OR Register A with itself, to set the Z FLAG for day 0.
534E
If the NZ FLAG is set (a day), JUMP to 5351H.
5350
INC A 3C
INCrement Register A by 1: day 0 is taken as 1.
5351
ADD A,L 85
ADD Register L to Register A: the low byte of the count plus the day.
5352
LD L,A 6F
Load Register L with Register A, the low byte of the count in Register Pair HL.
5353
If the NC FLAG is set (no carry), JUMP to 5356H.
5355
INC H 24
INCrement Register H by 1, for the carry into the high byte.
5356
POP DE D1
Restore Register Pair DE from the top of the stack.
5357
DEC HL 2B
DECrement Register Pair HL by 1: the days are counted from 0.
5358
RET C9
RETurn with the count of the days in Register Pair HL.
5359H - A Hyphen
Puts a space, a hyphen and a space at Register Pair DE and moves Register Pair DE past them.
5359
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the place in the buffer.
535A
LD (HL),20H 36 20
Store 20H, a space, in the buffer at Register Pair HL.
535C
INC HL 23
INCrement Register Pair HL by 1, past the space.
535D
LD (HL),2DH 36 2D
Store 2DH, the hyphen, in the buffer at Register Pair HL.
535F
INC HL 23
INCrement Register Pair HL by 1, past the hyphen.
5360
LD (HL),20H 36 20
Store 20H, a space, in the buffer at Register Pair HL.
5362
INC HL 23
INCrement Register Pair HL by 1, past the space.
5363
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the place after the three characters.
5364
RET C9
RETurn to the caller with Register Pair DE moved on.
5365H - TIME
Routine 13. With a text, up to three numbers HH:MM:SS are stored, each modulo 100, into TIME$ (4041H seconds, 4042H minutes, 4043H hours); a number not given keeps its old value. Without a text the time is shown by GTTIME@ and DSPLY@.
5365
LD DE,4041H 11 41 40
Point Register Pair DE to 4041H, TIME$: the seconds, the minutes and the hours.
5368
GOSUB to 55B2H to test the character at Register Pair HL: the C FLAG at the end of the line, else Register Pair HL moves past it.
536B
DEC HL 2B
DECrement Register Pair HL by 1, back to the character tested (the flags are kept).
536C
If the NC FLAG is set (a time given), JUMP to 537CH to set TIME$ at Register Pair DE from it; its RETurn ends TIME.
536E
LD HL,5653H 21 53 56
Point Register Pair HL to 5653H, the buffer for the time text.
5371
PUSH HL E5
Save Register Pair HL (5653H) to the top of the stack.
5372
GOSUB to 446DH, GTTIME@, to put the time as HH:MM:SS at Register Pair HL.
5375
LD (HL),0DH 36 0D
Store 0DH after the time at Register Pair HL, the end of the text for DSPLY@.
5377
POP HL E1
Restore Register Pair HL (5653H) from the top of the stack.
5378
GOSUB to 4467H, DSPLY@, to show the time text at Register Pair HL.
537B
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
537CH - Three Numbers
Sets the three bytes at Register Pair DE (DATE$, the saved date or TIME$) from the text at Register Pair HL: the first number goes to +02H (the month or the hours), the second to +01H, the third to +00H, each modulo 100 by DIVD@. A value that is not given (the end of the line comes first) keeps the old one, which is copied to 5653H-5655H before the numbers are read.
537C
PUSH DE D5
Save Register Pair DE, the three bytes to set, to the top of the stack.
537D
OR A B7
OR Register A with itself, to clear the C FLAG that ends the numbers below.
537E
LD B,03H 06 03
Load Register B with 03H, the three bytes copied to the work area.
5380
LD IX,5653H DD 21 53 56
Point Index Register IX to 5653H, where the three bytes are put together.
5384
LD A,(DE) 1A
Load Register A with the old byte at Register Pair DE.
5385
LD (IX+00H),A DD 77 00
Store Register A to the work area at Index Register IX+00H.
5388
INC DE 13
INCrement Register Pair DE by 1, the next old byte.
5389
INC IX DD 23
INCrement Index Register IX by 1, the next byte of the work area.
538B
DECrement Register B and, if it is not zero, JUMP back to 5384H for the next byte (DJNZ).
538D
POP DE D1
Restore Register Pair DE, the three bytes to set, from the top of the stack.
538E
PUSH DE D5
Save Register Pair DE to the top of the stack again, for the copy at the end.
538F
LD B,03H 06 03
Load Register B with 03H, the three numbers that may be given.
5391
DEC IX DD 2B
DECrement Index Register IX by 1: 5655H for the first number, 5654H, then 5653H.
5393
If the C FLAG is set (the line ended with the number before), JUMP to 53A6H: the rest keep their old values.
5395
GOSUB to 553EH to read a decimal number from the text at Register Pair HL into Register Pair DE: the C FLAG when the line ends after it.
5398
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the number, Register Pair DE = the text.
5399
LD A,64H 3E 64
Load Register A with 64H, 100, to take the number modulo 100.
539B
PUSH AF F5
Save Register Pair AF, with the C FLAG of 553EH, to the top of the stack.
539C
GOSUB to 444EH, DIVD@, to divide Register Pair HL by Register A (64H): Register A returns the remainder.
539F
LD (IX+00H),A DD 77 00
Store Register A, the number modulo 100, to the work area at Index Register IX+00H.
53A2
POP AF F1
Restore Register Pair AF, with the C FLAG of 553EH, from the top of the stack.
53A3
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the text again.
53A4
DECrement Register B and, if it is not zero, JUMP back to 5391H for the next number (DJNZ).
53A6
POP DE D1
Restore Register Pair DE, the three bytes to set, from the top of the stack.
53A7
LD HL,5653H 21 53 56
Point Register Pair HL to 5653H, the three new bytes.
53AA
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three bytes.
53AD
LDIR ED B0
Copy the three bytes from Register Pair HL (5653H) to Register Pair DE by LDIR, with Register Pair BC as the count.
53AF
RET C9
RETurn to the caller with the three bytes set.
53B0H - ERROR
Routine 8: ERROR n shows the message of error n (0-255, else 2DH), ERROR alone that of the last error posted (4304H). ERROR@ is called with bits 7 and 6 set: no frame, and it returns here instead of ending through ABORT@.
53B0
GOSUB to 55B2H to test the character at Register Pair HL: the C FLAG at the end of the line, else Register Pair HL moves past it.
53B3
DEC HL 2B
DECrement Register Pair HL by 1, back to the character tested (the flags are kept).
53B4
If the NC FLAG is set (a number given), JUMP to 53BBH to read it.
53B6
LD A,(4304H) 3A 04 43
Load Register A with the last error code from 4304H, which SYS5/SYS's ERROR@ keeps.
53B9
JUMP to 53C4H to show the message of the last error.
53BB
GOSUB to 553EH to read a decimal number from the text at Register Pair HL into Register Pair DE.
53BE
INC D 14
INCrement Register D by 1, the first half of a test of Register D against 00H.
53BF
DEC D 15
DECrement Register D by 1 back to its value: the NZ FLAG for a number of 256 or more.
53C0
If the NZ FLAG is set (the number is too big), JUMP to 54DDH to post error 2DH, Invalid data provided.
53C3
LD A,E 7B
Load Register A with Register E, the error code given.
53C4
OR C0H F6 C0
OR Register A with C0H: bit 7, return to the caller, and bit 6, no frame around the message.
53C6
GOSUB to 4409H, ERROR@, to show the message of the error in Register A.
53C9
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
53CAH - I
Routine 9: the drive given (EVAL@'s block at 55FCH, a drive only, else 20H), or drives 1 to 7, are marked to be logged again at their next access (bit 0 of DCT+03H). With MOUNT, each ready floppy drive's GAT is read at once and the number of sides is set from bit 5 of its +CDH (DCT+0CH).
53CA
LD IX,55FCH DD 21 FC 55
Point Index Register IX to 55FCH, the evaluation block of I: every field 5653H, parameter MOUNT.
53CE
XOR A AF
Set Register A to 00H by XORing it with itself, to clear MOUNT.
53CF
LD (53FBH),A 32 FB 53
Store Register A (00H) to 53FBH, the low byte of the MOUNT value: the operand of LD DE,0000H at 53FAH.
53D2
GOSUB to 4479H, EVAL@, to take a drive and the parameter MOUNT from the command line at Register Pair HL.
53D5
If the NZ FLAG is set (an error in the command line), JUMP to 54EEH to post the error in Register A.
53D8
LD DE,5653H 11 53 56
Point Register Pair DE to 5653H, the flag byte of the field.
53DB
LD BC,0701H 01 01 07
Load Register Pair BC with 0701H: Register B 07H, the count of the drives, Register C 01H, the first drive.
53DE
LD A,(IX+00H) DD 7E 00
Load Register A with the evaluation block's flags at Index Register IX+00H: bits 0-2 a field.
53E1
AND 07H E6 07
AND Register A with 07H, bits 0-2: the Z FLAG when no field was given.
53E3
If the Z FLAG is set (no drive given), JUMP to 53F3H for drives 1 to 7.
53E5
LD A,(DE) 1A
Load Register A with the flag byte of the field at Register Pair DE (5653H).
53E6
AND 68H E6 68
AND Register A with 68H, bits 6, 5 and 3: a name, a wildcard, a drive.
53E8
CP 08H FE 08
Compare Register A against 08H: the Z FLAG for a drive alone.
53EA
If the NZ FLAG is set (not a drive), JUMP to 54DAH to post error 20H, Improper drive number.
53ED
LD A,(DE) 1A
Load Register A with the flag byte of the field at Register Pair DE.
53EE
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
53F0
LD C,A 4F
Load Register C with Register A, the drive given in the field.
53F1
LD B,01H 06 01
Load Register B with 01H: the one drive given in the field.
53F3
GOSUB to 448BH, LOCDCT%, to point Index Register IY to the drive control table of the drive in Register C.
53F6
SET 0,(IY+03H) FD CB 03 C6
Set bit 0 of DCT+03H at Index Register IY+03H: the diskette is logged at the next access.
53FA
LD DE,0000H 11 00 00
Load Register Pair DE with the MOUNT value, the operand at 53FBH-53FCH (0000H in the file) that EVAL@ stored.
53FD
INC E 1C
INCrement Register E by 1, the first half of a test of Register E against 00H.
53FE
DEC E 1D
DECrement Register E by 1 back to its value: the Z FLAG when MOUNT was not given.
53FF
If the Z FLAG is set (no MOUNT), JUMP to 542BH for the next drive.
5401
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready.
5403
GOSUB to 4485H, DISKIO%, function 0 DCHECK: the Z FLAG when the drive is ready.
5406
If the NZ FLAG is set (not ready), JUMP to 542BH for the next drive.
5408
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system buffer, for the GAT.
540B
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
540D
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
540F
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read the GAT of the drive in Register C to Register Pair HL (4200H).
5412
If the NZ FLAG is set (the read failed), JUMP to 54EEH to post the error in Register A.
5415
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of DCT+03H at Index Register IY+03H, the rigid drive flag.
5419
If the NZ FLAG is set (a rigid drive), JUMP to 542BH: its sides are not taken from the GAT.
541B
LD A,(42CDH) 3A CD 42
Load Register A with +CDH of the GAT at 42CDH, the diskette's flags.
541E
RLCA 07
Rotate Register A left (RLCA), the first of three: bit 5 moves up.
541F
RLCA 07
Rotate Register A left (RLCA), the second time.
5420
RLCA 07
Rotate Register A left (RLCA), the third time: bit 5 of +CDH is now bit 0.
5421
AND 01H E6 01
AND Register A with 01H, to keep that bit: 1 for a two sided diskette.
5423
INC A 3C
INCrement Register A by 1: the number of sides, 1 or 2.
5424
LD (IY+0CH),A FD 77 0C
Store Register A to DCT+0CH at Index Register IY+0CH, the number of surfaces.
5427
SET 0,(IY+03H) FD CB 03 C6
Set bit 0 of DCT+03H at Index Register IY+03H again: the diskette is logged at the next access.
542B
INC C 0C
INCrement Register C by 1, the number of the next drive.
542C
DECrement Register B and, if it is not zero, JUMP back to 53F3H for the next drive (DJNZ).
542E
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
542FH - LIB
Routine 10: the names of the library commands from SYS1/SYS's table (5106H, which SYS1/SYS's routine 9 returns, request 09H), five to a line in columns of 12, after two spaces, to @DO or to the device or file given (54F3H).
542F
LD A,01H 3E 01
Load Register A with 01H, the display @DO, the output when none is given.
5431
GOSUB to 54F3H to take the output from the command line: Register Pair DE returns its control block.
5434
LD A,09H 3E 09
Load Register A with 09H, the request for SYS1/SYS's routine 9, which returns Register Pair HL = 5106H, its table of the library commands.
5436
GOSUB to 55BDH to make the request in Register A: Register Pair HL returns the table.
5439
LD A,(HL) 7E
Load Register A with the first character of the table at Register Pair HL, with bit 7 set.
543A
LD C,05H 0E 05
Load Register C with 05H, the names on a line.
543C
GOSUB to 55BEH to output a space to the control block at Register Pair DE.
543F
GOSUB to 55BEH to output a second space: a line starts with two.
5442
LD B,0CH 06 0C
Load Register B with 0CH, the 12 columns of a name.
5444
AND 7FH E6 7F
AND Register A with 7FH, to clear bit 7, which marks the first character of a name.
5446
GOSUB to 001BH, the ROM's output routine, to send the character in Register A to the control block at Register Pair DE.
5449
DEC B 05
DECrement Register B by 1, the columns of the name that are left.
544A
INC HL 23
INCrement Register Pair HL by 1, the next character of the table.
544B
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
544C
CP 80H FE 80
Compare Register A against 80H, the end of the table.
544E
If the Z FLAG is set (the end), JUMP to 5463H to end the list.
5450
If the C FLAG is set (bit 7 clear: the same name), JUMP back to 5444H for its next character.
5452
GOSUB to 55BEH to output a space: the rest of the column.
5455
DECrement Register B and, if it is not zero, JUMP back to 5452H for the next space (DJNZ).
5457
DEC C 0D
DECrement Register C by 1, the names left on the line.
5458
If the NZ FLAG is set (names are left), JUMP back to 5442H for the next name.
545A
PUSH AF F5
Save Register Pair AF, the next name's first character, to the top of the stack.
545B
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the line.
545D
GOSUB to 001BH, the ROM's output routine, to send the character in Register A (0DH) to the control block at Register Pair DE.
5460
POP AF F1
Restore Register Pair AF, the next name's first character, from the top of the stack.
5461
JUMP back to 543AH for the next line of library command names.
5463
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the last line.
5465
GOSUB to 001BH, the ROM's output routine, to send the character in Register A (0DH) to the control block at Register Pair DE.
5468
JUMP to 55C6H to close the output when it is a file; its RETurn ends LIB.
546BH - PAUSE
Routine 11: waits for ENTER, with bit 5 of SFLAG1$ (a DO file runs) cleared so that the keyboard is read even during a DO file; ENTER puts SFLAG1$ back, BREAK ends with error 30H (and the bit stays clear).
546B
LD HL,4302H 21 02 43
Point Register Pair HL to 4302H, SFLAG1$, the system flags.
546E
LD B,(HL) 46
Load Register B with SFLAG1$ at Register Pair HL, to put it back later.
546F
RES 5,(HL) CB AE
Reset bit 5 of SFLAG1$ at Register Pair HL: the keys are read from the keyboard, not the DO file.
5471
GOSUB to 002BH, the ROM's keyboard scan, which returns the key pressed in Register A, or 00H.
5474
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key.
5476
If the Z FLAG is set (ENTER), JUMP to 547FH to go on.
5478
CP 01H FE 01
Compare Register A against 01H, the BREAK key.
547A
If the NZ FLAG is set (neither key), JUMP back to 5471H to scan again.
547C
JUMP to 54E0H to post error 30H, Terminated: BREAK ends PAUSE.
547F
LD (HL),B 70
Store Register B, SFLAG1$ as it was, back at Register Pair HL (4302H).
5480
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
5481H - SCREEN
Routine 12: the 16 lines of 64 characters of the video memory at 3C00H, each followed by a carriage return, to @PR or to the device or file given (54F3H). On the Model I a code below 20H is sent as that code plus 40H, the character the display shows for it.
5481
LD A,02H 3E 02
Load Register A with 02H, the printer @PR, the output when none is given.
5483
GOSUB to 54F3H to take the output from the command line: Register Pair DE returns its control block.
5486
LD HL,3C00H 21 00 3C
Point Register Pair HL to 3C00H, the start of the video memory.
5489
LD C,10H 0E 10
Load Register C with 10H, the 16 lines of the screen.
548B
LD B,40H 06 40
Load Register B with 40H, the 64 characters of a line.
548D
LD A,(HL) 7E
Load Register A with the character of the screen at Register Pair HL.
548E
INC HL 23
INCrement Register Pair HL by 1, the next character of the screen.
548F
CP 20H FE 20
Compare Register A against 20H: the NC FLAG for a character of 20H or more.
5491
If the NC FLAG is set, JUMP to 5495H to send it as it is.
5493
ADD A,40H C6 40
ADD 40H to Register A: a code below 20H is shown by the display as the character 40H higher.
5495
GOSUB to 001BH, the ROM's output routine, to send the character in Register A to the control block at Register Pair DE.
5498
DECrement Register B and, if it is not zero, JUMP back to 548DH for the next character (DJNZ).
549A
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends a line.
549C
GOSUB to 001BH, the ROM's output routine, to send the character in Register A (0DH) to the control block at Register Pair DE.
549F
DEC C 0D
DECrement Register C by 1, the lines of the screen that are left.
54A0
If the NZ FLAG is set (lines are left), JUMP back to 548BH for the next line.
54A2
JUMP to 55C6H to close the output when it is a file; its RETurn ends SCREEN.
54A5H - CLOCK, DEBUG, VERIFY and BREAK
Routines 5, 7, 14 and 4: each takes ON or OFF from the command line (5527H: the Z FLAG for ON, or for nothing). CLOCK puts the clock display task (462FH) into interrupt slot 2 by SET@ or takes it out by RESET@; DEBUG sets or clears bit 2 of SFLAG1$, VERIFY bit 3; BREAK clears bit 0 (the BREAK key works) for ON and sets it for OFF.
54A5
GOSUB to 5527H to take ON or OFF from the command line: the Z FLAG for ON, the NZ FLAG for OFF.
54A8
LD A,02H 3E 02
Load Register A with 02H, interrupt slot 2, the slot of the clock display.
54AA
PUSH AF F5
Save Register Pair AF, the slot and the flags of 5527H, to the top of the stack.
54AB
If the NZ FLAG is set (OFF), GOSUB to 4413H, RESET@, to take the task out of slot Register A (02H).
54AE
POP AF F1
Restore Register Pair AF, the slot and the flags of 5527H, from the top of the stack.
54AF
LD DE,462FH 11 2F 46
Point Register Pair DE to 462FH, SYS0/SYS's task block of the clock display.
54B2
If the Z FLAG is set (ON), GOSUB to 4410H, SET@, to put the task block at Register Pair DE into slot Register A (02H).
54B5
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
54B6
DEBUG: GOSUB to 5527H to take ON or OFF from the command line: the Z FLAG for ON.
54B9
LD HL,4302H 21 02 43
Point Register Pair HL to 4302H, SFLAG1$, the system flags.
54BC
RES 2,(HL) CB 96
Reset bit 2 of SFLAG1$ at Register Pair HL, the DEBUG flag.
54BE
RET NZ C0
If the NZ FLAG is set (OFF), RETurn with DEBUG off.
54BF
SET 2,(HL) CB D6
Set bit 2 of SFLAG1$ at Register Pair HL: DEBUG is on.
54C1
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
54C2
VERIFY: GOSUB to 5527H to take ON or OFF from the command line: the Z FLAG for ON.
54C5
LD HL,4302H 21 02 43
Point Register Pair HL to 4302H, SFLAG1$, the system flags.
54C8
RES 3,(HL) CB 9E
Reset bit 3 of SFLAG1$ at Register Pair HL, the VERIFY flag.
54CA
RET NZ C0
If the NZ FLAG is set (OFF), RETurn with VERIFY off.
54CB
SET 3,(HL) CB DE
Set bit 3 of SFLAG1$ at Register Pair HL: every write is read back.
54CD
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
54CE
BREAK: GOSUB to 5527H to take ON or OFF from the command line: the Z FLAG for ON.
54D1
LD HL,4302H 21 02 43
Point Register Pair HL to 4302H, SFLAG1$, the system flags.
54D4
RES 0,(HL) CB 86
Reset bit 0 of SFLAG1$ at Register Pair HL, the BREAK disable flag: the BREAK key works.
54D6
RET Z C8
If the Z FLAG is set (ON), RETurn with the BREAK key on.
54D7
SET 0,(HL) CB C6
Set bit 0 of SFLAG1$ at Register Pair HL: the BREAK key is disabled.
54D9
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.
54DAH - The Error Exits
Seven entries, each loading its error code into Register A: 54DAH 20H Improper drive number, 54DDH 2DH Invalid data provided, 54E0H 30H Terminated, 54E3H 2BH Illegal devicespec, 54E6H 2EH Invalid parameter, 54E9H 08H Drive not available, 54ECH 0FH Write protected disk. Each LD A,n after the first is the operand of an LD BC,nn entered from the entry above it. 54EEH posts the error in Register A by ERROR@ with bit 6 set (no frame), and ERROR@ ends with ABORT@.
54DA
LD A,20H 3E 20
Load Register A with 20H, the error code Improper drive number.
54DC
LD BC,2D3EH 01 3E 2D
54DDH enters inside this LD BC,2D3EH: its bytes 3EH 2DH read as LD A,2DH, the error code Invalid data provided; from above it only loads Register Pair BC.
54DF
LD BC,303EH 01 3E 30
54E0H enters inside this LD BC,303EH: its bytes 3EH 30H read as LD A,30H, the error code Terminated; from above it only loads Register Pair BC.
54E2
LD BC,2B3EH 01 3E 2B
54E3H enters inside this LD BC,2B3EH: its bytes 3EH 2BH read as LD A,2BH, the error code Illegal devicespec; from above it only loads Register Pair BC.
54E5
LD BC,2E3EH 01 3E 2E
54E6H enters inside this LD BC,2E3EH: its bytes 3EH 2EH read as LD A,2EH, the error code Invalid parameter; from above it only loads Register Pair BC.
54E8
LD BC,083EH 01 3E 08
54E9H enters inside this LD BC,083EH: its bytes 3EH 08H read as LD A,08H, the error code Drive not available; from above it only loads Register Pair BC.
54EB
LD BC,0F3EH 01 3E 0F
54ECH enters inside this LD BC,0F3EH: its bytes 3EH 0FH read as LD A,0FH, the error code Write protected disk; from above it only loads Register Pair BC.
54EE
OR 40H F6 40
OR Register A, the error code, with 40H, bit 6, so that ERROR@ shows the message without its frame.
54F0
JUMP to 4409H, ERROR@, to show the message of the error in Register A and end through ABORT@.
54F3H - The Output
For LIB and SCREEN: Register A is the device used when no field is given (01H @DO, 02H @PR). EVAL@ takes a field with the block at 5605H: a device gives its DCB, a file is opened by INIT@ with its buffer at 5693H, and a drive is error 2BH. Register Pair DE returns the control block for the ROM's 001BH.
54F3
GOSUB to 4488H, LOCDCB%, to load Register Pair DE with the address of the DCB of the device in Register A.
54F6
PUSH DE D5
Save Register Pair DE, the default device's DCB, to the top of the stack.
54F7
LD IX,5605H DD 21 05 56
Point Index Register IX to 5605H, the evaluation block of LIB and SCREEN: every field 5653H, an empty parameter table.
54FB
GOSUB to 4479H, EVAL@, to take the output field from the command line at Register Pair HL.
54FE
POP DE D1
Restore Register Pair DE, the default device's DCB, from the top of the stack.
54FF
If the NZ FLAG is set (an error in the command line), JUMP to 54EEH to post the error in Register A.
5501
LD A,07H 3E 07
Load Register A with 07H, bits 0-2 of the flags, a field of any kind.
5503
AND (IX+00H) DD A6 00
AND Register A with the evaluation block's flags at Index Register IX+00H: the Z FLAG when no field was given.
5506
RET Z C8
If the Z FLAG is set (no field), RETurn with Register Pair DE = the default device's DCB.
5507
LD DE,5653H 11 53 56
Point Register Pair DE to 5653H, the field's flag byte.
550A
LD A,(DE) 1A
Load Register A with the field's flag byte at Register Pair DE (bit 6 a name, bit 3 a drive, bits 0-2 the number).
550B
BIT 6,A CB 77
Test bit 6 of Register A: the NZ FLAG when the field is a file name.
550D
If the NZ FLAG is set (a file), JUMP to 551AH to open it.
550F
BIT 3,A CB 5F
Test bit 3 of Register A: the NZ FLAG when the field is a drive.
5511
If the NZ FLAG is set (a drive), JUMP to 54E3H to post error 2BH, Illegal devicespec.
5513
LD A,(DE) 1A
Load Register A with the field's flag byte at Register Pair DE.
5514
AND 07H E6 07
AND Register A with 07H, bits 0-2: the device number.
5516
GOSUB to 4488H, LOCDCB%, to load Register Pair DE with the address of the DCB of the device in Register A.
5519
RET C9
RETurn with Register Pair DE = the device's DCB.
551A
LD B,00H 06 00
Load Register B with 00H, the logical record length 256.
551C
LD HL,5693H 21 93 56
Point Register Pair HL to 5693H, the file's sector buffer.
551F
INC DE 13
INCrement Register Pair DE by 1 to 5654H, the field's text, which INIT@ makes the file control block.
5520
GOSUB to 4420H, INIT@, to open or create the file at Register Pair DE with the buffer at Register Pair HL.
5523
If the NZ FLAG is set (INIT@ failed), JUMP to 54EEH to post the error in Register A.
5526
RET C9
RETurn with Register Pair DE = the file control block (5654H).
5527H - ON or OFF
PARAM@ takes the parameters from the command line at Register Pair HL with the table at 55D1H (eight bytes an entry: the name, then the address of its value): OFF and NO store their value into 5537H, the operand of LD DE,0000H at 5536H; ON and YES store theirs into 5691H, which nothing reads. Returns the Z FLAG for ON, for nothing given or for OFF=N, the NZ FLAG for OFF; an unknown parameter is error 2EH. Register Pairs BC and DE are kept.
5527
PUSH DE D5
Save Register Pair DE to the top of the stack.
5528
PUSH BC C5
Save Register Pair BC to the top of the stack.
5529
XOR A AF
Set Register A to 00H by XORing it with itself, to clear the OFF value.
552A
LD (5537H),A 32 37 55
Store Register A (00H) to 5537H, the low byte of the OFF value: the operand of LD DE,0000H at 5536H.
552D
LD DE,55D1H 11 D1 55
Point Register Pair DE to 55D1H, the parameter table of ON and OFF.
5530
GOSUB to 4476H, PARAM@, to take the parameters from the command line at Register Pair HL with the table at Register Pair DE.
5533
If the NZ FLAG is set (an unknown parameter), JUMP to 54E6H to post error 2EH, Invalid parameter.
5536
LD DE,0000H 11 00 00
Load Register Pair DE with the OFF value, the operand at 5537H-5538H (0000H in the file) that PARAM@ stored.
5539
INC E 1C
INCrement Register E by 1, the first half of a test of Register E against 00H.
553A
DEC E 1D
DECrement Register E by 1 back to its value: the NZ FLAG when OFF or NO was given.
553B
POP BC C1
Restore Register Pair BC from the top of the stack.
553C
POP DE D1
Restore Register Pair DE from the top of the stack.
553D
RET C9
RETurn with the Z FLAG for ON and the NZ FLAG for OFF.
553EH - A Decimal Number
Reads the digits at Register Pair HL into Register Pair DE. The number ends at a character that is not a digit, which is passed over, with the NC FLAG; or at the end of the line (a control code or a semicolon, 55B2H), which is not, with the C FLAG.
553E
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the number so far.
5541
GOSUB to 55B2H to take the character at Register Pair HL into Register A: the C FLAG at the end of the line, else Register Pair HL moves past it.
5544
RET C D8
If the C FLAG is set (the end of the line), RETurn with it and the number in Register Pair DE.
5545
SUB 30H D6 30
SUBtract 30H, the ASCII digit 0, from Register A: the C FLAG for a character below 0.
5547
If the C FLAG is set (not a digit), JUMP to 554DH: the number ends.
5549
CP 0AH FE 0A
Compare Register A against 0AH: the C FLAG for a digit 0-9.
554B
If the C FLAG is set (a digit), JUMP to 5551H to add it.
554D
ADD A,30H C6 30
ADD 30H to Register A, which gives the character back again.
554F
OR A B7
OR Register A with itself, to clear the C FLAG: the number ends at a separator.
5550
RET C9
RETurn with the NC FLAG and the number in Register Pair DE.
5551
PUSH HL E5
Save Register Pair HL, the text, to the top of the stack.
5552
LD H,D 62
Load Register H with Register D, the high byte of the number.
5553
LD L,E 6B
Load Register L with Register E: Register Pair HL = the number.
5554
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 2.
5555
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 4.
5556
ADD HL,DE 19
ADD Register Pair DE (the number) to Register Pair HL: the number times 5.
5557
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 10.
5558
LD E,A 5F
Load Register E with Register A, the value of the digit.
5559
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the digit.
555B
ADD HL,DE 19
ADD Register Pair DE (the digit) to Register Pair HL: the number times 10 plus the digit.
555C
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the new number.
555D
POP HL E1
Restore Register Pair HL, the text, from the top of the stack.
555E
JUMP back to 5541H for the next character of the number.
5560H - Decimal Digits
Puts the number in Register Pair DE (0-65535) at Register Pair HL as decimal digits without leading zeros (at least one digit) and returns Register Pair DE after them. The number is turned into six BCD digits at 55A9H-55ABH (sixteen doublings by ADC and DAA), and the digits into ASCII at 55ACH-55B1H by RLD.
5560
PUSH HL E5
Save Register Pair HL, the place for the digits, to the top of the stack.
5561
LD HL,55A9H 21 A9 55
Point Register Pair HL to 55A9H, three BCD bytes, the low two digits first.
5564
PUSH HL E5
Save Register Pair HL (55A9H) to the top of the stack.
5565
LD B,03H 06 03
Load Register B with 03H, the three BCD bytes to clear.
5567
LD (HL),00H 36 00
Store 00H to the BCD byte at Register Pair HL.
5569
INC HL 23
INCrement Register Pair HL by 1, the next BCD byte.
556A
DECrement Register B and, if it is not zero, JUMP back to 5567H for the next byte (DJNZ).
556C
POP HL E1
Restore Register Pair HL (55A9H) from the top of the stack.
556D
LD C,10H 0E 10
Load Register C with 10H, the 16 bits of the number.
556F
LD B,03H 06 03
Load Register B with 03H, the three BCD bytes.
5571
PUSH HL E5
Save Register Pair HL (55A9H) to the top of the stack.
5572
RL E CB 13
Rotate Register E left through the C FLAG (RL): the low byte of the number moves up.
5574
RL D CB 12
Rotate Register D left through the C FLAG (RL): the top bit of the number goes into the C FLAG.
5576
LD A,(HL) 7E
Load Register A with the BCD byte at Register Pair HL.
5577
ADC A,A 8F
ADD Register A to itself with the C FLAG (ADC): the byte doubled plus the bit carried in.
5578
DAA 27
Decimal Adjust Register A (DAA): the doubled byte as two BCD digits, the C FLAG carrying into the next byte.
5579
LD (HL),A 77
Store Register A to the BCD byte at Register Pair HL.
557A
INC HL 23
INCrement Register Pair HL by 1, the next BCD byte.
557B
DECrement Register B and, if it is not zero, JUMP back to 5576H for the next byte (DJNZ).
557D
POP HL E1
Restore Register Pair HL (55A9H) from the top of the stack.
557E
DEC C 0D
DECrement Register C by 1, the bits of the number that are left.
557F
If the NZ FLAG is set (bits are left), JUMP back to 556FH for the next bit.
5581
LD DE,55ACH 11 AC 55
Point Register Pair DE to 55ACH, the six ASCII digits.
5584
PUSH DE D5
Save Register Pair DE (55ACH) to the top of the stack.
5585
INC HL 23
INCrement Register Pair HL by 1 to 55AAH, the middle BCD byte.
5586
INC HL 23
INCrement Register Pair HL by 1 to 55ABH, the highest BCD byte.
5587
LD A,30H 3E 30
Load Register A with 30H, the ASCII digit 0, whose low four bits the RLD replaces.
5589
LD B,03H 06 03
Load Register B with 03H, the three BCD bytes.
558B
RLD ED 6F
Rotate the BCD digits left between Register A and the byte at Register Pair HL (RLD): the high digit goes into Register A as an ASCII digit.
558D
LD (DE),A 12
Store Register A, the digit, at Register Pair DE.
558E
INC DE 13
INCrement Register Pair DE by 1, the next digit's place.
558F
RLD ED 6F
Rotate the BCD digits left between Register A and the byte at Register Pair HL (RLD) again: the low digit goes into Register A.
5591
LD (DE),A 12
Store Register A, the digit, at Register Pair DE.
5592
INC DE 13
INCrement Register Pair DE by 1, the next digit's place.
5593
DEC HL 2B
DECrement Register Pair HL by 1, the next lower BCD byte.
5594
DECrement Register B and, if it is not zero, JUMP back to 558BH for the next byte (DJNZ).
5596
POP HL E1
Restore Register Pair HL with 55ACH, the first ASCII digit, from the top of the stack.
5597
LD B,05H 06 05
Load Register B with 05H, the leading zeros that may be dropped (the last digit is always kept).
5599
LD A,30H 3E 30
Load Register A with 30H, the ASCII digit 0, to find the leading zeros.
559B
CP (HL) BE
Compare Register A (30H) against the digit at Register Pair HL: the Z FLAG for a zero.
559C
If the NZ FLAG is set (the first digit that is not zero), JUMP to 55A1H.
559E
INC HL 23
INCrement Register Pair HL by 1, past the leading zero.
559F
DECrement Register B and, if it is not zero, JUMP back to 559BH for the next digit (DJNZ).
55A1
POP DE D1
Restore Register Pair DE with the place for the digits from the top of the stack.
55A2
LD C,B 48
Load Register C with Register B, the digits left less 1.
55A3
INC C 0C
INCrement Register C by 1, the number of digits to copy.
55A4
LD B,00H 06 00
Load Register B with 00H, the high byte of the count.
55A6
LDIR ED B0
Copy the digits from Register Pair HL to Register Pair DE by LDIR, with Register Pair BC as the count: Register Pair DE ends after them.
55A8
RET C9
RETurn with Register Pair DE after the digits.
55A9H - The Digits
Not in the file (the load module skips 55A9H-55B1H): the work area of 5560H.
55A9-55AB
DEFS 3
Three BCD bytes, the low two digits first (5561H): the number of 5560H.
55AC-55B1
DEFS 6
Six ASCII digits (5581H), from which the leading zeros are dropped.
55B2H - The End of the Line
Tests the character at Register Pair HL: a control code or a semicolon is the end of the line (the C FLAG, Register Pair HL unchanged); any other character is returned in Register A with the NC FLAG and Register Pair HL past it.
55B2
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
55B3
CP 20H FE 20
Compare Register A against 20H: the C FLAG for a control code, such as 0DH.
55B5
RET C D8
If the C FLAG is set (a control code), RETurn with it: the end of the line.
55B6
CP 3BH FE 3B
Compare Register A against 3BH, the semicolon that separates commands.
55B8
SCF 37
Set the C FLAG (SCF); the Z FLAG of the compare is kept.
55B9
RET Z C8
If the Z FLAG is set (a semicolon), RETurn with the C FLAG: the end of the command.
55BA
INC HL 23
INCrement Register Pair HL by 1, past the character.
55BB
OR A B7
OR Register A with itself, to clear the C FLAG.
55BC
RET C9
RETurn with the character in Register A and the NC FLAG.
55BDH - A Request
Entered by a GOSUB with a request code in Register A (09H: SYS1/SYS's routine 9). The overlay request handler drops the return address of the RST 28H, so the routine returns straight to the caller.
55BD
RST 28H EF
RESTART to 28H, the overlay request handler, with the request code in Register A; it returns to the caller of 55BDH, not to 55BEH.
55BEH - A Space
Sends a space to the control block at Register Pair DE; Register Pair AF is kept.
55BE
PUSH AF F5
Save Register Pair AF to the top of the stack.
55BF
LD A,20H 3E 20
Load Register A with 20H, a space, the character to send.
55C1
GOSUB to 001BH, the ROM's output routine, to send the character in Register A (20H) to the control block at Register Pair DE.
55C4
POP AF F1
Restore Register Pair AF from the top of the stack.
55C5
RET C9
RETurn to the caller with the space sent and Register A as it was.
55C6H - Close the Output
When the control block at Register Pair DE is a file (type 80H), it is closed by CLOSE@.
55C6
LD A,(DE) 1A
Load Register A with the type byte of the control block at Register Pair DE.
55C7
CP 80H FE 80
Compare Register A against 80H, the type of an open file control block.
55C9
RET NZ C0
If the NZ FLAG is set (a device), RETurn: nothing to close.
55CA
GOSUB to 4428H, CLOSE@, to close the file at Register Pair DE.
55CD
If the NZ FLAG is set (an error), JUMP to 54EEH to post the error in Register A.
55D0
RET C9
RETurn to the caller with the output file closed.
55D1H - The Parameter Tables
Data: the table of ON and OFF for PARAM@ (eight bytes an entry: the name, then the address of the value), the table of I for EVAL@ (nine bytes: the name, the address, the type byte), and the two evaluation blocks of I (55FCH) and of LIB and SCREEN (5605H).
55D1-55D6
DEFM "OFF " 4F 46 46 20 20 20
The name OFF for PARAM@ (5527H): CLOCK, DEBUG, VERIFY or BREAK off.
55D7-55D8
DEFW 5537H 37 55
OFF's value goes to 5537H-5538H, the operand of LD DE,0000H at 5536H.
55D9-55DE
DEFM "NO " 4E 4F 20 20 20 20
The name NO, the same as OFF: the value goes to the same place.
55DF-55E0
DEFW 5537H 37 55
NO's value goes to 5537H-5538H, the operand at 5536H, as OFF's.
55E1-55E6
DEFM "ON " 4F 4E 20 20 20 20
The name ON, which is also what nothing given means.
55E7-55E8
DEFW 5691H 91 56
ON's value goes to 5691H, inside the work area, where nothing reads it.
55E9-55EE
DEFM "YES " 59 45 53 20 20 20
The name YES, the same as ON: accepted and without effect.
55EF-55F0
DEFW 5691H 91 56
YES's value goes to 5691H, where nothing reads it, as ON's.
55F1
DEFB 00H 00
The end of the table of ON and OFF: a 00H in place of the next name.
55F2-55F7
DEFM "MOUNT " 4D 4F 55 4E 54 20
The name of I's parameter MOUNT for EVAL@: read each drive's GAT to set its sides.
55F8-55F9
DEFW 53FBH FB 53
MOUNT's value goes to 53FBH-53FCH, the operand of LD DE,0000H at 53FAH.
55FA
DEFB 20H 20
The type byte of MOUNT: 20H, bit 5, a logical value, so the name alone sets it.
55FB
DEFB 00H 00
The end of I's parameter table: a 00H in place of the next name.
55FC
DEFB 00H 00
The flags of I's evaluation block (53CAH), set by EVAL@.
55FD-55FE
DEFW 5653H 53 56
The address of the source block, 5653H, the drive.
55FF-5600
DEFW 5653H 53 56
The address of the destination block: 5653H again.
5601-5602
DEFW 5653H 53 56
The address of the wildmask block: 5653H again.
5603-5604
DEFW 55F2H F2 55
The address of the parameter table at 55F2H, MOUNT.
5605
DEFB 00H 00
The flags of the evaluation block of LIB and SCREEN (54F7H), set by EVAL@; also the empty parameter table of this block.
5606-5607
DEFW 5653H 53 56
The address of the source block, 5653H, the output device or file.
5608-5609
DEFW 5653H 53 56
The address of the destination block: 5653H again.
560A-560B
DEFW 5653H 53 56
The address of the wildmask block: 5653H again.
560C-560D
DEFW 5605H 05 56
The address of the parameter table: 5605H, the block's own first byte, 00H, so there are no parameters.
560EH - The Names of the Days and Months
Data: three letters each, for DATE (529DH, 52B7H), and the days of the months (5330H).
560E-5622
DEFM "SunMonTueWedThuFriSat" 53 75 6E 4D 6F 6E 54 75 65 57 65 64 54 68 75 46 72 69 53 61 74
The weekdays, from Sunday (0) to Saturday (6), three letters each.
5623-5646
DEFM "JanFebMarAprMayJunJulAugSepOctNovDec" 4A 61 6E 46 65 62 4D 61 72 41 70 72 4D 61 79 4A 75 6E 4A 75 6C 41 75 67 53 65 70 4F 63 74 4E 6F 76 44 65 63
The months, from January to December, three letters each.
5647-5652
DEFB 1FH,1CH,1FH,1EH,1FH,1EH,1FH,1FH,1EH,1FH,1EH,1FH 1F 1C 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F
The days of the months: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 (29 February is added by 5349H).
5653H - The Work Area
Not in the file: SYS12/SYS uses the memory after its last byte (5652H) for the field of EVAL@ or FSPEC@, the text of DATE and TIME, and the buffer of an output file.
5653-5692
DEFS 64
The field of EVAL@ (5653H flag, 5654H text, the file control block of an output file), the block of FSPEC@ for AUTO, the text of DATE and TIME, and 5691H where ON and YES are stored.
5693-5792
DEFS 256
The sector buffer of an output file of LIB or SCREEN (551CH).