Prev: E229 Up: Map Next: E376
E2E9: Draw Frame
Used by the routines at ShowTitleMenu and DrawPanel.
Draws a frame, from an entry of 05 bytes in the table at FrameTable, and moves on to the next entry. The edges of the frame are made with DrawFrameLeft, DrawFrameLeft_Draw and DrawFrameBar, and the corners with DrawFrameCorners.
draw-frame
Input
IX The entry of the frame
Output
IX The next entry
DrawFrame E2E9 LD A,(IX+$04) Fetch the attribute of the frame.
E2EC LD ($AAE4),A Store it in the colour rectangle at AAE4.
E2EF LD L,(IX+$00) Fetch the x position of the frame into L.
E2F2 LD H,(IX+$01) Fetch the y position of the frame into H.
E2F5 PUSH HL Save the position.
E2F6 PUSH HL Save it again.
E2F7 INC H Move down a pixel line, to the row below the frame.
E2F8 LD C,(IX+$02) Fetch the width of the frame.
E2FB LD B,$01 Set the height of the rectangle to one row.
E2FD LD ($AAE2),BC Store the width and the height in the rectangle.
E301 CALL FillScratchRectangle Colour the row below the frame.
E304 POP HL Restore the position.
E305 LD B,(IX+$03) Fetch the height of the frame in pixel lines.
E308 LD A,H Copy the y position into A.
E309 SUB B Subtract the height of the frame.
E30A LD H,A Copy it into H, to find the row above the frame.
E30B CALL FillScratchRectangle Colour the row above the frame.
E30E POP HL Restore the position.
E30F DEC L Move one pixel to the left, beside the frame.
E310 INC H Move down a pixel line.
E311 PUSH HL Save the position.
E312 LD C,$01 Set the width of the rectangle to one cell.
E314 LD A,(IX+$03) Fetch the height of the frame.
E317 ADD A,$17 Round it up to a whole number of rows.
E319 SRL A Halve it.
E31B SRL A Halve it again.
E31D SRL A Halve it a third time, to find the height in rows.
E31F LD B,A Copy it into B.
E320 LD ($AAE2),BC Store the width and the height in the rectangle.
E324 CALL FillScratchRectangle Colour the column on the left of the frame.
E327 POP HL Restore the position.
E328 LD A,(IX+$02) Fetch the width of the frame.
E32B ADD A,A Double it.
E32C ADD A,A Double it again.
E32D ADD A,A Double it a third time, to find the width in pixels.
E32E ADD A,L Add the x position.
E32F INC A Add one to find the column on the right of the frame.
E330 LD L,A Copy it into L.
E331 CALL FillScratchRectangle Colour the column on the right of the frame.
E334 LD L,(IX+$00) Fetch the x position of the frame into L.
E337 LD H,(IX+$01) Fetch the y position of the frame into H.
E33A CALL DrawFrameLeft Draw the left edge of the frame.
E33D LD A,L Fetch the x position of the left edge.
E33E ADD A,(IX+$02) Add the width of the frame.
E341 INC A Add one.
E342 LD L,A Copy the position of the right edge into L.
E343 CALL DrawFrameLeft_Draw Draw the right edge of the frame.
E346 LD A,(IX+$01) Fetch the y position of the frame.
E349 ADD A,$06 Add 06 to find the y position of the bottom bar.
E34B LD H,A Copy it into H.
E34C SUB (IX+$03) Subtract the height of the frame.
E34F SUB $08 Subtract eight to find the y position of the top bar.
E351 LD ($E358),A Patch it into the instruction at E358.
E354 CALL DrawFrameBar Draw the bottom bar of the frame.
E357 LD H,$00 Set H to the y position of the top bar (this is patched at E358).
E359 CALL DrawFrameBar Draw the top bar of the frame.
E35C LD DE,$E38C Point DE at FrameCornerPictures.
E35F LD A,(IX+$01) Fetch the y position of the frame.
E362 ADD A,$06 Add 06 to find the y position of the bottom bar.
E364 CALL DrawFrameCorners Draw the corners of the bottom bar.
E367 LD A,(IX+$01) Fetch the y position of the frame.
E36A SUB (IX+$03) Subtract the height of the frame.
E36D CALL DrawFrameCorners Draw the corners of the top bar.
E370 LD DE,$0005 Set the length of an entry of the frame table.
E373 ADD IX,DE Move IX on to the next entry.
E375 RET Return.
Prev: E229 Up: Map Next: E376