Prev: 6C68 Up: Map Next: 6CC2
6C95: Copy a maze background tile into a guard's buffer
Used by the routine at 6C68.
Input
DE Address of the tile in the guard's buffer
HL Display file address of the maze background tile
HL' Attribute file address of the maze background tile
Output
HL Display file address of the next maze background tile to the right
HL' Attribute file address of the next maze background tile to the right
6C95 EXX Exchange registers.
6C96 LD A,(HL) Pick up the attribute byte of the maze background tile.
6C97 INC HL Point HL' at the attribute byte of the next tile to the right.
6C98 EXX Exchange registers.
6C99 CP $3B Is there a magenta (guard sprite) tile here?
6C9B JR Z,$6CAF Jump if so.
6C9D LD (DE),A Copy the maze background tile attribute byte into the temporary guard buffer.
6C9E INC DE Point DE at the first graphic byte of the tile in the temporary guard buffer.
6C9F LD B,$08 Copy the maze background tile's graphic bytes into the temporary guard buffer.
6CA1 LD A,(HL)
6CA2 LD (DE),A
6CA3 INC DE
6CA4 INC H
6CA5 DJNZ $6CA1
6CA7 INC L Point HL at the first graphic byte of the next maze background tile to the right.
6CA8 JR Z,$6CAE
6CAA LD A,H
6CAB SUB $08
6CAD LD H,A
6CAE RET
There is a guard sprite tile at this location.
6CAF LD A,$3E Set the background tile attribute byte (INK 6: PAPER 7).
6CB1 LD (DE),A
6CB2 INC DE Point DE at the first graphic byte of the tile in the temporary guard buffer.
6CB3 LD B,$08 Clear out the background tile in the temporary guard buffer. Doing this means that, in some situations, the guard will eat the flowers or fruit in his path.
6CB5 LD A,$00
6CB7 LD (DE),A
6CB8 INC DE
6CB9 DJNZ $6CB7
6CBB INC L Point HL at the first graphic byte of the next maze background tile to the right.
6CBC RET NZ
6CBD LD A,H
6CBE ADD A,$08
6CC0 LD H,A
6CC1 RET
Prev: 6C68 Up: Map Next: 6CC2