Prev: 9CE8 Up: Map Next: 9D19
9CF2: Draw Top Left Corner Picture
Used by the routine at Draw_Special_Room_Parts.
Draws a picture of a corner of the frame of a special room at x position 00 and y position 10 which is the top left corner. The picture is three bytes wide and 20 lines high, and starts with its attributes (see Room_Graphics).
The entries at Draw_Top_Right_Corner_Picture, Draw_Bottom_Left_Corner_Picture and Draw_Bottom_Right_Corner_Picture draw the other three corners, using the shared code from Draw_Corner_Picture onwards.
Input
DE Address of the picture
Draw_Top_Left_Corner_Picture 9CF2 LD HL,$1000 Set the x position to 00 and the y position to 10 (1000).
Copy the attributes of the picture, four rows of three cells.
Draw_Corner_Picture 9CF5 PUSH HL Stash the position on the stack.
9CF6 CALL AttributeAddress Convert the position into an attribute buffer address.
9CF9 LD C,$04 Set the number of rows to 04.
Draw_Top_Left_Corner_Picture_Row_Loop 9CFB PUSH HL Stash the address of the start of the row on the stack.
9CFC LD B,$03 Set the number of cells in a row to 03.
Draw_Top_Left_Corner_Picture_Cell_Loop 9CFE LD A,(DE) Fetch an attribute from the picture.
9CFF LD (HL),A Write it to the cell.
9D00 INC DE Move on to the next attribute of the picture.
9D01 INC L Move on to the next cell.
9D02 DJNZ Draw_Top_Left_Corner_Picture_Cell_Loop Decrease the cell counter and loop back until the row is copied.
9D04 POP HL Restore the address of the start of the row.
9D05 LD A,L Fetch the low byte of the address.
9D06 ADD A,$20 Add the size of a row of cells.
9D08 LD L,A Store the low byte of the address.
9D09 LD A,H Fetch the high byte of the address.
9D0A ADC A,$00 Add the carry.
9D0C LD H,A Store the high byte of the address.
9D0D DEC C Decrease the row counter and loop back until all of the rows of attributes are copied.
9D0E JR NZ,Draw_Top_Left_Corner_Picture_Row_Loop
9D10 POP HL Restore the position from the stack.
9D11 CALL ScreenAddress Convert the position into a screen address.
9D14 LD C,$20 Set the number of lines to 20.
9D16 JP Draw_Three_Byte_Lines Jump to Draw_Three_Byte_Lines to copy the pixels.
Prev: 9CE8 Up: Map Next: 9D19