4E00
LD A,(4CFDH)
Fetch the value stored at memory location 4CFDH and put it into Register A.
NOTE: 4CFDH is where the “DO” (chaining) active flag is kept. 0=Not active, and 255=active.
4E03
OR A
Since a LD command does not set any FLAGS, Set FLAGS based on the contents of Register A.
4E04
If the Z FLAG (Zero) is set, then “DO” is not active, so JUMP to 4E1AH.
If we are here, then “DO” was active when the error struck, so the below code deals with “DO” being active.
4E06
XOR A
Set Register A to ZERO and clear all Flags.
4E07
LD (4CFDH),A
Disable “DOS” by storing a 0 (i.e., the value held in Register A) into the memory location 4CFDH.
NOTE: 4CFDH is where the “DO” (chaining) active flag is kept. 0=Not active, and 255=active.
4E0A
POP AF
Restore Register Pair AF from the top of the STACK to get the applicable error code.
4E0B
AND 7FH
MASK the value of Register A against 7FH (0111 1111). This has the effect of turning off bits 7, leaving only bits 6, 5, 4, 3, 2, 1, 0 active, which will indicate that any routine exit is to exit to DOS.
4E0D
PUSH AF
Save the masked error code (i.e., Register AF) to the top of the stack.
4E0E
LD HL,(42B1H)
Fetch the value stored at memory location 42B1H (i.e., the keyboard driver address) and put it into Register HL.
4E11
LD (4016H),HL
Store the value held in Register HL (i.e., the saved keyboard driver address) into the memory location 4016H (i.e., the two byte keyboard driver vector).
4E14
LD HL,(4415H)
Fetch the value stored at memory location 4415H (i.e., a backup copy of high memory address a/k/a the end of physical memory) and put it into Register HL.
NOTE: 4415H is the storage location for the ADDRESS OF THE END OF PHYSICAL MEMORY.
4E17
LD (4411H),HL
Store the value held in Register HL (the end of physical memory) into the memory location 4411H (i.e., the address of highest available memory location).
At this point, we don’t care if “DO” was or was not active; so the routine continues..
POP AF
Restore the error code Register Pair AF from the top of the STACK.
4E1B
EX (SP),HL
EXchange the value stored in Register Pair HL (the end of physical memory) with the value stored at the top of the STACK (i.e., the return address).
4E1C
LD (4E71H),HL
Store the value held in Register HL (i.e., the return address) into the memory location 4E71H (which is in the middle of a JP NZ,nnnnH opcode.
4E1F
PUSH DE
Save Register DE to the top of the stack.
4E20
PUSH BC
Save Register BC to the top of the stack.
4E21
PUSH AF
Save Register AF to the top of the stack.
4E22
LD B,A
LET Register B = Register A (i.e., the error code with bit 7 of the options cleared).
4E23
AND 3FH
MASK the value of Register A against 3FH (0011 1111). This has the effect of turning off bits 7, 6, leaving only bits 5, 4, 3, 2, 1, 0 active, removing some more options from the error code.
4E25
LD C,A
LET Register C = Register A (i.e., the error code with bits 7 and 6 of the options cleared). This leaves Register C holding the true error code.
4E26
BIT 6,B
Test Bit 6 of Register B (i.e., the error code with bit 7 of the options cleared). Bit 6 of an error code signifies whether to display the long error message or the short error message.
4E28
If the NZ FLAG (Not Zero) is set then we set to display the LONG error message, so JUMP to 4E2FH.
4E2A
GOSUB to 4E76H to display the SHORT error message.
4E2D
JUMP to 4E65H to display a carriage return, restore all registers, and check bit 7 to see if we need to reboot (not zero) or exit to the DOS PROMPT and jump there.
4E2FH – Display LONG Error Message. On Entry, Register C has the pure (i.e., no option bits) error code.
4E2F
INC C
Bump the value stored in Register C by 1.
4E30
LD HL,502BH
LET Register Pair HL = 502BH, which is the error message lookup table.
BIT 7,(HL)
Test Bit 7 of Register (HL) to see if we are at the start of a long error message.
4E35
If the NZ FLAG (Not Zero) is set then we have found the error message, so JUMP to 4E3AH.
INC HL
Bump the value stored in Register Pair HL by 1 to look at the next byte of the long error message table.
4E3AH – Continuation of DISPLAY LONG ERROR MESSAGE routine. Jumped here when HL is pointing to the start of a long error message (based on Bit 7). This will parse down C error messages
4E3A
DEC C
DECrement the value stored in Register C (which is counting backwards through error messages to find the one we need) by 1.
4E3B
If the NZ FLAG (Not Zero) is set, then we haven’t found our error yet, so LOOP BACK to 4E37H.
If we are here, we have counted down C messages until we hit the one we need, pointed to by (HL).
LD A,(HL)
Fetch the value stored at memory location pointed to by Register Pair HL (i.e., the word number) and put it into Register A.
4E3E
PUSH HL
Save Register HL (i.e., the long error message table pointer) to the top of the stack.
4E3F
AND 7FH
MASK the value of Register A against 7FH (0111 1111). This has the effect of turning off bits 7, leaving only bits 6, 5, 4, 3, 2, 1, 0 active.
4E41
LD C,A
LET Register C = Register A (i.e., the word number, minus Bit 7).
4E42
LD HL,4E9BH
LET Register Pair HL = 4E9BH, which is the LONG ERROR MESSAGE WORD TABLE.
BIT 7,(HL)
Test Bit 7 of the memory address pointed by Register Pair HL. If Bit 7 is NZ then we are at a new word.
4E47
If the NZ FLAG (Not Zero) is set then we are at a new word so JUMP to 4E4CH.
INC HL
Bump the value stored in Register Pair HL by 1 since we weren’t at a new word.
4E4A
LOOP BACK to to 4E45H until Bit 7 of (HL) is NOT ZERO.
4E4CH – Continuation of DISPLAY LONG ERROR MESSAGE routine. Jumped here when (HL) points to a new word in the long error message routine.
4E4C
DEC C
DECrement the value stored in Register C (which is counting backwards through error messages to find the one we need) by 1.
4E4D
If the NZ FLAG (Not Zero) is set then we still aren’t at the right word yet, so JUMP BACK to 4E49H.
If we are here, we have found the right word.
LD A,(HL)
Fetch the value stored at memory location pointed to by Register Pair HL (i.e., a character of the word we were looking for) and put it into Register A.
4E50
AND 7FH
MASK the value of Register A against 7FH (0111 1111). This has the effect of turning off bits 7, leaving only bits 6, 5, 4, 3, 2, 1, 0 active.
4E52
GOSUB to 0033H.
NOTE: 0033H is the character print routine, to put the character held in Register A at the current cursor position.
4E55
INC HL
Bump the value stored in Register Pair HL by 1 to point to the next letter of the word in the error message we were looking for.
4E56
BIT 7,(HL)
Test Bit 7 of Register (HL) to see if we just INC’d HL to a new word.
4E58
If the Z FLAG (Zero) is set then we are NOT yet at a new word, so LOOP to 4E4FH to keep displaying that word.
4E5A
LD A,20H
LET Register A = 20H (ASCII: SPACE).
4E5C
GOSUB to 0033H to display the SPACE.
NOTE: 0033H is the character print routine, to put the character held in Register A at the current cursor position.
4E5F
POP HL
Restore Register Pair HL (i.e., the long error message table pointer) from the top of the STACK.
4E60
INC HL
Bump the value stored in Register Pair HL by 1 to go to the next entry in the word lookup table for our specific error.
4E61
BIT 7,(HL)
Test Bit 7 of Register (HL) to see if the message is done or not.
4E63
If the Z FLAG (Zero) is set then we are NOT done with our full message, so LOOP BACK to 4E3DH to process the next word.
LD A,0DH
LET Register A = 0DH (ASCII: CARRIAGE RETURN).
4E67
GOSUB to 0033H to print a CARRIAGE RETURN) since we have finished with our error message.
NOTE: 0033H is the character print routine, to put the character held in Register A at the current cursor position.
4E6A
POP AF
Restore Register Pair AF from the top of the STACK.
4E6B
POP BC
Restore Register Pair BC from the top of the STACK.
4E6C
POP DE
Restore Register Pair DE from the top of the STACK.
4E6D
POP HL
Restore Register Pair HL from the top of the STACK.
4E6E
BIT 7,A
Test Bit 7 of Register A to see if we are returning to DOS (Z) or rebooting (NZ).
4E70
If the NZ FLAG (Not Zero) is set, JUMP to 0000H.
4E73
JUMP to 4030H.
NOTE: 4030H is the OPERATION ABORTED routine. Routine runs, displays an error, and returns to the DOS PROMPT.
4E76H – Display SHORT ERROR MESSAGE routine.
LD HL,4E94H
LET Register Pair HL = 4E94H, which is the table lookup for error numbers.
4E79
LD (HL),2FH
Store a 2FH into the memory location pointed to by Register Pair HL to initialize the number for the upcoming math, noting that 2FH is one below 30H which is the hex value for “0”.
INC (HL)
Bump the value pointed to by Register Pair HL by 1. On entry, (HL) will now be 30H or a 0.
4E7C
SUB 0AH
SUBtract the value 0AH (Decimal: 10) from Register A so that Register A will hold the TENS POSITION number.
4E7E
If the NC FLAG (No Carry) is set, JUMP to 4E7BH.
4E80
INC HL
Bump the value stored in Register Pair HL by 1 so that HL now points to the ONES POSITION number.
4E81
ADD A,3AH
ADD the value 3AH to Register A (Results held in Register A) to convert Register A into ASCII.
4E83
LD (HL),A
Store the value held in Register A (the ONES POSITION number) into the memory location pointed to by Register Pair HL.
4E84
LD HL,4E8AH
LET Register Pair HL = 4E8AH, whic his t he base of the message table.
4E87
JUMP to 021BH.
NOTE: 021BH will display the character at (HL) until a 03H is found, and then RETurn.
4E8AH – ERROR MESSAGE STORAGE for ERROR 00.
4E9BH – ERROR MESSAGE WORD TABLE.
4FB3
35
“COMMAND PARAMETER”
4FD9
39
“* * UNDEFINED ERROR CODE * *”
502CH – ERROR PHRASE TABLE.
502F
01
“CRC ERROR DURING DISK I/O”
5034
02
“DISK DRIVE NOT ON SYSTEM”
5039
03
“LOST DATA DURING DISK I/O”
503E
04
“CRC ERROR DURING DISK I/O”
5043
05
“DISK SECTOR NOT FOUND”
5047
06
“DISK DRIVE HARDWARE FAULT”
504B
07
“ILLEGAL SIDE NUMBER”
504E
08
“DISK DRIVE NOT READY”
5052
09
“ILLEGAL I/O ATTEMPT”
5055
10
“REQUIRED COMMAND PARAMETER NOT FOUND”
5059
11
“ILLEGAL COMMAND PARAMETER”
505B
12
“TIME OUT ON DISK DRIVE”
505F
13
“I/O ATTEMPT TO NON SYSTEM DISK”
5065
14
“WRITE FAULT ON DISK I/O”
506A
15
“WRITE PROTECTED DISK”
506D
16
“ILLEGAL LOGICAL FILE NUMBER”
5071
17
“DIRECTORY READ ERROR”
5074
18
“DIRECTORY WRITE ERROR”
5077
19
“INVALID FILE NAME”
5089
25
“FILE ACCESS DENIED DUE TO PASSWORD PROTECTION”
5090
26
“DIRECTORY SPACE FULL”
5096
28
“ATTEMPT TO READ PAST EOF”
509A
29
“ATTEMPT TO READ OUTSIDE OF FILE LIMITS”
50A0
30
“NO MORE EXTENTS AVAILABLE”
50A4
31
“PROGRAM NOT FOUND”
50A7
32
“INVALID DRIVE NUMBER”
50AA
33
“* * UNDEFINED ERROR CODE * *”
50AB
34
“ATTEMPT TO USE NON PROGRAM FILE AS A PROGRAM”
50B3
35
“MEMORY FAULT DURING PROGRAM LOAD”
50B7
36
“* * UNDEFINED ERROR CODE * *”
50B8
37
“FILE ACCESS DENIED DUE TO PASSWORD PROTECTION”
50C0
38
“I/O ATTEMPT TO UNOPEN FILE”
50C5
39
“INVALID COMMAND PARAMETER”
50C7
40
“FILE ALREADY IN DIRECTORY”
50CB
41
“ATTEMPT TO OPEN FILE ALREADY OPEN”
50Dl
42-63
22 Undefined Error Codes