| Routines

28569: Check whether anyone was punched by ERIC or ANGELFACE

Continues from 28558. Also used by the routine at 62628. Checks whether anyone was punched by ERIC or ANGELFACE, and knocks them out if so.
Input
H | 168 (ANGELFACE) or 172 (ERIC)
28569 | LD L,98 | Byte 98 of the puncher's buffer holds his x-coordinate
28571 | LD A,(HL) | Pick this up in A
28572 | DEC L | L=97
28573 | LD D,(HL) | Pick up the puncher's y-coordinate in D
28574 | DEC L | L=96
28575 | LD C,(HL) | Pick up the puncher's animatory state in C
28576 | SUB 2 | A=x-coordinate of the location two spaces in front of the puncher
28578 | BIT 7,(HL)
28580 | JR Z,28584
28582 | ADD A,4
28584 | LD E,A | Store the potential victim's x-coordinate in E
28585 | LD A,(32763) | Collect ERIC's status flags from 32763
28588 | AND A | Is ERIC doing the punching?
28589 | JR NZ,28606 | Jump if so
28591 | LD H,172 | 172=ERIC
28593 | CALL 28416 | Was ERIC punched?
28596 | JR NC,28606 | Jump if not
28598 | LD DE,32763 | 32763 holds ERIC's status flags
28601 | EX DE,HL |
28602 | SET 4,(HL) | Signal: ERIC was hit
28604 | EX DE,HL |
28605 | RET |
Now we check whether anyone was punched. We start with the three main kids.
28606 | LD B,3 | There are three main kids
28608 | LD H,169 | 169=EINSTEIN
28610 | CALL 28416 | Was this main kid punched?
28613 | JR NC,28626 | Jump if not
28615 | LD L,111 | Place the address of the uninterruptible subcommand routine at 27206 into bytes 111 and 112 of the victim's character buffer
28617 | LD (HL),70
28619 | INC L
28620 | LD (HL),106
28622 | INC L | Initialise the parameter determining how long the character will stay down (in byte 113)
28623 | LD (HL),20
28625 | RET |
28626 | DEC H | Next main kid
28627 | DJNZ 28610 | Jump back until three main kids have been considered
None of the main kids was hit. What about the little boys?
28629 | LD H,152 | 152=character number of little boy no. 1
28631 | LD B,11 | There are 11 little boys
28633 | CALL 28416 | Was this little boy hit?
28636 | JR C,28615 | Knock him over if so
28638 | INC H | Next little boy
28639 | DJNZ 28633 | Jump back until all 11 little boys have been considered
28641 | RET |