Prev: 90EC Up: Map Next: 9143
910A: Step an object's animation
The frame byte +$13: bits 0-3 the frame, bits 4-5 a count, bits 6-7 the count's reload. Each call counts bits 4-5 down; when they read 1 the frame steps on, from the last frame (low nibble of +$14) back to the first (high nibble of +$14), and the count is reloaded from bits 6-7. So a type's animation runs at one frame every one to three passes over any run of its frame list. (A count of 0 sets bits 4-7 all, and the animation goes on at the slowest rate.)
Input
IX The object
animate_object 910A LD A,(IX+$13) Count 1: step the frame
910D LD B,A
910E AND $30
9110 SUB $10
9112 LD D,A
9113 JR NZ,animate_object_1
9115 LD A,B The next frame, or the first after the last
9116 AND $0F
9118 INC A
9119 LD E,A
911A LD A,(IX+$14)
911D AND $0F
911F INC A
9120 CP E
9121 JR NZ,animate_object_0
9123 LD E,(IX+$14)
9126 SRL E
9128 SRL E
912A SRL E
912C SRL E
animate_object_0 912E LD A,B Reload the count from bits 6-7
912F AND $F0
9131 OR E
9132 LD B,A
9133 LD A,B
9134 AND $C0
9136 SRL A
9138 SRL A
913A LD D,A
animate_object_1 913B LD A,B Count down, or the reloaded count, into bits 4-5
913C AND $CF
913E OR D
913F LD (IX+$13),A
9142 RET
Prev: 90EC Up: Map Next: 9143