Prev: 9A96 Up: Map Next: 9AF0
9AB6: 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 38 lines high, which are drawn from top to bottom at x position E8 and y position 30. 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 9AB6 PUSH DE Stash the frame flags on the stack.
9AB7 BIT 2,E Test bit 2 of the frame flags (the right wall).
9AB9 LD HL,$30E8 Set the x position to E8 and the y position to 30 (30E8).
9ABC LD DE,$9BB0 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 9ABF JP Z,Clear_Tall_Panel Jump to Clear_Tall_Panel if the wall is not present.
Draw_Wall_Tiles 9AC2 LD B,$02 Set the number of tiles to 02.
9AC4 PUSH HL Stash the position on the stack.
9AC5 CALL ScreenAddress Convert the position into a screen address.
9AC8 LD A,(IX+$02) Fetch the room x of Sabreman.
9ACB ADD A,(IX+$04) Add the room y of Sabreman.
9ACE RLCA Double the sum to make an offset into the table of word pointers.
Draw_Right_Wall_Tile_Loop 9ACF AND %00000110 Keep the offset within the table (four entries).
9AD1 LD C,A Store the offset in C.
9AD2 PUSH BC Stash the tile counter and the offset on the stack.
9AD3 EX DE,HL Exchange the registers so that HL holds the address of the table.
9AD4 PUSH HL Stash the address of the table on the stack.
9AD5 LD B,$00 Clear the high byte of the offset.
9AD7 ADD HL,BC Add the offset to the address of the table.
9AD8 LD A,(HL) Fetch the low byte of the address of the tile.
9AD9 INC HL Move on to the high byte.
9ADA LD H,(HL) Fetch the high byte of the address of the tile.
9ADB LD L,A Copy the low byte to L.
9ADC EX DE,HL Exchange the registers so that DE holds the address of the tile and HL the screen address.
9ADD CALL Draw_Tile Draw the tile.
9AE0 POP DE Restore the address of the table into DE.
9AE1 POP BC Restore the tile counter and the offset.
9AE2 LD A,C Copy the offset to A.
9AE3 ADD A,$02 Move on to the next entry of the table.
9AE5 DJNZ Draw_Right_Wall_Tile_Loop Decrease the tile counter and loop back until both tiles are drawn.
9AE7 POP HL Restore the position of the area.
9AE8 LD BC,$0370 Set the size of the area to 0370.
9AEB CALL Set_Area_Attributes Set the attributes of the area.
9AEE POP DE Restore the frame flags from the stack.
9AEF RET Return.
Prev: 9A96 Up: Map Next: 9AF0