Prev: 26155 Up: Map Next: 26280
26243: Handler: Draw Worm Animation Frame
Used by the routine at Handler_Worms.
Draws an 8-pixel-row worm wiggle animation frame at the screen address in HL. Alternates between two graphic frames at 42947 and 42955 based on the animation toggle at ChickAnimationStates.
Input
HL Screen buffer address for the worm graphic
Handler_DrawWorm 26243 LD DE,42947 Default animation frame pointer: DE=42947 (worm frame 1).
26246 LD A,(24500) Rotate *ChickAnimationStates right through carry; if the carry flag is set, keep worm frame 1 and skip over the alternative frame (worm frame 2).
26249 RRCA
26250 LD (24500),A
26253 JR C,Handler_DrawWorm_Frame
26255 LD DE,42955 Else the carry flag is unset so set the alternative animation frame pointer: DE=42955 (worm frame 2).
This entry point is used by the routines at DrawNestChicks and AnimateSnapdragons.
Handler_DrawWorm_Frame 26258 LD B,8 Set a line counter in B (8 lines in a UDG).
26260 PUSH HL Stash the screen buffer address on the stack.
Handler_DrawWorm_FrameLoop 26261 LD A,(DE) Copy the UDG data to the screen buffer.
26262 LD (HL),A
26263 INC H Move down one pixel line in the screen buffer.
26264 INC DE Move to the next UDG graphic data byte.
26265 DJNZ Handler_DrawWorm_FrameLoop Decrease the line counter by one and loop back to Handler_DrawWorm_FrameLoop until all 8 lines of the UDG character have been drawn.
26267 POP HL Restore the screen buffer address from the stack.
26268 LD A,H Convert the screen buffer address to the corresponding attribute address and write 3 (magenta on black) as the worm colour attribute.
26269 RRCA
26270 RRCA
26271 RRCA
26272 AND %00000011
26274 OR %11111000
26276 LD H,A
26277 LD (HL),3
26279 RET Return.
Prev: 26155 Up: Map Next: 26280