| Routines

6F99: Check whether anyone was punched by ERIC or ANGELFACE

Continues from 6F8E. Also used by the routine at F4A4. Checks whether anyone was punched by ERIC or ANGELFACE, and knocks them out if so.
Input
H | 0xA8 (ANGELFACE) or 0xAC (ERIC)
6F99 | LD L,$62 | Byte 0x62 of the puncher's buffer holds his x-coordinate
6F9B | LD A,(HL) | Pick this up in A
6F9C | DEC L | L=0x61
6F9D | LD D,(HL) | Pick up the puncher's y-coordinate in D
6F9E | DEC L | L=0x60
6F9F | LD C,(HL) | Pick up the puncher's animatory state in C
6FA0 | SUB $02 | A=x-coordinate of the location two spaces in front of the puncher
6FA2 | BIT 7,(HL)
6FA4 | JR Z,$6FA8
6FA6 | ADD A,$04
6FA8 | LD E,A | Store the potential victim's x-coordinate in E
6FA9 | LD A,($7FFB) | Collect ERIC's status flags from 7FFB
6FAC | AND A | Is ERIC doing the punching?
6FAD | JR NZ,$6FBE | Jump if so
6FAF | LD H,$AC | 0xAC=ERIC
6FB1 | CALL $6F00 | Was ERIC punched?
6FB4 | JR NC,$6FBE | Jump if not
6FB6 | LD DE,$7FFB | 7FFB holds ERIC's status flags
6FB9 | EX DE,HL |
6FBA | SET 4,(HL) | Signal: ERIC was hit
6FBC | EX DE,HL |
6FBD | RET |
Now we check whether anyone was punched. We start with the three main kids.
6FBE | LD B,$03 | There are three main kids
6FC0 | LD H,$A9 | 0xA9=EINSTEIN
6FC2 | CALL $6F00 | Was this main kid punched?
6FC5 | JR NC,$6FD2 | Jump if not
6FC7 | LD L,$6F | Place the address of the uninterruptible subcommand routine at 6A46 into bytes 0x6F and 0x70 of the victim's character buffer
6FC9 | LD (HL),$46
6FCB | INC L
6FCC | LD (HL),$6A
6FCE | INC L | Initialise the parameter determining how long the character will stay down (in byte 0x71)
6FCF | LD (HL),$14
6FD1 | RET |
6FD2 | DEC H | Next main kid
6FD3 | DJNZ $6FC2 | Jump back until three main kids have been considered
None of the main kids was hit. What about the little boys?
6FD5 | LD H,$98 | 0x98=character number of little boy no. 1
6FD7 | LD B,$0B | There are 11 little boys
6FD9 | CALL $6F00 | Was this little boy hit?
6FDC | JR C,$6FC7 | Knock him over if so
6FDE | INC H | Next little boy
6FDF | DJNZ $6FD9 | Jump back until all 11 little boys have been considered
6FE1 | RET |