Prev: 659B Up: Map Next: 660D
65EA: Draw Chicks In The Nest
Used by the routine at Run_Game_Frame.
DrawNestChicks 65EA LD HL,$E08A HL=E08A (sprite buffer position for the first chick).
65ED LD B,$03 Set a chick counter in B for 03 chicks.
DrawNestChicks_Loop 65EF PUSH BC Stash the chick counter on the stack.
65F0 PUSH HL Stash the screen position on the stack.
65F1 LD HL,$A763 HL=Graphics_ChickFrame_01 (base address of the chick animation frames).
65F4 LD BC,$0008 BC=08 (bytes per frame).
Use the rotating bit pattern at ChickAnimationStates to select which animation frame to use for this chick. The pattern is rotated each time, so each chick picks up a different bit and animates independently.
65F7 LD A,($5FB4) Update *ChickAnimationStates by rotating the frame selection bits.
65FA RRCA
65FB LD ($5FB4),A
65FE JR C,DrawNestChicks_DrawFrame Jump to DrawNestChicks_DrawFrame if carry is set (use first frame at Graphics_ChickFrame_01).
6600 ADD HL,BC HL+=BC (use second frame at Graphics_ChickFrame_02).
DrawNestChicks_DrawFrame 6601 EX DE,HL Transfer the frame graphic address to DE.
6602 POP HL Restore the screen position from the stack.
6603 PUSH HL Keep a copy of the screen position on the stack.
6604 CALL Handler_DrawWorm_Frame Call Handler_DrawWorm_Frame to draw the chick frame to the screen.
6607 POP HL Restore the screen position and chick counter from the stack.
6608 POP BC
6609 INC L Move one character column to the right for the next chick.
660A DJNZ DrawNestChicks_Loop Decrease the chick counter by one and loop back to DrawNestChicks_Loop until all 03 chicks are drawn.
660C RET Return.
Prev: 659B Up: Map Next: 660D