home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Amos / amproe2x.dms / in.adf / Compiler_Examples / AMOS_versions / Stars1.AMOS / Stars1.amosSourceCode
Encoding:
AMOS Source Code  |  1993-06-16  |  1.8 KB  |  101 lines

  1. ' ---------------------------------  
  2. '
  3. ' AMOSPro Compiler Example 
  4. '
  5. ' Plottin' Stars Scroll
  6. '
  7. ' By Jean-Baptiste BOLCATO 
  8. '
  9. ' (c) 1993 Europress Software Ltd. 
  10. '
  11. ' ---------------------------------  
  12. '
  13. ' --------------------------------------------       
  14. '  Remark: A simple and clean star scroller    
  15. '
  16. '          Average Acceleration:  300 %
  17. '
  18. '          Test configuration: A1200, 6Mb  
  19. '
  20. '          Original AMOS Compiler:  250 %  
  21. ' --------------------------------------------       
  22.  
  23. ' ---- Variables Init ---- 
  24.  
  25. Dim X(512),Y(512),VX(512),N(6)
  26.  
  27. ' Ntsc test
  28. YMAX=256+56*(Ntsc=True)
  29.  
  30. ' Number of stars, timers
  31. N2=0 : N=1 : T=1
  32.  
  33. ' Get random start positions for stars   
  34. For I=1 To 512
  35.    X(I)=Rnd(320)
  36.    Y(I)=Rnd(248-56*(Ntsc=True))+8
  37.    VX(I)=Rnd(4)+1
  38. Next I
  39.  
  40. ' ---- Screen Init ----
  41.  
  42. Screen Open 0,320,YMAX,2,Lowres
  43. Palette 0,$FFF : Cls 0 : Ink 1
  44. Curs Off : Hide 
  45.  
  46. ' ---- Main Loop ----
  47.  
  48. ' switch OFF multitask 
  49. Amos Lock : Break Off 
  50. Dreg(0)=Execall(-132)
  51.  
  52. Repeat 
  53.    
  54.    CPT=0
  55.    
  56.    Repeat 
  57.       
  58.       ' Add a star every 8 loops 
  59.       Inc N2 : If N2=8 : N2=0 : Inc N : End If 
  60.       
  61.       Timer=0
  62.       
  63.       For I=1 To N
  64.          
  65.          ' A simple plot & unplot for the stars!
  66.          Plot X(I),Y(I),0
  67.          Add X(I),VX(I),0 To 319
  68.          Plot X(I),Y(I),1
  69.       Next I
  70.       
  71.       If Timer>T : Inc CPT : End If 
  72.       
  73.    Until CPT>4
  74.    
  75.    ' Needs more than T VBLs to display N stars
  76.    Bell : Home 
  77.    N(T)=N-1
  78.    Print "< Needs";N(T);" stars to pass under";T;" VBL >"
  79.    Inc T
  80.    
  81. Until T=5
  82.  
  83. ' --- Final Report --- 
  84.  
  85. ' Switch ON  multitask 
  86. Dreg(0)=Execall(-138)
  87. Amos Unlock : Break On 
  88.  
  89. Home 
  90. Print "      --- Final status report ---     "
  91. Print 
  92. For T=1 To 4
  93.    Print "< Needs";N(T);" stars to pass under";T;" VBL >"
  94. Next T
  95. Print 
  96. Print "    Press mouse key to end"
  97. Repeat 
  98.    Multi Wait 
  99. Until Mouse Key or(Inkey$<>"")
  100.  
  101. End