home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / amiga / demos / vivdcmpr.lha / VividMANDEL.C < prev   
Encoding:
C/C++ Source or Header  |  1993-07-23  |  2.7 KB  |  211 lines

  1. /*
  2.  * Mandel.c - TMS34082 SRAM code for Mandelbrot generation on the Vivid 24
  3.  *            ( this works in conjunction with the TMS34020 code which
  4.  *              coordinates the multiple co-processors )
  5.  *
  6.  */
  7.  
  8. register int Row @ RA[0];
  9. register int Column @ RA[1];  
  10. register float DeltaR @ RA[2];
  11. register float ConstI @ RA[3];
  12. register int Color @ RA[4];
  13. register float AR @ RA[5];
  14. register float AR2 @ RA[6];
  15.  
  16. register int HRES @ RB[0];
  17. register float VRES @ RB[1];
  18. register float DeltaI @ RB[2];
  19. register float ConstR @ RB[3];
  20. register float AI @ RB[4];
  21. register float AI2 @ RB[5];
  22.  
  23. int PixelData[2048];
  24.  
  25. void main(void)
  26. {
  27. /$
  28. .asm
  29.     sub         ONE.d,ONE.d,RB0
  30.     movrr       RB0.d,RB1,1
  31.     movrr       RB0.d,RB2,2
  32.     movrr       RB0.d,RB4,4
  33.     movrr       RB0.d,RB8,2
  34.     movrr       RB0.d,RA2,7
  35. .endasm
  36. $/
  37.  
  38. /* Move HRES to RB0 and convert VRES to floating point */
  39.     /$
  40.     .asm
  41.         movrr   RA0.i,@HRES
  42.         itof    RA1,@VRES
  43.     .endasm
  44.     $/
  45.     DeltaI = 2 / VRES;
  46.     DeltaR = 3 / (float)HRES; 
  47.     
  48. /* Signal 34020 we are done with initialization */
  49.     /$
  50.     .asm
  51.         wrap    ONE.f,RB9
  52.     .endasm
  53.     $/ 
  54. }
  55.  
  56. /* This function does one line of the mandelbrot set and then interrupts */
  57. /*  the 34020 so that it can copy the data out to the screen.            */
  58. /* It assumes that RA0 has an integer version of the Row.                */
  59. void func1(void)
  60. {
  61.     ConstI = (DeltaI * (float)Row) - 1;
  62.     ConstR = -2;    
  63.     for(Column = 0; Column < HRES; Column++)
  64.     {
  65.         AR = AI = AR2 = AI2 = 0;
  66.         for(Color = 128; Color > 0; Color--)
  67.         {
  68.             AI = (AR * AI * 2) + ConstI;
  69.             AR = AR2 - AI2 + ConstR;
  70.             AR2 = AR * AR;
  71.             AI2 = AI * AI;
  72.             if((AR2 + AI2) > 4)
  73.                 break;
  74.         }
  75.         PixelData[Column] = Color;        
  76.         ConstR += DeltaR;  
  77.     }
  78.  
  79.     Column = (int)PixelData;
  80.     
  81.     /$
  82.     .asm
  83.     ;put start of pixel data array into MCADDR for TMS34020 copy
  84.         pass    RA1.i,MCADDR
  85.     .endasm
  86.     $/
  87.  
  88. /* Tell 34020 we are done with this row */
  89.     /$
  90.     .asm
  91.         wrap    ONE.f,RB9
  92.     .endasm
  93.     $/
  94. }
  95.  
  96. void func2(void)
  97. {
  98. }
  99.  
  100. void func3(void)
  101. {
  102. }
  103.  
  104. void func4(void)
  105. {
  106. }
  107.  
  108. void func5(void)
  109. {
  110. }
  111. void func6(void)
  112. {
  113. }
  114.  
  115. void func7(void)
  116. {
  117. }
  118.  
  119. void func8(void)
  120. {
  121. }
  122.  
  123. void func9(void)
  124. {
  125. }
  126.  
  127. void func10(void)
  128. {
  129. }
  130.  
  131. void func11(void)
  132. {
  133. }
  134.  
  135. void func12(void)
  136. {
  137. }
  138.  
  139. void func13(void)
  140. {
  141. }
  142. void func14(void)
  143. {
  144. }
  145.  
  146. void func15(void)
  147. {
  148. }
  149.  
  150. void func16(void)
  151. {
  152. }
  153.  
  154. void func17(void)
  155. {
  156. }
  157.  
  158. void func18(void)
  159. {
  160. }
  161.  
  162. void func19(void)
  163. {
  164. }
  165.  
  166. void func20(void)
  167. {
  168. }
  169.  
  170. void func21(void)
  171. {
  172. }
  173. void func22(void)
  174. {
  175. }
  176.  
  177. void func23(void)
  178. {
  179. }
  180.  
  181. void func24(void)
  182. {
  183. }
  184.  
  185. void func25(void)
  186. {
  187. }
  188.  
  189. void func26(void)
  190. {
  191. }
  192.  
  193. void func27(void)
  194. {
  195. }
  196.  
  197. void func28(void)
  198. {
  199. }
  200.  
  201. void func29(void)
  202. {
  203. }
  204. void func30(void)
  205. {
  206. }
  207.  
  208. void func31(void)
  209. {
  210. }
  211.