Prev: 47576 Up: Map Next: 47611
47584: Guard Heading West
Keeps a guard heading west, at a speed of 2, until it hits something. It then turns north.
Input
IX Address of the guard
Output
H Speed in Y
L Speed in X
GuardHeadingWest 47584 LD HL,254 Set the speed in X to 254 and the speed in Y to 0.
47587 BIT 0,(IX+12) Test whether the guard has hit something along the X axis.
47591 RET Z Return if it has not.
47592 LD HL,512 Set the speed in X to 0 and the speed in Y to 2.
This entry point is used by the routines at GuardHeadingNorth, GuardHeadingEast and GuardHeadingSouth.
Turn the guard, to follow the wall.
TurnGuard 47595 LD A,(IX+13) Fetch the direction flags of the guard.
47598 LD C,A Stash them in C.
47599 INC A Move to the next direction.
47600 AND %00000011 Keep the direction.
47602 LD B,A Stash it in B.
47603 LD A,C Fetch the direction flags.
47604 AND %11111100 Keep the other flags.
47606 OR B Combine them with the new direction.
47607 LD (IX+13),A Store the flags.
47610 RET Return.
Prev: 47576 Up: Map Next: 47611