Difference between revisions of "Physical colour numbers"

From BeebWiki
Jump to: navigation, search
m (Tweek to introduction.)
m (Had two 'B's !)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
command, and used in the COLOUR and GCOL commands on platforms without a
 
command, and used in the COLOUR and GCOL commands on platforms without a
 
palette. The colour number is a bitmap of the colour to select. When
 
palette. The colour number is a bitmap of the colour to select. When
implementing an operating system interface on other platforms this mapping
+
implementing a VDU driver to interface with other platforms this mapping
 
must be adhered to.
 
must be adhered to.
  
 
===Colour bitmap===
 
===Colour bitmap===
 +
<div class="mw-widebody">
 
     7  6  5  4  3  2  1  0
 
     7  6  5  4  3  2  1  0
 
   +---+---+---+---+---+---+---+---+
 
   +---+---+---+---+---+---+---+---+
   | L | B | E | F | I | B | G | R |
+
   | L | D | E | F | I | B | G | R |
 
   +---+---+---+---+---+---+---+---+
 
   +---+---+---+---+---+---+---+---+
 
     |  |  |  |  |  |  |  |
 
     |  |  |  |  |  |  |  |
Line 40: Line 41:
 
   The Commodore implements:
 
   The Commodore implements:
 
   l b x f i b g r - colour
 
   l b x f i b g r - colour
     |   | +-------- bright
+
     |     +-------- bright
    |  +---------- flash
 
 
     +-------------- border
 
     +-------------- border
 
    
 
    
Line 55: Line 55:
 
     | +------------ underline
 
     | +------------ underline
 
     +-------------- inverse
 
     +-------------- inverse
 
+
</div>
 
The BBC uses b3=flash, whereas all platforms other than the BBC uses
 
The BBC uses b3=flash, whereas all platforms other than the BBC uses
 
b4=flash. For visual compatibility, programs could use 0-7 for non-flashing
 
b4=flash. For visual compatibility, programs could use 0-7 for non-flashing
Line 65: Line 65:
  
 
===Electron/BBC/Master/etc===
 
===Electron/BBC/Master/etc===
 +
<div class="mw-widebody">
 
   0+n  &00+n - foreground colour
 
   0+n  &00+n - foreground colour
 
  128+n  &80+n - background colour
 
  128+n  &80+n - background colour
Line 78: Line 79:
 
   6 &06  134 &86  Cyan            14 &0E  142 &8E  Flashing Cyan
 
   6 &06  134 &86  Cyan            14 &0E  142 &8E  Flashing Cyan
 
   7 &07  135 &87  White            15 &0F  143 &8F  Flashing White
 
   7 &07  135 &87  White            15 &0F  143 &8F  Flashing White
 
+
</div>
 
===ZX Spectrum===
 
===ZX Spectrum===
 +
<div class="mw-widebody">
 
   0+n  &00+n  %000FIBGR - foreground colour, bright and flash
 
   0+n  &00+n  %000FIBGR - foreground colour, bright and flash
 
   32+n  &20+n  %001xxBGR - foreground colour, without changing flash and bright
 
   32+n  &20+n  %001xxBGR - foreground colour, without changing flash and bright
Line 118: Line 120:
 
   64 &40                    Bright off      96 &60          Flash off
 
   64 &40                    Bright off      96 &60          Flash off
 
   72 &48                    Bright on      112 &70          Flash on
 
   72 &48                    Bright on      112 &70          Flash on
 
+
</div>
 
===Commodore===
 
===Commodore===
 +
<div class="mw-widebody">
 
   0+n  &00+n - foreground colour
 
   0+n  &00+n - foreground colour
 
  128+n  &80+n - background colour
 
  128+n  &80+n - background colour
Line 125: Line 128:
 
    
 
    
 
   Fore    Back                              Fore    Back
 
   Fore    Back                              Fore    Back
   ground  ground  Border  Colour          ground  ground  Colour
+
   ground  ground  Border  Colour          ground  ground   Border   Colour
   0 &00  128 &80  192 &C0  Black           16 &10 144 &90 Flashing Black
+
   0 &00  128 &80  192 &C0  Black             8 &08  136 &88 200 &C8 Dark Grey   
   1 &01  129 &81  193 &C1  Red             17 &11 145 &91 Flashing Red
+
   1 &01  129 &81  193 &C1  Red/Brown        9 &09  137 &89 201 &C9 Bright Red  
   2 &02  130 &82  194 &C2  Green            18 &12 146 &92 Flashing Green
+
   2 &02  130 &82  194 &C2  Green            10 &0A  138 &8A 202 &CA Bright Green
   3 &03  131 &83  195 &C3  Yellow           19 &13 147 &93 Flashing Yellow
