Prev: 9C62 Up: Map Next: 9CA7
9C70: Draw Ceiling Picture
Used by the routine at Draw_Special_Room_Parts.
Draws the picture of the ceiling of a special room, at x position 18 and y position 10. The picture is 1A bytes wide and 20 lines high (see Room_Graphics_Ceiling).
The attributes of the picture are bright red (42). The shared code from Draw_Wide_Picture onwards also draws the floor (see Draw_Floor_Picture).
Draw_Ceiling_Picture 9C70 LD HL,$1018 Set the x position to 18 and the y position to 10 (1018).
9C73 LD DE,$7D27 Point at the picture (7D27).
9C76 LD C,$42 Set the attribute of the picture to 42.
This entry point is used by the routine at Draw_Floor_Picture.
Fill in the attributes of the picture, four rows of 1A cells.
Draw_Wide_Picture 9C78 PUSH HL Stash the position on the stack.
9C79 PUSH DE Stash the address of the picture on the stack.
9C7A CALL AttributeAddress Convert the position into an attribute buffer address.
9C7D LD DE,$0020 Set the size of a row of cells to 20.
9C80 LD A,C Copy the attribute to A.
9C81 LD C,$04 Set the number of rows to 04.
Draw_Ceiling_Picture_Row_Loop 9C83 PUSH HL Stash the address of the start of the row on the stack.
9C84 LD B,$1A Set the number of cells in a row to 1A.
Draw_Ceiling_Picture_Cell_Loop 9C86 LD (HL),A Write the attribute to the cell.
9C87 INC L Move on to the next cell.
9C88 DJNZ Draw_Ceiling_Picture_Cell_Loop Decrease the cell counter and loop back until the row is filled.
9C8A POP HL Restore the address of the start of the row.
9C8B ADD HL,DE Move down to the next row.
9C8C DEC C Decrease the row counter and loop back until all of the rows of attributes are filled.
9C8D JR NZ,Draw_Ceiling_Picture_Row_Loop
Copy the pixels of the picture, 20 lines of 1A bytes.
9C8F POP DE Restore the address of the picture from the stack.
9C90 POP HL Restore the position from the stack.
9C91 CALL ScreenAddress Convert the position into a screen address.
9C94 LD C,$20 Set the number of lines to 20.
Draw_Ceiling_Picture_Line_Loop 9C96 PUSH HL Stash the screen address of the start of the line on the stack.
9C97 LD B,$1A Set the number of bytes in a line to 1A.
Draw_Ceiling_Picture_Byte_Loop 9C99 LD A,(DE) Fetch a byte of the picture.
9C9A LD (HL),A Write it to the screen.
9C9B INC DE Move on to the next byte of the picture.
9C9C INC L Move on to the next screen address.
9C9D DJNZ Draw_Ceiling_Picture_Byte_Loop Decrease the byte counter and loop back until the line is drawn.
9C9F POP HL Restore the screen address of the start of the line.
9CA0 CALL ScreenPosition1PixelBelow Move down a line.
9CA3 DEC C Decrease the line counter and loop back until all of the lines of the picture are drawn.
9CA4 JR NZ,Draw_Ceiling_Picture_Line_Loop
9CA6 RET Return.
Prev: 9C62 Up: Map Next: 9CA7