Routines |
Prev: 7A14 | Up: Map | Next: 7AE6 |
The address of this uninterruptible subcommand routine is placed into bytes 0x11 and 0x12 of a mouse's buffer by the routine at 7B0E (if the mouse was released by ERIC) or by the routine at F5BE (when preparing for a new game). Bytes 0x10 and 0x13-0x16 of the mouse's buffer are used to store the following values that control its movement:
|
||||||||||||||||||||
7A16 | LD L,$13 | A=remaining distance to travel | ||||||||||||||||||
7A18 | LD A,(HL) | |||||||||||||||||||
7A19 | AND A | Is this mouse (a) hiding, (b) about to hide, or (c) about to consider a change of direction and distance to travel? | ||||||||||||||||||
7A1A | JR Z,$7A62 | Jump if so | ||||||||||||||||||
7A1C | LD A,($7FF4) | 7FF4 holds the door/window status flags | ||||||||||||||||||
7A1F | PUSH AF | Save these flags | ||||||||||||||||||
7A20 | AND $3F | Reset bits 6 and 7 of the door/window status flags (i.e. pretend that the windows are closed) | ||||||||||||||||||
7A22 | LD ($7FF4),A | |||||||||||||||||||
7A25 | BIT 7,(HL) | Set the zero flag if the mouse is travelling right | ||||||||||||||||||
7A27 | LD L,$01 | Collect the mouse's x-coordinate in E | ||||||||||||||||||
7A29 | LD E,(HL) | |||||||||||||||||||
7A2A | JR Z,$7A2E | Jump if the mouse is travelling right | ||||||||||||||||||
7A2C | DEC E | |||||||||||||||||||
7A2D | DEC E | |||||||||||||||||||
7A2E | INC E | E=x-coordinate of the spot in front of the mouse | ||||||||||||||||||
7A2F | INC L | L=0x02 | ||||||||||||||||||
7A30 | LD A,(HL) | A=mouse's y-coordinate | ||||||||||||||||||
7A31 | LD D,A | Copy this to D | ||||||||||||||||||
7A32 | CP $0A | Is the mouse on the middle floor? | ||||||||||||||||||
7A34 | JR NZ,$7A3B | Jump if not | ||||||||||||||||||
7A36 | LD A,E | A=x-coordinate of the spot in front of the mouse | ||||||||||||||||||
7A37 | CP $54 | Is the mouse at the top of the stairs leading down to the stage? | ||||||||||||||||||
7A39 | JR Z,$7A40 | Turn the mouse round if so | ||||||||||||||||||
7A3B | CALL $7654 | Check for walls and closed doors in the mouse's path | ||||||||||||||||||
7A3E | JR NC,$7A48 | Jump if there are none | ||||||||||||||||||
7A40 | LD L,$13 | Turn the mouse round without changing the distance remaining to travel | ||||||||||||||||||
7A42 | LD A,(HL) | |||||||||||||||||||
7A43 | NEG | |||||||||||||||||||
7A45 | LD (HL),A | |||||||||||||||||||
7A46 | JR $7A25 | See what's in front of the mouse in this direction | ||||||||||||||||||
There are no walls or closed doors in the mouse's path.
|
||||||||||||||||||||
7A48 | POP AF | Restore the door/window status flags | ||||||||||||||||||
7A49 | LD ($7FF4),A | |||||||||||||||||||
7A4C | CALL $61B4 | Update the SRB for the mouse's current animatory state and location | ||||||||||||||||||
7A4F | LD L,$13 | Is the mouse travelling right? | ||||||||||||||||||
7A51 | BIT 7,(HL) | |||||||||||||||||||
7A53 | JR Z,$7A5B | Jump if so | ||||||||||||||||||
7A55 | INC (HL) | Decrease the distance left to travel | ||||||||||||||||||
7A56 | DEC E | Move the mouse one space left | ||||||||||||||||||
7A57 | LD A,$2F | 0x2F: animatory state of a mouse travelling left | ||||||||||||||||||
7A59 | JR $7A5F | |||||||||||||||||||
7A5B | DEC (HL) | Decrease the distance left to travel | ||||||||||||||||||
7A5C | INC E | Move the mouse one space right | ||||||||||||||||||
7A5D | LD A,$AF | 0xAF: animatory state of a mouse travelling right | ||||||||||||||||||
7A5F | JP $6130 | Update the mouse's animatory state and location and update the SRB | ||||||||||||||||||
Byte 0x13 holds 0, which means (a) the mouse is hiding at the moment, or (b) it's time for the mouse to consider a change of direction and distance to travel, or (c) it's time to hide for a bit.
|
||||||||||||||||||||
7A62 | INC L | Pick up byte 0x14 in A | ||||||||||||||||||
7A63 | LD A,(HL) | |||||||||||||||||||
7A64 | AND A | Is the mouse already hiding? | ||||||||||||||||||
7A65 | JR Z,$7A8C | Jump if so | ||||||||||||||||||
7A67 | DEC (HL) | Is it time for the mouse to hide temporarily? | ||||||||||||||||||
7A68 | JR NZ,$7A73 | Jump if not | ||||||||||||||||||
7A6A | LD L,$01 | Point HL at byte 0x01 of the mouse's buffer | ||||||||||||||||||
7A6C | LD A,(HL) | A=mouse's x-coordinate | ||||||||||||||||||
7A6D | LD L,$16 | Store this in byte 0x16 of the mouse's buffer for later retrieval | ||||||||||||||||||
7A6F | LD (HL),A | |||||||||||||||||||
7A70 | JP $74D3 | Make the mouse hide | ||||||||||||||||||
It's time for the mouse to consider a change of direction and distance to travel.
|
||||||||||||||||||||
7A73 | PUSH HL | |||||||||||||||||||
7A74 | CALL $79AE | Make any girls near this mouse start jumping | ||||||||||||||||||
7A77 | POP HL | |||||||||||||||||||
7A78 | CALL $6291 | A=random number | ||||||||||||||||||
7A7B | AND $83 | A=0x02-0x05 (bit 7 reset) or 0x82-0x85 (bit 7 set) | ||||||||||||||||||
7A7D | ADD A,$02 | |||||||||||||||||||
7A7F | RLCA | A=0x02-0x05 (bit 7 reset), with the carry flag holding the previous contents of bit 7 | ||||||||||||||||||
7A80 | AND A | |||||||||||||||||||
7A81 | RRA | |||||||||||||||||||
7A82 | JR C,$7A86 | Jump if bit 7 was set (the new direction is right) | ||||||||||||||||||
7A84 | NEG | The new direction is left | ||||||||||||||||||
7A86 | LD L,$13 | Set the new direction and distance to travel | ||||||||||||||||||
7A88 | LD (HL),A | |||||||||||||||||||
7A89 | JP $7A1C | Start moving | ||||||||||||||||||
The mouse is currently hiding. Check whether it should transform into a frog before reappearing (in case ERIC obtained the Science Lab storeroom key in the meantime).
|
||||||||||||||||||||
7A8C | INC L | L=0x15 | ||||||||||||||||||
7A8D | DEC (HL) | Is it time for the mouse to come out of hiding? | ||||||||||||||||||
7A8E | RET NZ | Return if not | ||||||||||||||||||
7A8F | LD A,H | A=mouse's character number | ||||||||||||||||||
7A90 | CP $D4 | Was this mouse released by ERIC? | ||||||||||||||||||
7A92 | JR NZ,$7AC0 | Jump if so | ||||||||||||||||||
7A94 | LD A,($7FEB) | 7FEB holds the inventory flags | ||||||||||||||||||
7A97 | BIT 1,A | Has ERIC got the Science Lab storeroom key? | ||||||||||||||||||
7A99 | JR Z,$7AA6 | Jump if not | ||||||||||||||||||
7A9B | LD A,$1D | 0x1D: animatory state of the frog | ||||||||||||||||||
7A9D | LD DE,$0A3B | (E,D)=(59,10) (location where the frog enters the game) | ||||||||||||||||||
7AA0 | CALL $6130 | Update the frog's animatory state and location and update the SRB | ||||||||||||||||||
7AA3 | JP $7955 | Bring the frog into the game | ||||||||||||||||||
It's time for this mouse to come out of hiding.
|
||||||||||||||||||||
7AA6 | CALL $6291 | A=random number between 0x05 and 0x14; this determines how long the mouse will hide next time | ||||||||||||||||||
7AA9 | AND $0F | |||||||||||||||||||
7AAB | ADD A,$05 | |||||||||||||||||||
7AAD | LD (HL),A | Store this in byte 0x15 of the mouse's buffer | ||||||||||||||||||
7AAE | CALL $6291 | A=random number between 2 and 5; this determines how many changes of direction and distance to travel the mouse will make before hiding again | ||||||||||||||||||
7AB1 | AND $03 | |||||||||||||||||||
7AB3 | ADD A,$02 | |||||||||||||||||||
7AB5 | DEC L | Store this in byte 0x14 of the mouse's buffer | ||||||||||||||||||
7AB6 | LD (HL),A | |||||||||||||||||||
7AB7 | LD L,$16 | E=x-coordinate of the mouse before it hid | ||||||||||||||||||
7AB9 | LD E,(HL) | |||||||||||||||||||
7ABA | LD L,$02 | D=y-coordinate of the mouse | ||||||||||||||||||
7ABC | LD D,(HL) | |||||||||||||||||||
7ABD | JP $7A5D | Unhide the mouse | ||||||||||||||||||
This mouse was released by ERIC and is currently hiding. It's due to come out of hiding, or die.
|
||||||||||||||||||||
7AC0 | LD L,$10 | Byte 0x10 holds the mouse's lifespan counter | ||||||||||||||||||
7AC2 | DEC (HL) | Is it time for this mouse to disappear for ever? | ||||||||||||||||||
7AC3 | JR NZ,$7ADB | Jump if not | ||||||||||||||||||
This mouse must die, and return control of the buffer it hijacked (0xC6, 0xC7, 0xCE-0xD0) to its original owner (little boy no. 9 or 10, BOY WANDER, ANGELFACE or EINSTEIN).
|
||||||||||||||||||||
7AC5 | LD L,$1D | Set bits 0 and 7 at byte 0x1D: restart the command list and make the character run | ||||||||||||||||||
7AC7 | LD (HL),$81 | |||||||||||||||||||
7AC9 | LD L,$0A | Remove any interruptible subcommand routine address that may have been in the character's buffer before it was hijacked | ||||||||||||||||||
7ACB | LD (HL),$00 | |||||||||||||||||||
7ACD | LD L,$0F | Pick up from byte 0x0F the animatory state of the character whose buffer the mouse borrowed | ||||||||||||||||||
7ACF | LD A,(HL) | |||||||||||||||||||
7AD0 | AND $F0 | A=character's base animatory state | ||||||||||||||||||
7AD2 | LD L,$00 | Restore this character's animatory state to its base value | ||||||||||||||||||
7AD4 | LD (HL),A | |||||||||||||||||||
7AD5 | INC L | Make the character reappear at x-coordinate 32 (which should be off-screen because ERIC cannot release mice in the boys' skool) | ||||||||||||||||||
7AD6 | LD (HL),$20 | |||||||||||||||||||
7AD8 | JP $6394 | Terminate this uninterruptible subcommand, thus returning control to the character who normally owns the buffer | ||||||||||||||||||
This mouse (released by ERIC) is about to come out of hiding.
|
||||||||||||||||||||
7ADB | LD A,($7FFF) | A=leftmost column of the play area on screen | ||||||||||||||||||
7ADE | CP $90 | Is at least half of the girls' skool on-screen? | ||||||||||||||||||
7AE0 | JR C,$7AC5 | Terminate the mouse if not | ||||||||||||||||||
7AE2 | LD L,$15 | |||||||||||||||||||
7AE4 | JR $7AA6 | Otherwise make the mouse reappear |
Prev: 7A14 | Up: Map | Next: 7AE6 |