Routines |
Prev: FB03 | Up: Map | Next: FBA0 |
Used by the routine at F7AD when bit 1 at 7FED is set (by the routine at 5D63). If 'down', 'left' or 'right' is pressed while ERIC is standing on a plant or plant pot, this routine will set bit 2 or 3 of ERIC's status flags at 7FED as follows:
|
||||||||||||
FB3C | LD HL,$7FF3 | 7FF3 holds ERIC's main action timer | ||||||||||
FB3F | DEC (HL) | Is it time to deal with ERIC yet? | ||||||||||
FB40 | RET NZ | Return if not | ||||||||||
FB41 | INC (HL) | Set ERIC's main action timer to 1, ensuring that we pass through the following section of code on the next call to this routine if no keypress is detected this time | ||||||||||
FB42 | CALL $71FA | Get the value from the keypress offset table corresponding to the last key pressed (if any) | ||||||||||
FB45 | RET Z | Return if no keys were pressed | ||||||||||
A key was pressed while ERIC was standing on a plant or plant pot.
|
||||||||||||
FB46 | LD HL,$7FF3 | Reset ERIC's main action timer at 7FF3 to 5 | ||||||||||
FB49 | LD (HL),$05 | |||||||||||
FB4B | RES 3,A | Reset bit 3 of the keypress code to make it lower case | ||||||||||
FB4D | CP $56 | Was 'down' pressed? | ||||||||||
FB4F | JR NZ,$FB56 | Jump if not | ||||||||||
'Down' was pressed, so make ERIC descend gracefully.
|
||||||||||||
FB51 | LD L,$ED | HL=7FED (ERIC's secondary status flags) | ||||||||||
FB53 | LD (HL),$08 | Set bit 3: ERIC is falling and will land on his feet | ||||||||||
FB55 | RET | |||||||||||
It wasn't 'down'. Was it 'left' or 'right'?
|
||||||||||||
FB56 | EX DE,HL | |||||||||||
FB57 | LD HL,$D200 | Point HL at byte 0x00 of ERIC's buffer | ||||||||||
FB5A | CP $52 | Was 'right' pressed? | ||||||||||
FB5C | JR NZ,$FB90 | Jump if not | ||||||||||
'Right' was pressed.
|
||||||||||||
FB5E | BIT 7,(HL) | Is ERIC facing left? | ||||||||||
FB60 | JP Z,$6E38 | Turn ERIC round if so | ||||||||||
FB63 | INC L | L=0x01 | ||||||||||
FB64 | LD A,(HL) | A=ERIC's x-coordinate | ||||||||||
FB65 | EX DE,HL | |||||||||||
FB66 | INC L | HL=7FF4 (which holds the door/window status flags) | ||||||||||
FB67 | CP $84 | This is the x-coordinate of the plant pot to the left of the gate | ||||||||||
FB69 | JR C,$FB7F | Jump if ERIC is standing on a plant pot in the boys' skool | ||||||||||
FB6B | JR Z,$FB72 | Jump if ERIC is standing on one of the plant pots beside the gate | ||||||||||
FB6D | LD A,$04 | Make a sound effect, update the SRB, and set bit 2 at 7FED (ERIC is stepping off a plant/plant pot) | ||||||||||
FB6F | JP $FAF4 | |||||||||||
ERIC is standing on one of the plant pots on either side of the skool gate, and has tried to step off the plant or plant pot in the direction of the gate.
|
||||||||||||
FB72 | BIT 4,(HL) | Is the skool gate open? | ||||||||||
FB74 | JR NZ,$FB6D | Jump if so | ||||||||||
FB76 | LD B,$0E | This is the y-coordinate of ERIC if he's standing on a fully grown plant on the bottom floor | ||||||||||
FB78 | INC E | Point DE at byte 0x02 of ERIC's buffer | ||||||||||
FB79 | LD A,(DE) | A=ERIC's y-coordinate | ||||||||||
FB7A | CP B | Is ERIC on top of a fully grown plant? | ||||||||||
FB7B | RET NZ | Return if not | ||||||||||
FB7C | JP $FAF2 | Otherwise make a sound effect, update the SRB, and set bits 2 and 3 at 7FED | ||||||||||
ERIC is standing on one of the plant pots in the boys' skool, and has tried to step off in the direction of the window.
|
||||||||||||
FB7F | CP $5B | Is ERIC standing on the top-floor plant pot? | ||||||||||
FB81 | JR NZ,$FB8A | Jump if not | ||||||||||
FB83 | LD B,$00 | This is the y-coordinate of ERIC if he's standing on a fully-grown plant on the top floor | ||||||||||
FB85 | BIT 6,(HL) | Is the top-floor window closed? | ||||||||||
FB87 | RET Z | Return if so | ||||||||||
FB88 | JR $FB78 | |||||||||||
FB8A | LD B,$07 | This is the y-coordinate of ERIC if he's standing on a fully-grown plant on the middle floor | ||||||||||
FB8C | BIT 7,(HL) | Set the zero flag if the middle-floor window is closed | ||||||||||
FB8E | JR $FB87 | |||||||||||
'Right' wasn't pressed. Was it 'left'?
|
||||||||||||
FB90 | CP $50 | Was 'left' pressed? | ||||||||||
FB92 | RET NZ | Return if not | ||||||||||
'Left' was pressed.
|
||||||||||||
FB93 | BIT 7,(HL) | Is ERIC facing right? | ||||||||||
FB95 | JP NZ,$6E38 | Turn ERIC round if so | ||||||||||
FB98 | INC L | Point HL at byte 0x01 of ERIC's buffer | ||||||||||
FB99 | LD A,(HL) | A=ERIC's x-coordinate | ||||||||||
FB9A | EX DE,HL | |||||||||||
FB9B | INC L | HL=7FF4 (which holds the door/window status flags) | ||||||||||
FB9C | CP $87 | This is the x-coordinate of the plant pot to the right of the gate; set the carry flag if ERIC is to the left of this, or set the zero flag if he's standing on it | ||||||||||
FB9E | JR $FB6B |
Prev: FB03 | Up: Map | Next: FBA0 |