Prev: 6DC5 Up: Map Next: 6DEF
6DC6: Control the vertical flight of a catapult pellet
The address of this uninterruptible subcommand routine is placed into bytes 0x6F and 0x70 of a catapult pellet's buffer by the routine at 6D1C. It controls the pellet from the beginning of its vertical flight to the end, including any collision with a shield.
Input
H 0xAA (BOY WANDER's pellet) or 0xAB (ERIC's pellet)
6DC6 CALL $6214 Update the SRB for the pellet's current location
6DC9 LD B,A B=pellet's animatory state
6DCA LD A,D A=pellet's y-coordinate
6DCB CP $98 Has the pellet hit the ceiling of the top floor?
6DCD JP Z,$6D24 Terminate the pellet if so
6DD0 DEC D Up a level
6DD1 LD L,$71 Byte 0x71 of the pellet's buffer holds the distance left to travel
6DD3 DEC (HL) Has the pellet finished travelling?
6DD4 JP Z,$6D24 Jump if so
6DD7 LD A,B A=pellet's animatory state
6DD8 CALL $61B0 Update the pellet's location and update the SRB
This entry point is used by the routine at 6D1C to check whether a pellet fired from a staircase has hit a shield.
6DDB LD L,$61 Byte 0x61 holds the pellet's y-coordinate
6DDD LD D,(HL) Pick this up in D
6DDE INC D D=y-coordinate of the pellet's potential target
6DDF INC L Byte 0x62 holds the pellet's x-coordinate
6DE0 LD E,(HL) Pick this up in E
6DE1 INC E E=x-coordinate of the pellet's potential target
This entry point is used by the routine at F726 with DE holding the coordinates of ERIC's hand (and H=0xAC).
6DE2 SET 7,E E=128 + x-coordinate of the potential target
6DE4 PUSH HL
6DE5 CALL $6DEF Has the pellet (or ERIC's hand) hit a shield?
6DE8 POP HL
6DE9 RET NC Return if not
6DEA LD L,$71 If it was a pellet that hit the shield, this sets its remaining distance to travel to 1, so it will be terminated the next time this routine is called
6DEC LD (HL),$01
6DEE RET
Prev: 6DC5 Up: Map Next: 6DEF