Prev: 6F1A Up: Map Next: 6F75
6F1E: Make ANGELFACE hit now and then
The address of this continual subcommand routine is placed into bytes 0x7C and 0x7D of ANGELFACE's buffer by command lists 0x8E, 0x96, 0x9E, 0xA6, 0xAE, 0xB4 and 0xB6. It decides whether ANGELFACE should throw a punch, and gets the punching action under way if so.
Input
H 0xA8 (ANGELFACE)
6F1E LD L,$70 Return now if there is an uninterruptible subcommand routine address in bytes 0x6F and 0x70 of ANGELFACE's buffer (meaning he is currently occupied)
6F20 LD A,(HL)
6F21 AND A
6F22 RET NZ
6F23 LD L,$60 Byte 0x60 holds ANGELFACE's animatory state
6F25 BIT 0,(HL) Is ANGELFACE midstride?
6F27 RET NZ Return if so
6F28 INC L Byte 0x61 holds ANGELFACE's y-coordinate
6F29 LD A,(HL) Pick this up in A
6F2A CALL $6649 Is ANGELFACE on a staircase?
6F2D RET NZ Return if so
6F2E CALL $6E3C Can any teachers see ANGELFACE?
6F31 RET C Return if so
ANGELFACE is not on a staircase, and there are no teachers nearby. Are there any potential victims nearby?
6F32 LD L,$62 Byte 0x62 holds ANGELFACE's x-coordinate
6F34 LD A,(HL) Pick this up in A
6F35 DEC L Pick up ANGELFACE's y-coordinate in D
6F36 LD D,(HL)
6F37 DEC L L=0x60 (which byte holds ANGELFACE's animatory state)
6F38 SUB $03 Set A equal to the 'target' x-coordinate (i.e. where a character would have to be in order to receive ANGELFACE's punch)
6F3A BIT 7,(HL)
6F3C JR Z,$6F40
6F3E ADD A,$06
6F40 LD E,A Place the target x-coordinate in E
6F41 LD C,(HL) C=ANGELFACE's animatory state
6F42 LD H,$AC 0xAC=ERIC
6F44 CALL $6F00 Is ERIC a potential target?
6F47 JR NC,$6F56 Jump if not
6F49 NOP
If we get here, there is a potential victim in front of ANGELFACE for him to take a swing at.
6F4A POP HL Drop the return address (6254) from the stack; this makes the character-moving routine at 6226 skip any further consideration of ANGELFACE on this pass, thus preventing him from moving midstride before throwing the punch
6F4B LD HL,$A871 Point HL at byte 0x71 of ANGELFACE's buffer
6F4E LD (HL),C Store his current animatory state there
6F4F DEC L Place the address of the uninterruptible subcommand routine at 6F80 (throw a punch) into bytes 0x6F and 0x70 of ANGELFACE's buffer
6F50 LD (HL),$6F
6F52 DEC L
6F53 LD (HL),$80
6F55 RET
ERIC is not a potential target for ANGELFACE's fist. What about the other main kids?
6F56 LD H,$A9 0xA9=EINSTEIN
6F58 LD B,$03 There are three main kids
6F5A CALL $6F00 Is this main kid a potential target?
6F5D JR NC,$6F61 Jump if not
6F5F JR $6F4A Otherwise throw a punch
6F61 DEC H Next main kid
6F62 DJNZ $6F5A Jump back until the three main kids have been checked
EINSTEIN and BOY WANDER weren't potential targets either. What about the little boys?
6F64 LD H,$98 0x98=little boy no. 1
6F66 LD B,$07 We check only the first seven little boys - interesting!
6F68 CALL $6F00 Is this little boy a potential target?
6F6B JR NC,$6F6F Jump if not
6F6D JR $6F4A Otherwise throw a punch
6F6F INC H Next little boy
6F70 DJNZ $6F68 Jump back until the seven little boys have been checked
6F72 LD H,$A8 Restore ANGELFACE's character number to H
6F74 RET
Prev: 6F1A Up: Map Next: 6F75