Controls for this are the D-pad (up/down colour select)
(L/R colour intensity)
P-up (random)
P-down (speed select)
restore legend
read num
dim letter$(num)
for a=1 to num
read letter$(a)
next a
dim hue(num)
for a=1 to num
hue(a)=128
next a
key=16
dim go1(key)
dim go(key)
dim g(key)
col=2
off=0
open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")
for a=1 to key
if and(c,2^(a-1))<>0 go1(a)=1
if and(c,2^(a-1))=0 go1(a)=0
next a
for a=1 to key
if and(c,2^(a-1))<>0 go(a)=1
if go(a)=1 g(a)=g(a)+1
if g(a)>2 g(a)=2
if g(a)=2 go(a)=0
if and(c,2^(a-1))=0 g(a)=0
next a
if go(5)=1 col=col-1
if go(7)=1 col=col+1
if col<1 col=1
if col>3 col=3
if go(4)=1 off=off+1
if off>1 off=0
for a=1 to num
if off=0 if col=a if go1(8)=1 hue(a)=hue(a)-1
if off=0 if col=a if go1(6)=1 hue(a)=hue(a)+1
next a
for a=1 to num
if off=1 if col=a if go(8)=1 hue(a)=hue(a)-1
if off=1 if col=a if go(6)=1 hue(a)=hue(a)+1
next a
for a=1 to num
if hue(a)<0 hue(a)=0
if hue(a)>256 hue(a)=256
next a
for a=1 to num
if go(1)=1 hue(a)=int(ran(257))
next a
setrgb 1,256,256,256
for a=1 to num
text 100,a*50+100,str$(hue(a),"###")
if hue(a)<1 text 100,a*50+100,"000"
if hue(a)>0 if hue(a)<10 text 100,a*50+100,"00"
if hue(a)>9 if hue(a)<100 text 100,a*50+100,"0"
next a
if off=0 text 240,100,"continuous"
if off=1 text 240,100," increment"
for a=1 to num
line 165,a*50+100 to 421,a*50+100
next a
for a=1 to num
rectangle 160+hue(a),a*50+95 to 170+hue(a),a*50+105
next a
for a=1 to num
if col<>a setrgb 1,256,256,256
if col=a setrgb 1,0,256,0
text 30,a*50+100,letter$(a)
next a
setrgb 1,hue(1),hue(2),hue(3)
fill rectangle 450,125 to 600,275
until (1=0)
label legend
data 3
data " Red","Green"," Blue"