Prev: 29568 Up: Map Next: 29613
29574: 'M' pressed - mount bike
The address of this routine is found in the table of keypress handling routines at 58704. It is called from the main loop at 63210 when 'M' or 'B' is pressed.
Input
A ERIC's animatory state
D ERIC's y-coordinate
E ERIC's x-coordinate
29574 AND 128 A=0 if ERIC's facing left, 128 if facing right
29576 ADD A,25 A=25/153: bike standing upright
29578 LD B,A Copy the bike's animatory state to B
29579 LD HL,54018 H=211 (bike), L=2
29582 LD A,D A=ERIC's y-coordinate
29583 CP (HL) Is ERIC on the same floor as the bike?
29584 RET NZ Return if not
29585 DEC L L=1
29586 LD A,E A=ERIC's x-coordinate
29587 CP (HL) Is ERIC at the same x-coordinate as the bike?
29588 RET NZ Return if not
ERIC is standing beside the bike. Prepare to place him on the saddle.
29589 DEC L L=0
29590 LD (HL),B Fill in the animatory state of the bike
29591 CALL 29012 Make a sound effect
29594 LD HL,32763 32763 holds ERIC's status flags
29597 LD (HL),2 Set bit 1: examine the secondary status flags at 32749
29599 LD A,18
29601 LD L,238 HL=32750 (value from the keypress offset table corresponding to the last key pressed while riding the bike)
29603 LD (HL),A Initialise this to 18 (which doesn't correspond to any key)
29604 INC L Initialise the bike's speed counter (at 32751) to 18 (matching its initial momentum, set below, so that it doesn't move forward before ERIC has started pedalling)
29605 LD (HL),A
29606 INC L Initialise the bike's momentum (at 32752) to 18 (giving ERIC a decent chance to start pedalling before the bike falls over)
29607 LD (HL),A
29608 LD L,243 HL=32755 (ERIC's main action timer)
29610 JP 29488 Place ERIC on the bike
Prev: 29568 Up: Map Next: 29613