'This demo is for Amiga's with a 68020 or higher processor : 
'
'  standard A3000           68(EC)030   processor available. 
'  standard A1200           68EC020     processor available. 
'  standard A4000/30        68(EC)030   processor available.     
'  standard A4000/40        68(LC)040   processor available. 
'
'  standard A500 and A500+  with 68020 or higher accelerator board.
'  standard A600            with 68020 or higher accelerator board.
'  standard A2000           with 68020 or higher accelerator board.
'  standard A1000           with 68020 or higher accelerator board.  
'
'Could be working on : 
'
'  standard A500 and A500+  with 68000 clocked at 14Mhz with FASTRAM.  
'  standard A600            with 68000 clocked at 14Mhz with FASTRAM 
'  standard A2000           with 68000 clocked at 14Mhz with FASTRAM 
'  standard A1000           with 68000 clocked at 14Mhz with FASTRAM   
'
'
Screen Open 0,320,200,2,L
Load "df0:examples/amal_60_sprites.abk"
Hide On 
'
'We are only using 60 Psprites, so set the maximum to 60 
'
Psprite Max 60
'We've 16 coloured images in bank 1, so set the Psprite engine in 16 colour
'mode. 
'
Set Psprite Colours 16
'
'Convert the Sprite/Bob images in bank 1 from normal format  
'to interleaved bitmap format. 
'
Convert Sprites 1
'
'Remember, after conversion the bank can be erased ! 
'This will free a lot of your precious memory. 
Erase 1
'
'Display a nice screen...
'
Unpack 10 To 0
'
'Give the Sprites a nicer colour...depends on your taste :-) 
'
Colour 17,Colour(1)
Colour 18,Colour(5)
Colour 19,Colour(6)
'
'It is very important to set the normal Bob and Sprite updates to Off !
'
Update Off 
'
'We are going to use 60 channels in normal interrupt mode !
'So we don't use the Synchro Off command.
'
'Don't bother about the AMAL setup, just for testing...
'
Y=42
NUM_SPR=0
For I=0 To 14
   Randomize Timer
   X=128+64
   X_ADD=80
   For _PSPR=1 To 4
'Use this line for a nice pattern... 
      A$="Let X="+Str$(X)-" "+"; Let Y="+Str$(Y)-" "+"Let R0="+Str$(-_PSPR)+";Let R1=1;Let R2=1;Let A=Z(5)+1"
'Use this line for total chaos ! 
'      A$="Let X="+Str$(X)-" "+"; Let Y="+Str$(Y)-" "+"Let R0="+Str$(-(Rnd(3)+1))+";Let R1=1;Let R2=1;Let A=Z(5)+1"
'
'I've slowed down the speed with 4 Pause instructions, else the images are 
'flipping too fast!
'
      A$=A$+"Loop: P ;P ;P ; P;"
      A$=A$+"Let X=X+R0 ;"
      A$=A$+"If X>432 Jump Reset ;"
      A$=A$+"If X<"+Str$(128+NUM_SPR)-" "+" Jump Reset ;"
      A$=A$+"Let A=A+R1;"
      A$=A$+"If A>7 Jump Image;"
      A$=A$+"Jump Loop ;"
      A$=A$+"Reset: ;"
      A$=A$+"Let R0=R0*-1 ;"
      A$=A$+"Jump Loop ;"
      A$=A$+"Swapy: ;"
      A$=A$+"Let R2=R2*-1 ;"
      A$=A$+"Jump Loop ;"
      A$=A$+"Image: ;"
      A$=A$+"Let A=1 ;"
      A$=A$+"Jump Loop ;"
'Assign an Amal string to an animation channel, for use with 68020+ processors.
      Set 68020 Amal NUM_SPR,A$
      Inc NUM_SPR
      Add X,X_ADD
   Next 
   Add Y,17
Next 
'
'Assign the Psprites to an Amal channel... 
'
For I=0 To 59
   Pchannel To Psprite I To I
Next 
'
'Let's go !
'
Amal On 
Multi No 
R=Execall(-132)
' Whe use 4 Pause instructions in the Amal progs, so synchronize it to 
' the same speed.
Psync Every 4
Repeat 
   ' Ok transfer the X/Y and A values to the Psprites and Update them on screen.  
   '  
   Wait Vbl 
   Psync Psprite 0 To 59
Until Left Click
R=Execall(-138)
Multi Yes 
Amal Off 
Erase 1
Erase 10
