Prev: 6B48 Up: Map Next: 6BD6
6B75: Draw the current maze
Used by the routine at 6000.
Input
BC 768
DE 16384
HL Address of the maze layout data (6FF7, 72F7, 75F7 or 78F7)
6B75 PUSH BC Save the tile counter.
6B76 PUSH HL Save the maze layout data address.
6B77 EX DE,HL Transfer the display file address to HL.
6B78 CALL $6C0F Set HL' to the corresponding attribute file address (always 5800).
6B7B EX DE,HL Transfer the display file address back to DE.
6B7C EXX Exchange registers.
6B7D POP DE Restore the maze layout data address to DE'.
6B7E POP BC Restore the tile counter to BC'.
6B7F LD A,(DE) Pick up a tile identifier.
6B80 INC DE Point DE' at the next tile identifier.
6B81 CP $00 Is the current tile blank?
6B83 JR Z,$6B9D Jump if so.
6B85 CP $02 Is the current tile a flower?
6B87 JR Z,$6BA1 Jump if so.
6B89 CP $03 Is the current tile an arrow (entrance or exit)?
6B8B JR Z,$6B95 Jump if so.
6B8D CP $09 Is the current tile a tunnel entrance?
6B8F JR Z,$6B99 Jump if so.
6B91 LD A,$3D Wall tile (INK 5).
6B93 JR $6BA3
6B95 LD A,$38 Arrow tile (INK 0).
6B97 JR $6BA3
6B99 LD A,$3F Tunnel entrance (INK 7).
6B9B JR $6BA3
6B9D LD A,$3E Blank tile (INK 6).
6B9F JR $6BA3
6BA1 LD A,$3C Flower (INK 4).
6BA3 LD (HL),A Set the attribute byte.
6BA4 INC HL Move HL' along the attribute file.
6BA5 DEC BC Decrement the tile counter.
6BA6 LD A,B Have we finished setting the attribute bytes yet?
6BA7 OR C
6BA8 JR NZ,$6B7F Jump back if not.
6BAA EXX Exchange registers.
The attribute bytes have been set. Time to draw the maze tiles.
6BAB PUSH HL Save the maze layout pointer.
6BAC LD A,(HL) Pick up a tile identifier in A.
6BAD LD H,$00 Point IX at the graphic data for the corresponding tile (at 7BF7+8*A).
6BAF LD L,A
6BB0 ADD HL,HL
6BB1 ADD HL,HL
6BB2 ADD HL,HL
6BB3 LD IX,$7BF7
6BB7 EX DE,HL
6BB8 ADD IX,DE
6BBA EX DE,HL
6BBB LD L,$08 Draw the tile.
6BBD LD A,(IX+$00)
6BC0 LD (DE),A
6BC1 INC D
6BC2 INC IX
6BC4 DEC L
6BC5 JR NZ,$6BBD
6BC7 INC E Point DE at the display file address for the next tile.
6BC8 JR Z,$6BCE
6BCA LD A,D
6BCB SUB $08
6BCD LD D,A
6BCE POP HL Restore the maze layout pointer to HL.
6BCF INC HL Move along to the next maze tile identifier.
6BD0 DEC BC Decrement the tile counter.
6BD1 LD A,B Have we drawn all the tiles yet?
6BD2 OR C
6BD3 JR NZ,$6BAB Jump back if not.
6BD5 RET
Prev: 6B48 Up: Map Next: 6BD6