+
   3 &03  131 &83  195 &C3  Yellow/Orange    11 &0B  139 &8B 203 &CB Bright Yellow  
   4 &04  132 &84  196 &C4  Blue            20 &14 148 &94 Flashing Blue
+
   4 &04  132 &84  196 &C4  Blue            12 &0C  140 &8C 204 &CC Bright Blue  
   5 &05  133 &85  197 &C5  Magenta         21 &15 149 &95 Flashing Magenta
+
   5 &05  133 &85  197 &C5  Magenta/Purple  13 &0D  141 &8D 205 &CD Bright Magenta
   6 &06  134 &86  198 &C6  Cyan            22 &16 150 &96 Flashing Cyan
+
   6 &06  134 &86  198 &C6  Cyan            14 &0E  142 &8E 206 &CE Light Grey   
   7 &07  135 &87  199 &C7  White            23 &17  151 &97  Flashing White
+
   7 &07  135 &87  199 &C7  Light Grey       15 &0F  143 &8F  207 &CF  White       
  8 &08  136 &88  200 &C8  Orange          24 &18  152 &98  Flashing Orange
+
</div>
  9 &09  137 &89  201 &C9  Bright Red       25 &19  153 &99  Flashing Bright Red
 
  10 &0A  138 &8A  202 &CA  Bright Green    26 &1A  154 &9A  Flashing Bright Green
 
  11 &0B  139 &8B  203 &CB  Bright Grey      27 &1B  155 &9B  Flashing Bright Grey
 
  12 &0C  140 &8C  204 &CC  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 
  13 &0D  141 &8D  205 &CD  Grey            29 &1D  157 &9D  Flashing Grey
 
  14 &0E  142 &8E  206 &CE  Dark Grey        30 &1E  158 &9E  Flashing Dark Grey
 
  15 &0F  143 &8F  207 &CF  Brown            31 &1F  159 &9F  Flashing Brown
 
 
 
 
===DOS/Windows===
 
===DOS/Windows===
 +
<div class="mw-widebody">
 
   0+n  &00+n - foreground colour
 
   0+n  &00+n - foreground colour
 
  128+n  &80+n - background colour
 
  128+n  &80+n - background colour
Line 165: Line 161:
 
   14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 
   14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 
   15 &0F  143 &8F  Bright White    31 &1F  159 &9F  Flashing Bright White
 
   15 &0F  143 &8F  Bright White    31 &1F  159 &9F  Flashing Bright White
 
+
</div>
 
===ANSI Terminal===
 
===ANSI Terminal===
 +
<div class="mw-widebody">
 
   0+n  &00+n - foreground colour
 
   0+n  &00+n - foreground colour
 
  128+n  &80+n - background colour
 
  128+n  &80+n - background colour
Line 191: Line 188:
 
   32+n  &20+n      Underlined text
 
   32+n  &20+n      Underlined text
 
   64+n  &40+n      Inverse text
 
   64+n  &40+n      Inverse text
 +
</div>
 +
 +
==See also==
 +
