Routines

28672: Check for walls, closed doors and ALBERT in front of ERIC


Used by routines at 29194 and 29278. The routine returns with the zero flag set if a wall or closed door lies in ERIC's path, or the carry flag set if ALBERT is impeding ERIC's progress.

A ERIC's or the bike's animatory state
E ERIC's or the bike's x-coordinate

28672 07 RLCA
28673 21F47F LD HL,32756 Doors flags
28676 7B LD A,E
28677 302B JR NC,28722 Jump if ERIC is facing left
28679 FEBD CP 189 189: far right of girls' skool
28681 C8 RET Z Return with zero flag set if ERIC has hit the far wall of the girls' skool
28682 FE5D CP 93 93: just left of boys' skool door
28684 2006 JR NZ,28692 Jump if ERIC hasn't hit the boys' skool door
28686 CB5E BIT 3,(HL) Is the boys' skool door open?
28688 201D JR NZ,28719 Jump if so
28690 BF CP A Return with zero flag set if ERIC has hit the boys' skool door or the skool gate
28691 C9 RET
28692 FE84 CP 132 132: just left of skool gate
28694 2006 JR NZ,28702 Jump if ERIC hasn't hit the skool gate
28696 CB66 BIT 4,(HL) Is the skool gate closed?
28698 28F6 JR Z,28690 Jump if so
28700 1811 JR 28719
28702 3A00CD LD A,(52480) A=ALBERT's animatory state
28705 FE7F CP 127 127: Is ALBERT facing left with his arm up?
28707 200A JR NZ,28719 Jump if not
28709 3A01CD LD A,(52481) A=ALBERT's x-coordinate
28712 D602 SUB 2 A=x-coordinate of spot 2 spaces in front of ALBERT
28714 BB CP E Is ERIC here?
28715 2002 JR NZ,28719 Jump if not
28717 37 SCF Signal: ALBERT is stopping ERIC
28718 C9 RET
28719 7D LD A,L Return with the zero and carry flags reset
28720 A7 AND A
28721 C9 RET
28722 FE01 CP 1 Has ERIC hit the far left wall of the boys' skool?
28724 C8 RET Z Return with the zero flag set if so
28725 FE60 CP 96 Is the boys' skool door in front of ERIC?
28727 28D5 JR Z,28686 Jump back if so
28729 FE87 CP 135 Is the skool gate in front of ERIC?
28731 28DB JR Z,28696 Jump back if so
28733 A7 AND A
28734 C9 RET Return with the zero and carry flags reset