Prev: 9731 Up: Map Next: 97A9
9774: Ripple Attributes
Used by the routine at FallThroughTrapdoor.
Moves the colours of a set of 0B rings of the attribute buffer outwards. Each ring is a square with sides of 17 cells, starting from the bottom left of the screen (5AE0) and moving one cell up and one to the right for each ring, so that the sides are 02 cells shorter. All of the cells of a ring are given the colour of the cell diagonally inside the first one.
RippleAttributes 9774 LD BC,$170B BC=170B (B is the length of the sides and C is the number of rings).
9777 LD HL,$5AE0 HL=5AE0 (the start of the first ring).
977A LD DE,$0020 DE=0020 (the size of a row).
RippleAttributes_Ring 977D PUSH HL Stash HL on the stack.
977E AND A Move up one row.
977F SBC HL,DE
9781 INC L Move one cell to the right.
9782 LD A,(HL) Fetch the attribute of that cell.
9783 POP HL Restore HL from the stack.
9784 PUSH BC Stash the length on the stack.
Draw the bottom of the ring, from left to right.
RippleAttributes_Bottom 9785 LD (HL),A Write A to the attribute buffer.
9786 INC L Move one cell to the right.
9787 DJNZ RippleAttributes_Bottom Decrease the length by one and loop back to RippleAttributes_Bottom until it is zero.
9789 POP BC Restore the length from the stack.
978A PUSH BC Stash it on the stack again.
Draw the right side of the ring, from bottom to top.
RippleAttributes_Right 978B LD (HL),A Write A to the attribute buffer.
978C AND A Move up one row.
978D SBC HL,DE
978F DJNZ RippleAttributes_Right Decrease the length by one and loop back to RippleAttributes_Right until it is zero.
9791 POP BC Restore the length from the stack.
9792 PUSH BC Stash it on the stack again.
Draw the top of the ring, from right to left.
RippleAttributes_Top 9793 LD (HL),A Write A to the attribute buffer.
9794 DEC L Move one cell to the left.
9795 DJNZ RippleAttributes_Top Decrease the length by one and loop back to RippleAttributes_Top until it is zero.
9797 POP BC Restore the length from the stack.
9798 PUSH BC Stash it on the stack again.
Draw the left side of the ring, from top to bottom.
RippleAttributes_Left 9799 LD (HL),A Write A to the attribute buffer.
979A ADD HL,DE Move down one row.
979B DJNZ RippleAttributes_Left Decrease the length by one and loop back to RippleAttributes_Left until it is zero.
Move on to the next ring, which is inside this one.
979D LD (HL),A Write A to the attribute buffer.
979E AND A Move up one row.
979F SBC HL,DE
97A1 INC L Move one cell to the right.
97A2 POP BC Restore the length from the stack.
97A3 DEC B Make the sides two cells shorter.
97A4 DEC B
97A5 DEC C Decrease the number of rings by one and loop back to RippleAttributes_Ring until it is zero.
97A6 JR NZ,RippleAttributes_Ring
97A8 RET Return.
Prev: 9731 Up: Map Next: 97A9