Prev: 39189 Up: Map Next: 39291
39216: Draw run of 2 × 2 blocks horizontally
The parameters for block drawing start at the byte after the address in IX. These are:
Byte offset from IX Effect
0 127 (start horizontal block drawing)
1 Start x-coordinate (characters)
2 Start y-coordinate (characters)
3 - n Block data
n + 1 End marker (255)
The block data is comprised of one or more byte values.
If a block data byte has its most significant bit reset, then it is interpreted as a block style index corresponding to an entry in the table of block style definitions at 49794, and a single such block is drawn before the next byte is processed.
If a block data byte has its most significant bit set, then bits 0-6 are interpreted as a run-length (e.g. a value of 144 means a run-length of 16 2 × 2 blocks) and the following data byte represents the index of the entry in the table of block style definitions at 49794 to repeatedly use throughout the run. Once the run of blocks has been drawn, the next byte is processed.
When the value 255, the end marker, is encountered, the horizontal drawing ends.
Used by the routine at 39047.
Input
IX Current position in room layout data
39216 INC IX Advance IX to x-coordinate...
39218 LD C,(IX+0) ...and load into C
39221 INC IX Advance IX to y-coordinate...
39223 LD B,(IX+0) ...and load into B
39226 INC IX Advance IX to first block layout data byte
39228 PUSH BC Store BC (B = y-coordinate, C = x-coordinate)
39229 CALL 63203 Move virtual cursor (bitmap) to display file address for coordinates x=C, y=B and load address into HL
39232 POP BC Restore BC (B = y-coordinate, C = x-coordinate)
39233 CALL 63233 Point HL at terrain interaction data for character coordinates x=C, y=B...
39236 LD (23709),HL ...and store at 23709
39239 LD A,(IX+0) Load A with next block layout data...
39242 CP 255 ...and if this is 255 (end marker)...
39244 JR Z,39261 ...then skip ahead to 39261
39246 BIT 7,A If draw-run flag is set...
39248 JR NZ,39266 ...then skip ahead to 39266
39250 PUSH IX Store IX (current position in block layout data)
39252 CALL 41271 Draw 2 × 2 block with style index A at bitmap virtual text cursor then move right two characters
39255 POP IX Restore IX (current position in block layout data)
39257 INC IX Advance IX to next block layout data...
39259 JR 39239 ...and loop back to 39239 to process
End marker encountered
39261 INC IX Advance IX to next byte in room layout data...
39263 JP 39067 ...and jump to 39067 to process
Draw-run flag set
39266 AND 127 Reset draw-run flag...
39268 LD B,A ...and load B with run length
39269 INC IX Advance IX to block style index...
39271 LD A,(IX+0) ...and load into A
39274 INC IX Advance IX to next block layout data
39276 PUSH IX Store IX (current position in block layout data)
39278 PUSH BC Store BC (B = remaining number of blocks to draw)
39279 PUSH AF Store AF
39280 CALL 41271 Draw 2 × 2 block with style index A at bitmap virtual text cursor then move right two characters
39283 POP AF Restore AF
39284 POP BC Restore BC (B = remaining number of blocks to draw)
39285 DJNZ 39278 Decrease remaining number of blocks and loop back to 39278 if not zero
39287 POP IX Restore IX (current position in block layout data)
39289 JR 39239 Loop back to 39239 for next block layout data
Prev: 39189 Up: Map Next: 39291