Routines
 Prev: 7BB6 Up: Map Next: 7C3F
7BE1: 'C' pressed - use hook
 The address of this routine is found in the table of keypress handling routines at ED00. It is called from the main loop at F02B when 'C' is pressed. 7BE1 LD A,(\$7FE9) Collect the object inventory flags from 7FE9 7BE4 BIT 6,A Has Sam got the hook? 7BE6 RET Z Return if not 7BE7 LD A,(\$E604) A=Sam's z-coordinate 7BEA LD HL,(\$E601) Collect Sam's x- and y-coordinates in L and H 7BED RRCA Is Sam's z-coordinate 1 (indoors)? 7BEE JR NC,\$7C0B Jump if not 7BF0 LD A,L A=x (Sam's x-coordinate) 7BF1 CP \$DE Is Sam in no. 17 or no. 15 (x>=222)? 7BF3 RET NC Return if so 7BF4 CP \$CF Is Sam in no. 19 (207<=x<222)? 7BF6 JR NC,\$7C07 Jump if so 7BF8 CP \$7A Is Sam in the police station, no. 27, or the apartments next to no. 19 (122<=x<207)? 7BFA JR NC,\$7C03 Jump if so 7BFC CP \$67 Is Sam in no. 31 (103<=x<122)? 7BFE JR NC,\$7C07 Jump if so 7C00 CP \$19 Is Sam in no. 74 or the hotel (25<=x<103)? 7C02 RET NC Return if so 7C03 LD A,\$07 7 is the y-coordinate of the roof of the police station, no. 27, and the apartment building next to no. 19 7C05 JR \$7C09 7C07 LD A,\$0D 13 is the y-coordinate of the roofs of no. 19 and no. 31 7C09 CP H Is Sam on the roof of a building? 7C0A RET C Return if not Sam is in a location that is amenable to hook-throwing. 7C0B INC H H=1+Sam's y-coordinate 7C0C LD A,(\$E600) A=Sam's animatory state 7C0F AND \$80 Keep only the direction bit (bit 7) 7C11 JR Z,\$7C14 Jump if Sam is facing left 7C13 INC L L=1+Sam's x-coordinate 7C14 ADD A,\$79 A=0x79/0xF9 (hook) 7C16 EX DE,HL DE=hook's initial coordinates 7C17 LD HL,\$E513 Point HL at byte 0x13 of character buffer 0xE5 7C1A INC (HL) Is the current owner of character buffer 0xE5 (the hook or a banknote) under the control of an uninterruptible subcommand routine? 7C1B DEC (HL) 7C1C RET NZ Return if so (the hook must currently be in flight, which is unlikely) The hook will be thrown. Prepare it for launch now. 7C1D INC L Initialise the distance remaining for the hook to fly (stored in byte 0x14 of the hook's buffer) 7C1E LD (HL),\$14 7C20 DEC L Place the address of the uninterruptible subcommand routine at 7BB6 into bytes 0x12 and 0x13 of the hook's buffer 7C21 LD (HL),\$7B 7C23 DEC L 7C24 LD (HL),\$B6 7C26 LD L,\$04 Set the hook's z-coordinate to 4 7C28 LD (HL),L 7C29 DEC L Set bit 7 of byte 0x03 of the hook's buffer, thus making the hook fly as fast as possible 7C2A LD (HL),\$80 7C2C DEC L Initialise the hook's x- and y-coordinates 7C2D LD (HL),D 7C2E DEC L 7C2F LD (HL),E 7C30 DEC L Initialise the hook's animatory state 7C31 LD (HL),A 7C32 CALL \$E9D5 Update the hook's animatory state and location and update the SRB 7C35 LD HL,\$7FE9 The object inventory flags are stored at 7FE9 7C38 RES 6,(HL) Clear bit 6, thus removing the hook from Sam's possession 7C3A LD H,\$E6 0xE6=Sam 7C3C JP \$F304 Raise Sam's arm and make a sound effect
 Prev: 7BB6 Up: Map Next: 7C3F