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

  1. ' ---------------------------------  
  2. '
  3. ' AMOSPro Compiler Example 
  4. '
  5. ' Cycling Plasma     
  6. '
  7. ' By Jean-Baptiste BOLCATO 
  8. '
  9. ' (c) 1993 Europress Software Ltd. 
  10. '
  11. ' ---------------------------------  
  12. '
  13. '
  14. ' --------------------------------------------       
  15. ' Remark: What about a little Plasma effect?     
  16. '
  17. '         Average Acceleration:  260 % 
  18. '
  19. '         Test configuration: A1200, 6Mb 
  20. '         Original AMOS Compiler:  240 % 
  21. ' --------------------------------------------       
  22.  
  23. ' ---- Variables Init ---- 
  24.  
  25. Set Buffer 4
  26.  
  27. ' Ntsc test
  28. XMAX=256
  29. YMAX=256-56*(Ntsc=True)
  30.  
  31. ' Plasma calculation zone  
  32. XBLOCK=248
  33. YBLOCK=248
  34.  
  35. 'Precalculate circle-scroll coords 
  36. Degree 
  37. Dim X(360),Y(360)
  38. XMID=XBLOCK-XMAX/2
  39. YMID=YBLOCK-YMAX/2
  40. For A=1 To 360
  41.    X(A)=XMID+XMID*Cos(A)
  42.    Y(A)=YMID+YMID*Sin(A)
  43. Next A
  44.  
  45. ' ---- Screen Init ----
  46.  
  47. Screen Open 0,512,512,32,Lowres
  48. Screen Display 0,160,50,XMAX,YMAX
  49. Flash Off : Curs Off : Hide 
  50. For I=1 To 15
  51.    Colour I,$800+I*$11
  52.    Colour 31-I,$800+I*$11
  53. Next I
  54. Colour 31,$700
  55. Cls 0 : Wait Vbl 
  56.  
  57. ' ---- Main Loop ----
  58.  
  59.  
  60. Timer=0
  61.  
  62. ' Describe whole plasma zone 
  63. For Y=0 To YBLOCK/2
  64.    For X=0 To XBLOCK/2
  65.       
  66.       ' Calculate x,y-pixel's ink
  67.       IK=X*X
  68.       IK=IK+Y*Y
  69.       IK=IK/16
  70.       IK=IK mod 31
  71.       Inc IK
  72.       
  73.       ' Draw pixel 
  74.       Ink IK
  75.       Plot X,Y
  76.       Plot XBLOCK-X,Y
  77.       Plot X,YBLOCK-Y
  78.       Plot XBLOCK-X,YBLOCK-Y
  79.       
  80.    Next X
  81. Next Y
  82.  
  83. ' Pattern copy 
  84. Screen Copy 0,0,0,248,248 To 0,248,0
  85. Screen Copy 0,0,0,248,248 To 0,0,248
  86. Screen Copy 0,0,0,248,248 To 0,248,248
  87.  
  88. ' --- Final Report --- 
  89.  
  90. T#=Timer
  91.  
  92. Screen Open 1,320,32,2,Lowres
  93. Palette 0,$FFF : Paper 0 : Pen 1
  94. Curs Off : Cls 0
  95. Print "      --- Final status report ---      "
  96. Print 
  97. Print Using "< Needs####.##s to draw whole plasma >";T#/50
  98.  
  99. ' --- Final Fireworks! ---   
  100.  
  101. ' Cycle colors 
  102. Screen 0
  103. Shift Up 1,1,31,1
  104.  
  105. ' Screen circle scroll 
  106. Repeat 
  107.    Add A,1,1 To 360
  108.    Screen Offset 0,X(A),Y(A)
  109.    Wait Vbl 
  110. Until Mouse Key or(Inkey$<>"")
  111.  
  112. End