| ← CBCC | Map | CBFE → |
CBDC: Advance an object's animation
|
Advances the object's animation by one frame on every other call. It does not wrap the animation frame, so the caller resets it at the animation's length.
|
|||||||||||
|
|||||||||||
| advance_anim | CBDC | INC (IY+$0E) | Act only on every other call: tick the animation timer and return until it comes round. | ||||||||
| CBDF | LD A,(IY+$0E) | ||||||||||
| CBE2 | CP $02 | ||||||||||
| CBE4 | RET NZ | ||||||||||
| CBE5 | XOR A | Reset the animation timer to 0 for the next pair of calls. | |||||||||
| CBE6 | LD (IY+$0E),A | ||||||||||
| CBE9 | LD A,(IY+$0B) | Index the frame table by the animation frame, two bytes per entry. | |||||||||
| CBEC | ADD A,A | ||||||||||
| CBED | LD E,A | ||||||||||
| CBEE | LD D,$00 | ||||||||||
| CBF0 | ADD HL,DE | ||||||||||
| CBF1 | LD E,(HL) | Read that frame's sprite-data pointer. | |||||||||
| CBF2 | INC HL | ||||||||||
| CBF3 | LD D,(HL) | ||||||||||
| CBF4 | LD (IX+$06),E | Store it into the sprite record's pointer so the next draw shows this frame. | |||||||||
| CBF7 | LD (IX+$07),D | ||||||||||
| CBFA | INC (IY+$0B) | Step to the next frame. | |||||||||
| CBFD | RET | ||||||||||
| ← CBCC | Map | CBFE → |
