Prev: 662B Up: Map Next: 66A8
6683: Handler: Draw Worm Animation Frame
Used by the routine at Handler_Worms.
Draws an 08-pixel-row worm wiggle animation frame at the screen address in HL. Alternates between two graphic frames at A7C3 and A7CB based on the animation toggle at ChickAnimationStates.
Input
HL Screen buffer address for the worm graphic
Handler_DrawWorm 6683 LD DE,$A7C3 Default animation frame pointer: DE=A7C3 (worm frame 1).
6686 LD A,($5FB4) Rotate *ChickAnimationStates right through carry; if the carry flag is set, keep worm frame 1 and skip over the alternative frame (worm frame 2).
6689 RRCA
668A LD ($5FB4),A
668D JR C,Handler_DrawWorm_Frame
668F LD DE,$A7CB Else the carry flag is unset so set the alternative animation frame pointer: DE=A7CB (worm frame 2).
This entry point is used by the routines at DrawNestChicks and AnimateSnapdragons.
Handler_DrawWorm_Frame 6692 LD B,$08 Set a line counter in B (08 lines in a UDG).
6694 PUSH HL Stash the screen buffer address on the stack.
Handler_DrawWorm_FrameLoop 6695 LD A,(DE) Copy the UDG data to the screen buffer.
6696 LD (HL),A
6697 INC H Move down one pixel line in the screen buffer.
6698 INC DE Move to the next UDG graphic data byte.
6699 DJNZ Handler_DrawWorm_FrameLoop Decrease the line counter by one and loop back to Handler_DrawWorm_FrameLoop until all 08 lines of the UDG character have been drawn.
669B POP HL Restore the screen buffer address from the stack.
669C LD A,H Convert the screen buffer address to the corresponding attribute address and write 03 (magenta on black) as the worm colour attribute.
669D RRCA
669E RRCA
669F RRCA
66A0 AND %00000011
66A2 OR %11111000
66A4 LD H,A
66A5 LD (HL),$03
66A7 RET Return.
Prev: 662B Up: Map Next: 66A8