Prev: 9A33 Up: Map Next: 9A96
9A53: Draw Top Right Corner
Used by the routine at Draw_Room.
Draws the top right corner of the frame of the room if bit 1 of the frame flags is set, or clears its area if it is not.
The corner is three bytes wide and 20 lines high and is drawn at x position E8 y position 10. The shape depends on whether the ceiling (bit 0) and the right wall (bit 2) are present, and on the room x and y: the table at Top_Right_Corner_Table has a set of four shapes for each of four combinations of the room coordinates. The routine also draws the other corners, which jump to Draw_Corner_Shape.
Input
DE Frame flags of the room in E
IX Object record of Sabreman
Draw_Top_Right_Corner 9A53 PUSH DE Stash the frame flags on the stack.
9A54 LD HL,$10E8 Set the x position to E8 and the y position to 10 (10E8).
9A57 LD A,E Copy the frame flags to A.
9A58 LD DE,$9A96 Point at the table of corner shapes (Top_Right_Corner_Table).
9A5B BIT 1,A Jump to 9A62 to clear the area if the corner is not present.
9A5D JP Z,Clear_Panel
9A5F SBC A,C
Draw_Corner 9A60 PUSH HL Stash the position on the stack.
9A61 EX DE,HL Exchange the registers so that HL holds the address of the table.
9A62 BIT 0,A Jump to Draw_Top_Right_Corner_Check_Right_Wall if the ceiling is not present.
9A64 JR Z,Draw_Top_Right_Corner_Check_Right_Wall
9A66 INC HL Skip the shapes for a ceiling.
9A67 INC HL
Draw_Top_Right_Corner_Check_Right_Wall 9A68 BIT 2,A Jump to Draw_Corner_Shape if the right wall is not present.
9A6A JR Z,Draw_Corner_Shape
9A6C INC HL Skip the shapes for a right wall.
9A6D INC HL
9A6E INC HL
9A6F INC HL
This entry point is used by the routines at Draw_Bottom_Right_Corner, Draw_Bottom_Left_Corner and Draw_Top_Left_Corner.
Draw_Corner_Shape 9A70 LD A,(IX+$02) Fetch the room x of Sabreman.
9A73 ADD A,(IX+$04) Add the room y of Sabreman.
9A76 ADD A,A Multiply the sum by eight.
9A77 ADD A,A
9A78 ADD A,A
9A79 AND %00011000 Keep only bits 3 and 4.
9A7B LD C,A Store the offset in C.
9A7C LD B,$00 Clear the high byte of the offset.
9A7E ADD HL,BC Add the offset to the address in the table.
9A7F LD A,(HL) Fetch the low byte of the address of the shape.
9A80 INC HL Move on to the high byte.
9A81 LD H,(HL) Fetch the high byte of the address of the shape.
9A82 LD L,A Copy the low byte to L.
9A83 EX DE,HL Exchange the registers so that DE holds the address of the shape.
9A84 LD BC,$0320 Set the size of the area to three bytes wide, 20 lines high (0320).
9A87 CALL ScreenAddress Convert the position into a screen address.
9A8A CALL Draw_Tile_Without_Header Draw the shape.
9A8D POP HL Restore the position from the stack.
9A8E LD BC,$0320 Set the size of the area to 0320.
9A91 CALL Set_Area_Attributes Set the attributes of the area.
9A94 POP DE Restore the frame flags from the stack.
9A95 RET Return.
Prev: 9A33 Up: Map Next: 9A96