Prev: 38705 Up: Map Next: 38825
38772: Ripple Attributes
Used by the routine at FallThroughTrapdoor.
Moves the colours of a set of 11 rings of the attribute buffer outwards. Each ring is a square with sides of 23 cells, starting from the bottom left of the screen (23264) and moving one cell up and one to the right for each ring, so that the sides are 2 cells shorter. All of the cells of a ring are given the colour of the cell diagonally inside the first one.
RippleAttributes 38772 LD BC,5899 BC=5899 (B is the length of the sides and C is the number of rings).
38775 LD HL,23264 HL=23264 (the start of the first ring).
38778 LD DE,32 DE=0032 (the size of a row).
RippleAttributes_Ring 38781 PUSH HL Stash HL on the stack.
38782 AND A Move up one row.
38783 SBC HL,DE
38785 INC L Move one cell to the right.
38786 LD A,(HL) Fetch the attribute of that cell.
38787 POP HL Restore HL from the stack.
38788 PUSH BC Stash the length on the stack.
Draw the bottom of the ring, from left to right.
RippleAttributes_Bottom 38789 LD (HL),A Write A to the attribute buffer.
38790 INC L Move one cell to the right.
38791 DJNZ RippleAttributes_Bottom Decrease the length by one and loop back to RippleAttributes_Bottom until it is zero.
38793 POP BC Restore the length from the stack.
38794 PUSH BC Stash it on the stack again.
Draw the right side of the ring, from bottom to top.
RippleAttributes_Right 38795 LD (HL),A Write A to the attribute buffer.
38796 AND A Move up one row.
38797 SBC HL,DE
38799 DJNZ RippleAttributes_Right Decrease the length by one and loop back to RippleAttributes_Right until it is zero.
38801 POP BC Restore the length from the stack.
38802 PUSH BC Stash it on the stack again.
Draw the top of the ring, from right to left.
RippleAttributes_Top 38803 LD (HL),A Write A to the attribute buffer.
38804 DEC L Move one cell to the left.
38805 DJNZ RippleAttributes_Top Decrease the length by one and loop back to RippleAttributes_Top until it is zero.
38807 POP BC Restore the length from the stack.
38808 PUSH BC Stash it on the stack again.
Draw the left side of the ring, from top to bottom.
RippleAttributes_Left 38809 LD (HL),A Write A to the attribute buffer.
38810 ADD HL,DE Move down one row.
38811 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.
38813 LD (HL),A Write A to the attribute buffer.
38814 AND A Move up one row.
38815 SBC HL,DE
38817 INC L Move one cell to the right.
38818 POP BC Restore the length from the stack.
38819 DEC B Make the sides two cells shorter.
38820 DEC B
38821 DEC C Decrease the number of rings by one and loop back to RippleAttributes_Ring until it is zero.
38822 JR NZ,RippleAttributes_Ring
38824 RET Return.
Prev: 38705 Up: Map Next: 38825