Routines
 Prev: 27125 Up: Map Next: 27191
27126: Make a little boy trip people up
The address of this continual subcommand routine is placed into bytes 124 and 125 of little boy no. 1's character buffer by the routine at 27246, and into bytes 124 and 125 of the character buffers of little boys 2-11 by the routine at 27266.
Input
H Little boy's character number (152-162)
27126 LD L,97 Pick up the little boy's y-coordinate in A
27128 LD A,(HL)
27129 CALL 26185 Is the boy on a staircase?
27132 RET NZ Return if so
27133 LD B,10 We will check characters 163-172 (teachers and main kids)
27135 LD DE,41826 D=163 (MR WACKER), E=98
27138 INC L L=98
27139 EX DE,HL
27140 LD A,(DE) A=little boy's x-coordinate
27141 CP (HL) Does this teacher's or main kid's x-coordinate match?
27142 JR Z,27149 Jump if so
27144 INC H Next teacher or main kid
27145 DJNZ 27140 Jump back until all teachers and main kids have been checked
27147 EX DE,HL
27148 RET
A teacher or main kid is at the same x-coordinate as the little boy. Now check the y-coordinates.
27149 DEC E E=L=97
27150 DEC L
27151 LD A,(DE) A=little boy's y-coordinate
27152 INC E E=98
27153 CP (HL) Does this teacher's or main kid's y-coordinate match?
27154 INC HL L=98
27155 JR NZ,27144 Consider the next teacher or main kid if not
A teacher or main kid is at the same location as the little boy.
27157 LD L,112 Bytes 111 and 112 of the character's buffer may hold a routine address; pick up the MSB in A
27159 LD A,(HL)
27160 LD L,98
27162 AND A Is there an uninterruptible subcommand routine address in bytes 111 and 112?
27163 JR NZ,27144 Consider the next teacher or main kid if so
27165 LD A,H A=number of the character in the same location as the little boy
27166 CP 172 Is it ERIC?
27168 JR Z,27184 Jump if so
27170 LD L,111 Place the address of the uninterruptible subcommand routine at 27206 into bytes 111 and 112 of the teacher's or main kid's buffer
27172 LD (HL),70
27174 INC L
27175 LD (HL),106
27177 INC L Initialise the timing parameter in byte 113 of the character's buffer (which determines how long the character will stay down)
27178 LD (HL),20
27180 LD L,98
27182 JR 27144 Consider the next teacher or main kid
ERIC is in the same location as the little boy. Knock ERIC out.
27184 LD HL,32763 32763 holds ERIC's status flags
27187 SET 4,(HL) Signal: ERIC has been knocked out
27189 EX DE,HL
27190 RET
 Prev: 27125 Up: Map Next: 27191