Prev: 62794 Up: Map Next: 62903
62815: Make MR WACKER find and expel ERIC
The address of this routine is found in the command list at 62768, the address of which is placed into bytes 27 and 28 of MR WACKER's buffer by the routine at 62770.
Input
H 200 (MR WACKER)
62815 LD L,29 Set bit 7 of byte 29 of MR WACKER's buffer, making him run
62817 SET 7,(HL)
62819 LD A,255 Set the MSB of the lesson clock at 32739 to 255 (this lesson will not end until ERIC's expelled)
62821 LD (32740),A
62824 CALL 25944 Move MR WACKER one step closer to ERIC (if he's not yet close enough)
62827 LD HL,51200 Point HL at byte 0 of MR WACKER's buffer
62830 BIT 0,(HL) Is MR WACKER now midstride?
62832 RET NZ Return if so
62833 INC L L=1
62834 LD DE,(53761) E=ERIC's x-coordinate, D=ERIC's y-coordinate
62838 LD A,(HL) A=MR WACKER's x-coordinate
62839 SUB E Is MR WACKER within 3 x-coordinates of ERIC?
62840 ADD A,3
62842 CP 7
62844 RET NC Return if not
62845 INC L L=2
62846 LD A,(HL) A=MR WACKER's y-coordinate
62847 SUB D Is MR WACKER within 3 y-coordinates of ERIC?
62848 ADD A,3
62850 CP 7
62852 RET NC Return if not
MR WACKER has found ERIC.
62853 LD HL,32763 32763 holds ERIC's status flags
62856 LD (HL),64 Set bit 6: MR WACKER is expelling ERIC (who is now paralysed)
62858 LD L,237 HL=32749 (ERIC's other status flags)
62860 BIT 5,(HL) Bit 5 is set if ERIC jumped out of the top-floor window
62862 LD H,200 200=MR WACKER
62864 LD E,99 Message 99: YOU HAVE 10000 LINES...
62866 JR Z,62869 Jump if ERIC didn't jump out of the top-floor window (i.e. he has 10000 lines)
62868 INC E E=100: YOU ARE NOT A BIRD...
62869 LD BC,27144 Redirect control to the routine at 27144 (make character speak) and return to 62875 (below) when done
62872 CALL 25503
62875 LD DE,(32741) Collect the score from 32741 into DE
62879 LD HL,(32745) Collect the current hi-score from 32745 into HL
62882 AND A Clear the carry flag ready for subtraction
62883 SBC HL,DE Do we have a new hi-score?
62885 JR NC,62891 Jump if not
62887 LD (32745),DE Insert the new hi-score
62891 LD HL,0 Reset the score (at 32741) and the lines total (at 32743) to 0
62894 LD (32741),HL
62897 LD (32743),HL
62900 JP 63189 Enter demo mode
Prev: 62794 Up: Map Next: 62903