Routines |
Prev: D8D4 | Up: Map | Next: D92A |
Used by the routine at GoldfishGame.
|
|||||
Set the attributes.
|
|||||
GoldfishGame_AnimateSand | D8E2 | LD A,$11 | Set PAPER: BLUE (01). | ||
D8E4 | RST $10 | ||||
D8E5 | LD A,$01 | ||||
D8E7 | RST $10 | ||||
D8E8 | LD HL,$DB22 | Write DB22 (Buffer_SandAnimation) to *CHARS. | |||
D8EB | LD ($5C36),HL | ||||
D8EE | LD A,$10 | Set INK: YELLOW (06). | |||
D8F0 | RST $10 | ||||
D8F1 | LD A,$06 | ||||
D8F3 | RST $10 | ||||
Set the co-ordinates of where we're going to PRINT AT.
|
|||||
D8F4 | LD B,$04 | Set up the screen buffer location 21/04 using CL_SET. | |||
D8F6 | LD C,$21 | ||||
D8F8 | CALL $0DD9 | ||||
Print the current sand UDGs to the screen buffer.
|
|||||
D8FB | LD A,$20 | A=20 (base sprite ID). | |||
PrintSand_Loop | D8FD | PUSH AF | Stash the current sand sprite ID on the stack. | ||
D8FE | CALL GoldfishGame_PrintColourUDG | Call GoldfishGame_PrintColourUDG. | |||
D901 | POP AF | Restore the current sand sprite ID from the stack. | |||
D902 | INC A | Move onto the next sand sprite ID. | |||
D903 | CP $40 | Keep looping back to PrintSand_Loop until the sand sprite ID is equal to 40. | |||
D905 | JR NZ,PrintSand_Loop | ||||
Now move all the UDGs one pixel to the right. The next time this routine is called, the sand will appear to have moved when it's printed to the screen.
|
|||||
D907 | LD DE,$DC22 | DE=Buffer_SandAnimation. | |||
D90A | LD B,$08 | B=08 (line counter; each sand UDG is 08 bytes). | |||
AnimateSandLine_Loop | D90C | PUSH BC | Stash the line counter and the sand UDG buffer pointer on the stack. | ||
D90D | PUSH DE | ||||
D90E | LD HL,$00F8 | HL=DE+00F8. | |||
D911 | ADD HL,DE | ||||
D912 | LD A,(HL) | A=*HL. | |||
D913 | RRA | Rotate A right one position. | |||
D914 | POP HL | Restore the sand buffer pointer from the stack. | |||
D915 | PUSH HL | But keep a copy of it (the sand buffer position) on the stack still. | |||
D916 | LD DE,$0008 | DE=0008. | |||
D919 | LD B,$20 | B=20 (UDG counter; the total number of sand UDGs in the row). | |||
D91B | PUSH AF | Stash AF on the stack. | |||
AnimateSandUDG_Loop | D91C | POP AF | Restore AF from the stack. | ||
D91D | RR (HL) | Rotate *HL right. | |||
D91F | PUSH AF | Stash AF on the stack. | |||
D920 | ADD HL,DE | HL+=DE. | |||
D921 | DJNZ AnimateSandUDG_Loop | Decrease counter by one and loop back to AnimateSandUDG_Loop until counter is zero. | |||
D923 | POP AF | Restore AF and DE from the stack. | |||
D924 | POP DE | ||||
D925 | INC DE | Increment DE by one. | |||
D926 | POP BC | Restore the line counter from the stack. | |||
D927 | DJNZ AnimateSandLine_Loop | Decrease the line counter by one and loop back to AnimateSandLine_Loop until all lines have been rotated. | |||
D929 | RET | Return. |
Prev: D8D4 | Up: Map | Next: D92A |