Prev: 39015 Up: Map Next: 39071
39048: 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 39048 PUSH BC Stash the counters on the stack.
39049 PUSH HL Stash the address on the stack.
39050 LD A,H Fetch the high byte of the address and compare it with 88 (the start of the attribute buffer).
39051 CP 88
39053 JR C,ColourRows_Next Jump to ColourRows_Next if the row is above the attribute buffer.
ColourRows_Loop 39055 LD (HL),D Write the attribute to the cell.
39056 INC L Move on to the next cell.
39057 DJNZ ColourRows_Loop Decrease the cell counter and loop back until the row is done.
ColourRows_Next 39059 POP HL Restore the address from the stack.
39060 LD BC,32 Set the size of a row of cells to 32.
39063 AND A Move up to the row above.
39064 SBC HL,BC
39066 POP BC Restore the counters from the stack.
39067 DEC C Decrease the row counter and loop back until all of the rows are done.
39068 JR NZ,ColourRows
39070 RET Return.
View the equivalent code in;
Prev: 39015 Up: Map Next: 39071