Prev: AD34 Up: Map Next: ADAC
AD87: Clear Icon Area
Used by the routine at QueueProgram.
Clears an area of the screen that is four characters wide and thirty-two lines high, working upwards from the address that is given.
Input
HL Screen address of the bottom left
ClearIconArea AD87 PUSH BC Save the registers.
AD88 PUSH DE
AD89 PUSH HL
AD8A LD C,$20 There are 20 lines to clear.
ClearIconArea_Line AD8C LD B,$04 There are four bytes in a line.
AD8E XOR A Clear a byte...
ClearIconArea_Byte AD8F LD (HL),A ...on the screen.
AD90 INC L Move on to the next byte.
AD91 DJNZ ClearIconArea_Byte Loop back until the line has been cleared.
AD93 DEC L Go back to the start of the line.
AD94 DEC L
AD95 DEC L
AD96 DEC L
AD97 LD A,H Fetch the high byte of the address...
AD98 DEC H ...and move up one line.
AD99 AND $07 Jump if that has not moved into the character above.
AD9B JR NZ,ClearIconArea_Next
AD9D LD A,H Otherwise fetch the high byte again, as it has moved up a row of characters...
AD9E ADD A,$08 ...add eight to it...
ADA0 LD H,A ...and store it.
ADA1 LD A,L Fetch the low byte...
ADA2 SUB $20 ...take one row of characters off it...
ADA4 LD L,A ...and store it.
ClearIconArea_Next ADA5 DEC C Loop back until all of the lines have been cleared.
ADA6 JR NZ,ClearIconArea_Line
ADA8 POP HL Restore the registers.
ADA9 POP DE
ADAA POP BC
ADAB RET Return.
Prev: AD34 Up: Map Next: ADAC