Prev: 8ABB Up: Map Next: 8BDD
8BBA: Animate a crumbling floor tile in the current cavern
Used by the routine at 8ABB.
Input
HL Address of the crumbling floor tile's location in the attribute buffer at 5C00
8BBA LD C,L Point BC at the bottom row of pixels of the crumbling floor tile in the screen buffer at 7000
8BBB LD A,H
8BBC ADD A,$1B
8BBE OR $07
8BC0 LD B,A
8BC1 DEC B Collect the pixels from the row above in A
8BC2 LD A,(BC)
8BC3 INC B Copy these pixels into the row below it
8BC4 LD (BC),A
8BC5 DEC B Point BC at the next row of pixels up
8BC6 LD A,B Have we dealt with the bottom seven pixel rows of the crumbling floor tile yet?
8BC7 AND $07
8BC9 JR NZ,$8BC1 If not, jump back to deal with the next one up
8BCB XOR A Clear the top row of pixels in the crumbling floor tile
8BCC LD (BC),A
8BCD LD A,B Point BC at the bottom row of pixels in the crumbling floor tile
8BCE ADD A,$07
8BD0 LD B,A
8BD1 LD A,(BC) Pick up the bottom row of pixels in A
8BD2 OR A Is the bottom row clear?
8BD3 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.
8BD4 LD A,($8020) Pick up the attribute byte of the background tile for the current cavern from 8020
8BD7 INC H Set HL to the address of the crumbling floor tile's location in the attribute buffer at 5E00
8BD8 INC H
8BD9 LD (HL),A Set the attribute at this location to that of the background tile
8BDA DEC H Set HL back to the address of the crumbling floor tile's location in the attribute buffer at 5C00
8BDB DEC H
8BDC RET
Prev: 8ABB Up: Map Next: 8BDD