Prev: 40103 Up: Map Next: 40168
40113: 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 0 and y position 48. The picture is three bytes wide and 112 lines high (see Room_Graphics_Left_Wall).
The attributes of the picture are bright cyan (77). The shared code from Draw_Wall_Picture onwards also draws the right wall (see Draw_Right_Wall_Picture).
Draw_Left_Wall_Picture 40113 LD HL,12288 Set the x position to 0 and the y position to 48 (12288).
40116 LD DE,33639 Point at the picture (33639).
40119 LD C,77 Set the attribute of the picture to 77.
This entry point is used by the routine at Draw_Right_Wall_Picture.
Fill in the attributes of the picture, 14 rows of three cells.
Draw_Wall_Picture 40121 PUSH HL Stash the position on the stack.
40122 PUSH DE Stash the address of the picture on the stack.
40123 CALL AttributeAddress Convert the position into an attribute buffer address.
40126 LD DE,32 Set the size of a row of cells to 32.
40129 LD A,C Copy the attribute to A.
40130 LD C,14 Set the number of rows to 14.
Draw_Left_Wall_Picture_Row_Loop 40132 PUSH HL Stash the address of the start of the row on the stack.
40133 LD B,3 Set the number of cells in a row to 3.
Draw_Left_Wall_Picture_Cell_Loop 40135 LD (HL),A Write the attribute to the cell.
40136 INC L Move on to the next cell.
40137 DJNZ Draw_Left_Wall_Picture_Cell_Loop Decrease the cell counter and loop back until the row is filled.
40139 POP HL Restore the address of the start of the row.
40140 ADD HL,DE Move down to the next row.
40141 DEC C Decrease the row counter and loop back until all of the rows of attributes are filled.
40142 JR NZ,Draw_Left_Wall_Picture_Row_Loop
Copy the pixels of the picture, 112 lines of three bytes.
40144 POP DE Restore the address of the picture from the stack.
40145 POP HL Restore the position from the stack.
40146 CALL ScreenAddress Convert the position into a screen address.
40149 LD C,112 Set the number of lines to 112.
This entry point is used by the routine at Draw_Top_Left_Corner_Picture.
Draw_Three_Byte_Lines 40151 PUSH HL Stash the screen address of the start of the line on the stack.
40152 LD B,3 Set the number of bytes in a line to 3.
Draw_Left_Wall_Picture_Byte_Loop 40154 LD A,(DE) Fetch a byte of the picture.
40155 LD (HL),A Write it to the screen.
40156 INC DE Move on to the next byte of the picture.
40157 INC L Move on to the next screen address.
40158 DJNZ Draw_Left_Wall_Picture_Byte_Loop Decrease the byte counter and loop back until the line is drawn.
40160 POP HL Restore the screen address of the start of the line.
40161 CALL ScreenPosition1PixelBelow Move down a line.
40164 DEC C Decrease the line counter and loop back until all of the lines of the picture are drawn.
40165 JR NZ,Draw_Three_Byte_Lines
40167 RET Return.
Prev: 40103 Up: Map Next: 40168