Prev: 39339 Up: Map Next: 39413
39378: Clear Panel
Clears a rectangle of the screen to the right of the position in HL. There are three entry points, which select the size of the rectangle. They stand in for the parts of the frame of the room (see Draw_Room) that are not present.
Each of those routines stashed DE on the stack, so this routine ends by restoring it. The caller is returned to by the last instruction.
Before After Clear_Panel
clear-panel-before clear-panel-after
Input
HL Position (L is the x position, H is the y position)
Clear_Panel 39378 LD BC,772 Set the size of the area to 3 bytes wide and 4 lines high (772).
39381 JR Clear_Panel_Rectangle Jump to Clear_Panel_Rectangle.
This entry point is used by the routine at Draw_Right_Wall.
Clear_Tall_Panel 39383 LD BC,880 Set the size of the area to 3 bytes wide and 112 lines high (880).
39386 JR Clear_Panel_Rectangle Jump to Clear_Panel_Rectangle.
This entry point is used by the routine at Draw_Ceiling.
Clear_Wide_Panel 39388 LD BC,6688 Set the size of the area to 26 bytes wide and 32 lines high (6688).
Clear_Panel_Rectangle 39391 CALL ScreenAddress Convert the position into a screen address.
39394 LD E,0 Set the byte to write to 0.
39396 LD D,B Keep the width of the rectangle for the next line.
Clear_Panel_Loop 39397 LD (HL),E Clear a byte of the line.
39398 INC L Move on to the next byte.
39399 DJNZ Clear_Panel_Loop Decrease the width counter and loop back until the line is clear.
39401 LD B,D Fetch the width of the rectangle again.
39402 LD A,L Fetch the low byte of the screen address.
39403 SUB B Subtract the width to move back to the start of the line.
39404 LD L,A Store the low byte of the address.
39405 CALL ScreenPosition1PixelBelow Move down one pixel line.
39408 DEC C Decrease the line counter and loop back until all of the lines are clear.
39409 JR NZ,Clear_Panel_Loop
39411 POP DE Restore DE from the stack.
39412 RET Return.
Prev: 39339 Up: Map Next: 39413