Prev: 9867 Up: Map Next: 989F
9888: Colour Rows
Sets the attributes of C rows of B character cells, working upwards from the attribute address in HL. A row that is above the start of the attribute buffer is skipped.
Input
B Number of cells in each row
C Number of rows
D Attribute to write
HL Address in the attribute buffer of the bottom left cell
ColourRows 9888 PUSH BC Stash the counters on the stack.
9889 PUSH HL Stash the address on the stack.
988A LD A,H Fetch the high byte of the address and compare it with 58 (the start of the attribute buffer).
988B CP $58
988D JR C,ColourRows_Next Jump to ColourRows_Next if the row is above the attribute buffer.
ColourRows_Loop 988F LD (HL),D Write the attribute to the cell.
9890 INC L Move on to the next cell.
9891 DJNZ ColourRows_Loop Decrease the cell counter and loop back until the row is done.
ColourRows_Next 9893 POP HL Restore the address from the stack.
9894 LD BC,$0020 Set the size of a row of cells to 20.
9897 AND A Move up to the row above.
9898 SBC HL,BC
989A POP BC Restore the counters from the stack.
989B DEC C Decrease the row counter and loop back until all of the rows are done.
989C JR NZ,ColourRows
989E RET Return.
View the equivalent code in;
Prev: 9867 Up: Map Next: 989F