* [http://mdfs.net/Info/Comp/BBC/Display/Colours/Physical.htm Physical colour numbers]
 +
* [http://mdfs.net/Software/BBCBasic/Porting/VDUSpecs BBC BASIC Host VDU Interface Specification]
  
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 23:06, 16 June 2016 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 23:06, 16 June 2016 (UTC)

Latest revision as of 21:11, 17 July 2021

Physical colour numbers are used as the short physical colour in the VDU 19 command, and used in the COLOUR and GCOL commands on platforms without a palette. The colour number is a bitmap of the colour to select. When implementing a VDU driver to interface with other platforms this mapping must be adhered to.

Colour bitmap

   7   6   5   4   3   2   1   0
 +---+---+---+---+---+---+---+---+
 | L | D | E | F | I | B | G | R |
 +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |
   |   |   |   |   |   |   |   +---Red
   |   |   |   |   |   |   +-------Green
   |   |   |   |   |   +-----------Blue
   |   |   |   |   +---------------Intense
   |   |   |   +-------------------Flash
   |   |   +-----------------------Extension
   |   +---------------------------Border
   +-------------------------------0=Foreground, 1=Background
 
 This gives:
  0 0 e f i b g r - &00+n - foreground colour
  0 1 e f i b g r - &40+n - extension
  1 0 e f i b g r - &80+n - background colour
  1 1 e f i b g r - &C0+n - border colour
 
 The BBC implements:
  l x x x f b g r - colour
          +-------- flash
 
 The ZX Spectrum implements:
  l b e f i b g r - colour
    | | | +-------- bright
    | | +---------- flash
    | +------------ change only flash/bright
    +-------------- border
 
 The Commodore implements:
  l b x f i b g r - colour
    |     +-------- bright
    +-------------- border
 
 DOS/Windows implements:
  l x x f i b g r - colour
        | +-------- bright
        +---------- flash
 
 ANSI terminal implements:
  l b e f i b g r - colour
    | | | +-------- bright
    | | +---------- flash
    | +------------ underline
    +-------------- inverse

The BBC uses b3=flash, whereas all platforms other than the BBC uses b4=flash. For visual compatibility, programs could use 0-7 for non-flashing colours and 24-31 for flashing colours. On the BBC these will be flashing colours, on other platforms these will be bright flashing colours where supported.

Implementation details

Electron/BBC/Master/etc

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black             8 &08  136 &88  Flashing Black
  1 &01  129 &81  Red               9 &09  137 &89  Flashing Red
  2 &02  130 &82  Green            10 &0A  138 &8A  Flashing Green
  3 &03  131 &83  Yellow           11 &0B  139 &8B  Flashing Yellow
  4 &04  132 &84  Blue             12 &0C  140 &8C  Flashing Blue
  5 &05  133 &85  Magenta          13 &0D  141 &8D  Flashing Magenta
  6 &06  134 &86  Cyan             14 &0E  142 &8E  Flashing Cyan
  7 &07  135 &87  White            15 &0F  143 &8F  Flashing White

ZX Spectrum

  0+n  &00+n  %000FIBGR - foreground colour, bright and flash
 32+n  &20+n  %001xxBGR - foreground colour, without changing flash and bright
 64+n  &40+n  %010xIxxx - bright without changing current colour
 96+n  &60+n  %011Fxxxx - flash without changing current colour
128+n  &80+n  %100FIBGR - background colour, bright and flash
160+n  &A0+n  %101xxBGR - background colour, without changing flash and bright
192+n  &C0+n  %11xxxBGR - border colour
 
  Fore    Back                               Fore    Back
 ground  ground   Border   Colour           ground  ground   Colour
  0 &00  128 &80  192 &C0  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  193 &C1  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  194 &C2  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  195 &C3  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  196 &C4  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  197 &C5  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  198 &C6  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  199 &C7  White            23 &17  151 &97  Flashing White
  8 &08  136 &88           Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89           Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A           Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B           Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C           Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D           Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E           Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F           Bright White     31 &1F  159 &9F  Flashing Bright White
 
 32 &20  160 &A0           Black, without changing flash/bright
 33 &21  161 &A1           Red, without changing flash/bright
 34 &22  162 &A2           Green, without changing flash/bright
 35 &23  163 &A3           Yellow, without changing flash/bright
 36 &24  164 &A4           Blue, without changing flash/bright
 37 &25  165 &A5           Magenta, without changing flash/bright
 38 &26  166 &A6           Cyan, without changing flash/bright
 39 &27  167 &A7           White, without changing flash/bright
 
 64 &40                    Bright off       96 &60           Flash off
 72 &48                    Bright on       112 &70           Flash on

Commodore

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
192+n  &C0+n - border colour
 
  Fore    Back                               Fore    Back
 ground  ground   Border   Colour           ground  ground   Border   Colour
  0 &00  128 &80  192 &C0  Black             8 &08  136 &88  200 &C8  Dark Grey     
  1 &01  129 &81  193 &C1  Red/Brown         9 &09  137 &89  201 &C9  Bright Red    
  2 &02  130 &82  194 &C2  Green            10 &0A  138 &8A  202 &CA  Bright Green  
  3 &03  131 &83  195 &C3  Yellow/Orange    11 &0B  139 &8B  203 &CB  Bright Yellow 
  4 &04  132 &84  196 &C4  Blue             12 &0C  140 &8C  204 &CC  Bright Blue   
  5 &05  133 &85  197 &C5  Magenta/Purple   13 &0D  141 &8D  205 &CD  Bright Magenta
  6 &06  134 &86  198 &C6  Cyan             14 &0E  142 &8E  206 &CE  Light Grey    
  7 &07  135 &87  199 &C7  Light Grey       15 &0F  143 &8F  207 &CF  White         

DOS/Windows

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  White            23 &17  151 &97  Flashing White
  8 &08  136 &88  Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89  Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A  Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B  Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D  Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F  Bright White     31 &1F  159 &9F  Flashing Bright White

ANSI Terminal

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  White            23 &17  151 &97  Flashing White
  8 &08  136 &88  Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89  Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A  Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B  Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D  Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F  Bright White     31 &1F  159 &9F  Flashing Bright White
 
 32+n  &20+n      Underlined text
 64+n  &40+n      Inverse text

See also

Jgharston (talk) 23:06, 16 June 2016 (UTC)