| Routines

E236: Prepare buffer 0xD5 for use by a stinkbomb cloud

Used by the routines at 7140 and F862. Prepares buffer 0xD5 (normally used by BOY WANDER's catapult pellet) for use by a stinkbomb cloud. Returns to the main loop if the buffer is already in use by a stinkbomb cloud; otherwise returns to the caller with buffer 0xD5 ready to go.
E236 | LD HL,$D501 | Point HL at byte 0x01 of buffer 0xD5
E239 | LD A,(HL) | A=x-coordinate of the object that last used or is now using this buffer
E23A | CP $C0 | Is this buffer being used now?
E23C | JR NC,$E24A | Jump if not
E23E | DEC L | L=0x00
E23F | LD A,(HL) | A=animatory state of the object that is using this buffer
E240 | POP BC | Pop the return address from the stack into BC
E241 | AND $7F | Drop the 'direction' bit (bit 7) of the object's animatory state
E243 | CP $4F | 0x4F: Is this buffer being used by BOY WANDER's catapult pellet?
E245 | RET NZ | Return to the main loop if not
E246 | PUSH BC | Restore the return address (to the caller of this routine) to the stack
E247 | CALL $74CF | Terminate BOY WANDER's catapult pellet
E24A | LD H,$D2 | 0xD2=ERIC
E24C | RET |