Prev: 6FF2 Up: Map Next: 703F
7000: Check for walls, closed doors and ALBERT in front of the bike
Used by the routines at 720A (when the bike is travelling of its own accord, or ERIC is standing on the saddle) and 725E (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
7000 RLCA Set the carry flag if the bike is facing right
7001 LD HL,$7FF4 7FF4 holds the doors flags
7004 LD A,E A=ERIC's/bike's x-coordinate
7005 JR NC,$7032 Jump if the bike is facing left
The bike is travelling to the right.
7007 CP $BD Has the bike hit the far right wall of the girls' skool?
7009 RET Z Return with the zero flag set if so
700A CP $5D Is the boys' skool door in front of the bike?
700C JR NZ,$7014 Jump if not
700E BIT 3,(HL) Is the boys' skool door open?
7010 JR NZ,$702F Jump if so
7012 CP A Return with the zero flag set if the bike has hit the boys' skool door or the skool gate
7013 RET
7014 CP $84 Is the skool gate in front of the bike?
7016 JR NZ,$701E Jump if not
7018 BIT 4,(HL) Is the skool gate closed?
701A JR Z,$7012 Jump if so
701C JR $702F
Neither the skool door nor the skool gate is in the way. What about ALBERT?
701E LD A,($CD00) A=ALBERT's animatory state
7021 CP $7F 0x7F: Is ALBERT facing left with his arm up?
7023 JR NZ,$702F Jump if not
7025 LD A,($CD01) A=ALBERT's x-coordinate
7028 SUB $02 A=x-coordinate of the spot 2 spaces in front of ALBERT
702A CP E Is the bike here?
702B JR NZ,$702F Jump if not
702D SCF Signal: ALBERT is stopping the bike
702E RET
No obstruction lies in the bike's path.
702F LD A,L Set A to a non-zero value
7030 AND A Return with the zero and carry flags reset
7031 RET
The bike is travelling to the left.
7032 CP $01 Has the bike hit the far left wall of the boys' skool?
7034 RET Z Return with the zero flag set if so
7035 CP $60 Is the boys' skool door in front of the bike?
7037 JR Z,$700E Jump back if so to check whether it's open
7039 CP $87 Is the skool gate in front of the bike?
703B JR Z,$7018 Jump back if so to check whether it's open
703D AND A Return with the zero and carry flags reset
703E RET
Prev: 6FF2 Up: Map Next: 703F