| Routines

35770: Animate a crumbling floor tile in the current cavern

Used by the routine at 35515.
Input
HL | Address of the crumbling floor tile's location in the attribute buffer at 23552
35770 | LD C,L | Point BC at the bottom row of pixels of the crumbling floor tile in the screen buffer at 28672
35771 | LD A,H
35772 | ADD A,27
35774 | OR 7
35776 | LD B,A
35777 | DEC B | Collect the pixels from the row above in A
35778 | LD A,(BC)
35779 | INC B | Copy these pixels into the row below it
35780 | LD (BC),A
35781 | DEC B | Point BC at the next row of pixels up
35782 | LD A,B | Have we dealt with the bottom seven pixel rows of the crumbling floor tile yet?
35783 | AND 7
35785 | JR NZ,35777 | If not, jump back to deal with the next one up
35787 | XOR A | Clear the top row of pixels in the crumbling floor tile
35788 | LD (BC),A
35789 | LD A,B | Point BC at the bottom row of pixels in the crumbling floor tile
35790 | ADD A,7
35792 | LD B,A
35793 | LD A,(BC) | Pick up the bottom row of pixels in A
35794 | OR A | Is the bottom row clear?
35795 | RET NZ | Return if not
The bottom row of pixels in the crumbling floor tile is clear. Time to put a background tile in its place.
35796 | LD A,(32800) | Pick up the attribute byte of the background tile for the current cavern from 32800
35799 | INC H | Set HL to the address of the crumbling floor tile's location in the attribute buffer at 24064
35800 | INC H
35801 | LD (HL),A | Set the attribute at this location to that of the background tile
35802 | DEC H | Set HL back to the address of the crumbling floor tile's location in the attribute buffer at 23552
35803 | DEC H
35804 | RET |