Prev: 36979 Up: Map Next: 37147
36987: Draw a window
Used by the routines at 26747, 26788, 28092, 29800, 29880, 30540, 30602, 31370, 32035, 32876, 33180, 34350, 34768, 34914, 35101, 35141, 37654 and 38749.
Input
A Index of window to draw (e.g. 14 for "PRESS SPACE OR FIRE TO CONTINUE" window)
IY 23610
36987 EX AF,AF' Switch AF and AF'
36988 LD A,111 Reset draw-hand-menu-cursor flag (later in this routine)...
36990 LD (37084),A ...
This entry point is used by the routines at 36919 and 36979.
36993 SET 1,(IY+65) Set disable-in-game-glow flag
36997 EX AF,AF' Restore original AF (with A being index of window)
36998 LD (37655),A Set this index as the Current Window index
37001 LD L,A Load HL with A value (index of required window, e.g. 14 for "PRESS SPACE OR FIRE TO CONTINUE" window)...
37002 LD H,0 ...
37004 ADD HL,HL Multiply index by eight (as each window's data takes up eight bytes in table at 41874)...
37005 ADD HL,HL ...
37006 ADD HL,HL ...
37007 LD BC,41874 Set BC to start of window data table
37010 ADD HL,BC Calculate location of start of required window's data
37011 LD E,(HL) Load E with x-coordinate of left edge (characters)
37012 INC HL Load C with x-coordinate of right edge (characters)...
37013 LD C,(HL) ...
37014 INC HL Load D with y-coordinate of top edge (characters)...
37015 LD D,(HL) ...
37016 INC HL Load B with y-coordinate of bottom edge (characters)...
37017 LD B,(HL) ...
37018 LD (23493),DE Store values for later use...
37022 LD (23495),BC ...
37026 INC HL Load A with window's upper edge border style...
37027 LD A,(HL) ...
37028 LD (36912),A Store for later use
37031 INC HL Load A with window's border attribute...
37032 LD A,(HL) ...
37033 EX AF,AF' Exchange AF and AF'
37034 INC HL Load A with starting y-coordinate of hand cursor...
37035 LD A,(HL) ...
37036 LD (23489),A Store for later use
37039 INC HL Load A with window's content attribute...
37040 LD A,(HL) ...
37041 LD (23477),A Store for later use
37044 EX AF,AF' Exchange AF and AF' (restoring border attribute to A and putting background colour in A')
37045 CALL 37147 Draw window frame
37048 LD HL,23493 Point HL at previously stored values
37051 INC (HL) Increase top-left x-coordinate
37052 INC HL Increase top-left y-coordinate...
37053 INC (HL) ...
37054 INC HL Decrease bottom-right x-coordinate...
37055 DEC (HL) ...
37056 INC HL Decrease bottom-right y-coordinate...
37057 DEC (HL) ...
37058 LD A,(23477) Load window background attribute into A
37061 LD (38250),A Load this attribute into instruction in routine at 38242 that sets attribute of window contents
37064 LD (23695),A Store window background attribute at 23695
37067 CALL 38242 Fill the interior of the window with its specified attribute (i.e. background colour and colour of text within)
37070 CALL 38417 Blank the interior of the window (bitmap area)
37073 LD HL,23493 Load x-coordinate of left of interior of window into C...
37076 LD C,(HL) ...
37077 INC HL Load y-coordinate of top of interior of window into B...
37078 LD B,(HL) ...
37079 CALL 36551 Move virtual cursor (bitmap) to top-left of interior or window
37082 PUSH HL Store HL
The operand of the instruction at 37083 represents the draw-hand-menu-cursor flag. This is modified by the instructions at 36945, 36982 and 36990.
37083 LD A,0 Load A with draw-hand-menu-cursor flag
37085 CP 105 If value is not 105...
37087 JP NZ,37138 ...then jump to 37138 (i.e. don't draw the hand cursor)
Window is a menu (105)
37090 LD BC,(23493) Load B with y-coordinate of top edge and C with x-coordinate of left edge
37094 INC C Increase x-coordinate by one
37095 LD A,(23489) Load A with starting y-coordinate of hand cursor
37098 ADD A,B Add y-coordinate of top of area to this...
37099 LD B,A ...and place back into B
37100 PUSH BC Store coordinates for later
37101 CALL 36551 Move virtual cursor (bitmap) to coordinates in BC
37104 LD DE,54701 Load DE with pointer to "menu hand" graphic
37107 LD B,8 Loop over 8 pixel rows (drawing upper half of hand):
37109 LD A,(DE) Load a bitmap byte from hand graphic
37110 LD (HL),A Place bitmap byte at virtual cursor (bitmap) location (i.e. draw it to screen)
37111 INC DE Advance DE
37112 INC L Advance L (i.e. move right one character as hand graphic is 2-by-2 characters)
37113 LD A,(DE) Load a bitmap byte from hand graphic
37114 LD (HL),A Place bitmap byte at virtual cursor (bitmap) location (i.e. draw it to screen)
37115 DEC L Move virtual cursor (bitmap) left one character again
37116 INC DE Advance DE
37117 INC H Advance H (i.e. move down one pixel row, or 256 bytes)
37118 DJNZ 37109 Repeat loop to draw next row
37120 POP BC Recover coordinates
37121 INC B Increase y-coordinate as we are now drawing lower half of hand
37122 CALL 36551 Move virtual cursor (bitmap) to coordinates in BC
37125 LD B,8 Loop over 8 pixel rows (drawing lower half of hand):
37127 LD A,(DE) Load a bitmap byte from hand graphic
37128 LD (HL),A Place bitmap byte at virtual cursor (bitmap) location (i.e. draw it to screen)
37129 INC DE Advance DE
37130 INC L Advance L (i.e. move right one character as hand graphic is 2-by-2 characters)
37131 LD A,(DE) Load a bitmap byte from hand graphic
37132 LD (HL),A Place bitmap byte at virtual cursor (bitmap) location (i.e. draw it to screen)
37133 DEC L Move virtual cursor (bitmap) left one character again
37134 INC DE Advance DE
37135 INC H Advance H (i.e. move down one pixel row, or 256 bytes)
37136 DJNZ 37127 Repeat loop to draw next row
37138 XOR A Set A to zero
37139 LD (23475),A Set hand cursor's current y-coordinate to zero (i.e. defaults to top of its movement range within current window)
37142 POP HL Restore HL
37143 LD (36488),HL Set memory location to start printing character
37146 RET Return
Prev: 36979 Up: Map Next: 37147