home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
ST_USER
/
1990
/
USEROC90.MSA
/
TEXT_COLOURS.DOC
< prev
next >
Wrap
Text File
|
1990-08-19
|
5KB
|
99 lines
MULTICOLOURED MAYHEM
There may be only seven colours in the rainbow, but you
can display 4,096 on your STE using Adam Greenwod's utility
When I visited my computer store at the beginning of January and found the new
STE sitting there waiting to be bought three months before the expected release
date, I was off to see the bank manager as soon as possible. Having sorted out
the usual student overdraft a little earlier in the term than usual it was back
to the shop and then off home with my new companion clutched tightly in my
arms.
However, this particular silver lining did indeed have a cloud attached. In
releasing the STE a few months early it seemed that Atari had omitted to finish
it first. Perhaps an exaggeration, but I was more than a little surprised to
find that my new machine wouldn't boot up in medium res, thus making the new
auto-boot install application option seem rather pointless.
Having made sure it wasn't just my machine, I decided to relax by looking
at all those new colours using the STE control panel (which the rather small
STE addendum included with my computer assured me was on my explorer disk).
Having found the old control panel firmly attached to my disk and the new one
nowhere in sight, I set about finding another way of getting to see the
improved colour range.
My first thought was to go for it and try and get all 4,096 on the screen,
until I worked out that this meant swapping palettes more than once a scan
line. A swift bit of arithmetic left me with one palette for each shade of one
of the three primary colours, leaving 16 palette changes per screen to get all
the different combinations from two colours. The third, then would have to be
added afterwards and gradually darkened and lightened so that all the colours
would be visible in a short space of time.
I had already been playing with the fairly standard method of swapping
palettes with the horizontal blanking interrupt just before I bought the STE,
so I was fairly in tune with the problem at hand. The solution was to set the
red of each colour in the palette to a different level, thus showing all the
different shades of this colour, then change the level of blue about every
twelve lines, and the green every few screen refreshes. This meant putting
control of the blue in the hands of a horizontal blank routine and the green in
a vertical blank one.
Much has been said on the subject of horizontal and vertical blanking
interrupts, so it isn't really necessary to go over all that again. The program
is in any event fully commented to show how these features are used. The main
part of this program is the palette setting, using three lists of colour
palettes, and the extra information used by the STE to get the greater range of
colours.
Anyone who has played with colour on the old ST will know that the level of
red, green and blue is set by one word length value, split into sets of four
bits:
R G B
.xxx .xxx .xxx
Only the three least significant bits of each colour are used. The STE uses
the fourth bit of each colour to give the extra range, obviously having a much
larger look-up table. The way this extra bit is used seems rather odd at first,
but is necessary to allow compatibility with the ST.
Instead of the colours getting lighter as the four-bit value increases from
0 to 15 with the extra bit being used by the brighter colours (8-15) the extra
bit is used for every other colour. If this were not so the colours from a
standard ST would all appear at half brightness. This means that the 16 colour
levels are, in ascending order of brightness, 0, 8, 1, 9, 2, 10, 3, 11, 4, 12,
5, 13, 6, 14, 7, 15. This can be seen in the colour settings in the program.
This doesn't cause a problem with this program, as the colour levels are
simply read from the list, and only the relevant bits are set for each colour.
This method is, as far as I could tell, the simplest, using little memory and
making for a much more elegant program.
To show all the colours a stripe of each colour is first copied onto the
screen so that all 16 colours are used. Once the level of red for each colour
has been set it is not changed by any of the other routines, so we then have
only two of the primary colours to worry about.
The level of blue is changed every twelve lines, the new level coming from
the list of blue values, with a counter maintained to step through the list.
Green is set every Vblank, but a larger counter is used to slow down the rate
at which the level of green changes. Another counter is used to move through
the green list, and blue is also reset in this part of the code.
The program was written with Devpac, so extra directives such as EVEN may
need to be included for other assemblers. All the code is commented so it
should be easy to follow. An assembled version is included anyway.
The program can be run from low or medium resolution by double clicking
COLORS.TOS. To quit the program just press space. If you're not convinced that
the extra colours make a difference just have a look at the same program on an
old ST - a major difference. If you don't believe that the program displays all
4096 colours - count them!
HARDWARE: STE + COLOUR MONITOR