Jet Set Willy: Routine at 8AEB

| Routines

8AEB: Cycle the INK and PAPER colours

Used by the routines at 87CA (while scrolling the instructions across the screen) and 89AD (while the game is paused).
8AEB | LD HL,$5800 | Point HL at the first byte of the attribute file
8AEE | LD A,(HL) | Pick up this byte
8AEF | AND $07 | Keep only bits 0-2 (the INK colour)
8AF1 | OUT ($FE),A | Set the border colour to match
Now we loop over every byte in the attribute file.
8AF3 | LD A,(HL) | Pick up an attribute file byte
8AF4 | ADD A,$03 | Cycle the INK colour forward by three
8AF6 | AND $07
8AF8 | LD D,A | Save the new INK colour in D
8AF9 | LD A,(HL) | Pick up the attribute file byte again
8AFA | ADD A,$18 | Cycle the PAPER colour forward by three (and turn off any BRIGHT colours)
8AFC | AND $B8
8AFE | OR D | Merge in the new INK colour
8AFF | LD (HL),A | Save the new attribute byte
8B00 | INC HL | Point HL at the next byte in the attribute file
8B01 | LD A,H | Have we reached the end of the attribute file yet?
8B02 | CP $5B
8B04 | JR NZ,$8AF3 | If not, jump back to modify the next byte
8B06 | RET |