Prev: 47908 Up: Map Next: 47964
47941: 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 47941 PUSH BC Stash the counters and the start of the row on the stack.
47942 PUSH HL
ColourRows_Loop 47943 LD A,(HL) Fetch the attribute.
47944 AND %00111000 Keep only bits 3-5 (the paper).
47946 JR NZ,ColourRows_Next Jump to ColourRows_Next if the paper is not black.
47948 LD (HL),D Colour the cell with the colour of the actor.
ColourRows_Next 47949 INC L Move on to the next column.
47950 DJNZ ColourRows_Loop Decrease the column counter by one and loop back to ColourRows_Loop until all of the columns have been coloured.
47952 POP HL Restore the start of the row from the stack.
47953 LD BC,32 BC=0032.
47956 AND A Reset the carry flag.
47957 SBC HL,BC Move up one row of attributes.
47959 POP BC Restore the counters from the stack.
47960 DEC C Decrease the row counter by one and loop back to ColourRows until all of the rows have been coloured.
47961 JR NZ,ColourRows
47963 RET Return.
View the equivalent code in;
Prev: 47908 Up: Map Next: 47964