home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Multi_Rainbows.AMOS / Multi_Rainbows.amosSourceCode
Encoding:
AMOS Source Code  |  1993-03-10  |  8.0 KB  |  268 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*   MULTI-RAINBOWS-DEMO   * 
  5. '*    for V1.1 and over    * 
  6. '*                         * 
  7. '* (c) Europress Software  * 
  8. '*                         * 
  9. '*     Ronnie Simpson      * 
  10. '*       & F.Lionet        * 
  11. '*************************** 
  12. '
  13. Rem *** reserve some memory for the arrays 
  14. '
  15. Dim C(3),CC(3,279)
  16. Global C(),CC(),NRAIN
  17. NRAIN=3
  18. Rem *** define colours to be affected
  19. '
  20. C(0)=1 : C(1)=2 : C(2)=3
  21. Rem *** read the data into the arrays
  22. '
  23. For N=0 To NRAIN-1
  24.    Restore "Rn"+Mid$(Str$(N),2)
  25.    For C=0 To 279
  26.       Read CC(C(N),C)
  27.    Next 
  28. Next 
  29. Rem *** load the screen to be displayed  
  30. '
  31. Load Iff "AMOSPro_Tutorial:IFF/Window.iff",0
  32. Screen Open 1,640,32,2,Hires : Curs Off : Flash Off : Hide 
  33. Palette $22,$CC : Screen Display 1,,140,,
  34. Locate 0,1 : Centre "This is the screen before the multi-rainbows"
  35. Cdown : Centre "Press any mouse key to see the effect."
  36. Repeat : Wait 5 : Until Mouse Key : Screen Close 1
  37. '
  38. Rem *** call the multi_rainbow procedure 
  39. '
  40. _MULTIPLE_RAINBOWS[30]
  41. '
  42. Repeat : Until Mouse Key
  43. Copper On : Wait 50 : Fade 2 : Wait 30
  44. Edit 
  45. '
  46. Procedure _MULTIPLE_RAINBOWS[Y]
  47.    
  48.    ' Ensure the display is stable 
  49.    Wait Vbl : View : Wait Vbl : View : Wait Vbl 
  50.    
  51.    ' Copy the actual copper list in a memory bank 
  52.    Reserve As Work 10,11*1024
  53.    L=0
  54.    Repeat 
  55.       
  56.       C=Leek(Cop Logic+L)
  57.       Loke Start(10)+L,C
  58.       L=L+4
  59.       
  60.    Until C=$FFFFFFFE
  61.    
  62.    ' No more copper 
  63.    Copper Off : Wait Vbl 
  64.    
  65.    ' Where to poke the new list 
  66.    ACOP=Cop Logic : ACH=Start(10)
  67.    
  68.    ' Copy the sprites definitions 
  69.    Cop Move 0,0
  70.    Loke ACOP,Leek(ACH)
  71.    Add ACOP,4 : Add ACH,4
  72.    For N=0 To 15
  73.       Cop Move 0,0
  74.       Loke ACOP,Leek(ACH)
  75.       Add ACOP,4 : Add ACH,4
  76.    Next 
  77.    
  78.    ' Copper-list creation loop  
  79.    Y=30 : YRAIN=0
  80.    Do 
  81.       
  82.       ' Wait for the first line
  83.       Cop Wait 7,Y : ACOP=ACOP+4
  84.       
  85.       ' Get the first position from AMOS list  
  86.       CY=Deek(ACH)/256+YBASE
  87.       
  88.       If Y=CY
  89.          
  90.          ' We take the first instruction in AMOS original 
  91.          ' copper list. This instruction is a WAIT... 
  92.          ACH=ACH+4 : C1=Deek(ACH)
  93.          
  94.          If(C1 and 1)=0
  95.             
  96.             ' We are defining a new screen. Best solution is   
  97.             ' to copy the original definition. We must only
  98.             ' change the colours according to the new rainbows...
  99.             Do 
  100.                
  101.                C1=Deek(ACH) : C2=Deek(ACH+2)
  102.                
  103.                Exit If(C1 and 1)<>0
  104.                
  105.                ' Is the colour copied a colour included in one
  106.                ' of the rainbow?
  107.                For C=0 To NRAIN-1
  108.                   If C1=C(C)*2+$180
  109.                      C2=CC(C(C),YRAIN)
  110.                   End If 
  111.                Next 
  112.                
  113.                Add ACH,4
  114.                Cop Move 0,0
  115.                Doke ACOP,C1 : Doke ACOP+2,C2 : Add ACOP,4
  116.                
  117.             Loop 
  118.          End If 
  119.          
  120.       Else 
  121.          
  122.          ' It is not a screen, lets simply put the current  
  123.          ' colours for all the rainbows 
  124.          For C=0 To NRAIN-1
  125.             Cop Move $180+C(C)*2,CC(C(C),YRAIN) : Add ACOP,4
  126.          Next 
  127.          
  128.       End If 
  129.       
  130.       ' Next line
  131.       Inc Y : Inc YRAIN
  132.       
  133.       ' In PAL, lets skip the 255 wait 
  134.       If Y=256 : YBASE=256 : End If 
  135.       
  136.       ' When do we exit? 
  137.       Exit If Y>311
  138.       Exit If YRAIN>279
  139.       Exit If ACOP-Cop Logic>10*1024
  140.       
  141.    Loop 
  142.    
  143.    ' The end of the list! 
  144.    Cop Wait 255,255
  145.    
  146.    ' Everything is finished, lets display it  
  147.    Cop Swap : Wait Vbl 
  148. End Proc
  149. '
  150. Rem *** the first rainbow definition 
  151. '
  152. RN0:
  153. Data $A00,$900,$800,$700,$600,$500,$400,$300
  154. Data $200,$100,$600,$600,$600,$600,$600,$300
  155. Data $400,$500,$600,$700,$800,$900,$A00,$A00
  156. Data $900,$800,$700,$600,$500,$400,$300,$200
  157. Data $100,$600,$600,$600,$600,$600,$300,$400
  158. Data $500,$600,$700,$800,$900,$A00,$A00,$900
  159. Data $800,$700,$600,$500,$400,$300,$200,$100
  160. Data $600,$600,$600,$600,$600,$300,$400,$500
  161. Data $600,$700,$800,$900,$A00,$A00,$900,$800
  162. Data $700,$600,$500,$400,$300,$200,$100,$600
  163. Data $600,$600,$600,$600,$300,$400,$500,$600
  164. Data $700,$800,$900,$A00,$A00,$900,$800,$700
  165. Data $600,$500,$400,$300,$200,$100,$600,$600
  166. Data $600,$600,$600,$300,$400,$500,$600,$700
  167. Data $800,$900,$A00,$A00,$900,$800,$700,$600
  168. Data $500,$400,$300,$200,$100,$600,$600,$600
  169. Data $600,$600,$300,$400,$500,$600,$700,$800
  170. Data $900,$A00,$A00,$900,$800,$700,$600,$500
  171. Data $400,$300,$200,$100,$600,$600,$600,$600
  172. Data $600,$300,$400,$500,$600,$700,$800,$900
  173. Data $A00,$A00,$900,$800,$700,$600,$500,$400
  174. Data $300,$200,$100,$600,$600,$600,$600,$600
  175. Data $300,$400,$500,$600,$700,$800,$900,$A00
  176. Data $A00,$900,$800,$700,$600,$500,$400,$300
  177. Data $200,$100,$600,$600,$600,$600,$600,$300
  178. Data $400,$500,$600,$700,$800,$900,$A00,$A00
  179. Data $900,$800,$700,$600,$500,$400,$300,$200
  180. Data $100,$600,$600,$600,$600,$600,$300,$400
  181. Data $500,$600,$700,$800,$900,$A00,$A00,$900
  182. Data $800,$700,$600,$500,$400,$300,$200,$100
  183. Data $600,$600,$600,$600,$600,$300,$400,$500
  184. Data $600,$700,$800,$900,$A00,$A00,$900,$800
  185. Data $700,$600,$500,$400,$300,$200,$100,$600
  186. Data $600,$600,$600,$600,$300,$400,$500,$600
  187. Data $700,$800,$900,$A00,$0,$0,$0,$0
  188. Data $0,$0,$0,$0,$0,$0,$0,$0
  189. '
  190. Rem *** the second rainbow definition  
  191. '
  192. RN1:
  193. Data $BEE,$CC,$CC,$CC,$BEE,$CC,$CC,$CC
  194. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  195. Data $CC,$CC,$CC,$BEE,$CC,$CC,$CC,$CC
  196. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  197. Data $CC,$CC,$BEE,$CC,$CC,$CC,$CC,$CC
  198. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  199. Data $CC,$BEE,$CC,$CC,$CC,$CC,$CC,$CC
  200. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  201. Data $BEE,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  202. Data $CC,$CC,$CC,$CC,$CC,$BEE,$CC,$CC
  203. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$BEE
  204. Data $CC,$CC,$CC,$CC,$CC,$CC,$CC,$CC
  205. Data $BEE,$CC,$CC,$CC,$CC,$CC,$CC,$BEE
  206. Data $CC,$CC,$CC,$CC,$BEE,$CC,$CC,$CC
  207. Data $BEE,$CC,$CC,$BEE,$CC,$BEE,$CC,$BEE
  208. Data $CC,$BEE,$CC,$BEE,$BEE,$BEE,$BEE,$BEE
  209. Data $BEE,$CC,$BEE,$BEE,$BEE,$CC,$BEE,$BEE
  210. Data $BEE,$BEE,$BEE,$CC,$BEE,$BEE,$BEE,$BEE
  211. Data $BEE,$AEE,$9EE,$8EE,$8EE,$7EE,$6EE,$5EE
  212. Data $4EE,$3EE,$3EE,$2EE,$2EE,$1DD,$1DD,$4CF
  213. Data $0,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1
  214. Data $2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1
  215. Data $2A1,$80,$11,$55,$55,$55,$55,$55
  216. Data $55,$55,$9AA,$55,$55,$55,$55,$55
  217. Data $55,$55,$11,$80,$80,$2A1,$2A1,$2A1
  218. Data $2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1
  219. Data $2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1
  220. Data $2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1,$2A1
  221. Data $2A1,$2A1,$2A1,$2A1,$EE0,$CC0,$AA0,$880
  222. Data $660,$E0E,$C0C,$A0A,$808,$606,$EE,$CC
  223. Data $AA,$88,$66,$2A1,$2A1,$2A1,$EE0,$CC0
  224. Data $AA0,$880,$660,$E0E,$C0C,$A0A,$808,$606
  225. Data $EE,$CC,$AA,$88,$66,$2A1,$0,$0
  226. Data $0,$0,$0,$0,$0,$0,$0,$0
  227. Data $0,$0,$0,$0,$0,$0,$0,$0
  228. Data $0,$0,$0,$0,$0,$0,$0,$0
  229. '
  230. Rem *** the final rainbow definition   
  231. '
  232. RN2:
  233. Data $0,$0,$0,$0,$0,$0,$0,$0
  234. Data $0,$0,$0,$0,$0,$0,$0,$0
  235. Data $0,$0,$0,$0,$0,$0,$0,$0
  236. Data $0,$0,$0,$0,$0,$0,$0,$0
  237. Data $0,$0,$0,$0,$0,$0,$0,$0
  238. Data $0,$0,$0,$0,$F61,$E50,$F61,$E50
  239. Data $F61,$E50,$D40,$F61,$E50,$D40,$F61,$E50
  240. Data $D40,$C30,$F61,$E50,$D40,$C30,$F61,$E50
  241. Data $D40,$C30,$B20,$F61,$E50,$D40,$C30,$B20
  242. Data $F61,$E50,$D40,$C30,$B20,$A10,$F61,$E50
  243. Data $D40,$C30,$B20,$A10,$F61,$E50,$D40,$C30
  244. Data $B20,$A10,$900,$F61,$E50,$D40,$C30,$B20
  245. Data $A10,$900,$F61,$E50,$D40,$C30,$B20,$A10
  246. Data $900,$800,$F61,$E50,$D40,$C30,$B20,$A10
  247. Data $900,$800,$F61,$E50,$D40,$C30,$B20,$A10
  248. Data $EEE,$DDD,$EEE,$DDD,$EEE,$DDD,$CCC,$EEE
  249. Data $DDD,$CCC,$EEE,$DDD,$CCC,$BBB,$EEE,$DDD
  250. Data $CCC,$BBB,$EEE,$DDD,$CCC,$BBB,$AAA,$EEE
  251. Data $DDD,$CCC,$BBB,$AAA,$EEE,$DDD,$CCC,$BBB
  252. Data $AAA,$999,$EEE,$DDD,$CCC,$BBB,$AAA,$999
  253. Data $EEE,$DDD,$CCC,$BBB,$AAA,$999,$888,$EEE
  254. Data $DDD,$CCC,$BBB,$AAA,$999,$888,$EEE,$DDD
  255. Data $CCC,$BBB,$AAA,$999,$888,$777,$EEE,$DDD
  256. Data $CCC,$BBB,$AAA,$999,$888,$777,$EEE,$DDD
  257. Data $CCC,$BBB,$AAA,$999,$888,$777,$666,$555
  258. Data $444,$333,$222,$111,$0,$0,$0,$0
  259. Data $0,$0,$0,$0,$0,$0,$0,$0
  260. Data $0,$0,$0,$0,$0,$0,$0,$0
  261. Data $0,$0,$0,$0,$0,$0,$0,$0
  262. Data $0,$0,$0,$0,$0,$0,$0,$0
  263. Data $0,$0,$0,$0,$0,$0,$0,$0
  264. Data $0,$0,$0,$0,$0,$0,$0,$0
  265. Data $0,$0,$0,$0,$0,$0,$0,$0
  266. Data $0,$0,$0,$0,$0,$0,$0,$0
  267. Data $0,$0,$0,$0,$0,$0,$0,$0
  268. Data $0,$0,$0,$0,$0,$0,$0,$0