Prev: 27752 Up: Map Next: 27842
27797: Copy a maze background tile into a guard's buffer
Used by the routine at 27752.
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
27797 EXX Exchange registers.
27798 LD A,(HL) Pick up the attribute byte of the maze background tile.
27799 INC HL Point HL' at the attribute byte of the next tile to the right.
27800 EXX Exchange registers.
27801 CP 59 Is there a magenta (guard sprite) tile here?
27803 JR Z,27823 Jump if so.
27805 LD (DE),A Copy the maze background tile attribute byte into the temporary guard buffer.
27806 INC DE Point DE at the first graphic byte of the tile in the temporary guard buffer.
27807 LD B,8 Copy the maze background tile's graphic bytes into the temporary guard buffer.
27809 LD A,(HL)
27810 LD (DE),A
27811 INC DE
27812 INC H
27813 DJNZ 27809
27815 INC L Point HL at the first graphic byte of the next maze background tile to the right.
27816 JR Z,27822
27818 LD A,H
27819 SUB 8
27821 LD H,A
27822 RET
There is a guard sprite tile at this location.
27823 LD A,62 Set the background tile attribute byte (INK 6: PAPER 7).
27825 LD (DE),A
27826 INC DE Point DE at the first graphic byte of the tile in the temporary guard buffer.
27827 LD B,8 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.
27829 LD A,0
27831 LD (DE),A
27832 INC DE
27833 DJNZ 27831
27835 INC L Point HL at the first graphic byte of the next maze background tile to the right.
27836 RET NZ
27837 LD A,H
27838 ADD A,8
27840 LD H,A
27841 RET
Prev: 27752 Up: Map Next: 27842