![]() |
Routines |
| Prev: 40034 | Up: Map | Next: 40103 |
|
Used by the routine at Draw_Special_Room_Parts.
Draws the picture of the ceiling of a special room, at x position 24 and y position 16. The picture is 26 bytes wide and 32 lines high (see Room_Graphics_Ceiling).
The attributes of the picture are bright red (66). The shared code from Draw_Wide_Picture onwards also draws the floor (see Draw_Floor_Picture).
|
||||
| Draw_Ceiling_Picture | 40048 | LD HL,4120 | Set the x position to 24 and the y position to 16 (4120). | |
| 40051 | LD DE,32039 | Point at the picture (32039). | ||
| 40054 | LD C,66 | Set the attribute of the picture to 66. | ||
|
This entry point is used by the routine at Draw_Floor_Picture.
Fill in the attributes of the picture, four rows of 26 cells.
|
||||
| Draw_Wide_Picture | 40056 | PUSH HL | Stash the position on the stack. | |
| 40057 | PUSH DE | Stash the address of the picture on the stack. | ||
| 40058 | CALL AttributeAddress | Convert the position into an attribute buffer address. | ||
| 40061 | LD DE,32 | Set the size of a row of cells to 32. | ||
| 40064 | LD A,C | Copy the attribute to A. | ||
| 40065 | LD C,4 | Set the number of rows to 4. | ||
| Draw_Ceiling_Picture_Row_Loop | 40067 | PUSH HL | Stash the address of the start of the row on the stack. | |
| 40068 | LD B,26 | Set the number of cells in a row to 26. | ||
| Draw_Ceiling_Picture_Cell_Loop | 40070 | LD (HL),A | Write the attribute to the cell. | |
| 40071 | INC L | Move on to the next cell. | ||
| 40072 | DJNZ Draw_Ceiling_Picture_Cell_Loop | Decrease the cell counter and loop back until the row is filled. | ||
| 40074 | POP HL | Restore the address of the start of the row. | ||
| 40075 | ADD HL,DE | Move down to the next row. | ||
| 40076 | DEC C | Decrease the row counter and loop back until all of the rows of attributes are filled. | ||
| 40077 | JR NZ,Draw_Ceiling_Picture_Row_Loop | |||
|
Copy the pixels of the picture, 32 lines of 26 bytes.
|
||||
| 40079 | POP DE | Restore the address of the picture from the stack. | ||
| 40080 | POP HL | Restore the position from the stack. | ||
| 40081 | CALL ScreenAddress | Convert the position into a screen address. | ||
| 40084 | LD C,32 | Set the number of lines to 32. | ||
| Draw_Ceiling_Picture_Line_Loop | 40086 | PUSH HL | Stash the screen address of the start of the line on the stack. | |
| 40087 | LD B,26 | Set the number of bytes in a line to 26. | ||
| Draw_Ceiling_Picture_Byte_Loop | 40089 | LD A,(DE) | Fetch a byte of the picture. | |
| 40090 | LD (HL),A | Write it to the screen. | ||
| 40091 | INC DE | Move on to the next byte of the picture. | ||
| 40092 | INC L | Move on to the next screen address. | ||
| 40093 | DJNZ Draw_Ceiling_Picture_Byte_Loop | Decrease the byte counter and loop back until the line is drawn. | ||
| 40095 | POP HL | Restore the screen address of the start of the line. | ||
| 40096 | CALL ScreenPosition1PixelBelow | Move down a line. | ||
| 40099 | DEC C | Decrease the line counter and loop back until all of the lines of the picture are drawn. | ||
| 40100 | JR NZ,Draw_Ceiling_Picture_Line_Loop | |||
| 40102 | RET | Return. | ||
| Prev: 40034 | Up: Map | Next: 40103 |