We need to process a FULL SCREEN debug screen.
4F17
LD A,1CH 3E 1C
LET Register A = 1CH (home the cursor).
Original Source Code Comment: HOME CURSOR
4F19
GOSUB to 0033H.
NOTE: 0033H is the character print routine, to put the character held in Register A at the current cursor position.
Original Source Code Comment: OUT TO THE DISPLAY
4F1C
LD HL,3C00H 21 00 3C
LET Register Pair HL = 3C00H (i.e., the first screen location).
Original Source Code Comment: TOP OF THE SCREEN
4F1F
LD (4020H),HLLD (CURSOR),HL 22 20 40
Set the cursor position by storing the value held in Register HL into the memory location 4020H.
NOTE: 4020H is the storage location for the CURSOR POSITION ON SCREEN.
Original Source Code Comment: SET THE CURSOR POSITION
4F22
GOSUB to 4F80H to display the memory.
Original Source Code Comment: DISPLAY THE MEMORY
4F25
GOSUB to 5273H to display a carriage return.
Original Source Code Comment: OUTPUT A CR
4F28
LD HL,(4020H)LD HL,(CURSOR) 2A 20 40
Fetch the value stored at memory location 4020H (i.e., the cursor location on screen) and put it into Register HL.
Original Source Code Comment: GET THE PRESENT CURSOR LOCATION
4F2B
LD (4F61H),HLLD (CURSAV),HL 22 61 4F
Store the value held in Register HL (i.e., the cursor location on screen) into the memory location 4F61H.
Original Source Code Comment: AND SAVE IT FOR LATER
4F2E
LD BC,00C0H 01 C0 00
LET Register Pair BC = 00C0H (Decimal: 192) as an offset to HL to move the cursor down 3 lines.
Original Source Code Comment: MOVE THE CURSOR DOWN 3 LINES
4F31
ADD HL,BC 09
ADD the value held in Register Pair BC (the 3 line offset) to Register Pair HL (the current screen position). The results are held in Register Pair HL.
Original Source Code Comment: HL = NEW CURSOR POSITION
4F32
LD (4020H),HLLD (CURSOR),HL 22 20 40
Store the value held in Register HL into the memory location 4020H.
NOTE: 4020H is the storage location for the CURSOR POSITION ON SCREEN.
Original Source Code Comment: SET IT
4F35
LD HL,4FA2HLD HL,DISPL7 21 A2 4F
LET Register Pair HL = 4FA2H so as to point to the message storage area for "SP PC AF ..".
Original Source Code Comment: HL => 'SP PC AF ETC' MSG
4F38
GOSUB to 021BH to display that message.
NOTE: 021BH will display the character at (HL) until a 03H is found.
Original Source Code Comment: DISPLAY IT
4F3B
GOSUB to 5273H to display a carriage return.
Original Source Code Comment: AND A CR
4F3E
LD HL,4108HLD HL,MEM+8 21 08 41
LET Register Pair HL = 4108H to point to the bottom of the REGISTER SAVE area.
4F41
PUSH HL E5
Save Register HL (i.e., the pointer to the REGISTER SAVE area) to the top of the STACK. In a few instructions we will have a EXchange command to swap this value.
4F42
LD HL,4FA2HLD HL,DISPL7 21 A2 4F
LET Register Pair HL = 4FA2H (i.e., the storage location for the message " AF BC DE HL AF").
4F45
LD B,0CH 06 0C
LET Register B = 0CH (Decimal: 12) since there are 12 register pairs.
Original Source Code Comment: SET FOR 12 REGISTER PAIRS
4F47DISPL0 / DISPL1
EX (SP),HL E3
EXchange the value stored in Register Pair HL (i.e., the storage location for the message " AF BC DE HL AF") with the value stored at the top of the STACK (i.e., the pointer to the REGISTER SAVE area).
4F48
LD E,(HL) 5E
Fetch the value stored at memory location pointed to by Register Pair HL (i.e., the LSB of one of the registers) and put it into Register E.
4F49
INC HL 23
Bump the value stored in Register Pair HL by 1.
4F4A
LD D,(HL) 56
Fetch the MSB of the saved register pair into Register D. DE now holds the saved value (4F48H-4F4AH is the source's LD DE,(HL)).
4F4B
INC HL 23
Bump the value stored in Register Pair HL by 1 to point to the LSB of the next register pair in the REGISTER SAVE area.
4F4C
PUSH HL E5
Save Register HL (i.e., the pointer to the next register pair in the REGISTER SAVE area) to the top of the STACK.
4F4D
EX DE,HL EB
EXchange the value stored in Register Pair HL (i.e., the pointer to the next register pair in the REGISTER SAVE area) with the value stored in Register Pair DE (i.e., the value of a saved register pair from the REGISTER SAVE area).
4F4E
LD A,H 7C
LET Register A = Register H so that we can display the MSB of the value held for that Register Pair.
4F4F
GOSUB 5258H (OUTBYT) to display Register A (the MSB) as two hex digits.
4F52
LD A,L 7D
LET Register A = Register L (the LSB of the value).
4F53
GOSUB to 526CH to display a byte held in Register A (i.e., that LSB) as a two byte ascii value followed by a space.
4F56
LD A,B 78
LET Register A = Register B (i.e., the counter for the 12 register pairs to dump).
4F57
AND 0BH E6 0B
AND 0BH on the count in A. No instruction tests the flags this sets: DISPL5 follows either way.
The AND 0BH and CP 08H set flags that no instruction tests: the source has no jump between them and DISPL5.
4F59
CP 08H FE 08
Compare A with 08H. No instruction tests the result: DISPL5 follows either way.
4F5BDISPL5
POP HL E1
Restore Register Pair HL (i.e., the pointer to the next register pair in the REGISTER SAVE area) the from the top of the STACK.
4F5C
EX (SP),HL E3
EXchange the value stored in Register Pair HL (i.e., the pointer to the next register pair in the REGISTER SAVE area) with the value stored at the top of the STACK (i.e., the storage location for the message " AF BC DE HL AF").
4F5D
LOOP back to 4F47H until Register B is ZERO.
4F5F
POP HL E1
Clear the STACK.
4F60
LD HL,0000HLD HL,0 21 00 00
LET Register Pair HL = the cursor address stored at 4F61H-4F62H (CURSAV, the operand of this instruction) by 4F2BH: the line under the memory display.
Original Source Code Comment: CURSOR SAVED HERE
4F63
LD BC,0040HLD BC,64 01 40 00
LET Register Pair BC = 0040H (64), one screen line.
Original Source Code Comment: BUMP DOWN ONE LINE
4F66
ADD HL,BC 09
ADD the value held in Register Pair BC (i.e., one screen line offset) to Register Pair HL (i.e., the saved cursor location). The results are held in Register Pair HL.
Original Source Code Comment: HL = NEW CURSOR
4F67
LD (4020H),HLLD (CURSOR),HL 22 20 40
Store the value held in Register HL (i.e., the advanced by one line cursor location) into the memory location 4020H.
NOTE: 4020H is the storage location for the CURSOR POSITION ON SCREEN.
Original Source Code Comment: SET IT
4F6A
LD HL,4FD7HLD HL,PC 21 D7 4F
LET Register Pair HL = 4FD7H, which points to the message PC.
Original Source Code Comment: HL => 'PC' MSG
4F6D
GOSUB to 021BH to display that message.
NOTE: 021BH will display the character at (HL) until a 03H is found.
Original Source Code Comment: DISPLAY IT
4F70
GOSUB to 526FH to display a space.
Original Source Code Comment: AND A SPACE
4F73
LD HL,(411EH)LD HL,(MEM+30) 2A 1E 41
Fetch 411EH-411FH (MEM+30, the program's PC) into Register Pair HL.
Original Source Code Comment: HL => USERS PC AREA
4F76
LD B,10H 06 10
LET Register B = 10H (Decimal: 16) to set up for a loop of 16.
Original Source Code Comment: SET FOR 16 BYTES
4F78CURSA1
LD A,(HL) 7E
Fetch the value stored at memory location pointed to by Register Pair HL and put it into Register A.
Original Source Code Comment: GET A BYTE
4F79
GOSUB to 526CH to print a byte held in Register A as a two byte ascii value followed by a space.
Original Source Code Comment: OUTPUT IT AS TWO BYTE ASCII AND SPACE
4F7C
INC HL 23
Bump Register Pair HL to point to the next byte.
Original Source Code Comment: BUMP TO NEXT BYTE
4F7D
LOOP back to 4F78H until Register B is ZERO.
Original Source Code Comment: LOOP FOR COUNT
4F7F
RET C9
RETurn to the caller.
Original Source Code Comment: DONE WITH DISPLAY