There a grid display operated by a phone app.
to display preset pictures.
I wrote my own picture maker.
D-pad to move high-lighted square.
Page up/down to change the colour.
The numbers show how much of each colour.
'END' to randomize.
restore rainbow
read hue
dim R(hue)
dim G(hue)
dim B(hue)
dim C$(hue)
for a=1 to hue
read R(a)
read G(a)
read B(a)
read C$(a)
next a
tiles=256
dim col(tiles)
dim tot(tiles)
for a=1 to tiles
col(a)=int(ran(hue))+1
next a
sel=1
dim go(16)
dim g(16)
open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")
for a=1 to 16
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(8)=1 sel=sel-1
if go(6)=1 sel=sel+1
if go(5)=1 sel=sel-1
if go(7)=1 sel=sel+16
if sel>81 sel=sel-256
if sel<1 sel=sel+256
if sel<1 sel=1
if sel>tiles sel=tiles
for a=1 to tiles
if go(14)=1 col(a)=int(ran(hue))+1
next a
for a=1 to tiles
if sel=a and go(1)=1 col(a)=col(a)-1
if sel=a and go(4)=1 col(a)=col(a)+1
if col(a)<0 col(a)=0
if col(a)>hue col(a)=hue
next a
for a=1 to hue
tot(a)=0
next a
for a=1 to tiles
for b=1 to hue
if col(a)=b tot(b)=tot(b)+1
next b
next a
for a=1 to hue
text 540,a*20+8,str$(tot(a),"##")
total=total+tot(a)
next a
w=0
h=0
for a=1 to tiles
w=w+1
if w>16 then
w=1
h=h+1
endif
for b=1 to hue
if col(a)=b setrgb 1,R(b),G(b),B(b)
next b
fill rectangle w*20+122,42+(h*20) to w*20+142,62+(h*20)
next a
w=0
h=0
for a=1 to tiles
w=w+1
if w>16 then
w=1
h=h+1
endif
setrgb 1,256,256,256
if sel=a rectangle w*20+122,42+(h*20) to w*20+142,62+(h*20)
next a
for a=1 to hue
setrgb 1,R(a),G(a),B(a)
fill rectangle 570,a*20-5 to 590,a*20+15
'setrgb 1,256,256,256
'text 570,a*20+10,C$(a)
next a
setrgb 1,256,256,256
for a=1 to tiles
for b=1 to hue
if sel=a and col(a)=b rectangle 570,b*20-5 to 590,b*20+15
next b
next a
until (1=0)
label rainbow
data 24
data 256,000,000,"red"
data 256,104,030,"orange"
data 256,256,000,"yellow"
data 000,256,000,"green"
data 000,000,256,"blue"
data 080,100,200,"indigo"
data 050,010,060,"violet"
data 120,060,000,"brown"
data 128,128,128,"grey"
data 256,150,150,"pink"
data 256,200,160,"flesh"
data 256,256,256,"white"
data 220,020,060,"crimson"
data 144,000,032,"burgundy"
data 204,119,034,"ochre"
data 128,128,000,"olive"
data 128,000,000,"maroon"
data 128,055,144,"l.violet"
data 242,133,000,"tangerine"
data 180,090,000,"tan"
data 128,000,000,"d.green"
data 000,128,128,"sky blue"
data 102,000,153,"purple"
data 000,128,000,"d.green"