Prev: BB24 Up: Map Next: BB5C
BB45: Colour Rows
Used by the routine at HandlerOrchid.
Colours C rows of B attribute cells, working upwards from the attribute address in HL. A cell is only changed if its paper is black.
Input
B The number of columns
C The number of rows
D The attribute value to write
HL The attribute buffer address of the bottom-left cell
ColourRows BB45 PUSH BC Stash the counters and the start of the row on the stack.
BB46 PUSH HL
ColourRows_Loop BB47 LD A,(HL) Fetch the attribute.
BB48 AND %00111000 Keep only bits 3-5 (the paper).
BB4A JR NZ,ColourRows_Next Jump to ColourRows_Next if the paper is not black.
BB4C LD (HL),D Colour the cell with the colour of the actor.
ColourRows_Next BB4D INC L Move on to the next column.
BB4E DJNZ ColourRows_Loop Decrease the column counter by one and loop back to ColourRows_Loop until all of the columns have been coloured.
BB50 POP HL Restore the start of the row from the stack.
BB51 LD BC,$0020 BC=0020.
BB54 AND A Reset the carry flag.
BB55 SBC HL,BC Move up one row of attributes.
BB57 POP BC Restore the counters from the stack.
BB58 DEC C Decrease the row counter by one and loop back to ColourRows until all of the rows have been coloured.
BB59 JR NZ,ColourRows
BB5B RET Return.
View the equivalent code in;
Prev: BB24 Up: Map Next: BB5C