Routines |
Prev: 50712 | Up: Map | Next: 50807 |
Used by the routine at 50545.
|
||||
This routine uses bits in the room number byte at 60087 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.
|
||||
50747 | CALL 57947 | Clear the playing area (pixels) | ||
50750 | LD A,(60087) | Get room number | ||
50753 | LD C,A | Temp store in C register | ||
50754 | AND 24 | Filter bits 3 and 4 of room number - these will determine the PAPER colour of the room | ||
50756 | CP 16 | Is bit 4 set (and bit 3 unset)? | ||
50758 | JR Z,50775 | If so, room will have a red (PAPER 2) background | ||
50760 | CP 8 | Is bit 3 set (and bit 4 unset)? | ||
50762 | JR Z,50788 | If so, room will have a blue (PAPER 1) background | ||
Room will have a black (PAPER 0) background
|
||||
50764 | LD A,C | Retrieve room number from C register | ||
50765 | AND 7 | Filter bottom 3 bits | ||
50767 | CP 2 | |||
50769 | JR NC,50799 | If >= 2, colour is fine as red or brighter on black is OK, so jump to set it (INK 2-7) | ||
50771 | ADD A,3 | INK 0 (black) and 1 (blue) are too dark for a black background so add 3 to make it a brighter colour (magenta/green) | ||
50773 | JR 50799 | |||
Room will have a red (PAPER 2) background
|
||||
50775 | LD B,A | Store (PAPER) colour in B register | ||
50776 | LD A,C | Retrieve room number from C register | ||
50777 | AND 3 | Filter bits 0 and 1 (values 0-3) | ||
50779 | JR Z,50785 | Black (INK 0) is OK on red | ||
50781 | ADD A,5 | 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. | ||
50783 | AND 7 | Filter ink colour (0-7) | ||
50785 | OR B | Combine with paper colour | ||
50786 | JR 50799 | |||
Room will have a blue (PAPER 1) background
|
||||
50788 | LD B,A | Store (PAPER) colour in B register | ||
50789 | LD A,C | Retrieve room number from C register | ||
50790 | AND 7 | Filter bits 0-2 (values 0-7) | ||
50792 | CP 3 | |||
50794 | JR NC,50798 | If >= 3, colour is fine as magenta or brighter on blue is OK (INK 3 - 7) | ||
50796 | ADD A,6 | 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 50764. |
||
Set calculated room colours:
|
||||
50798 | OR B | Combine INK colour with PAPER colour | ||
50799 | OR 64 | Set BRIGHT bit | ||
50801 | LD (60073),A | Store room colours | ||
50804 | CALL 57863 | Set screen colour for room |
Prev: 50712 | Up: Map | Next: 50807 |