home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 7 / AU_CD7.iso / aujun99 / regulars / starinfo / adcock / _parallax2 / _runimage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1999-02-07  |  7KB  |  243 lines

  1.  Parallax ][   (The sine table's revenge)
  2.   A doodle by Mark Adcock (aka casma)
  3.  Customisations
  4.  ==============
  5. speed%=15
  6.  The Speed of the whole effect. Keep between 10 and 20
  7. high%=1
  8.  If high=1 the plotting routine will use 1x2 blocks (slow risc pc users
  9.  might want to take the WAIT out)
  10.  If high=0 2x2 blocks will be used (Recommeded for pre risc pc machines)
  11. cls%=1
  12.  If low, the routine will only plot non zero pixels. These leaves some interesting trails behind.
  13.  ---- Mess Below here ----          
  14.  13+128:
  15. $;" at line ";
  16.     fp%=8
  17.  ba%(2)
  18. bank%=1
  19.  6,113,1
  20.  6,112,1
  21. ba%(1)=
  22. FindBaseAddress+32
  23.  6,113,2
  24.  6,112,2
  25. ba%(2)=
  26. FindBaseAddress+32
  27. Tables
  28. B%=sin%
  29. twopi=2*
  30. /5120
  31. fpbig%=(2^fp%-1)
  32.  cls% 
  33. .        
  34.     A%=ba%(bank%)
  35.     C%=(a% 
  36.  5120)
  37. 1!    D%=128+128*
  38.  (twopi*a%*2)
  39. 2!    E%=128+128*
  40.  (twopi*a%*2)
  41. 3)    silly!0=fpbig%*(1+
  42.  (twopi*a%/3))
  43. 4)    silly!4=fpbig%*(1+
  44.  (twopi*a%/2))
  45. 5)    silly!8=fpbig%*(1+
  46.  (twopi*a%/4))
  47. 7#    a%=(a%+speed%)
  48. (5120*3*4*2)
  49.  6,113,bank%
  50.     bank%=3-bank%
  51.   A%=ba%(1)
  52.     C%=(a% 
  53.  5120)
  54. @!    D%=128+128*
  55.  (twopi*a%*2)
  56. A!    E%=128+128*
  57.  (twopi*a%*2)
  58. B)    silly!0=fpbig%*(1+
  59.  (twopi*a%/3))
  60. C)    silly!4=fpbig%*(1+
  61.  (twopi*a%/2))
  62. D)    silly!8=fpbig%*(1+
  63.  (twopi*a%/4))
  64. F#    a%=(a%+speed%)
  65. (5120*3*4*2)
  66. Rot(RX%,RY%,ang%)
  67. L:NX%=RX%*(cos%!(4*ang%))-RY%*(sin%!(4*ang%))+(160<<fp%)
  68. M:NY%=RX%*(sin%!(4*ang%))+RY%*(cos%!(4*ang%))+(128<<fp%)
  69. FindBaseAddress
  70.  i% 8
  71. i%!0 = 149
  72. i%!4 =  -1
  73.  "OS_ReadVduVariables",i%,i%
  74. U    =i%!0
  75.  code% 1024
  76. P%=code%
  77. [ OPT 2
  78. .silly     equd   1<<fp%
  79.            equd   1<<fp%
  80.            equd   1<<fp%
  81. .go       mov  r6,#255
  82. a .loop2    rsb  r5,r3,#0     
  83. b           sub  r9,r6,r4     
  84. d"          add  r10,r1,r2,lsl#2
  85. e#          ldr  r11,[r10,#128]  
  86. f#          mul  r7,r11,r5       
  87. g"          ldr  r12,[r10]      
  88. h#          mul  r8,r12,r9       
  89. i#          sub  r7,r7,r8        
  90. j#          add  r7,r7,#128<<fp% 
  91. l"          mul  r8,r5,r12      
  92. m#          mla  r8,r9,r11,r8    
  93. n#          add  r8,r8,#128<<fp% 
  94. p"          rsb  r5,r3,#320     
  95.           
  96. r$          mul  r10,r12,r5       
  97. s$          mla  r10,r11,r9,r10   
  98. t$          mul  r9,r12,r9        
  99. u$          rsb  r9,r9,#0         
  100. v$          mla  r9,r5,r11,r9     
  101. w$          add  r10,r10,#128<<fp%
  102.           adr  r5,silly
  103. y#          ldmia r5,{r5,r11,r12}
  104. z(          mla  r9,r5,r9,r9          
  105. {           mla  r9,r10,r11,r9
  106.           mov  r5,#256
  107.           mla  r9,r5,r12,r9
  108. ~           mov  r9,r9,lsr#fp%
  109. &          sub   r9,r9,r7          
  110.           mov   r9,r9,lsr#8
  111.           sub   r10,r10,r8
  112. !          mov   r10,r10,lsr#8
  113.           
  114.           
  115.           
  116. Line(high%)
  117.           
  118.            subs    r6,r6,#2
  119. "           bge     loop2      
  120.         movs    pc,r14
  121. Store(cls%)
  122.  cls%=0 
  123. [ OPT 2
  124. cmp      r5,#0
  125. strne    r5,[r0],#4
  126. strne    r5,[r0,#316]
  127. addeq    r0,r0,#4
  128. [ OPT 2          
  129. str    r5,[r0],#4
  130. str    r5,[r0,#316]
  131. Line(high%)
  132.  high%=1 
  133. [ OPT 2
  134. stmfd    r13!,{r2}
  135.     .line
  136.             mov      r11,#255
  137. -           add      r2,r1,#(sprite%-sin%)
  138. .loop      ;
  139. +           and      r1,r8,#127<<(fp%+1)
  140. ,           and      r12,r7,#127<<(fp%+1)
  141. '           add      r1,r12,r1,lsl#7
  142. 8           ldrb     r5,[r2,r1,lsr#(fp%+1)]          
  143.             add      r7,r7,r9
  144. 2           add      r8,r8,r10                 
  145.            ;
  146. +           and      r1,r8,#127<<(fp%+1)
  147. ,           and      r12,r7,#127<<(fp%+1)
  148. '           add      r1,r12,r1,lsl#7
  149. .           ldrb     r1,[r2,r1,lsr#(fp%+1)]
  150. &           orr      r5,r5,r1,lsl#8
  151.             add      r7,r7,r9
  152. &           add      r8,r8,r10     
  153.            ;
  154. +           and      r1,r8,#127<<(fp%+1)
  155. ,           and      r12,r7,#127<<(fp%+1)
  156. '           add      r1,r12,r1,lsl#7
  157. .           ldrb     r1,[r2,r1,lsr#(fp%+1)]
  158. '           orr      r5,r5,r1,lsl#16
  159.             add      r7,r7,r9
  160. !           add      r8,r8,r10
  161.            ;
  162. +           and      r1,r8,#127<<(fp%+1)
  163. ,           and      r12,r7,#127<<(fp%+1)
  164. '           add      r1,r12,r1,lsl#7
  165. .           ldrb     r1,[r2,r1,lsr#(fp%+1)]
  166. 2           orr      r5,r5,r1,lsl#24           
  167.             add      r7,r7,r9
  168. &           add      r8,r8,r10     
  169.            ;          
  170. "           
  171. Store(cls%)       
  172.            ;
  173. !           subs    r11,r11,#4
  174.            bge     loop
  175.            ;
  176. %           add     r0,r0,#640-256
  177.                      
  178. ,           sub     r1,r2,#(sprite%-sin%)
  179. !           ldmfd    r13!,{r2}
  180. [ OPT 2
  181. !           stmfd    r13!,{r2}
  182.     .line
  183.             mov      r11,#255
  184. -           add      r2,r1,#(sprite%-sin%)
  185. .loop      ;
  186. +           and      r1,r8,#127<<(fp%+1)
  187. ,           and      r12,r7,#127<<(fp%+1)
  188. '           add      r1,r12,r1,lsl#7
  189. .           ldrb     r1,[r2,r1,lsr#(fp%+1)]
  190. 1           orr      r5,r1,r1,lsl#8           
  191. &           add      r7,r7,r9,lsl#1
  192. 8           add      r8,r8,r10,lsl#1                 
  193.            ;
  194. +           and      r1,r8,#127<<(fp%+1)
  195. ,           and      r12,r7,#127<<(fp%+1)
  196. 1           add      r1,r12,r1,lsl#7          
  197. .           ldrb     r1,[r2,r1,lsr#(fp%+1)]
  198. &           orr      r1,r1,r1,lsl#8
  199. '           orr      r5,r5,r1,lsl#16
  200. &           add      r7,r7,r9,lsl#1
  201. '           add      r8,r8,r10,lsl#1
  202.            ;
  203. &           
  204. Store(cls%)           
  205.            ;
  206. !           subs    r11,r11,#4
  207.            bge     loop
  208.            ;
  209. %           add     r0,r0,#640-256
  210.            
  211. ,           sub     r1,r2,#(sprite%-sin%)
  212. !           ldmfd    r13!,{r2}
  213. Tables
  214.  memory% 1024*4+128*128
  215.     'sin%=memory%:sprite%=memory%+1024*4
  216.  l%=0 
  217.  1023
  218. 'sin%!(l%*4)=
  219. (360*l%/512)*(2^fp%)
  220.  6,112,1
  221.  6,113,1
  222.  "OS_File",5,"<parallax2$dir>.spr" 
  223.  ,,,,spr_len%
  224.  spr% spr_len%+4
  225. !spr%=spr_len%+4
  226.  "OS_File",255,"<parallax2$dir>.spr",spr%+4
  227.  "OS_SpriteOp",47+256,spr%,"big"
  228.  "OS_SpriteOp",34+256,spr%,"big",0,0,&08
  229.  y%=0 
  230.  x%=0 
  231. O  sprite%?(127-((x%+64)
  232. 128)+((y%+64)
  233. 128)*128)=ba%(1)?(x%-32+(255-y%)*320)
  234. FindBaseAddress
  235.  i% 8
  236. i%!0 = 149
  237. i%!4 =  -1
  238.  "OS_ReadVduVariables",i%,i%
  239. &    =i%!0
  240.  ---- Mess above here ----
  241.  As the wise man once said -       "Don't code under pressure..."
  242.  the only reply to the above is -  "...or your head might implode"
  243.