Colour Selector

Les Ellingham


Issue 5

Sep/Oct 83

Next Article >>

<< Prev Article


One of the simplest ways to achieve a professional polish to your programs is to use colour effectively. Even the simplest of programs in Graphics 1 or 2 can be made to look special by carefully choosing the colours of the text. Remember, in these modes you can have five colours including background on the screen without resorting to fancy tricks-just use upper and lower case and inverse.

Various books and manuals have charts of SETCOLOR values and some even have printed colour charts, but no printed page can convey the full range of Atari's 256 colours, particularly as the colours can look different depending on the background and will vary from television to television. The usual way to achieve the right balance is to experiment and change colours one by one until the desired result is obtained. As this can be a long process, I decided to write a short Utility which would take away the guesswork and show colours in close relation to each other as well as providing all the important SETCOLOR and POKE values. The result is Colour Selector.

The utility itself is very easy to use, just choose a Setcolor statement by pressing keys 0-4 and a marker will indicate which statement you will be changing. Press the right and left arrow keys to cycle up and down through the colours available. To change to another register, press SELECT and choose again. When you have achieved the balance you require, note down the SETCOLOR or POKE values to use in your own programs.

The program, although relatively simple, is interesting in that it introduces both the concepts of custom display lists and display list interrupts. Lines 1000-1050 set up a display list which comprises three lines of Graphics 0 followed by two blank lines, four lines of Graphics 1, two blank lines, four lines of Graphics 2, two blank lines, one line of Graphics 0 followed by two more blank lines, five lines of Graphics 0, two blank lines and finally two lines of Graphics 0. This may sound quite complicated but all the information to build this display list is in line 1030 and the whole display list routine only takes five program lines. The introduction of blank lines

in the display gives a very pleasing effect and also helps to balance out the display list to the required 192 scan lines and assists in overcoming a small problem in the display list interrupt which does not always give a clean separation of colours when the keyboard is in use.

Now, display lists are one thing but Display List Interrupts are an entirely different proposition. Altering the display list itself is easily accomplished from Basic but Interrupts require the use of machine language and my understanding of machine language is about as deep as the average man's knowledge of nuclear physics! What I required was a way to keep the bottom half of the screen the same colour irrespective of what was being done to the registers which would normally control the background and text. Without this there would be problems in reading the information when the colours were changed. I remembered a routine in De Re Atari which does just this and duly typed it in. There was just one small problem, the routine on page 5-3 of De Re Atari does not work! Experimentation, they say, is the secret of learning programming techniques and after a few hours I had some small understanding of the routine, despite starting from absolute scratch. I can now proudly present in lines 1110-1130, a corrected version of a routine from De Re Atari!

To enable display list interrupts you must add 128 to the line before the one you wish to change, which is why in line 1030 a 135 follows the three 7's. Try changing this back to 7 and adding 128 to another number and see what happens. I won't explain the machine language routine (I can't!) but if you want to change the colour of the bottom half of the screen, just change the figure 18 in line 1120 to change the background and the figure 14 to change the text. The numbers to use are the same as you would use to POKE a colour register.

That's it then-Colour Selector-a simple utility which ended up teaching me quite a lot about display lists. Don't be afraid to experiment, you may surprise yourself. I would never have dreamed of presenting a correction to De Re Atari. What next?

AtariLister - requires Java