Prev: 47185 Up: Map Next: 47326
47193: Draw a window
Used by the routines at 37764, 37909, 37951, 38780, 40258, 42638, 44253, 45552, 45641, 45685, 45723, 45809, 45963, 63399, 64230, 64317 and 64582.
Input
A Index of window to draw
IY 23610
47193 EX AF,AF' Switch AF and AF'
47194 LD A,111 Reset draw-hand-menu-cursor flag (later in this routine)...
47196 LD (47290),A ...
This entry point is used by the routine at 47185.
47199 SET 1,(IY+65) Set characters-movement-unrestricted flag / disable-in-game-glow flag
47203 EX AF,AF' Restore original AF (with A being index of window)
47204 LD (63400),A Set this index as the "current" window index
47207 LD L,A Load HL with A value (index of required window)...
47208 LD H,0 ...
47210 ADD HL,HL Multiply index by eight (as each window's data takes up eight bytes in table at 49034)...
47211 ADD HL,HL ...
47212 ADD HL,HL ...
47213 LD BC,49034 Set BC to start of window data table
47216 ADD HL,BC Calculate location of start of required window's data
47217 LD E,(HL) Load E with x-coordinate of left edge (characters)
47218 INC HL Load C with x-coordinate of right edge (characters)...
47219 LD C,(HL) ...
47220 INC HL Load D with y-coordinate of top edge (characters)...
47221 LD D,(HL) ...
47222 INC HL Load B with y-coordinate of bottom edge (characters)...
47223 LD B,(HL) ...
47224 LD (23408),DE Store values for later use...
47228 LD (23410),BC ...
47232 INC HL Load A with window's upper edge border style...
47233 LD A,(HL) ...
47234 LD (63306),A Store for later use in routine at 63302
47237 INC HL Load A with window's border attribute...
47238 LD A,(HL) ...
47239 EX AF,AF' Exchange AF and AF'
47240 INC HL Load A with starting y-coordinate of hand cursor...
47241 LD A,(HL) ...
47242 LD (23456),A Store for later use
47245 INC HL Load A with window's content attribute...
47246 LD A,(HL) ...
47247 LD (23481),A Store for later use
47250 EX AF,AF' Exchange AF and AF' (restoring border attribute to A and putting background colour in A')
47251 CALL 47326 Draw window frame
47254 LD HL,23408 Point HL at previously stored values
47257 INC (HL) Increase top-left x-coordinate
47258 INC HL Increase top-left y-coordinate...
47259 INC (HL) ...
47260 INC HL Decrease bottom-right x-coordinate...
47261 DEC (HL) ...
47262 INC HL Decrease bottom-right y-coordinate...
47263 DEC (HL) ...
47264 LD A,(23481) Load window content attribute into A
47267 LD (48035),A Prepare to fill a region with the attribute in A
47270 LD (23695),A Store window content attribute at 23695
47273 CALL 48027 Fill a region of attribute file with specified attribute
47276 CALL 48081 Blank the interior of the window (display file)
47279 LD HL,23408 Load x-coordinate of left of interior of window into C...
47282 LD C,(HL) ...
47283 INC HL Load y-coordinate of top of interior of window into B...
47284 LD B,(HL) ...
47285 CALL 63203 Move virtual cursor (bitmap) to display file address for coordinates x=C, y=B and load address into HL
47288 PUSH HL Store HL (address in display file of top-left of interior of window)
The operand of the instruction at 47289 represents the draw-hand-menu-cursor flag. This is modified by the instructions at 47188 and 47196.
47289 LD A,0 Load A with draw-hand-menu-cursor flag
47291 CP 105 If value is not 105...
47293 JP NZ,47317 ...then jump to 47317 (i.e. don't draw the hand cursor)
Window is a menu (105)
47296 LD BC,(23408) Load B with y-coordinate of top edge and C with x-coordinate of left edge
47300 LD A,(23456) Load A with starting y-coordinate of hand cursor
47303 ADD A,B Add y-coordinate of top of area to this...
47304 LD B,A ...and place back into B
47305 LD A,2 Load A with 2 (graphic lookup index of menu hand cursor graphic in table at 29272)
47307 LD DE,514 Load D (graphic width) with 2 and E (graphic height) with 2
47310 PUSH IX Store IX
47312 CALL 63507 Draw a graphic with lookup index A at character coordinates (C, B) with width E and height D
47315 POP IX Restore IX
47317 XOR A Set A to zero
47318 LD (23479),A Set hand cursor's current y-coordinate to zero (i.e. defaults to top of its movement range within current window)
47321 POP HL Restore HL (address in display file of top-left of interior of window)
47322 LD (63018),HL Set memory location to start printing character in character printing routine
47325 RET Return
Prev: 47185 Up: Map Next: 47326