![]() |
Routines |
Prev: 30292 | Up: Map | Next: 30532 |
H | Pellet's character number (213 or 214) |
30380 | LD L,19 | Byte 19 of the pellet's buffer holds the distance left to travel |
30382 | DEC (HL) | Has the pellet finished travelling? |
30383 | JP Z,29903 | Terminate the pellet if so |
30386 | LD A,(HL) | A=distance left to travel |
30387 | CP 5 | Does the pellet have fewer than 5 spaces left to travel? |
30389 | JR C,30413 | Jump if so (to check for hittable obstacles) |
The pellet is merrily wending its way through the air. It's not ready to hit anything vulnerable yet, or has simply failed to do so. The only thing that can stop it at the moment is a wall, door or window.
|
||
30391 | LD L,0 | Point HL at byte 0 of the pellet's buffer |
30393 | LD A,(HL) | A=animatory state of pellet |
30394 | RLCA | Set the carry flag if the pellet is travelling to the left |
30395 | CCF | |
30396 | SBC A,A | A=-1 if the pellet is travelling leftwards, 1 if rightwards |
30397 | ADD A,A | |
30398 | INC A | |
30399 | INC L | Add the pellet's x-coordinate to obtain that of the location directly in front of the pellet |
30400 | ADD A,(HL) | |
30401 | LD E,A | Store this in E |
30402 | INC L | L=2 |
30403 | LD D,(HL) | D=pellet's y-coordinate |
30404 | CALL 30292 | Check for closed doors, windows and walls in the pellet's path |
30407 | JP C,29903 | Terminate the pellet if there is one |
30410 | JP 29264 | Otherwise just advance the pellet one space |
The pellet is ready to hit a vulnerable character, cup or tree.
|
||
30413 | CALL 30229 | Has the pellet hit a water- or sherry-filled cup? |
30416 | JR NZ,30435 | Jump if not |
The pellet has hit a water- or sherry-filled cup, or a conker in the tree. The A register holds the animatory state of the object (drop of water/sherry, or conker) that the pellet will become.
|
||
30418 | LD L,18 | Place the address of the routine at 29896 into bytes 17 and 18 of the catapult pellet's buffer |
30420 | LD (HL),116 | |
30422 | DEC L | |
30423 | LD (HL),200 | |
30425 | PUSH AF | Save the new animatory state of the transmuted pellet |
30426 | CALL 25012 | Update SRB for the pellet's current location |
30429 | POP AF | Restore the transmuted pellet's animatory state to A |
30430 | DEC D | The projectile will ascend two levels |
30431 | DEC D | |
30432 | JP 24880 | Update SRB for the projectile's new location |
The pellet hasn't hit a water- or sherry-filled cup. Has it hit a teacher?
|
||
30435 | LD L,1 | Point HL at byte 1 of the pellet's buffer |
30437 | LD E,(HL) | E=pellet's x-coordinate |
30438 | INC L | L=2 |
30439 | LD D,(HL) | D=pellet's y-coordinate |
30440 | LD B,5 | There are 5 teachers who can be hit by a pellet |
30442 | CALL 29858 | Has the pellet hit any of these teachers? |
30445 | JR NZ,30491 | Jump if not |
30447 | LD C,0 | Point BC at byte 0 of the stricken teacher's buffer |
30449 | LD A,(BC) | A=animatory state of this teacher |
30450 | AND 7 | Is the teacher already sitting on the floor? |
30452 | CP 6 | |
30454 | JR NZ,30482 | Jump if not |
30456 | LD L,19 | Place 6 into byte 19 of the pellet's buffer (the distance the pellet will travel after bouncing off the teacher's head) |
30458 | LD (HL),A | |
This section of code controls the pellet's motion on its ascent from the teacher's head.
|
||
30459 | LD L,19 | Byte 19 of the pellet's buffer holds the distance left to travel |
30461 | DEC (HL) | Decrement this |
30462 | JP Z,29903 | Terminate the pellet if its journey is over |
30465 | CALL 30229 | Has the pellet hit a water- or sherry-filled cup? |
30468 | JR Z,30418 | Jump if so |
30470 | CALL 25012 | Update SRB for the pellet's current location |
30473 | DEC D | Has the pellet hit the ceiling on the top floor? |
30474 | JR NZ,30477 | Jump if not (having raised the pellet one level) |
30476 | INC D | D=1; this makes the pellet hover just below the ceiling on the top floor before disappearing, which is a bug |
30477 | CALL 30534 | Replace the address of this routine in bytes 17 and 18 of the pellet's buffer with 30480 (that of the next instruction) |
30480 | JR 30459 | |
The pellet has hit a teacher who's standing up.
|
||
30482 | LD C,18 | Point BC at byte 18 of the teacher's buffer |
30484 | LD A,(BC) | A=MSB of a routine address, or 0 |
30485 | PUSH BC | |
30486 | AND A | Is there a routine address in bytes 17 and 18? |
30487 | JP Z,29983 | Jump if not (this teacher can be knocked over) |
30490 | POP BC | |
The pellet hasn't hit any liquid-containing cups or vulnerable teachers. Has it hit any kids?
|
||
30491 | LD D,206 | 206=BOY WANDER |
30493 | LD B,5 | There are 5 kids who can be knocked over |
30495 | CALL 27820 | Has the pellet hit any of them? |
30498 | JP NC,30786 | Knock them down if so |
The pellet hasn't hit any liquid-containing cups, teachers or kids. Has it hit a conker in the tree?
|
||
30501 | LD L,19 | Byte 19 of the pellet's buffer holds the distance left to travel |
30503 | LD A,(HL) | Pick this up in A |
30504 | DEC A | Is there only one space left to travel? |
30505 | JP Z,30391 | Jump if so |
30508 | LD L,2 | Point HL at byte 2 of the pellet's buffer |
30510 | LD A,(HL) | A=pellet's y-coordinate |
30511 | CP 4 | Was the pellet fired on the top floor? |
30513 | JR NC,30524 | Jump if not |
30515 | DEC L | L=1 |
30516 | LD A,(HL) | A=pellet's x-coordinate |
30517 | CP 128 | Jump if the pellet is to the right of the tree (it was fired in the girls' skool) |
30519 | JR NC,30524 | |
30521 | CP 96 | Set the carry flag if A>=96 (i.e. the pellet is in the tree) |
30523 | CCF | |
30524 | JP NC,30391 | Jump unless the pellet will knock a conker out of the tree |
30527 | LD A,55 | 55: animatory state of conker |
30529 | JP 30418 | Transmute the pellet into a conker |
Prev: 30292 | Up: Map | Next: 30532 |