Routines |
Prev: 59481 | Up: Map | Next: 59548 |
|
||||
This routine is identical to Colourise_PreviewGrid in the main game code.
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 | 59515 | LD B,4 | Set a counter in B for 4 rows. | |
59517 | LD DE,22678 | DE=22678 (attribute buffer location). | ||
59520 | LD HL,59633 | HL=AttributeData_PreviewGrid. | ||
PreviewGrid_RowCounter_Loop | 59523 | PUSH BC | Stash the row counter on the stack. | |
59524 | LD B,2 | Set a counter in B for 2 character blocks per square. | ||
PreviewGrid_BlockCounter_Loop | 59526 | PUSH BC | Stash the block counter and the attribute reference pointer on the stack. | |
59527 | PUSH HL | |||
59528 | LD BC,10 | Copy 0010 bytes from HL to DE. | ||
59531 | LDIR | |||
59533 | LD HL,22 | DE+=0022. | ||
59536 | ADD HL,DE | |||
59537 | EX DE,HL | |||
59538 | POP HL | Restore the attribute reference pointer and the block counter from the stack. | ||
59539 | POP BC | |||
59540 | DJNZ PreviewGrid_BlockCounter_Loop | Decrease block counter by one and loop back to PreviewGrid_BlockCounter_Loop until the block counter is zero. | ||
59542 | 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 10 bytes - the data is actually 16 bytes long, to cope with this reference movement.
|
||||
59543 | INC HL | Increment the attribute reference pointer by two. | ||
59544 | INC HL | |||
59545 | 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. | ||
59547 | RET | Return. |
Prev: 59481 | Up: Map | Next: 59548 |