Prev: 69F5 Up: Map Next: 6A37
69F6: Make a little boy trip people up
The address of this continual subcommand routine is placed into bytes 0x7C and 0x7D of little boy no. 1's character buffer by the routine at 6A6E, and into bytes 0x7C and 0x7D of the character buffers of little boys 2-11 by the routine at 6A82.
Input
H Little boy's character number (0x98-0xA2)
69F6 LD L,$61 Pick up the little boy's y-coordinate in A
69F8 LD A,(HL)
69F9 CALL $6649 Is the boy on a staircase?
69FC RET NZ Return if so
69FD LD B,$0A We will check characters 0xA3-0xAC (teachers and main kids)
69FF LD DE,$A362 D=0xA3 (MR WACKER), E=0x62
6A02 INC L L=0x62
6A03 EX DE,HL
6A04 LD A,(DE) A=little boy's x-coordinate
6A05 CP (HL) Does this teacher's or main kid's x-coordinate match?
6A06 JR Z,$6A0D Jump if so
6A08 INC H Next teacher or main kid
6A09 DJNZ $6A04 Jump back until all teachers and main kids have been checked
6A0B EX DE,HL
6A0C RET
A teacher or main kid is at the same x-coordinate as the little boy. Now check the y-coordinates.
6A0D DEC E E=L=0x61
6A0E DEC L
6A0F LD A,(DE) A=little boy's y-coordinate
6A10 INC E E=0x62
6A11 CP (HL) Does this teacher's or main kid's y-coordinate match?
6A12 INC HL L=0x62
6A13 JR NZ,$6A08 Consider the next teacher or main kid if not
A teacher or main kid is at the same location as the little boy.
6A15 LD L,$70 Bytes 0x6F and 0x70 of the character's buffer may hold a routine address; pick up the MSB in A
6A17 LD A,(HL)
6A18 LD L,$62
6A1A AND A Is there an uninterruptible subcommand routine address in bytes 0x6F and 0x70?
6A1B JR NZ,$6A08 Consider the next teacher or main kid if so
6A1D LD A,H A=number of the character in the same location as the little boy
6A1E CP $AC Is it ERIC?
6A20 JR Z,$6A30 Jump if so
6A22 LD L,$6F Place the address of the uninterruptible subcommand routine at 6A46 into bytes 0x6F and 0x70 of the teacher's or main kid's buffer
6A24 LD (HL),$46
6A26 INC L
6A27 LD (HL),$6A
6A29 INC L Initialise the timing parameter in byte 0x71 of the character's buffer (which determines how long the character will stay down)
6A2A LD (HL),$14
6A2C LD L,$62
6A2E JR $6A08 Consider the next teacher or main kid
ERIC is in the same location as the little boy. Knock ERIC out.
6A30 LD HL,$7FFB 7FFB holds ERIC's status flags
6A33 SET 4,(HL) Signal: ERIC has been knocked out
6A35 EX DE,HL
6A36 RET
Prev: 69F5 Up: Map Next: 6A37