Routines

62668: Make ALBERT keep an eye out for ERIC during lessons


Used by table of A&P number 76

H 205 (ALBERT)

62668 2E00 LD L,0
62670 7E LD A,(HL) A=ALBERT's animatory state
62671 F6FA OR 250 Is ALBERT midstride or lying on his back?
62673 E0 RET PO Return if so
62674 ED5B01D2 LD DE,(53761) Collect ERIC's coordinates in DE
62678 7A LD A,D A=ERIC's y-coordinate
62679 FE0E CP 14 Is ERIC above the level of the stage?
62681 380F JR C,62698 Jump if so
62683 7B LD A,E A=ERIC's x-coordinate
62684 FE60 CP 96 Is ERIC inside the boys' skool?
62686 380A JR C,62698 Jump if so
62688 2E01 LD L,1
62690 BE CP (HL) Is ERIC to the left of ALBERT?
62691 3005 JR NC,62698 Jump if not
62693 C606 ADD A,6
62695 BE CP (HL) Is ERIC within 6 spaces to the left of ALBERT?
62696 300D JR NC,62711 Jump if so

ERIC's not in the "danger zone".
62698 2E00 LD L,0
62700 7E LD A,(HL) A=ALBERT's animatory state
62701 FE7F CP 127 127: Is ALBERT facing left with his arm up?
62703 C0 RET NZ Return if not
62704 C1 POP BC Drop the return address (25431)
62705 C1 POP BC Drop the character buffer reference used by 25296
62706 3E78 LD A,120 120: ALBERT facing left, standing
62708 C3F4F3 JP 62452 Update ALBERT's animatory state and SRB

ERIC is in the "danger zone" near ALBERT.
62711 2D DEC L L=0
62712 C1 POP BC Drop the return address (25431)
62713 C1 POP BC Drop the character buffer reference used by 25296
62714 CB7E BIT 7,(HL) Is ALBERT facing right?
62716 C23064 JP NZ,25648 Turn ALBERT round if so
62719 3E7F LD A,127 127: ALBERT facing left with his arm up
62721 BE CP (HL) Is ALBERT already holding ERIC back?
62722 C8 RET Z Return if so
62723 CDF4F3 CALL 62452 Make ALBERT put his arm up and update SRB
62726 21807F LD HL,32640
62729 CB4E BIT 1,(HL) Is MR WACKER already looking for ERIC in order to expel him?
62731 2011 JR NZ,62750 Jump if so
62733 CB56 BIT 2,(HL) Is MR WACKER already looking for ERIC?
62735 200D JR NZ,62750 Jump if so
62737 CBD6 SET 2,(HL) Signal: MR WACKER is looking for the truant ERIC
62739 211BC8 LD HL,51227 Place the address of the table of A&P at 62766 into bytes 27 and 28 of MR WACKER's buffer. This table contains a single entry, namely the address of the routine at 32054.
62742 362E LD (HL),46
62744 2C INC L
62745 36F5 LD (HL),245
62747 2C INC L L=29
62748 CBC6 SET 0,(HL) Signal: restart table of A&P (at 62766 now)
62750 26CD LD H,205 205=ALBERT
62752 CD0074 CALL 29696 Determine coordinates at which to print ALBERT's exclamation
62755 CD8C6A CALL 27276 Save the area of the screen which will be overwritten
62758 013262 LD BC,25138 B=message no. 98, C=50 (INK 2: PAPER 3)
62761 3E02 LD A,2
62763 C37374 JP 29811 Make ALBERT sound the alarm