![]() |
Routines |
Prev: 55508 | Up: Map | Next: 55594 |
Used by the routine at GoldfishGame.
|
|||||
Set the attributes.
|
|||||
GoldfishGame_AnimateSand | 55522 | LD A,17 | Set PAPER: BLUE (1). | ||
55524 | RST 16 | ||||
55525 | LD A,1 | ||||
55527 | RST 16 | ||||
55528 | LD HL,56098 | Write 56098 (Buffer_SandAnimation) to *CHARS. | |||
55531 | LD (23606),HL | ||||
55534 | LD A,16 | Set INK: YELLOW (6). | |||
55536 | RST 16 | ||||
55537 | LD A,6 | ||||
55539 | RST 16 | ||||
Set the co-ordinates of where we're going to PRINT AT.
|
|||||
55540 | LD B,4 | Set up the screen buffer location 33/4 using CL_SET. | |||
55542 | LD C,33 | ||||
55544 | CALL 3545 | ||||
Print the current sand UDGs to the screen buffer.
|
|||||
55547 | LD A,32 | A=32 (base sprite ID). | |||
PrintSand_Loop | 55549 | PUSH AF | Stash the current sand sprite ID on the stack. | ||
55550 | CALL GoldfishGame_PrintColourUDG | Call GoldfishGame_PrintColourUDG. | |||
55553 | POP AF | Restore the current sand sprite ID from the stack. | |||
55554 | INC A | Move onto the next sand sprite ID. | |||
55555 | CP 64 | Keep looping back to PrintSand_Loop until the sand sprite ID is equal to 64. | |||
55557 | 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.
|
|||||
55559 | LD DE,56354 | DE=Buffer_SandAnimation. | |||
55562 | LD B,8 | B=8 (line counter; each sand UDG is 8 bytes). | |||
AnimateSandLine_Loop | 55564 | PUSH BC | Stash the line counter and the sand UDG buffer pointer on the stack. | ||
55565 | PUSH DE | ||||
55566 | LD HL,248 | HL=DE+0248. | |||
55569 | ADD HL,DE | ||||
55570 | LD A,(HL) | A=*HL. | |||
55571 | RRA | Rotate A right one position. | |||
55572 | POP HL | Restore the sand buffer pointer from the stack. | |||
55573 | PUSH HL | But keep a copy of it (the sand buffer position) on the stack still. | |||
55574 | LD DE,8 | DE=0008. | |||
55577 | LD B,32 | B=32 (UDG counter; the total number of sand UDGs in the row). | |||
55579 | PUSH AF | Stash AF on the stack. | |||
AnimateSandUDG_Loop | 55580 | POP AF | Restore AF from the stack. | ||
55581 | RR (HL) | Rotate *HL right. | |||
55583 | PUSH AF | Stash AF on the stack. | |||
55584 | ADD HL,DE | HL+=DE. | |||
55585 | DJNZ AnimateSandUDG_Loop | Decrease counter by one and loop back to AnimateSandUDG_Loop until counter is zero. | |||
55587 | POP AF | Restore AF and DE from the stack. | |||
55588 | POP DE | ||||
55589 | INC DE | Increment DE by one. | |||
55590 | POP BC | Restore the line counter from the stack. | |||
55591 | DJNZ AnimateSandLine_Loop | Decrease the line counter by one and loop back to AnimateSandLine_Loop until all lines have been rotated. | |||
55593 | RET | Return. |
Prev: 55508 | Up: Map | Next: 55594 |