Jet Set Willy: Routine at 35563

| Routines

35563: Cycle the INK and PAPER colours

Used by the routines at 34762 (while scrolling the instructions across the screen) and 35245 (while the game is paused).
35563 | LD HL,22528 | Point HL at the first byte of the attribute file
35566 | LD A,(HL) | Pick up this byte
35567 | AND 7 | Keep only bits 0-2 (the INK colour)
35569 | OUT (254),A | Set the border colour to match
Now we loop over every byte in the attribute file.
35571 | LD A,(HL) | Pick up an attribute file byte
35572 | ADD A,3 | Cycle the INK colour forward by three
35574 | AND 7
35576 | LD D,A | Save the new INK colour in D
35577 | LD A,(HL) | Pick up the attribute file byte again
35578 | ADD A,24 | Cycle the PAPER colour forward by three (and turn off any BRIGHT colours)
35580 | AND 184
35582 | OR D | Merge in the new INK colour
35583 | LD (HL),A | Save the new attribute byte
35584 | INC HL | Point HL at the next byte in the attribute file
35585 | LD A,H | Have we reached the end of the attribute file yet?
35586 | CP 91
35588 | JR NZ,35571 | If not, jump back to modify the next byte
35590 | RET |