Prev: 28665 Up: Map Next: 28713
28672: Make BOY WANDER fire his catapult now and then
The address of this continual subcommand routine is placed into bytes 124 and 125 of BOY WANDER's buffer by command lists 140, 148, 156, 164, 172, 178, 192, 194 and 216. It decides whether BOY WANDER should let rip with a pellet, and gets the catapult-firing action under way if so.
28672 LD L,98 Byte 98 of BOY WANDER's buffer holds his x-coordinate
28674 LD A,(HL) Pick this up in A
28675 AND 3 Is BOY WANDER's x-coordinate divisible by 4?
28677 RET NZ Return if not
28678 LD L,96 Byte 96 holds BOY WANDER's animatory state
28680 BIT 0,(HL) Is BOY WANDER midstride?
28682 RET NZ Return if so
28683 LD L,112 Return if there is already an uninterruptible subcommand routine address in bytes 111 and 112 of BOY WANDER's buffer (he's otherwise occupied)
28685 LD A,(HL)
28686 AND A
28687 RET NZ
28688 CALL 24993 A=random number
28691 RRCA Return half the time
28692 RET NC
28693 LD L,97 Byte 97 holds BOY WANDER's y-coordinate
28695 LD A,(HL) Pick this up in A
28696 CALL 26185 Is BOY WANDER on a staircase?
28699 RET NZ Return if so
28700 CALL 28220 Are there any teachers around who can see BOY WANDER?
28703 RET C Return if so
28704 LD A,(43618) Pick up the x-coordinate of BOY WANDER's pellet in A
28707 RLCA Is BOY WANDER's catapult pellet airborne at the moment?
28708 RET NC Return if so
28709 LD L,111
28711 JR 28665 Make BOY WANDER fire his catapult
Prev: 28665 Up: Map Next: 28713