| Routines

77F2: Make ANGELFACE hit now and then

Used by the routines at F7DF and F804. Decides whether ANGELFACE should throw a punch, and gets the punching action under way if so.
Input
H | 0xCF (ANGELFACE)
77F2 | LD L,$00 | Byte 0x00 of ANGELFACE's buffer holds his animatory state
77F4 | BIT 0,(HL) | Is ANGELFACE midstride?
77F6 | RET NZ | Return if so
77F7 | CALL $774F | Is ANGELFACE exactly on the top, middle or bottom floor?
77FA | RET NZ | Return if not
77FB | CALL $6291 | A=random number
77FE | RLCA | Return 50% of the time
77FF | RET NC
7800 | CALL $6D64 | Can any adults see ANGELFACE?
7803 | RET C | Return if so
7804 | LD B,$03 | Is there anyone 3 spaces in front of ANGELFACE and facing him?
7806 | CALL $77C8
7809 | RET C | Return if not
780A | POP BC | Drop the return address (6357)
780B | POP BC | Pop the value of HL that was pushed on to the stack by the routine at 62D0 before coming here; RET will now take us back either to 62D0 to move the next character, or to the main loop
780C | LD HL,$7813 | Place the address of the uninterruptible subcommand routine at 7813 into bytes 0x11 and 0x12 of ANGELFACE's buffer
780F | LD ($CF11),HL
7812 | RET |