31D5
LD HL,3C16H
Let HL = 3C16H (an address left of middle on the first line of the screen).
31D8
LD BC,3C2FH
Let BC = 3C2FH (an address about 3/4 of the way to the right on the first line of the screen).
31DB
LD A,(BC)
Fetch the character from the screen pointed to by Register Pair BC and put it into Register A.
31DC
INC A
LET A = A + 1 to increment the ASCII value of that character by 1.
31DD
LD (BC),A
Replace the character on screen with the character value + 1.
31DE
GOSUB to 330CH, which does some SERIOUS byte manipulation on the character held in Register A to turn it into an ASCII HEX Digit and display it at (HL), and then BUMP HL.
31E1
LD IX,3C30H
LET IX = 3C30H (a screen location on the top line of the screen).
31E5
LD HL,8000H
LET HL = 8000H.
31E8
GOSUB to 32B7H to write memory locations 8000H-FFFFH out and then read them back.
31EB
LD A,(IX+00H)
Fetch the value stored at IX+00H and put it into Register A.
31EE
OR A
Since a LD command does not affect the flags, an OR A is necessary to the flags based on the contents Register A.
31EF
If the value held at 3C30H is NOT 00H then JUMP to 3215H.
If we are here, then we are going to move the RAM test to 8100H and JUMP to it there.
31F1
LD IX,FC30H
Let IX = FC30H.
31F5
LD DE,8100H
Let DE = 8100H.
31F8
LD BC,0059H
Let BC = 59H (or 89 bytes).
31FB
LD HL,32B3H
Let HL = 32B3H.
31FE
LDIR
Move the byte from (HL) to (DE), then HL and DE are incremented, and BC is decremented until BC is zero. Interrupts CAN fire during this command.
3200
LD H,B
LET Register H = Register B (which is 0).
3201
LD L,C
LET Register L = Register C (which is 0).
3202
LD SP,FFFEH
Set the STACK POINTER to top of memory.
3205
GOSUB to 8100H (the relocated 32B3H routine). Note: Entering the memory test at 32B3 sets the RAM Bank Select at: Lower 32K Ram in Bank 0 / Upper 32K RAM in Bank 2.
3208
LD SP,37FEH
Set the STACK POINTER to 37FEH.
320B
LD IX,3C30H
Let IX = 3C30H.
320F
LD A,(IX+00H)
Fetch the contents of the memory location pointed to by IX+00H into Register A.
3212
OR A
Since a LD command does not affect the flags, an OR A is necessary to the flags based on the contents Register A.
3213
If the memory location pointed to by IX+00H into Register A was ZERO, JUMP to 31D5H to do another pass.
If the memory location pointed to by IX+00H into Register A was NOT zero then we have a problem, so we need to display the memory test failure messages and addresses.
3215
LD DE,3C80H
Let DE = 3C80H, the first character on the 3rd line of the video screen.
3218
LD HL,3278H
Let HL = 3278H to point to a message.
321B
GOSUB to 345EH display the messages pointed to by HL at the screen location of DE, in this case "Intr Errors= Hard Errors= Last Error @" + 00h.
321E
LD DE,3D00H
Set DE to be the 1st character on the 5th line of the screen.
3221
INC HL
Let HL = HL + 1 (to point to the next error message).
3222
GOSUB to 345EH display the messages pointed to by HL at the screen location of DE, in this case "Failing Rows:",00h.
3225
PUSH IX
Save register pair IX to the top of the STACK.
3227
POP BC
Move the value at the top of the STACK (which is the value stored in Register IX, i.e., 3C30H) to Register Pair BC.
3228
LD HL,3C8CH
Set HL to be the 13th character on the 3rd line of the screen. This would the screen location to put the first byte of the 2 byte number of "Intr Errors".
322B
LD A,(BC)
Load the value stored in the memory location pointed to by Register Pair BC (the first byte of the 2 byte number of "Intr Errors" to report) into Register A.
322C
INC BC
Bump BC to point to the second byte of the 2 byte number of "Intr Errors".
322D
GOSUB to 330CH, which does some SERIOUS byte manipulation on the character held in Register A to turn it into an ASCII HEX Digit and display it at (HL), and then BUMP HL.
3230
LD HL,3C9CH
Set HL to be the 29th character on the 3rd line of the screen. This would the screen location to put the first byte of the 2 byte number of "Hard Errors".
3233
LD A,(BC)
Load the value stored in the memory location pointed to by Register Pair BC (the first byte of the 2 byte number of "Hard Errors" to report) into Register A.
3234
INC BC
Bump BC to point to the screen location to put the second byte of the 2 byte number of "Hard Errors".
3235
GOSUB to 330CH, which does some SERIOUS byte manipulation on the character held in Register A to turn it into an ASCII HEX Digit and display it at (HL), and then BUMP HL.
3238
LD HL,3CADH
Set HL to be the 46th character on the 3rd line of the screen. This would the screen location to put the first byte of the 4 byte number of "Last Error @".
323B
LD A,(BC)
Load the value stored in the memory location pointed to by Register Pair BC into Register A.
323C
INC BC
Bump BC to the screen location to put the second byte of the 4 byte number of "Last Error @".
323D
GOSUB to 330CH, which does some SERIOUS byte manipulation on the character held in Register A to turn it into an ASCII HEX Digit and display it at (HL), and then BUMP HL.
3240
LD A,(BC)
Load the value stored in the memory location pointed to by Register Pair BC into Register A.
3241
INC BC
Bump BC to the screen location to put the third byte of the 4 byte number of "Last Error @".
3242
GOSUB to 330CH, which does some SERIOUS byte manipulation on the character held in Register A to turn it into an ASCII HEX Digit and display it at (HL), and then BUMP HL.
3245
LD HL,32A5H
Let HL = 32A5H to point to the message "Failing Rows:",00h.
3248
LD DE,3D00H
Set DE to be the 1st character on the 5th line of the screen.
324B
GOSUB to 345EH display the messages pointed to by HL at the screen location of DE, in this case "Failing Rows:",00h.
Now we will point to the 15th character on Row 5, right after the "Failing Rows:" message, to populate 8 single number rows (7 to 0). The byte at Register Pair BC will be the binary representation of the rows which failed.
324E
LD A,(BC)
Load the value stored in the memory location pointed to by Register Pair BC into Register A.
Start of a loop of 08 cycles.
3251
RLCA
Rotate the bits in A left (with Bit 7 going into both the CARRY and Bit 0).
3252
If Bit 7 was a 0, meaning that that bit does not represent a FAILED ROW, move to the next cycle of the loop as we are not going to display anything (since it didn't fail).
3254
EX AF,AF'
Preserve the rotated Register A by EXchanging the values of AF and AF'.
3255
LD A,B
Let Register A = Register B (i.e., where we are in the loop of 8).
3256
ADD 2FH
ADD 2FH to Register A. 2F is one character below a 0 so this would turn a number into the ASCII equivalent of that number.
3258
LD (DE),A
Put the ASCII value of B onto the screen in the FAILING ROWS list.
3259
EX AF,AF'
Restore Register A by EXchanging (back) the values of AF and AF'.
325A
INC DE
Bump DE to the next space on the video display (so it doesn't overwrite the just displayed number).
325B
INC DE
Bump DE to the next space on the video display (so as to put a space between the displayed numbers).
325C
Loop back to 3251H and keep looping until Register B = 0 (i.e., all 8 bits of the byte holding the failing rows have been displayed or skipped).
325E
JUMP to 344FH to disable the interrupts and HALT.