Prev: 6907 Up: Map Next: 696C
6922: Make a guard drop his lunch if necessary
Used by the routine at 6907.
6922 LD A,($6DBE) Pick up the guard's return delay counter.
6925 AND A Has this guard been thrown out of the park?
6926 RET NZ Return if so.
6927 LD E,$04 There are four maze background tiles to consider.
6929 LD HL,$6DBF Point HL at the first maze background tile in the temporary guard buffer.
692C LD A,(HL) Pick up the attribute byte of this maze background tile.
692D CP $3A Is there already a cherry or strawberry here?
692F RET Z Return if so.
6930 LD BC,$0009 Point HL at the next maze background tile.
6933 ADD HL,BC
6934 DEC E Have we checked all four tiles yet?
6935 JR NZ,$692C Jump back if not.
6937 LD HL,($7C65) Decrement the lunch-drop countdown timer.
693A DEC HL
693B LD ($7C65),HL
693E LD A,H Is it zero now?
693F OR L
6940 RET NZ Return if not.
6941 CALL $6B12 Generate a pseudo-random number in A.
6944 LD L,A Copy it to L.
6945 PUSH HL Save L briefly.
6946 CALL $6B12 Generate another pseudo-random number in A.
6949 POP HL Restore L.
694A AND $03 Reduce A to 0, 1, 2 or 3 and copy it to H.
694C LD H,A
694D LD BC,$0320 Add 800 and reset the lunch-drop countdown timer to this value.
6950 ADD HL,BC
6951 LD ($7C65),HL
6954 CALL $6B12 Generate yet another pseudo-random number in A.
6957 AND $01 Is bit 0 set?
6959 JR NZ,$6960 Jump if so.
695B LD HL,$7C7C Point HL at the sprite data for the cherry.
695E JR $6963
6960 LD HL,$7CA0 Point HL at the sprite data for the strawberry.
6963 LD DE,$6DBF Copy the cherry/strawberry sprite into the maze background tiles in the temporary guard buffer.
6966 LD BC,$0024
6969 LDIR
696B RET
Prev: 6907 Up: Map Next: 696C