indexbase 0
include "window.inc"

Window "PLASMANIA", 640, 480, 1
sys_mode=4
Font 12,24,700,"courier"

SINGLE x, y, c, r, g, b, ix

Dim Cols0(255) As SINGLE
Dim Cols1(255) As SINGLE
Dim Cols2(255) As SINGLE

for ix=0 to 255
    Cols0(ix) = abs(128-127*sin(ix*pi/32))
    Cols1(ix) = abs(128-127*sin(ix*pi/64))
    Cols2(ix) = abs(128-127*sin(ix*pi/128))
next

ClsColor 255,0,0
Text 180,32,"PLASMANIA 2012", 255,150,200
FlipBuffer

for y=1 to Height
    for x=1 to Width
        c= sin(x/35)*128+sin(y/28)*32+sin(x+y)/16*64
        if c >255 
           c = c-256
        end if
        if c <0
           c = 256+c
        end if
        r = cols0(c)
        if r >255  
	   r = r-256
        end if
        if r <0  
	   r = 256+c
        end if
        g = cols1(c)
        if g >255  
	   g = g-256
        end if
        if g <0  
	   g = 256+c
        end if
        b = cols2(c)
        if b >255  
	   b = b-256
        end if
        if b <0  
	   b = 256+c
        end if
        Poke x, y, r,g,b 
    next
next
FlipBuffer
Pause
WinEnd