Prev: B9D8 Up: Map Next: B9FB
B9E0: Guard Heading West
Keeps a guard heading west, at a speed of 02, until it hits something. It then turns north.
Input
IX Address of the guard
Output
H Speed in Y
L Speed in X
GuardHeadingWest B9E0 LD HL,$00FE Set the speed in X to FE and the speed in Y to 00.
B9E3 BIT 0,(IX+$0C) Test whether the guard has hit something along the X axis.
B9E7 RET Z Return if it has not.
B9E8 LD HL,$0200 Set the speed in X to 00 and the speed in Y to 02.
This entry point is used by the routines at GuardHeadingNorth, GuardHeadingEast and GuardHeadingSouth.
Turn the guard, to follow the wall.
TurnGuard B9EB LD A,(IX+$0D) Fetch the direction flags of the guard.
B9EE LD C,A Stash them in C.
B9EF INC A Move to the next direction.
B9F0 AND %00000011 Keep the direction.
B9F2 LD B,A Stash it in B.
B9F3 LD A,C Fetch the direction flags.
B9F4 AND %11111100 Keep the other flags.
B9F6 OR B Combine them with the new direction.
B9F7 LD (IX+$0D),A Store the flags.
B9FA RET Return.
Prev: B9D8 Up: Map Next: B9FB