Prev: 28398 Up: Map Next: 28460
28399: Change Colour In Ink And Paper
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 28399 LD B,7 The ink mask is 7, keeping bits 3-7.
28401 LD H,248
Replace matching bits.
28403 CALL ChangeMatchingColourBits Call ChangeMatchingColourBits.
Move both colours into the paper bits.
28406 LD A,C Shift the source colour left by three.
28407 SLA A
28409 SLA A
28411 SLA A
28413 LD C,A
28414 LD A,L Shift the destination colour left by three.
28415 SLA A
28417 SLA A
28419 SLA A
28421 LD L,A
28422 LD B,56 Prepare the paper mask.
28424 LD H,199
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 28426 PUSH IX Stash IX on the stack.
28428 LD IX,27770 Point IX at AttributeBuffer.
28432 LD DE,384 Count the 384 bytes of AttributeBuffer.
Test this attribute byte.
ChangeMatchingColourBits_Byte 28435 LD A,(IX+0) Jump to ChangeMatchingColourBits_Next if the selected bits are not C.
28438 AND B
28439 CP C
28440 JR NZ,ChangeMatchingColourBits_Next
28442 LD A,(IX+0) Replace those bits with L.
28445 AND H
28446 OR L
28447 LD (IX+0),A
Advance through the buffer.
ChangeMatchingColourBits_Next 28450 INC IX Advance the buffer pointer.
28452 DEC DE Jump to ChangeMatchingColourBits_Byte until the buffer is done.
28453 LD A,D
28454 OR E
28455 JR NZ,ChangeMatchingColourBits_Byte
28457 POP IX Restore IX from the stack.
28459 RET Return.
Prev: 28398 Up: Map Next: 28460