| Routines

29194: Control the bike when ERIC's not sitting on the saddle

The address of this uninterruptible subcommand routine is placed into bytes 17 and 18 of the bike's buffer by the routine at 29278. It controls the bike when it is wheeling along on its own (after ERIC has dismounted), or when ERIC is standing on the saddle.
29194 | LD HL,32752 | 32752 holds the bike's momentum
29197 | LD A,(HL) | Pick this up in A
29198 | SUB 7 | Is it time for the bike to come to rest?
29200 | JR NC,29223 | Jump if not
It's time for the bike to come to rest.
29202 | LD L,237 | HL=32749 (ERIC's status flags)
29204 | BIT 7,(HL) | Is ERIC standing on the saddle of the bike?
29206 | JR Z,29210 | Jump if not
29208 | LD (HL),16 | Set bit 4 at 32749: ERIC is falling and will not land on his feet
29210 | LD H,211 | 211=bike
29212 | CALL 25012 | Update the SRB for the bike's current animatory state and location
29215 | DEC A | A=animatory state of the bike resting on the floor
29216 | LD L,18 | Remove the address of this routine from bytes 17 and 18 of the bike's buffer
29218 | LD (HL),0
29220 | JP 24880 | Update the bike's animatory state and update the SRB
The bike still has some momentum left. Check whether it has hit anything.
29223 | LD (HL),A | Set the bike's remaining momentum at 32752
29224 | LD HL,(54016) | E=bike's x-coordinate, A=bike's animatory state
29227 | LD A,L
29228 | LD E,H
29229 | CALL 28672 | Check for walls, closed doors or ALBERT in the bike's path
29232 | LD L,237 | HL=32749 (ERIC's status flags)
29234 | JR NC,29242 | Jump if ALBERT's not impeding the bike's progress
29236 | BIT 7,(HL) | Is ERIC standing on the saddle of the bike?
29238 | JR Z,29252 | Jump if not
29240 | LD (HL),16 | Set bit 4: ERIC is falling and will not land on his feet
29242 | JR NZ,29252 | Jump if there are no walls or closed doors in the bike's path
29244 | BIT 7,(HL) | Is ERIC standing on the saddle of the bike?
29246 | JR Z,29210 | Jump if not
29248 | LD (HL),64 | Set bit 6: ERIC has hit a wall or closed door while standing on the saddle of the bike
29250 | JR 29210 |
29252 | LD H,211 | 211=bike
29254 | CALL 29264 | Move the bike and one space forward and update the SRB
29257 | LD A,(32749) | 32749 holds ERIC's status flags
29260 | RLCA | Is ERIC standing on the saddle of the bike?
29261 | RET NC | Return if not
This entry point is used by the routine at 29278.
29262 | LD H,210 | 210=ERIC
This entry point is used by the routine at 30380.
29264 | CALL 25012 | Update the SRB for the character's current animatory state and location
29267 | RLCA |
29268 | RRCA |
29269 | JR C,29273 | Jump if the character is facing right
29271 | DEC E |
29272 | DEC E |
29273 | INC E | Now E=x-coordinate of the spot in front of the character
29274 | JP 31723 | Update the character's location, update the SRB, and scroll the screen if necessary