Routines |
Prev: DCD1 | Up: Map | Next: DD52 |
Used by the routine at F43E.
|
||||
MoveTile_Up | DCDC | LD A,($E75E) | 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. | |
DCDF | DEC A | |||
DCE0 | LD ($E760),A | |||
DCE3 | LD A,($E761) | B=*Tile_SpacesToMove. | ||
DCE6 | LD B,A | |||
MoveTile_Up_Loop | DCE7 | PUSH BC | Stash the row counter on the stack. | |
DCE8 | LD A,($E75D) | A=*Tile_Horizontal_Position. | ||
DCEB | DEC A | Decrease A by one. | ||
DCEC | LD ($E75F),A | Write A to *Tile_Horizontal_Coordinate. | ||
DCEF | LD B,$04 | B=04. | ||
MoveTile_Up_0 | DCF1 | PUSH BC | Stash the row (tile height) counter on the stack. | |
DCF2 | LD A,($E75F) | B=*Tile_Horizontal_Coordinate. | ||
DCF5 | LD B,A | |||
DCF6 | LD A,($E760) | C=*Tile_Vertical_Coordinate. | ||
DCF9 | LD C,A | |||
DCFA | CALL Calculate_ScreenBlockAddress | Call Calculate_ScreenBlockAddress. | ||
DCFD | PUSH HL | Stash the destination screen buffer address on the stack. | ||
DCFE | DEC B | Decrease B by one. | ||
DCFF | CALL Calculate_ScreenBlockAddress | Call Calculate_ScreenBlockAddress. | ||
DD02 | PUSH HL | DE=screen buffer address of the tile (using the stack). | ||
DD03 | POP DE | |||
DD04 | POP HL | Restore the destination screen buffer address from the stack. | ||
DD05 | LD A,$08 | A=08. | ||
DD07 | LD BC,$0004 | BC=0004. | ||
DD0A | PUSH HL | Stash HL, HL and DE on the stack. | ||
MoveTile_Up_1 | DD0B | PUSH HL | ||
DD0C | PUSH DE | |||
DD0D | LDIR | LDIR. | ||
DD0F | DEC HL | Decrease HL by one. | ||
DD10 | PUSH HL | Stash HL on the stack. | ||
DD11 | LD (HL),C | Write C to *HL. | ||
DD12 | POP DE | Restore DE from the stack. | ||
DD13 | DEC DE | Decrease DE by one. | ||
DD14 | LD BC,$0003 | BC=0003. | ||
DD17 | LDDR | LDDR. | ||
DD19 | POP DE | Restore DE and HL from the stack. | ||
DD1A | POP HL | |||
DD1B | INC D | Increment D by one. | ||
DD1C | INC H | Increment H by one. | ||
DD1D | LD BC,$0004 | BC=0004. | ||
DD20 | DEC A | Decrease A by one. | ||
DD21 | JP NZ,MoveTile_Up_1 | Jump to MoveTile_Up_1 if A is not zero. | ||
DD24 | POP HL | Restore HL from the stack. | ||
DD25 | CALL Calculate_AttributeAddress | Call Calculate_AttributeAddress. | ||
Move DE up one attribute row.
|
||||
DD28 | LD HL,$FFE0 | DE+=FFE0 (subtract 0020). | ||
DD2B | ADD HL,DE | |||
DD2C | EX DE,HL | |||
DD2D | LD BC,$0004 | BC=0004. | ||
DD30 | LDIR | LDIR. | ||
DD32 | LD BC,$0003 | BC=0003. | ||
DD35 | LD A,$47 | A=INK: WHITE, PAPER: BLACK (BRIGHT) . | ||
DD37 | DEC HL | Decrease HL by one. | ||
DD38 | LD (HL),A | Write A to *HL. | ||
DD39 | PUSH HL | Stash HL on the stack. | ||
DD3A | POP DE | Restore DE from the stack. | ||
DD3B | DEC DE | Decrease DE by one. | ||
DD3C | LDDR | LDDR. | ||
DD3E | LD HL,$E75F | HL=Tile_Horizontal_Coordinate. | ||
DD41 | INC (HL) | Increment *HL by one. | ||
DD42 | POP BC | Restore BC from the stack. | ||
DD43 | 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!
|
||||
DD45 | POP BC | Using the number of spaces left to move (from the stack) call Sound_TileMovement. | ||
DD46 | PUSH BC | |||
DD47 | CALL Sound_TileMovement | |||
DD4A | LD HL,$E75D | Decrease *Tile_Horizontal_Position by one. | ||
DD4D | DEC (HL) | |||
DD4E | POP BC | Restore the number of spaces left to move from the stack. | ||
DD4F | 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. | ||
DD51 | RET | Return. |
Prev: DCD1 | Up: Map | Next: DD52 |