If you are interested in starting to code YaBasic Demos (Sony PS2), here are some interesting things you could need or should take a look at.
http://http://www.yabasic.de/http://www.secretly.de/public/yabfiles.zip (~500 zipped Stuff, even from Shockwave and others ^^)
I am not sure, but seems the examples in the yabfiles.zip does not work with the latest yabasic version!?
However here are some small examples i found, working with latest version:
Spiral Example:
#!/usr/local/bin/yabasic
rem This program was coded by Hermang Mansilla
rem and released under GPL license :-)
rem This Program draws rotating polygons
dim x(6),y(6), X(6),Y(6)
R=90
rem origin coordinats
OX=R+6:OY=R+6
rem size of Window
SX=3*R:SY=3*R
open window SX,SY
kk=0.15
label inicio
input "Number of sides (2<N<7)=" N
if N>6 or N<3 then end fi
clear window
k=N-2
rem pone cordenad en x(), y()
for i=0 to k+1
x(i)=R*sin(2*pi*i/(k+2))
y(i)=R*cos(2*pi*i/(k+2))
gosub transfcor
rem The following print lines are for diagnostic, you can comment them
print
print "cordenadas (x,y)=",x(i),y(i),"-->(",X(i),",",Y(i),")"
next i
gosub dibuja
goto inicio
end
label transfcor
X(i)=x(i)+OX
Y(i)=OY-y(i)
if Y(i)<0 then Y(i)=-Y(i) endif
return
label dibuja
for i=1 to 10+5*k
X(k+2)=X(0):Y(k+2)=Y(0)
for j=0 to k+1
X1=X(j):Y1=Y(j)
X2=X(j+1):Y2=Y(j+1)
line X1,Y1 to X2,Y2
X(j)=X(j)+kk*( X(j+1)-X(j) )
Y(j)=Y(j)+kk*( Y(j+1)-Y(j) )
next j
next i
return
Mandel Example:
#!/usr/local/bin/yabasic
rem Released under GPL License distribute and modify freely
rem version 0.1b1 (needs lots of modifications but works :-)
header$="Yamandel, Copyright (c) Hermang H. Mansilla Mattos, Nov 1998"
goto Main
label Initialize
Ro=-1.60:Io=-1.0
Rn=0.60:In=1.0
rem Ro=-1.0:Io=-0.7
rem Rn=-0.5:In=0
delta=0.01
VentXmax=300
VentYmax=260
IterMax=350
dim buffer(VentXmax/8,VentYmax)
return :rem Initialize
label showcord
print @(8,14) "From:";
print @(8,15) "Real=",str$(Ro);
print @(8,16) "Imag=",str$(Io);
print @(8,17) "To:";
print @(8,18) "Real=",str$(Rn);
print @(8,19) "Imag=",str$(In);
return:rem showcord
label Mandelbrot
ZR=0
ZI=0
n=0
label Lazo
TR=R+ZR*ZR-ZI*ZI
TI=I+2*ZI*ZR
ZR=TR
ZI=TI
n=n+1
MAG2=ZR*ZR+ZI*ZI
if MAG2>4 then
answer$="N"
goto Salir
fi
if n<IterMax then goto Lazo
else answer$="Y"
fi
label Salir
return :rem Mandelbrot
label UpdateScreen
rem dot xi+(R-Ro)/delta ,yi+(I-Io)/delta
dot Xcor,VentYmax-Ycor
rem buffer(
return
label DibujaFractal
dr=(Rn-Ro)/VentXmax
di=(In-Io)/VentYmax
for Ycor=yinit to VentYmax step 2
for Xcor=xinit to VentXmax step 2
R=dr*Xcor+Ro
I=di*Ycor+Io
gosub Mandelbrot
print @(2,5) R,"+i",I,answer$
if answer$="Y" then gosub UpdateScreen
fi
next Xcor
next Ycor
return :rem DibujaFractal
label Main
gosub Initialize
clear screen
print "Press F10 to quit, R to redraw"
open window VentXmax,VentYmax
gosub showcord
xinit=1:yinit=1
print @(3,6) "Loop 1 of 4";
gosub DibujaFractal
beep
xinit=2:yinit=2
print @(3,6) "Loop 2 of 4";
gosub DibujaFractal
beep
xinit=1:yinit=2
print @(3,6) "Loop 3 of 4";
gosub DibujaFractal
beep
xinit=2:yinit=1
print @(3,6) "Loop 4 of 4";
gosub DibujaFractal
beep
label handlekey
k$=inkey$
if k$<>"f10" then goto handlekey fi
close window
end
IFS example:
#!/usr/local/bin/yabasic -fg white -bg black
print "Animated Fractal ported by Hermang Mansilla"
print "this program uses a timing routine so is sensitive"
print "to the speed of your computer, edit variable TreshHold"
print "to change the effect and speed"
print "original C code by Boris Van Schooten"
ThresHold=4.5 : rem tested on Pentium 166 MMX
Frames2Skip=8
WINXSIZE=640
WINYSIZE=480
input "Press Any Key to Continue", dummy$
goto Main
label Initialize
myiter=0
PrevTime=0
skip=0
NRIFSPAR=5
dim rot(NRIFSPAR), parscale(NRIFSPAR), movex(NRIFSPAR), movey(NRIFSPAR)
for i=1 to NRIFSPAR
read rot(i),parscale(i),movex(i),movey(i)
next i
data 0, 0.3, 0.5, 0.5
data 0, 0.3, -0.5, 0.5
data 0, 0.3, 0.5, -0.5
data 0, 0.3, -0.5, -0.5
data 0, 0.3, 0, -0.5
MAXPT=16384
dim ptsX(MAXPT,2),ptsY(MAXPT,2)
Dim Stack(MAXPT)
phase=0.0
thispt=1
sp=1
myflag=1
return : rem Initialize
label PushStack
Stack(sp)=xpos
sp=sp+1
Stack(sp)=ypos
sp=sp+1
Stack(sp)=angle
sp=sp+1
Stack(sp)=scale
sp=sp+1
Stack(sp)=iterleft
sp=sp+1
Stack(sp)=a
sp=sp+1
return : rem PushStack
label PopStack
sp=sp-1
a=Stack(sp)
sp=sp-1
iterleft=Stack(sp)
sp=sp-1
scale=Stack(sp)
sp=sp-1
angle=Stack(sp)
sp=sp-1
ypos=Stack(sp)
sp=sp-1
xpos=Stack(sp)
return : rem PopStack
label doIfs
if iterleft>0 then
sinang=sin(angle)
cosang=cos(angle)
for a=1 to NRIFSPAR
pscale=parscale(a)
pmovex=movex(a)*scale
pmovey=movey(a)*scale
gosub PushStack
xpos=xpos+cosang*pmovex+sinang*pmovey
ypos=ypos+sinang*pmovex-cosang*pmovey
angle=angle+rot(a)
scale=scale*pscale
iterleft=iterleft-1
gosub doIfs
gosub PopStack
next a
else
if thispt>MAXPT then goto salida fi
ptsX(thispt,myflag)=xpos
ptsY(thispt,myflag)=ypos
rem dot ptsX(thispt,myflag),ptsY(thispt,myflag)
thispt=thispt+1
fi
label salida
return
label DrawPoints
for p=1 to thispt
dot ptsX(p,myflag),ptsY(p,myflag)
myflag=1-myflag
clear rect ptsX(p,myflag),ptsY(p,myflag) to ptsX(p,myflag),ptsY(p,myflag)
myflag=1-myflag
next p
return
label SlideIfsPar
rem slide ifs parameters
rot(1)=rot(1)+0.005
rot(2)=rot(2)+0.015
rot(3)=rot(3)-0.00555
rot(4)=rot(4)-0.01555
rot(5)=rot(5)-0.005555
parscale(1) = 0.2+0.3*(1+sin(phase*0.01))
parscale(2) = 0.2+0.3*(1+sin(phase*0.021))
parscale(3) = 0.2+0.3*(1+sin(phase*0.0311))
parscale(4) = 0.2+0.3*(1+sin(phase*0.04111))
parscale(5) = 0.2+0.3*(1+sin(phase*0.051111))
movex(1) = 0.5*(sin(phase*0.03))
movex(2) = 0.5*(sin(phase*0.043))
movex(3) = 0.5*(sin(phase*0.0533))
movex(4) = 0.5*(sin(phase*0.06333))
movex(5) = 0.5*(sin(phase*0.073333))
movey(1) = 0.5*(sin(phase*0.05))
movey(2) = 0.5*(sin(phase*0.042))
movey(3) = 0.5*(sin(phase*0.0322))
movey(4) = 0.5*(sin(phase*0.02222))
movey(5) = 0.5*(sin(phase*0.012222))
phase=phase+0.12
return :rem SlideIfsPar
label Main
GOSUB Initialize
clear screen
open window WINXSIZE, WINYSIZE
label KeepRunning
k$=inkey$(0)
thispt=1
xpos=WINXSIZE/2
ypos=WINYSIZE/2
angle=0
scale=WINYSIZE/2
iterleft=6
gosub CheckElapsed
rem if skip=0 then
rem Frames2Skip=Frames2Skip - 1
rem fi
if mod(myiter,Frames2Skip)=0 then
gosub PushStack
gosub doIfs
gosub PopStack
gosub DrawPoints
myflag=1-myflag
fi
myiter=myiter+1
rem print myiter," ",skip," ",Frames2Skip
gosub SlideIfsPar
if k$<>"q" then goto KeepRunning fi
close window
end
label CheckElapsed
t$=time$
totalelapsed=val(mid$(t$,10,5))
if totalelapsed>PrevTime then
elapsed=totalelapsed-PrevTime
fi
PrevTime=totalelapsed
if elapsed>ThresHold then
skip=1
else skip=0
fi
return