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 >
Text File  |  1990-08-19  |  5KB  |  99 lines

  1.                           MULTICOLOURED MAYHEM
  2.  
  3.  
  4.           There may be only seven colours in the rainbow, but you
  5.          can display 4,096 on your STE using Adam Greenwod's utility
  6.  
  7.  
  8. When I visited my computer store at the beginning of January and found the new
  9. STE sitting there waiting to be bought three months before the expected release
  10. date, I was off to see the bank manager as soon as possible. Having sorted out
  11. the usual student overdraft a little earlier in the term than usual it was back
  12. to the shop and then off home with my new companion clutched tightly in my
  13. arms.
  14.  
  15.     However, this particular silver lining did indeed have a cloud attached. In
  16. releasing the STE a few months early it seemed that Atari had omitted to finish
  17. it first. Perhaps an exaggeration, but I was more than a little surprised to
  18. find that my new machine wouldn't boot up in medium res, thus making the new
  19. auto-boot install application option seem rather pointless.
  20.  
  21.     Having made sure it wasn't just my machine, I decided to relax by looking
  22. at all those new colours using the STE control panel (which the rather small
  23. STE addendum included with my computer assured me was on my explorer disk).
  24. Having found the old control panel firmly attached to my disk and the new one
  25. nowhere in sight, I set about finding another way of getting to see the
  26. improved colour range.
  27.  
  28.     My first thought was to go for it and try and get all 4,096 on the screen,
  29. until I worked out that this meant swapping palettes more than once a scan
  30. line. A swift bit of arithmetic left me with one palette for each shade of one
  31. of the three primary colours, leaving 16 palette changes per screen to get all
  32. the different combinations from two colours. The third, then would have to be
  33. added afterwards and gradually darkened and lightened so that all the colours
  34. would be visible in a short space of time.
  35.  
  36.     I had already been playing with the fairly standard method of swapping
  37. palettes with the horizontal blanking interrupt just before I bought the STE,
  38. so I was fairly in tune with the problem at hand. The solution was to set the
  39. red of each colour in the palette to a different level, thus showing all the
  40. different shades of this colour, then change the level of blue about every
  41. twelve lines, and the green every few screen refreshes. This meant putting
  42. control of the blue in the hands of a horizontal blank routine and the green in
  43. a vertical blank one.
  44.  
  45.     Much has been said on the subject of horizontal and vertical blanking
  46. interrupts, so it isn't really necessary to go over all that again. The program
  47. is in any event fully commented to show how these features are used. The main
  48. part of this program is the palette setting, using three lists of colour
  49. palettes, and the extra information used by the STE to get the greater range of
  50. colours.
  51.  
  52.     Anyone who has played with colour on the old ST will know that the level of
  53. red, green and blue is set by one word length value, split into sets of four
  54. bits:
  55.  
  56.         R       G       B
  57.       .xxx    .xxx    .xxx
  58.  
  59.     Only the three least significant bits of each colour are used. The STE uses
  60. the fourth bit of each colour to give the extra range, obviously having a much
  61. larger look-up table. The way this extra bit is used seems rather odd at first,
  62. but is necessary to allow compatibility with the ST.
  63.  
  64.     Instead of the colours getting lighter as the four-bit value increases from
  65. 0 to 15 with the extra bit being used by the brighter colours (8-15) the extra
  66. bit is used for every other colour. If this were not so the colours from a
  67. standard ST would all appear at half brightness. This means that the 16 colour
  68. levels are, in ascending order of brightness, 0, 8, 1, 9, 2, 10, 3, 11, 4, 12,
  69. 5, 13, 6, 14, 7, 15. This can be seen in the colour settings in the program.
  70.  
  71.     This doesn't cause a problem with this program, as the colour levels are
  72. simply read from the list, and only the relevant bits are set for each colour.
  73. This method is, as far as I could tell, the simplest, using little memory and
  74. making for a much more elegant program.
  75.  
  76.     To show all the colours a stripe of each colour is first copied onto the
  77. screen so that all 16 colours are used. Once the level of red for each colour
  78. has been set it is not changed by any of the other routines, so we then have
  79. only two of the primary colours to worry about.
  80.  
  81.     The level of blue is changed every twelve lines, the new level coming from
  82. the list of blue values, with a counter maintained to step through the list.
  83. Green is set every Vblank, but a larger counter is used to slow down the rate
  84. at which the level of green changes. Another counter is used to move through
  85. the green list, and blue is also reset in this part of the code.
  86.  
  87.     The program was written with Devpac, so extra directives such as EVEN may
  88. need to be included for other assemblers. All the code is commented so it
  89. should be easy to follow. An assembled version is included anyway.
  90.  
  91.     The program can be run from low or medium resolution by double clicking
  92. COLORS.TOS. To quit the program just press space. If you're not convinced that
  93. the extra colours make a difference just have a look at the same program on an
  94. old ST - a major difference. If you don't believe that the program displays all
  95. 4096 colours - count them!
  96.  
  97.  
  98. HARDWARE: STE + COLOUR MONITOR
  99.