Prev: D870 Up: Map Next: D8D4
D8A2: Goldfish Game: Animate Boats
Used by the routine at GoldfishGame.
boats-animation
GoldfishGame_AnimateBoats D8A2 LD A,($D93D) A=*GoldfishGame_BuoyancyCounter.
D8A5 AND %00000001 Keep only bit 0.
D8A7 RET Z Return if the result is zero.
D8A8 LD DE,$4000 DE=4000 (screen buffer location).
D8AB LD B,$08 B=08.
GoldfishGame_AnimateBoats_0 D8AD PUSH BC Stash BC and DE on the stack.
D8AE PUSH DE
D8AF LD B,$08 B=08.
GoldfishGame_AnimateBoats_1 D8B1 PUSH BC Stash BC and DE on the stack.
D8B2 PUSH DE
D8B3 LD A,(DE) A=*DE.
D8B4 RL A Rotate A left.
D8B6 PUSH AF Stash AF on the stack.
D8B7 LD HL,$001F HL=001F.
D8BA ADD HL,DE HL+=DE.
D8BB LD B,$20 B=20.
GoldfishGame_AnimateBoats_2 D8BD POP AF Restore AF from the stack.
D8BE RL (HL) Rotate *HL left.
D8C0 PUSH AF Stash AF on the stack.
D8C1 DEC HL Decrease HL by one.
D8C2 DJNZ GoldfishGame_AnimateBoats_2 Decrease counter by one and loop back to GoldfishGame_AnimateBoats_2 until counter is zero.
D8C4 POP AF Restore AF and DE from the stack.
D8C5 POP DE
D8C6 LD HL,$0020 HL=0020.
D8C9 ADD HL,DE HL+=DE.
D8CA EX DE,HL Exchange the DE and HL registers.
D8CB POP BC Restore BC from the stack.
D8CC DJNZ GoldfishGame_AnimateBoats_1 Decrease counter by one and loop back to GoldfishGame_AnimateBoats_1 until counter is zero.
D8CE POP DE Restore DE and BC from the stack.
D8CF POP BC
D8D0 INC D Increment D by one.
D8D1 DJNZ GoldfishGame_AnimateBoats_0 Decrease counter by one and loop back to GoldfishGame_AnimateBoats_0 until counter is zero.
D8D3 RET Return.
Prev: D870 Up: Map Next: D8D4