Routines |
Prev: 56529 | Up: Map | Next: 56658 |
Used by the routine at 62526.
|
||||
MoveTile_Up | 56540 | LD A,(59230) | Take *Tile_Vertical_Position and store it in A. Decrease it by one, which adjusts the value for the tile height, and write this value to *Tile_Vertical_Coordinate. | |
56543 | DEC A | |||
56544 | LD (59232),A | |||
56547 | LD A,(59233) | B=*Tile_SpacesToMove. | ||
56550 | LD B,A | |||
MoveTile_Up_Loop | 56551 | PUSH BC | Stash the row counter on the stack. | |
56552 | LD A,(59229) | A=*Tile_Horizontal_Position. | ||
56555 | DEC A | Decrease A by one. | ||
56556 | LD (59231),A | Write A to *Tile_Horizontal_Coordinate. | ||
56559 | LD B,4 | B=4. | ||
MoveTile_Up_0 | 56561 | PUSH BC | Stash the row (tile height) counter on the stack. | |
56562 | LD A,(59231) | B=*Tile_Horizontal_Coordinate. | ||
56565 | LD B,A | |||
56566 | LD A,(59232) | C=*Tile_Vertical_Coordinate. | ||
56569 | LD C,A | |||
56570 | CALL Calculate_ScreenBlockAddress | Call Calculate_ScreenBlockAddress. | ||
56573 | PUSH HL | Stash the destination screen buffer address on the stack. | ||
56574 | DEC B | Decrease B by one. | ||
56575 | CALL Calculate_ScreenBlockAddress | Call Calculate_ScreenBlockAddress. | ||
56578 | PUSH HL | DE=screen buffer address of the tile (using the stack). | ||
56579 | POP DE | |||
56580 | POP HL | Restore the destination screen buffer address from the stack. | ||
56581 | LD A,8 | A=8. | ||
56583 | LD BC,4 | BC=0004. | ||
56586 | PUSH HL | Stash HL, HL and DE on the stack. | ||
MoveTile_Up_1 | 56587 | PUSH HL | ||
56588 | PUSH DE | |||
56589 | LDIR | LDIR. | ||
56591 | DEC HL | Decrease HL by one. | ||
56592 | PUSH HL | Stash HL on the stack. | ||
56593 | LD (HL),C | Write C to *HL. | ||
56594 | POP DE | Restore DE from the stack. | ||
56595 | DEC DE | Decrease DE by one. | ||
56596 | LD BC,3 | BC=0003. | ||
56599 | LDDR | LDDR. | ||
56601 | POP DE | Restore DE and HL from the stack. | ||
56602 | POP HL | |||
56603 | INC D | Increment D by one. | ||
56604 | INC H | Increment H by one. | ||
56605 | LD BC,4 | BC=0004. | ||
56608 | DEC A | Decrease A by one. | ||
56609 | JP NZ,MoveTile_Up_1 | Jump to MoveTile_Up_1 if A is not zero. | ||
56612 | POP HL | Restore HL from the stack. | ||
56613 | CALL Calculate_AttributeAddress | Call Calculate_AttributeAddress. | ||
Move DE up one attribute row.
|
||||
56616 | LD HL,65504 | DE+=65504 (subtract 0032). | ||
56619 | ADD HL,DE | |||
56620 | EX DE,HL | |||
56621 | LD BC,4 | BC=0004. | ||
56624 | LDIR | LDIR. | ||
56626 | LD BC,3 | BC=0003. | ||
56629 | LD A,71 | A=INK: WHITE, PAPER: BLACK (BRIGHT) . | ||
56631 | DEC HL | Decrease HL by one. | ||
56632 | LD (HL),A | Write A to *HL. | ||
56633 | PUSH HL | Stash HL on the stack. | ||
56634 | POP DE | Restore DE from the stack. | ||
56635 | DEC DE | Decrease DE by one. | ||
56636 | LDDR | LDDR. | ||
56638 | LD HL,59231 | HL=Tile_Horizontal_Coordinate. | ||
56641 | INC (HL) | Increment *HL by one. | ||
56642 | POP BC | Restore BC from the stack. | ||
56643 | DJNZ MoveTile_Up_0 | Decrease counter by one and loop back to MoveTile_Up_0 until counter is zero. | ||
The tile has successfully moved one space!
|
||||
56645 | POP BC | Using the number of spaces left to move (from the stack) call Sound_TileMovement. | ||
56646 | PUSH BC | |||
56647 | CALL Sound_TileMovement | |||
56650 | LD HL,59229 | Decrease *Tile_Horizontal_Position by one. | ||
56653 | DEC (HL) | |||
56654 | POP BC | Restore the number of spaces left to move from the stack. | ||
56655 | DJNZ MoveTile_Up_Loop | Decrease the number of spaces counter by one and loop back to MoveTile_Up_Loop until the tile is in the destination space. | ||
56657 | RET | Return. |
Prev: 56529 | Up: Map | Next: 56658 |