┌────────────────────────────────────────────────────┐
│            SCREEN COLOURS AND ATTRIBUTES           │
└────────────────────────────────────────────────────┘

The Monochrome and Colour  display boards on IBM-PC/XT
and compatible computers support an 80-column, 25-line
screen image,  thus allowing 80 * 25 = 2000 characters
to be displayed at the same time. The screen is memory
mapped to video RAM which starts at paragraph B000 Hex
in mono systems and B800 Hex in colour machines.  Each
location having an even-numbered address, contains the
ASCII  value of  the character  at  the  corresponding
screen position, and each odd-numbered location has an
ATTRIBUTE  byte,  which  determines the way  that  the
adjacent character is displayed.  Thus a standard text
screen takes up 4000 bytes of video memory.

In  mono systems, the characters displayed may  have a
number of attributes, apart from the normal text mode.
Depending  on the  attribute byte  setting, characters
may appear in high-intensity,  in inverse-video, blink
or underlined. The ASSEMBLY.LIB Library module and its
associated  definition  file,  ASSEMBLY.FUN,  provides
several routines which allow  your Q-BASIC programs to
write  text directly to the display with an  attribute
which you supply.  The following  is an explanation of
how to determine the best  attribute for your specific
application.

The appearance of the character is actually controlled
by the individual bit settings of its' attribute byte.
These bits perform the following functions :
        Blink         Intensity
             Background       Foreground
        ┌───┬───┬───┬───┬───┬───┬───┬───┐
        │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
        └───┴───┴───┴───┴───┴───┴───┴───┘
          │               │
          │               └─ 0  Normal intensity
          │                  1  High intensity
          │

          0  The character does not blink
          1  The character blinks

With one exception, the two groups of three bits which
represent the foreground and background characteristic
should be either set or reset to give the following :

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ =   0 The character
└───┴───┴───┴───┴───┴───┴───┴───┘       is invisible.

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 0 │ 0 │ 0 │ 0 │ 1 │ 1 │ 1 │ =   7 White on black
└───┴───┴───┴───┴───┴───┴───┴───┘       (normal video)

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 1 │ =   1 Normal video
└───┴───┴───┴───┴───┴───┴───┴───┘       (underlined)

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 1 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ =  70 Black on white
└───┴───┴───┴───┴───┴───┴───┴───┘      (inverse video)

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 1 │ 1 │ 1 │ 0 │ 1 │ 1 │ 1 │ = 119 White on white
└───┴───┴───┴───┴───┴───┴───┴───┘       (filled block)


The decimal number to the right of the bit box, is the
decimal number you should supply to Q-BASIC  functions
to set the attribute you require.

To make the character blink add 128 to attribute given
and to display it in intense video add 8.

These added  values set the blink and  intensity bits,
respectively.


┌────────────────────────────────────────────────────┐
│                     COLOURS                        │
└────────────────────────────────────────────────────┘

In colour systems,  the procedure  is exactly the same
except that the two groups  of bits  which control the
foreground  and  background  characteristics,  can  be
individually set to determine the display colours. The
three bits of each group produce eight different color
combinations  and setting the intensity bit  gives the
foreground a range of eight further colours. Underline
characters are not produced in colour mode.




        Blink         Intensity
             Background       Foreground
        ┌───┬───┬───┬───┬───┬───┬───┬───┐
        │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
        └───┴───┴───┴───┴───┴───┴───┴───┘
          3   R   G   B   │   R   G   B
          │   e   r   l   │
          │   d   e   u   └── 0  normal intensity
          │       e   e       1  high intensity
          │       n

          0  The character does not blink
          1  The character blinks


┌────────────────────────────────────────────────────┐
│   Colours available in alphanumeric (text) mode.   │
├────────────────────────────────────────────────────┤
│   Intensity   R       G       B      Colour        │
└────────────────────────────────────────────────────┘
        0       0       0       0      Black
        0       0       0       1      Blue
        0       0       1       0      Green
        0       0       1       1      Cyan
        0       1       0       0      Red
        0       1       0       1      Magenta
        0       1       1       0      Brown
        0       1       1       1      Light Grey
        1       0       0       0      Dark Grey
        1       0       0       1      Light Blue
        1       0       1       0      Light Green


┌────────────────────────────────────────────────────┐
│   Colours available in alphanumeric mode. (cont.)  │
├────────────────────────────────────────────────────┤
│   Intensity   R       G       B      Colour        │
└────────────────────────────────────────────────────┘
        1       0       1       1      Light Cyan
        1       1       0       0      Light Red
        1       1       0       1      Light Magenta
        1       1       1       0      Yellow
        1       1       1       1      White




Examples:

Blink          Intense
      R   G   B       R   G   B
┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 0 │ 0 │ 1 │ 1 │ 1 │ 1 │ 1 │ =  31 Intense White
└───┴───┴───┴───┴───┴───┴───┴───┘       on Blue

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 0 │ 1 │ 1 │ 0 │ 0 │ 0 │ 0 │ =  48 Black on Cyan
└───┴───┴───┴───┴───┴───┴───┴───┘

┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 1 │ 0 │ 0 │ 0 │ 1 │ 1 │ 0 │ 1 │ = 141 Magenta/Black
└───┴───┴───┴───┴───┴───┴───┴───┘      (intense blink)


┌───┬───┬───┬───┬───┬───┬───┬───┐
│ 0 │ 1 │ 0 │ 0 │ 1 │ 1 │ 1 │ 0 │ =  78 Yellow on Red
└───┴───┴───┴───┴───┴───┴───┴───┘

Other nice colour settings include :

13  Magenta on Black      14  Yellow on Black
27  Cyan on Blue          30  Yellow on Blue
32  Black on Green        96  Black on Brown


Christy Gemmell                          25th May 1988