Prev: 28658 Up: Map Next: 28735
28672: Check for walls, closed doors and ALBERT in front of the bike
Used by the routines at 29194 (when the bike is travelling of its own accord, or ERIC is standing on the saddle) and 29278 (when ERIC is sitting on the bike). Returns with the zero flag set if a wall or closed door lies in the bike's path, or the carry flag set if ALBERT is impeding the bike's progress.
Input
A ERIC's or the bike's animatory state
E ERIC's or the bike's x-coordinate
28672 RLCA Set the carry flag if the bike is facing right
28673 LD HL,32756 32756 holds the doors flags
28676 LD A,E A=ERIC's/bike's x-coordinate
28677 JR NC,28722 Jump if the bike is facing left
The bike is travelling to the right.
28679 CP 189 Has the bike hit the far right wall of the girls' skool?
28681 RET Z Return with the zero flag set if so
28682 CP 93 Is the boys' skool door in front of the bike?
28684 JR NZ,28692 Jump if not
28686 BIT 3,(HL) Is the boys' skool door open?
28688 JR NZ,28719 Jump if so
28690 CP A Return with the zero flag set if the bike has hit the boys' skool door or the skool gate
28691 RET
28692 CP 132 Is the skool gate in front of the bike?
28694 JR NZ,28702 Jump if not
28696 BIT 4,(HL) Is the skool gate closed?
28698 JR Z,28690 Jump if so
28700 JR 28719
Neither the skool door nor the skool gate is in the way. What about ALBERT?
28702 LD A,(52480) A=ALBERT's animatory state
28705 CP 127 127: Is ALBERT facing left with his arm up?
28707 JR NZ,28719 Jump if not
28709 LD A,(52481) A=ALBERT's x-coordinate
28712 SUB 2 A=x-coordinate of the spot 2 spaces in front of ALBERT
28714 CP E Is the bike here?
28715 JR NZ,28719 Jump if not
28717 SCF Signal: ALBERT is stopping the bike
28718 RET
No obstruction lies in the bike's path.
28719 LD A,L Set A to a non-zero value
28720 AND A Return with the zero and carry flags reset
28721 RET
The bike is travelling to the left.
28722 CP 1 Has the bike hit the far left wall of the boys' skool?
28724 RET Z Return with the zero flag set if so
28725 CP 96 Is the boys' skool door in front of the bike?
28727 JR Z,28686 Jump back if so to check whether it's open
28729 CP 135 Is the skool gate in front of the bike?
28731 JR Z,28696 Jump back if so to check whether it's open
28733 AND A Return with the zero and carry flags reset
28734 RET
Prev: 28658 Up: Map Next: 28735