Prev: 9CA7 Up: Map Next: 9CE8
9CB1: Draw Left Wall Picture
Used by the routine at Draw_Special_Room_Parts.
Draws the picture of the left wall of a special room, at x position 00 and y position 30. The picture is three bytes wide and 70 lines high (see Room_Graphics_Left_Wall).
The attributes of the picture are bright cyan (4D). The shared code from Draw_Wall_Picture onwards also draws the right wall (see Draw_Right_Wall_Picture).
Draw_Left_Wall_Picture 9CB1 LD HL,$3000 Set the x position to 00 and the y position to 30 (3000).
9CB4 LD DE,$8367 Point at the picture (8367).
9CB7 LD C,$4D Set the attribute of the picture to 4D.
This entry point is used by the routine at Draw_Right_Wall_Picture.
Fill in the attributes of the picture, 0E rows of three cells.
Draw_Wall_Picture 9CB9 PUSH HL Stash the position on the stack.
9CBA PUSH DE Stash the address of the picture on the stack.
9CBB CALL AttributeAddress Convert the position into an attribute buffer address.
9CBE LD DE,$0020 Set the size of a row of cells to 20.
9CC1 LD A,C Copy the attribute to A.
9CC2 LD C,$0E Set the number of rows to 0E.
Draw_Left_Wall_Picture_Row_Loop 9CC4 PUSH HL Stash the address of the start of the row on the stack.
9CC5 LD B,$03 Set the number of cells in a row to 03.
Draw_Left_Wall_Picture_Cell_Loop 9CC7 LD (HL),A Write the attribute to the cell.
9CC8 INC L Move on to the next cell.
9CC9 DJNZ Draw_Left_Wall_Picture_Cell_Loop Decrease the cell counter and loop back until the row is filled.
9CCB POP HL Restore the address of the start of the row.
9CCC ADD HL,DE Move down to the next row.
9CCD DEC C Decrease the row counter and loop back until all of the rows of attributes are filled.
9CCE JR NZ,Draw_Left_Wall_Picture_Row_Loop
Copy the pixels of the picture, 70 lines of three bytes.
9CD0 POP DE Restore the address of the picture from the stack.
9CD1 POP HL Restore the position from the stack.
9CD2 CALL ScreenAddress Convert the position into a screen address.
9CD5 LD C,$70 Set the number of lines to 70.
This entry point is used by the routine at Draw_Top_Left_Corner_Picture.
Draw_Three_Byte_Lines 9CD7 PUSH HL Stash the screen address of the start of the line on the stack.
9CD8 LD B,$03 Set the number of bytes in a line to 03.
Draw_Left_Wall_Picture_Byte_Loop 9CDA LD A,(DE) Fetch a byte of the picture.
9CDB LD (HL),A Write it to the screen.
9CDC INC DE Move on to the next byte of the picture.
9CDD INC L Move on to the next screen address.
9CDE DJNZ Draw_Left_Wall_Picture_Byte_Loop Decrease the byte counter and loop back until the line is drawn.
9CE0 POP HL Restore the screen address of the start of the line.
9CE1 CALL ScreenPosition1PixelBelow Move down a line.
9CE4 DEC C Decrease the line counter and loop back until all of the lines of the picture are drawn.
9CE5 JR NZ,Draw_Three_Byte_Lines
9CE7 RET Return.
Prev: 9CA7 Up: Map Next: 9CE8