Signetics 2650 & 2636 programming/Programming colours

Tutorial — Programming colours edit

This family of consoles have a very limited palette of colors to work with. The PVI has three digital (i.e. either on or off) colour signals that are connected to the red, green and blue inputs of the PAL encoder. This limits the system to a palette of eight colours: black, red, green, blue, cyan, magenta, yellow and white.

This seems simple at first sight, but is complicated by two other signals that can affect the colour on the display:

  • the OBJ/SCR output of the PVI which goes low whenever an object or a score digit is being displayed. Remember: SCR is score, not screen!
  • bit 5 of the 74LS138 'effects' register.

A further complication is that some consoles such as the Interton VC4000 use these signals to alter the brightness of the colour, while others use it to invert the colour. The rest of this page is applicable to the colour inversion method, specifically as implemented on the Voltmace Database.

Hardware description edit

 
Block diagram of the colour control circuit in the Voltmace Database video game console.

The three active-high colour inputs to the PAL encoder are connected directly to the active-low colour outputs of the PVI: R, G, B.

The active-high INV input to the PAL encoder is derived from a wire-AND circuit comprising an open-collector transistor, the open-drain OBJ/SCR and a pull-up resistor. Either one of those devices can pull the invert input to a low logic level.

The INVERT signal is set by writing to bit 5 of the hex D-type flip-flop, 74LS378, at memory address $1E80. Writing a 1 to that bit causes the transistor to turn on, and pull the INV input to the PAL encoder to a logic 0 irrespective of the state of OBJ/SCR.

Registers edit

All the colour information is controlled by four registers, three in the PVI and one logic chip. Note that these registers are all write-only. It is up to the programmer to keep track of what is in them.

$1E80 'Effects' register edit

7 6 5 4 3 2 1 0
- - INVERT - - - - -

The other bits in this register are used by the audio circuitry.

$1FC1 Colour objects 1 & 2 edit

7 6 5 4 3 2 1 0
X X R1 G1 B1 R2 G2 B2

$1FC2 Colour objects 3 & 4 edit

7 6 5 4 3 2 1 0
X X R3 G3 B3 R4 G4 B4

$1FC6 Background and screen — enable and colours edit

7 6 5 4 3 2 1 0
X R G B Background

Enable

R G B
X Background colour Screen colour

If Background Enable is set to zero, both the screen and background grid are output from the PVI as '111'.

If the background grid is not used for graphics, the registers that define it, $1F80 - $1FAC, may be used for variable storage. They are hidden on the display by setting background and screen to the same colour.

Colours edit

If you find the hardware description hard to follow with the multiple inversions, you aren't alone. All you really need to do is use the table below when programming colours.

COLOUR OBJECTS BACKGROUND or SCREEN
INVERT = 0 INVERT = 1
BLACK 111 000 111
BLUE 110 001 110
GREEN 101 010 101
CYAN 100 011 100
RED 011 100 011
MAGENTA 010 101 010
YELLOW 001 110 001
WHITE 000 111 000

The score colour cannot be programmed independently; it is always the inverse of the colour programmed for the background.

Neither the object colours or the score colour are affected by the state of bit 5 of the 74LS138 'effects' register since the OBJ/SCR will be low while they are being displayed.

The INVERT bit is used in some games such as Interton's Super Space as a screen-saver. While it is tempting to normally set the INVERT bit to 0, it might be better to have it normally set to 1. In this way the colour codes are the same for objects, score, background and screen, and will be in negative logic, i.e. a 0 turns the colour on.

Code snippets edit

All the colours are set by these four registers:

effects     equ $1E80
colours12   equ $1FC1
colours34   equ $1FC2
backgnd     equ $1FC6

It is a good idea to clear the effects register early on in your program. This will not only turn off the colour inversion, but will also turn off the audio.

        eorz    r0
        stra,r0 effects		

Alternatively, as discussed above, the audio can be turned off and the colour inversion turned on so that all colours can be programmed with the same codes.

        lodi,r0 $20
        stra,r0 effects		

Remember that the objects colours are always active low, so the RGB sequence 101 would appear as green, etc:

        lodi,r0 %00010101       ; XX  /  011     /   110
        stra,r0 colours12       ;     / obj1 red / obj2 blue

The background and screen colours depend on the state of the invert bit. When the invert bit is 0, their colours are always active high, so the RGB sequence 010 would appear as green, etc:

        eorz    r0
        stra,r0 effects         ; invert bit = 0	
        lodi,r0 %00001110       ;  X / 100            /   1     / 001
        stra,r0 backgnd         ;    / background red / enabled / screen blue

Conversely, when the invert bit is 1, their colours are active low, so the RGB sequence 101 would appear as green, etc:

        lodi,r0 $20
        stra,r0 effects         ; invert bit = 1	
        lodi,r0 %00001110       ;  X / 011            /   1     / 110
        stra,r0 backgnd         ;    / background red / enabled / screen blue

Tutorial program edit

 
Demonstration of colour programming on the Voltmace Database games console

The code for this tutorial can be found at Signetics 2650 & 2636 programming/Tutorial code - programming colours. When this program is run, you should see a static screen that looks like this:

The fours objects are programmed in different colours. When the first row of objects have been displayed, the INVERT bit in the effects register is set to one. This inverts the colour of the screen (yellow 110 becomes blue 001) and the background switches from black to white.

Notice that the objects and the score digits are the same above and below this transition. Also note that the score is the inverse of the colour programmed for the background.

Exercises edit

  1. Change the colours of the four objects to red, cyan, yellow and blue.
  2. Change the initial colour of the background grid to cyan.
  3. Change the colour of the score to magenta.