![]() |
Routines |
| A | 1 or 2 (from byte 255 of water animation table) |
| H | 214 (water's buffer) |
| L | 19 |
| 64077 | DEC A | Is the water at the right phase to fill a cup? |
| 64078 | JR NZ,64126 | Jump if not |
| 64080 | LD L,2 | Point HL at byte 2 of the water's buffer |
| 64082 | LD A,(HL) | A=water's y-coordinate |
| 64083 | SUB 14 | All cups have a y-coordinate of 14 |
| 64085 | RET NZ | Return if the water's not at the right height |
| 64086 | LD L,A | L=0 |
| 64087 | DEC A | A=-1 |
| 64088 | BIT 7,(HL) | Is the water travelling to the left? |
| 64090 | JR Z,64094 | Jump if so |
| 64092 | LD A,3 | |
| 64094 | INC L | L=1 |
| 64095 | ADD A,(HL) | Now A=x-coordinate of the spot the water is hitting |
| 64096 | CALL 30217 | Is this the x-coordinate of one of the cups? |
| 64099 | RET NZ | Return if not |
| 64100 | LD HL,32747 | 32747 holds the inventory flags |
| 64103 | BIT 4,(HL) | Set the zero flag if there's water (not sherry) in the pistol |
| 64105 | LD HL,56439 | H=220, L=119 |
| 64108 | JR Z,64112 | Jump if there's water in the pistol |
| 64110 | LD L,124 | |
| 64112 | INC H | Point HL at a cup graphic data table |
| 64113 | CP (HL) | Is this the right data table for the cup? |
| 64114 | JR NZ,64112 | Jump back to check the next table if not |
| 64116 | DEC L | Point HL at the start of the appropriate data table |
| HL | Cup | Contents | 56694 | Leftmost cup in boys' skool | Water | 56699 | Leftmost cup in boys' skool | Sherry | 56950 | Middle cup in boys' skool | Water | 56955 | Middle cup in boys' skool | Sherry | 57206 | Rightmost cup in boys' skool | Water | 57211 | Rightmost cup in boys' skool | Sherry | 57462 | Cup in girls' skool | Water | 57467 | Cup in girls' skool | Sherry |
|---|
| 64117 | CALL 27672 | Alter the appropriate UDG and attribute references in the play area to show the cup filled with water or sherry |
| 64120 | POP HL | Drop the return address (to the routine at 63915) from the stack |
| 64121 | LD H,214 | 214=water's buffer |
| 64123 | JP 29903 | Remove the water from sight |
| 64126 | DEC (HL) | Decrement the water animation phase identifier in byte 19 of the water's buffer from 156 to 155; this has the effect of bringing us back through this section of code (via the routine at 63915) until the water has hit either a plant or the floor |
| 64127 | CALL 30543 | Is the water's y-coordinate 3 (top floor), 10 (middle floor) or 17 (bottom floor)? |
| 64130 | JR NZ,64147 | Jump if not |
| 64132 | CP 17 | Did it hit the bottom floor? |
| 64134 | JR Z,64120 | Terminate the water if so |
| 64136 | DEC L | L=1 |
| 64137 | LD A,(HL) | A=water's x-coordinate |
| 64138 | CP 96 | Terminate the water if A<96 (it's inside the boys' skool) or A>=160 (it's inside the girls' skool) |
| 64140 | JR C,64120 | |
| 64142 | CP 160 | |
| 64144 | JR NC,64120 | |
| 64146 | RET |
| 64147 | CALL 63878 | Has the water hit a plant pot? |
| 64150 | RET NZ | Return if not |
| 64151 | LD A,(32747) | 32747 holds the inventory flags |
| 64154 | BIT 4,A | Has the pistol got sherry in it? |
| 64156 | JR NZ,64120 | Terminate the sherry if so (sherry does not make plants grow) |
| 64158 | POP DE | Drop the return address (to the routine at 63915) from the stack |
| 64159 | CALL 25012 | Update SRB for the water's current animatory state and location |
| 64162 | INC D | Now D=y-coordinate of the plant |
| 64163 | LD L,19 | Initialise the counter that determines the phases of growth of the watered plant |
| 64165 | LD (HL),22 | |
| 64167 | INC L | Store the x-coordinate of the plant in byte 20 of the buffer for retrieval later when it starts growing |
| 64168 | LD (HL),E | |
| 64169 | LD E,0 | The plant's initial x-coordinate will be 0 (which is certainly off-screen at the moment, since the leftmost plant pot is at x-coordinate 91) |
| 64171 | LD A,E | And its initial animatory state will be 0 (ERIC standing, facing left), so it's a good thing it will be off-screen! |
| 64172 | CALL 30534 | Place address 64175 (below) into bytes 17 and 18 of the plant's buffer and update SRB for the plant's initial animatory state and location |
| 64175 | LD L,19 | Byte 19 holds the counter that determines the phases of growth (and death) of the plant |
| 64177 | DEC (HL) | Is the plant ready to die? |
| 64178 | JR NZ,64195 | Jump if not |
| 64180 | LD A,(32749) | 32749 holds ERIC's status flags |
| 64183 | CP 2 | Is ERIC standing on a plant or plant pot? |
| 64185 | JR NZ,64192 | Jump if not |
| 64187 | LD A,16 | Set bit 4 at 32749, indicating that ERIC is going to take a fall (even if ERIC's standing on a different plant pot; this is a bug) |
| 64189 | LD (32749),A | |
| 64192 | JP 29903 | Kill the plant |
| 64195 | LD A,(HL) | Pick up the plant lifespan counter in A |
| 64196 | CP 8 | Is it time for the plant to start growing? |
| 64198 | JR NZ,64209 | Jump if not |
| 64200 | INC L | E=x-coordinate of the plant (stored in byte 20 earlier) |
| 64201 | LD E,(HL) | |
| 64202 | LD L,2 | Point HL at byte 2 of the plant's buffer |
| 64204 | LD D,(HL) | D=y-coordinate of the plant |
| 64205 | LD A,42 | 42: flower, half-grown |
| 64207 | JR 64216 | |
| 64209 | CP 4 | Is it time for the plant to reach full height? |
| 64211 | RET NZ | Return if not |
| 64212 | CALL 25012 | Update SRB for the plant's current animatory state |
| 64215 | INC A | A=43: flower, fully grown |
| 64216 | CALL 24880 | Update SRB for the plant's new animatory state |
| 64219 | LD A,(32749) | 32749 holds ERIC's status flags |
| 64222 | CP 2 | Is ERIC standing on a plant? |
| 64224 | RET NZ | Return if not |
| 64225 | LD A,(53761) | A=ERIC's x-coordinate |
| 64228 | LD L,1 | Point HL at byte 1 of his buffer |
| 64230 | CP (HL) | Is ERIC standing on this plant? |
| 64231 | RET NZ | Return if not |
| 64232 | LD H,210 | 210=ERIC |
| 64234 | CALL 25012 | Update SRB for ERIC's current animatory state and location |
| 64237 | DEC D | ERIC will rise one level |
| 64238 | JP 24880 | Update SRB for ERIC's new location |