Routines |
Prev: F51E | Up: Map | Next: F5B6 |
F533 | LD HL,$7FF6 | Decrement the jumping action timer at 7FF6 (which starts at 0x10) | ||
F536 | DEC (HL) | Has ERIC completed the jump? | ||
F537 | JP Z,$F425 | Jump if so | ||
F53A | LD A,(HL) | Pick up the current value of the action timer in A | ||
F53B | CP $0C | |||
F53D | LD B,$0F | Lines reprimand 0x0F: YOU ARE NOT A KANGAROO | ||
F53F | JP Z,$F456 | Jump if it's time to check whether any teachers can see ERIC jumping | ||
F542 | LD H,$AC | 0xAC=ERIC | ||
F544 | CP $0D | Is it time to check whether ERIC has touched a shield or opened the safe? | ||
F546 | JP Z,$F51E | Jump if so | ||
F549 | CP $0E | Is it time to make the jumping sound effect? | ||
F54B | JP Z,$EAEB | Jump if so | ||
F54E | CP $09 | Is it time to move ERIC's arm back? | ||
F550 | JP Z,$706B | Jump if so | ||
F553 | CP $03 | Is it time to bring ERIC back down to the floor? | ||
F555 | JR NZ,$F55E | Jump if not | ||
F557 | CALL $6214 | Update the SRB for ERIC's current location | ||
F55A | INC D | Move ERIC downwards | ||
F55B | JP $61B0 | Update ERIC's location and update the SRB | ||
F55E | CP $06 | Return if A < 0x06 (nothing to check or do) | ||
F560 | RET C | |||
At this point A=0x06 (which means it's time to check whether ERIC has jumped onto a boy, or ERIC is already standing on a boy), or A is one of {0x07, 0x08, 0x0A, 0x0B, 0x0F}, or A>0x80 (which means ERIC has jumped while standing on a boy).
|
||||
F561 | JR NZ,$F5AB | Jump unless (a) it's time to check whether ERIC has jumped on a boy, or (b) ERIC is already standing on a boy | ||
F563 | LD L,$61 | Byte 0x61 of ERIC's buffer holds his y-coordinate | ||
F565 | LD D,(HL) | Pick this up in D | ||
F566 | INC D | Down a level (where the boy that ERIC is standing on would be, if any) | ||
F567 | INC L | Byte 0x62 holds ERIC's x-coordinate | ||
F568 | LD E,(HL) | Pick this up in E | ||
F569 | LD B,$0B | There are 11 little boys | ||
F56B | LD H,$98 | 0x98=little boy no. 1 | ||
F56D | CALL $F5B9 | Is ERIC standing on a little boy? | ||
F570 | JR C,$F57A | Jump if so | ||
F572 | LD H,$A7 | 0xA7=BOY WANDER | ||
F574 | LD B,$03 | There are three main kids besides ERIC | ||
F576 | CALL $F5BF | Is ERIC standing on one of the three main kids? | ||
F579 | RET NC | Return if not | ||
ERIC is standing on a kid who's been knocked out.
|
||||
F57A | CALL $673A | Check for keypresses | ||
F57D | LD HL,$7FF6 | Set the jumping action timer at 7FF6 to 0x07, so that we keep returning to this section of code while ERIC is standing on a boy | ||
F580 | LD (HL),$07 | |||
F582 | RET Z | Return if no key of interest was pressed | ||
F583 | SET 5,A | Convert the ASCII code of the keypress in A to lower case | ||
F585 | CP $6A | Was 'j' (jump) pressed? | ||
F587 | JR NZ,$F58C | Jump if not | ||
F589 | LD (HL),$90 | Set the jumping action timer at 7FF6 to 0x90 to indicate that ERIC has jumped while standing on a boy | ||
F58B | RET | Return to the main loop with the carry flag reset | ||
A key other than 'j' was pressed while ERIC was standing on a boy.
|
||||
F58C | CP $6F | 0x6F='o' | ||
F58E | LD B,$00 | Set B=0x00 (ERIC facing left) for later comparison | ||
F590 | JR Z,$F597 | Jump if 'o' (left) was pressed | ||
F592 | LD B,$80 | Set B=0x80 (ERIC facing right) for later comparison | ||
F594 | CP $70 | Was 'p' (right) pressed? | ||
F596 | RET NZ | Return if not | ||
F597 | LD HL,$AC66 | A=animatory state of ERIC before he jumped (stored in byte 0x66 of his buffer) | ||
F59A | LD A,(HL) | |||
F59B | AND $80 | Keep only the 'direction' bit | ||
F59D | CP B | Should ERIC turn round? | ||
F59E | RET Z | Return if not | ||
F59F | LD A,(HL) | Adjust ERIC's pre-jump animatory state to reflect his turning round while standing on a boy | ||
F5A0 | XOR $80 | |||
F5A2 | LD (HL),A | |||
F5A3 | CALL $6214 | Update the SRB for ERIC's current animatory state | ||
F5A6 | XOR $80 | A=animatory state of ERIC facing the other way | ||
F5A8 | JP $61B0 | Update ERIC's animatory state and update the SRB | ||
At this point A is one of {0x07, 0x08, 0x0A, 0x0B, 0x0F} (which means there is nothing to do), or A=0x80-0x8F (which means ERIC has jumped while standing on a boy).
|
||||
F5AB | CP $86 | Return now if the SUB $80 instruction below would make A=0x06 | ||
F5AD | RET Z | |||
F5AE | SUB $80 | Return unless ERIC jumped while standing on a boy | ||
F5B0 | RET C | |||
So ERIC has jumped while standing on a boy. Now either A=0x00, meaning it's time to set the jumping action timer at 7FF6 back to 7, so we can deal with ERIC while he's standing on a boy; or A=0x01-0x0F (but not 0x06, because that would lead us into the code at F563 to perform a redundant check on whether ERIC is standing on a boy), meaning we need to run the usual checks while ERIC is in mid-air.
|
||||
F5B1 | JP NZ,$F53B | Run the usual checks while ERIC is in mid-air above a supine boy | ||
F5B4 | JR $F57C | This should be JR F57D |
Prev: F51E | Up: Map | Next: F5B6 |