home *** CD-ROM | disk | FTP | other *** search
/ Informática Multimedia: Special Games / INFESPGAMES.mdf / os2 / fractint / 256color.bas next >
Encoding:
BASIC Source File  |  1991-03-31  |  1.0 KB  |  55 lines

  1. ' 256COLOR.BAS -- M. Covington 1990
  2.  
  3. DEFINT A-Z
  4. DIM P&(0:256) ' AS LONG  ' the palette
  5.  
  6. ' Set video mode
  7.  
  8. 'SCREEN 13
  9. PRINT "      Remapping colors..."
  10.  
  11. ' Redefine colors 1-253
  12.  
  13. DIM L(3)
  14. L(1) = 0        ' initial red, green, and blue levels
  15. L(2) = 0
  16. L(3) = 42
  17.  
  18. C = 1           ' which color is being defined (1-252)
  19. W = 2           ' which element of V is changing
  20. I = 1           ' what's being added to L(I)
  21.  
  22. FOR S = 1 TO 6          ' 6 sectors of color wheel
  23.   FOR N = 1 TO 42       ' 42 colors in each
  24.     P&(C) = L(1) + 256 * L(2) + 65536 * L(3)
  25.     C = C + 1
  26.     L(W) = L(W) + I
  27.   NEXT
  28.   W = (W MOD 3) + 1
  29.   I = -I
  30. NEXT
  31.  
  32. ' Define the remaining colors
  33.  
  34. P&(0) = 0
  35. P&(254) = P&(253) + 5
  36. P&(255) = P&(254) + 5
  37.  
  38. ' Set the palette
  39.  
  40. 'PALETTE USING P(0)
  41.  
  42. ' Demonstrate the results
  43.  
  44. 'FOR C = 0 TO 255
  45. '  LINE (C + 32, 0)-(C + 32, 180), C
  46. 'NEXT
  47.  
  48. OPEN "I:COV1.MAP" FOR OUTPUT AS #1
  49. FOR C = 0 TO 255
  50. B = (P&(C) MOD 256&) * 4
  51. G = ((P&(C) \ 256&) MOD 256&) * 4
  52. R = ((P&(C) \ 65536&) MOD 256&) * 4
  53. PRINT #1,R,G,B
  54. NEXT
  55. END