Prev: 55408 Up: Map Next: 55508
55458: Goldfish Game: Animate Boats
Used by the routine at GoldfishGame.
boats-animation
Every other frame, scroll the on-screen boats one pixel left.
GoldfishGame_AnimateBoats 55458 LD A,(55613) A=*GoldfishGame_BuoyancyCounter.
55461 AND %00000001 Keep only bit 0.
55463 RET Z Return if this is a skipped frame.
Walk the top third of the display: eight pixel-row groups, then eight scanlines in each group.
55464 LD DE,16384 DE=16384 (top of the screen).
55467 LD B,8 B=8 (pixel-row groups).
GoldfishGame_AnimateBoats_BoatLoop 55469 PUSH BC Stash the group counter and the scanline pointer on the stack.
55470 PUSH DE
55471 LD B,8 B=8 (scanlines in this group).
GoldfishGame_AnimateBoats_CopyLoop 55473 PUSH BC Stash the scanline counter and pointer on the stack.
55474 PUSH DE
55475 LD A,(DE) Seed the carry with the leftmost pixel of this scanline.
55476 RL A
55478 PUSH AF Point HL at the rightmost byte of the scanline.
55479 LD HL,31
55482 ADD HL,DE
55483 LD B,32 B=32 (bytes in one scanline).
GoldfishGame_AnimateBoats_ByteLoop 55485 POP AF Rotate this screen byte left through the carry.
55486 RL (HL)
55488 PUSH AF
55489 DEC HL Step left one byte and loop back to GoldfishGame_AnimateBoats_ByteLoop until the whole scanline has scrolled.
55490 DJNZ GoldfishGame_AnimateBoats_ByteLoop
55492 POP AF Restore the carry and the scanline pointer from the stack.
55493 POP DE
55494 LD HL,32 Move DE on to the next scanline in this character row.
55497 ADD HL,DE
55498 EX DE,HL
55499 POP BC Restore the scanline counter from the stack.
55500 DJNZ GoldfishGame_AnimateBoats_CopyLoop Decrease the scanline counter and loop back to GoldfishGame_AnimateBoats_CopyLoop until all 8 scanlines are done.
55502 POP DE Restore the scanline pointer and group counter from the stack.
55503 POP BC
55504 INC D Move to the next pixel-row group and loop back to GoldfishGame_AnimateBoats_BoatLoop until all 8 groups are done.
55505 DJNZ GoldfishGame_AnimateBoats_BoatLoop
55507 RET Return.
Prev: 55408 Up: Map Next: 55508