Prev: 36987 Up: Map Next: 37333
37147: Draw a window frame
Used by the routine at 36987.
Input
A Window border attribute
A' Window background colour
37147 LD (23695),A Store border attribute at 23695
37150 LD A,(23493) Load A with x-coordinate of left of window
37153 LD C,A Copy into C
37154 LD A,(23495) Load A with x-coordinate of right of window
37157 SUB C Get distance between left and right coordinates
37158 DEC A Subtract 1 to get width of window top-edge (not including corner pieces)
37159 LD C,A Transfer this to BC...
37160 LD B,0 ...
37162 PUSH BC Store BC on stack
37163 LD BC,(23493) Load B with y-coordinate of top edge and C with x-coordinate of left edge
37167 INC C Increase C by one to skip over corner piece
37168 CALL 36551 Set position of virtual cursor for drawing
37171 POP HL Put width of top edge piece into HL...
37172 PUSH HL ...but retain it on stack also
37173 CALL 36908 Draw the top edge of the window
37176 LD A,(36912) Get previously drawn window component character (i.e. top edge)...
37179 INC A ...and increase to obtain next one (i.e. bottom edge)
37180 LD (36912),A Place this new character into the drawing routine
37183 LD A,(23493) Load A with x-coordinate of left of window
37186 LD C,A Copy into C
37187 LD A,(23496) Load A with y-coordinate of bottom of window
37190 LD B,A Copy into B
37191 INC C Increase C by one to skip over corner piece
37192 CALL 36551 Set position of virtual cursor for drawing
37195 POP HL Put width of bottom edge into HL...
37196 CALL 36908 Draw the bottom edge of the window
37199 LD A,(36912) Get previously drawn window component character (i.e. bottom edge)...
37202 INC A ...and increase to obtain next one (i.e. left edge)
37203 LD (36912),A Place this new character into the drawing routine
37206 LD A,(23494) Load y-coordinate of top of window into A
37209 LD B,A Copy into B
37210 LD A,(23496) Load y-coordinate of bottom of window into A
37213 SUB B Subtract B...
37214 DEC A ...and decrease by one to get length of left-edge (not including corner pieces)
37215 PUSH AF Store AF (A contains length of left / right edges)
37216 LD E,A Store length in E
37217 LD BC,(23493) Load B with y-coordinate of top edge and C with x-coordinate of left edge
37221 ADD A,B Add to get starting point of left edge
37222 LD B,A Load into B
37223 PUSH DE Store DE
37224 CALL 36551 Set position of virtual cursor for drawing
37227 LD A,(36912) Get character to draw
37230 CALL 36475 Draw character
37233 POP DE Restore DE (length of edge in E)
37234 LD A,(23495) Load x-coordinate of right edge of window into A
37237 LD C,A Copy to C
37238 LD A,(23494) Load y-coordinate of top edge of window into A
37241 ADD A,E Add to E to give y-coordinate of bottom of edge
37242 LD B,A Copy to B
37243 CALL 36551 Set position of virtual cursor for drawing
37246 LD A,(36912) Get character previously drawn (left edge)...
37249 INC A ...and increase to give right edge
37250 CALL 36475 Draw character
37253 POP AF Restore AF (A contains length of left / right edges)
37254 DEC A Decrease A by one as we have drawn one character of both left and right edges
37255 JP NZ,37215 If there is still some left and right edge to be drawn, loop back
edges of window have been drawn
37258 LD A,(23495) Load x-coordinate of right edge into A
37261 LD C,A Copy to C
37262 LD A,(23494) Load y-coordinate of top edge into A
37265 LD B,A Copy to B
37266 CALL 36551 Set position of virtual cursor for drawing
37269 LD A,(36912) Get character previously STORED (left edge)...
37272 INC A ...and increase twice to get top-right corner piece...
37273 INC A ...
37274 LD (36912),A Update drawing routine with this character
37277 CALL 36475 Draw character
37280 LD BC,(23495) Load B with y-coordinate of bottom edge and C with x-coordinate of right edge
37284 CALL 36551 Set position of virtual cursor for drawing
37287 LD A,(36912) Get character previously stored (top-right corner)...
37290 INC A ...and increase to get bottom-right corner piece
37291 LD (36912),A Place this character back into drawing routine
37294 CALL 36475 Draw character
37297 LD A,(23493) Load x-coordinate of left edge into A
37300 LD C,A Copy into C
37301 LD A,(23496) Load y-coordinate of bottom edge into A
37304 LD B,A Copy into B
37305 CALL 36551 Set position of virtual cursor for drawing
37308 LD A,(36912) Get character previously stored (bottom-right corner)...
37311 INC A ...and increase to get bottom-left corner piece
37312 LD (36912),A Place this character back into drawing routine
37315 CALL 36475 Draw character
37318 LD BC,(23493) Load B with y-coordinate of top edge and C with x-coordinate of left edge
37322 CALL 36551 Set position of virtual cursor for drawing
37325 LD A,(36912) Get character previously stored (bottom-left corner)...
37328 INC A ...and increase to get top-left corner piece
37329 CALL 36475 Draw character
37332 RET Return
Prev: 36987 Up: Map Next: 37333