And for those interested the source code is here :
sync on
sync rate 0
#constant MAX_THINGS 20
#constant POS_X 0
#constant POS_Y 4
#constant POS_COLOUR 8
#constant POS_DX 16
#constant POS_DY 20
#constant MOVEMENT 24
header as DWORD
addr as DWORD
node as DWORD
colour as DWORD
tx as DWORD
l as integer
x as integer
y as integer
set display mode 1024,768,32
header=linkList_CreateHeader()
addr=calloc(64)
randomize timer()
for l=1 TO MAX_THINGS
pokeL addr,POS_X,rnd(screen width())
pokeL addr,POS_Y,rnd(screen height())
pokeL addr,POS_COLOUR,hexToInt("00FFFFFF")
pokeL addr,POS_DX,rnd(8)-4
pokeL addr,POS_DY,rnd(8)-4
pokeL addr,MOVEMENT,0
node=linkList_AddNode(header,addr,64,1)
next l
repeat
node=linkList_GetFirstNode(header)
while node<>0
t=linkList_GetNodeData(node,addr,64,0)
colour=peekL(addr,POS_COLOUR)
ink colour,colour
dot peekL(addr,POS_X),peekL(addr,POS_Y)
x=peekL(addr,POS_X)+peekL(addr,POS_DX)
if x<=0
x=0
pokeL addr,POS_DX,0-peekL(addr,POS_DX)
else
if x>=screen width()
x=screen width()-1
pokeL addr,POS_DX,0-peekL(addr,POS_DX)
endif
endif
y=peekL(addr,POS_Y)+peekL(addr,POS_DY)
if y<=0
y=0
pokeL addr,POS_DY,0-peekL(addr,POS_DY)
else
if y>=screen height()
y=screen height()-1
pokeL addr,POS_DY,0-peekL(addr,POS_DY)
endif
endif
pokeL addr,POS_X,x
pokeL addr,POS_Y,y
incL addr,MOVEMENT,1
if peekL(addr,MOVEMENT) && 16
select rnd(4)
case 0 : x=1
endcase
case 1 : x=256
endcase
case 2 : x=65536
endcase
case 3 : x=1118481
endcase
endselect
pokeL addr,POS_COLOUR,peekL(addr,POS_COLOUR)-x
endif
if peekL(addr,MOVEMENT) && 256
select rnd(4)
case 0 : pokeL addr,POS_DX,rnd(8)-4
endcase
case 1 : pokeL addr,POS_DY,rnd(8)-4
endcase
case 2 : pokeL addr,POS_DX,rnd(8)-4
pokeL addr,POS_DY,rnd(8)-4
endcase
endselect
endif
tx=linkList_WriteNodeData(node,addr,64,0)
fastsync
node=linkList_GetNextNode(node)
endwhile
until escapekey()=1
x=linkList_FreeHeader(header)
wait key