Routines |
Prev: A133 | Up: Map | Next: A1A5 |
|
||||||||||
A13E | PUSH IX | Save IX and BC | ||||||||
A140 | PUSH BC | |||||||||
A141 | LD A,$01 | Initialise the width of the popup at A095 | ||||||||
A143 | LD ($A095),A | |||||||||
First compute the width of the windows based on the max length of all the lines of text plus 2 Special case: the first line of text computes a width of length of text plus 1
|
||||||||||
A146 | LD A,$01 | Initialise the temporal computed width of the windows at A093 | ||||||||
A148 | LD ($A093),A | |||||||||
A14B | LD DE,$0003 | In the first iteration, point IX to the first character of the line. Subsequent iterations points to the vertical position | ||||||||
A14E | ADD IX,DE | |||||||||
A150 | LD A,(IX+$00) | Pick up the character at IX | ||||||||
A153 | OR A | Is the character an end of marker ($00)? | ||||||||
A154 | JP Z,$A160 | Jump if so | ||||||||
A157 | LD HL,$A093 | Increment the temporal computed width at A093 | ||||||||
A15A | INC (HL) | |||||||||
A15B | INC IX | Increment the address pointer to read the next character | ||||||||
A15D | JP $A150 | Jump back to A150 and repeat the process | ||||||||
A160 | LD A,($A093) | Compare the width computed in the last iteration with the max width previously saved | ||||||||
A163 | LD HL,$A095 | |||||||||
A166 | CP (HL) | |||||||||
A167 | JP C,$A16D | Jump to A16D if the max width is greater or equal than the current computed width | ||||||||
A16A | LD ($A095),A | Update the max width of the windows at A095 with the new computed value | ||||||||
A16D | DJNZ $A146 | Jump back while there are lines to process | ||||||||
The next section of code obtain the position and color attributes of the windows
|
||||||||||
A16F | POP BC | Restore BC and IX | ||||||||
A170 | POP IX | |||||||||
A172 | PUSH IX | Save BC and IX | ||||||||
A174 | PUSH BC | |||||||||
A175 | LD A,B | Is there only one line of text? | ||||||||
A176 | CP $01 | |||||||||
A178 | JP NZ,$A17F | Jump if not | ||||||||
A17B | LD HL,$A095 | Increment the width of the windows by one at A095. This account for the special case described above | ||||||||
A17E | INC (HL) | |||||||||
A17F | LD A,(IX+$01) | Pick up the horizontal position of the first line of text | ||||||||
A182 | SUB $03 | Substract 3 to obtain the horizontal position of the windows: one for the border and two for the left margin. | ||||||||
A184 | LD H,A | Save the horizontal position of the windows at H | ||||||||
A185 | LD A,(IX+$02) | Pick up the vertical position of the first line of text | ||||||||
A188 | SRL A | The position is defined in bits 7-3 so move this value to bits 4-0 | ||||||||
A18A | SRL A | |||||||||
A18C | SRL A | |||||||||
A18E | DEC A | Decrement by one to account for the top border | ||||||||
A18F | LD L,A | Save the vertical position of the windows at L | ||||||||
A190 | LD E,B | Save the number of lines of the windows in register E | ||||||||
A191 | LD A,($A095) | Pick up the width of the windows saved at A095 | ||||||||
A194 | SUB $02 | Substract 2 for the borders | ||||||||
A196 | LD D,A | Save the width of the windows (minus borders) at D | ||||||||
A197 | LD A,$47 | Save at A the color attributes for the windows border | ||||||||
A199 | LD C,$07 | Save at C the color attributes for the windows body | ||||||||
A19B | CALL $CE7B | Draws the windows borders in the display file | ||||||||
A19E | POP BC | Save BC and IX | ||||||||
A19F | POP IX | |||||||||
A1A1 | CALL $A2DF | Print the text content of the windows in the display file | ||||||||
A1A4 | RET |
Prev: A133 | Up: Map | Next: A1A5 |