Prev: 6FF9 Up: Map Next: 7029
7000: Make BOY WANDER fire his catapult now and then
The address of this continual subcommand routine is placed into bytes 0x7C and 0x7D of BOY WANDER's buffer by command lists 0x8C, 0x94, 0x9C, 0xA4, 0xAC, 0xB2, 0xC0, 0xC2 and 0xD8. It decides whether BOY WANDER should let rip with a pellet, and gets the catapult-firing action under way if so.
Input
H 0xA7 (BOY WANDER)
7000 LD L,$62 Byte 0x62 of BOY WANDER's buffer holds his x-coordinate
7002 LD A,(HL) Pick this up in A
7003 AND $03 Is BOY WANDER's x-coordinate divisible by 4?
7005 RET NZ Return if not
7006 LD L,$60 Byte 0x60 holds BOY WANDER's animatory state
7008 BIT 0,(HL) Is BOY WANDER midstride?
700A RET NZ Return if so
700B LD L,$70 Return if there is already an uninterruptible subcommand routine address in bytes 0x6F and 0x70 of BOY WANDER's buffer (he's otherwise occupied)
700D LD A,(HL)
700E AND A
700F RET NZ
7010 CALL $61A1 A=random number
7013 RRCA Return half the time
7014 RET NC
7015 LD L,$61 Byte 0x61 holds BOY WANDER's y-coordinate
7017 LD A,(HL) Pick this up in A
7018 CALL $6649 Is BOY WANDER on a staircase?
701B RET NZ Return if so
701C CALL $6E3C Are there any teachers around who can see BOY WANDER?
701F RET C Return if so
7020 LD A,($AA62) Pick up the x-coordinate of BOY WANDER's pellet in A
7023 RLCA Is BOY WANDER's catapult pellet airborne at the moment?
7024 RET NC Return if so
7025 LD L,$6F
7027 JR $6FF9 Make BOY WANDER fire his catapult
Prev: 6FF9 Up: Map Next: 7029