Routines |
Prev: C618 | Up: Map | Next: C677 |
Used by the routine at C571.
|
||||
This routine uses bits in the room number byte at EAB7 to determine the room colours. Some colour combinations are avoided, but screens come in a variety of black, blue and red backgrounds.
The same algorithm to calculate screen colours apply to both 'standard' and tunnel rooms.
|
||||
C63B | CALL $E25B | Clear the playing area (pixels) | ||
C63E | LD A,($EAB7) | Get room number | ||
C641 | LD C,A | Temp store in C register | ||
C642 | AND $18 | Filter bits 3 and 4 of room number - these will determine the PAPER colour of the room | ||
C644 | CP $10 | Is bit 4 set (and bit 3 unset)? | ||
C646 | JR Z,$C657 | If so, room will have a red (PAPER 2) background | ||
C648 | CP $08 | Is bit 3 set (and bit 4 unset)? | ||
C64A | JR Z,$C664 | If so, room will have a blue (PAPER 1) background | ||
Room will have a black (PAPER 0) background
|
||||
C64C | LD A,C | Retrieve room number from C register | ||
C64D | AND $07 | Filter bottom 3 bits | ||
C64F | CP $02 | |||
C651 | JR NC,$C66F | If >= 2, colour is fine as red or brighter on black is OK, so jump to set it (INK 2-7) | ||
C653 | ADD A,$03 | INK 0 (black) and 1 (blue) are too dark for a black background so add 3 to make it a brighter colour (magenta/green) | ||
C655 | JR $C66F | |||
Room will have a red (PAPER 2) background
|
||||
C657 | LD B,A | Store (PAPER) colour in B register | ||
C658 | LD A,C | Retrieve room number from C register | ||
C659 | AND $03 | Filter bits 0 and 1 (values 0-3) | ||
C65B | JR Z,$C661 | Black (INK 0) is OK on red | ||
C65D | ADD A,$05 | Blue (INK 1), red (INK 2) or magenta (INK 3) don't look great on red, so add 5 to brighten to yellow (INK 6), white (INK 7) or black (INK 0) respectively. | ||
C65F | AND $07 | Filter ink colour (0-7) | ||
C661 | OR B | Combine with paper colour | ||
C662 | JR $C66F | |||
Room will have a blue (PAPER 1) background
|
||||
C664 | LD B,A | Store (PAPER) colour in B register | ||
C665 | LD A,C | Retrieve room number from C register | ||
C666 | AND $07 | Filter bits 0-2 (values 0-7) | ||
C668 | CP $03 | |||
C66A | JR NC,$C66E | If >= 3, colour is fine as magenta or brighter on blue is OK (INK 3 - 7) | ||
C66C | ADD A,$06 | For black (INK 0), blue (INK 1) and red (INK 2), add 6 to brighten to yellow (INK 6), white (INK 7) or black (INK 0). This allows black (INK 0) on blue (PAPER 1), but the reverse (INK 1, PAPER 0) is avoided at C64C. |
||
Set calculated room colours:
|
||||
C66E | OR B | Combine INK colour with PAPER colour | ||
C66F | OR $40 | Set BRIGHT bit | ||
C671 | LD ($EAA9),A | Store room colours | ||
C674 | CALL $E207 | Set screen colour for room |
Prev: C618 | Up: Map | Next: C677 |