Prev: 39574 Up: Map Next: 39664
39606: Draw Right Wall
Used by the routine at Draw_Room.
Draws the right wall of the room if bit 2 of the frame flags is set, or clears its area if it is not.
The wall is made of two tiles, each three bytes wide and 56 lines high, which are drawn from top to bottom at x position 232 and y position 48. The tiles come from the table at Right_Wall_Tile_Table, indexed by the sum of the room x and the room y. The routine is also used to draw the left wall (see Draw_Left_Wall).
Input
DE Frame flags of the room in E
IX Object record of Sabreman
Draw_Right_Wall 39606 PUSH DE Stash the frame flags on the stack.
39607 BIT 2,E Test bit 2 of the frame flags (the right wall).
39609 LD HL,12520 Set the x position to 232 and the y position to 48 (12520).
39612 LD DE,39856 Point at the table of wall tiles (Right_Wall_Tile_Table).
This entry point is used by the routine at Draw_Left_Wall.
Draw_Right_Wall_Check_Present 39615 JP Z,Clear_Tall_Panel Jump to Clear_Tall_Panel if the wall is not present.
Draw_Wall_Tiles 39618 LD B,2 Set the number of tiles to 2.
39620 PUSH HL Stash the position on the stack.
39621 CALL ScreenAddress Convert the position into a screen address.
39624 LD A,(IX+2) Fetch the room x of Sabreman.
39627 ADD A,(IX+4) Add the room y of Sabreman.
39630 RLCA Double the sum to make an offset into the table of word pointers.
Draw_Right_Wall_Tile_Loop 39631 AND %00000110 Keep the offset within the table (four entries).
39633 LD C,A Store the offset in C.
39634 PUSH BC Stash the tile counter and the offset on the stack.
39635 EX DE,HL Exchange the registers so that HL holds the address of the table.
39636 PUSH HL Stash the address of the table on the stack.
39637 LD B,0 Clear the high byte of the offset.
39639 ADD HL,BC Add the offset to the address of the table.
39640 LD A,(HL) Fetch the low byte of the address of the tile.
39641 INC HL Move on to the high byte.
39642 LD H,(HL) Fetch the high byte of the address of the tile.
39643 LD L,A Copy the low byte to L.
39644 EX DE,HL Exchange the registers so that DE holds the address of the tile and HL the screen address.
39645 CALL Draw_Tile Draw the tile.
39648 POP DE Restore the address of the table into DE.
39649 POP BC Restore the tile counter and the offset.
39650 LD A,C Copy the offset to A.
39651 ADD A,2 Move on to the next entry of the table.
39653 DJNZ Draw_Right_Wall_Tile_Loop Decrease the tile counter and loop back until both tiles are drawn.
39655 POP HL Restore the position of the area.
39656 LD BC,880 Set the size of the area to 880.
39659 CALL Set_Area_Attributes Set the attributes of the area.
39662 POP DE Restore the frame flags from the stack.
39663 RET Return.
Prev: 39574 Up: Map Next: 39664