| Routines

62094: Deal with ERIC when he's been knocked over

Used by the routine at 63405 when bit 7 at 32763 is set (by the routine at 29896). Note that the routine at 26175 also sets bit 7 at 32763 when someone sits in the seat occupied by ERIC, but in that case this routine is not called because bit 2 at 32763 is still set (indicating that ERIC is sitting) and takes precedence; this is a bug.
62094 | LD HL,32733 | 32733 holds ERIC's knockout delay counter
62097 | LD A,(HL) | Is this the first time this routine's been called since ERIC was downed?
62098 | AND A
62099 | JR Z,62112 | Jump if so
62101 | DEC (HL) | Otherwise wait a while before enabling ERIC to stand up again
62102 | RET NZ
62103 | LD L,243 | HL=32755 (ERIC's main action timer)
62105 | LD (HL),1 | Set this to 1 so that the keyboard is checked on the next pass through the main loop
62107 | LD L,251 | HL=32763 (ERIC's status flags)
62109 | LD (HL),4 | Set bit 2: ERIC is sitting or lying down; the routine at 62178 handles ERIC from this point
62111 | RET |
ERIC has just been hit. Determine the manner of his descent to the floor.
62112 | LD (HL),40 | Initialise ERIC's knockout delay counter at 32733 to 40
62114 | LD H,210 | 210=ERIC
62116 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
62119 | PUSH DE | Save ERIC's coordinates briefly
62120 | PUSH AF | Save ERIC's current animatory state briefly
62121 | CP 4 | 4: Was ERIC sitting on a chair?
62123 | JR NZ,62134 | Jump if not
62125 | CALL 32000 | Get the identifier of ERIC's location
62128 | LD B,5 | 5: ERIC sitting on the floor
62130 | CP 6 | Is ERIC in a classroom in the boys' skool (A=6, 7 or 8)?
62132 | JR NC,62136 | Jump if so
62134 | LD B,6 | 6: ERIC lying on his back
62136 | POP AF | Restore ERIC's current animatory state to A
62137 | POP DE | Restore ERIC's coordinates to DE
62138 | AND 128 | Keep only the 'direction' bit (bit 7) of ERIC's current animatory state
62140 | ADD A,B | A=ERIC's new animatory state (sitting on the floor or lying on his back)
62141 | CALL 24880 | Update ERIC's animatory state and update the SRB
62144 | CALL 25248 | Update the display
Now to initialise the sound effect parameters. Your browser doesn't support HTML5 audio. Here is a link to the audio instead.
62147 | LD HL,275 | H=1 (pitch adjustment), L=19 (border colour XOR mask)
This entry point is used by the routine at 23907 with H=2 and L=22.
62150 | LD DE,0 | D=0 (duration), E=0 (initial pitch)
62153 | LD A,2 | A=2 (initial border colour)
This entry point is used by the routines at 62178 (with H=255, L=23, D=255, E=255) and 63861 (with H=248, L=18, D=128, E=0, A=4).
62155 | XOR L | Make a sound effect
62156 | OUT (254),A
62158 | LD B,E
62159 | DJNZ 62159
62161 | LD B,A
62162 | LD A,E
62163 | ADD A,H
62164 | LD E,A
62165 | LD A,B
62166 | DEC D
62167 | JR NZ,62155
This entry point is used by the routine at 24477.
62169 | EI | Re-enable interrupts
62170 | LD A,1 | Reset the border colour to blue
62172 | OUT (254),A
62174 | RET |