![]() |
Routines |
H | 206 (BOY WANDER) |
30555 | LD A,(54546) | Pick up byte 18 of buffer 213 (BOY WANDER's pellet) |
30558 | AND A | Is there a routine address in bytes 17 and 18? |
30559 | RET NZ | Return if so (this buffer is in use) |
30560 | LD L,A | L=0 |
30561 | BIT 0,(HL) | Is BOY WANDER midstride? |
30563 | RET NZ | Return if so |
30564 | INC L | L=1 |
30565 | LD A,(HL) | A=BOY WANDER's x-coordinate |
30566 | AND 3 | Return unless BOY WANDER's x-coordinate is divisible by 4 |
30568 | RET NZ | |
30569 | CALL 30543 | Is BOY WANDER exactly on the top, middle, or bottom floor? |
30572 | RET NZ | Return if not |
30573 | CALL 25233 | A=random number |
30576 | RRCA | Return half the time |
30577 | RET NC | |
30578 | CALL 28004 | Is there a teacher nearby? |
30581 | RET C | Return if so |
30582 | POP BC | Drop the return address (25431) |
30583 | POP BC | Pop the value of HL that was pushed on to the stack by the routine at 25296 before coming here; RET will now take us back either to 25296 to move the next character, or to the main loop |
30584 | CALL 25012 | Update SRB for BOY WANDER's current animatory state and location |
30587 | LD L,20 | Store BOY WANDER's current animatory state in byte 20 of his buffer for the time being |
30589 | LD (HL),A | |
30590 | AND 240 | |
30592 | ADD A,10 | A=26 or 154: BOY WANDER raising arm to fire |
30594 | CALL 30534 | Update SRB for this animatory state and hand over to 30597 |
30597 | CALL 25012 | Update SRB for BOY WANDER's current animatory state |
30600 | INC A | A=27 or 155: BOY WANDER firing catapult |
30601 | CALL 30534 | Update SRB for this animatory state and hand over to 30604 |
30604 | LD L,17 | Place the address of the routine at 30643 into bytes 17 and 18 of BOY WANDER's buffer |
30606 | LD (HL),179 | |
30608 | LD A,(54546) | Pick up byte 18 of buffer 213 (BOY WANDER's pellet) |
30611 | AND A | Is this buffer already being used? |
30612 | RET NZ | Return if so |
30613 | LD B,213 | Use buffer 213 for BOY WANDER's catapult pellet |
30615 | LD L,0 | Point HL at byte 0 of the shooter's character buffer |
30617 | LD A,(HL) | A=shooter's animatory state |
30618 | AND 128 | A=128 if the pellet will travel right, 0 if left |
30620 | ADD A,79 | A=79/207: catapult pellet travelling left/right |
30622 | INC L | Collect the initial coordinates of the pellet from the shooter's buffer into DE |
30623 | LD E,(HL) | |
30624 | INC L | |
30625 | LD D,(HL) | |
30626 | LD H,B | H=buffer to be used for pellet (214 if ERIC's, 213 if BOY WANDER's) |
30627 | LD (HL),D | Fill in the initial coordinates and animatory state of the pellet |
30628 | DEC L | |
30629 | LD (HL),E | |
30630 | DEC L | |
30631 | LD (HL),A | |
30632 | LD L,17 | Place the address of the pellet-controlling routine at 30380 into bytes 17 and 18 of the pellet's buffer |
30634 | LD (HL),172 | |
30636 | INC L | |
30637 | LD (HL),118 | |
30639 | INC L | L=19 |
30640 | LD (HL),13 | The pellet will travel 13 spaces |
30642 | RET |