![]() |
Routines |
| Prev: 6EEE | Up: Map | Next: 6F2C |
|
Used by the routine at ChangePictureColour.
Changes colour C to colour L across the saved attribute buffer, first in the ink bits and then, with both colours moved up three bits, in the paper bits.
|
||||
| ChangeInkAndPaperColour | 6EEF | LD B,$07 | The ink mask is 07, keeping bits 3-7. | |
| 6EF1 | LD H,$F8 | |||
|
Replace matching bits.
|
||||
| 6EF3 | CALL ChangeMatchingColourBits | Call ChangeMatchingColourBits. | ||
|
Move both colours into the paper bits.
|
||||
| 6EF6 | LD A,C | Shift the source colour left by three. | ||
| 6EF7 | SLA A | |||
| 6EF9 | SLA A | |||
| 6EFB | SLA A | |||
| 6EFD | LD C,A | |||
| 6EFE | LD A,L | Shift the destination colour left by three. | ||
| 6EFF | SLA A | |||
| 6F01 | SLA A | |||
| 6F03 | SLA A | |||
| 6F05 | LD L,A | |||
| 6F06 | LD B,$38 | Prepare the paper mask. | ||
| 6F08 | LD H,$C7 | |||
|
Walks the attribute buffer. Wherever the bits selected by B equal C, those bits are replaced with L and the bits in H are kept.
|
||||
| ChangeMatchingColourBits | 6F0A | PUSH IX | Stash IX on the stack. | |
| 6F0C | LD IX,$6C7A | Point IX at AttributeBuffer. | ||
| 6F10 | LD DE,$0180 | Count the 0180 bytes of AttributeBuffer. | ||
|
Test this attribute byte.
|
||||
| ChangeMatchingColourBits_Byte | 6F13 | LD A,(IX+$00) | Jump to ChangeMatchingColourBits_Next if the selected bits are not C. | |
| 6F16 | AND B | |||
| 6F17 | CP C | |||
| 6F18 | JR NZ,ChangeMatchingColourBits_Next | |||
| 6F1A | LD A,(IX+$00) | Replace those bits with L. | ||
| 6F1D | AND H | |||
| 6F1E | OR L | |||
| 6F1F | LD (IX+$00),A | |||
|
Advance through the buffer.
|
||||
| ChangeMatchingColourBits_Next | 6F22 | INC IX | Advance the buffer pointer. | |
| 6F24 | DEC DE | Jump to ChangeMatchingColourBits_Byte until the buffer is done. | ||
| 6F25 | LD A,D | |||
| 6F26 | OR E | |||
| 6F27 | JR NZ,ChangeMatchingColourBits_Byte | |||
| 6F29 | POP IX | Restore IX from the stack. | ||
| 6F2B | RET | Return. | ||
| Prev: 6EEE | Up: Map | Next: 6F2C |