Routines |
Prev: EBF5 | Up: Map | Next: EC5A |
|
||||
Colours in the green checkerboard attribute pattern. Note, it doesn't alter the top row at all - only the rows which will have content in them.
|
||||
Colourise_PreviewGrid | EC39 | LD B,$04 | Set a counter in B for 04 rows. | |
EC3B | LD DE,$5896 | DE=5896 (attribute buffer location). | ||
EC3E | LD HL,$ECAF | HL=AttributeData_PreviewGrid. | ||
PreviewGrid_RowCounter_Loop | EC41 | PUSH BC | Stash the row counter on the stack. | |
EC42 | LD B,$02 | Set a counter in B for 02 character blocks per square. | ||
PreviewGrid_BlockCounter_Loop | EC44 | PUSH BC | Stash the block counter and the attribute reference pointer on the stack. | |
EC45 | PUSH HL | |||
EC46 | LD BC,$000A | Copy 000A bytes from HL to DE. | ||
EC49 | LDIR | |||
EC4B | LD HL,$0016 | DE+=0016. | ||
EC4E | ADD HL,DE | |||
EC4F | EX DE,HL | |||
EC50 | POP HL | Restore the attribute reference pointer and the block counter from the stack. | ||
EC51 | POP BC | |||
EC52 | DJNZ PreviewGrid_BlockCounter_Loop | Decrease block counter by one and loop back to PreviewGrid_BlockCounter_Loop until the block counter is zero. | ||
EC54 | POP BC | Restore the row counter from the stack. | ||
This is how it becomes checkered, we move the pointer forward by two (each block is two character blocks wide) and then it can alternate between the two attribute values. Although we copy 0A bytes - the data is actually 10 bytes long, to cope with this reference movement.
|
||||
EC55 | INC HL | Increment the attribute reference pointer by two. | ||
EC56 | INC HL | |||
EC57 | DJNZ PreviewGrid_RowCounter_Loop | Decrease the row counter by one and loop back to PreviewGrid_RowCounter_Loop until all the rows have been coloured in. | ||
EC59 | RET | Return. |
Prev: EBF5 | Up: Map | Next: EC5A |