Guest User

Untitled

a guest
Jul 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.87 KB | None | 0 0
  1. // Function calls itself until there are no more linked PBs
  2. void Cmd_3() {
  3. 0248 8e00 set16
  4.  
  5. // Save CmdBlockBuf ptr
  6. 0249 00e0 0e07 sr @0x0e07, $AR0
  7.  
  8. // Processes pb.update.updNum[0] to pb.update.updNum[5]
  9. // Applies specified number of updates for every millisecond of voice frame (5 millisecs)
  10. // first millisec's updates are ignored <- not proven, yet
  11.  
  12. // 024b 0080 0ba2 lri $AR0, #0x0ba2 // pb.update.updNum[0]
  13. // 024d 0081 03c0 lri $AR1, #0x03c0
  14. // 024f 0e05 lris $AC0.M, #0x05
  15. // 0250 00fe 0e04 sr @0x0e04, $AC0.M // counter to decrement
  16. // 0252 8900 clr $ACC1
  17. u16* pUpdates_this_ms = 0x0ba2
  18. u16* pUpdate_block = 0x03c0
  19. u16 ms_remaining = 5
  20.  
  21. NextMillisecUpd:
  22. // 0253 8150 clr'l $ACC0 : $AX0.H, @$AR0
  23. // 0254 009f 0b80 lri $AC1.M, #0x0b80
  24. // 0256 007a 025b bloop $AX0.H, 0x025b
  25. // 0258 193e lrri $AC0.M, @$AR1
  26. // 0259 4c49 add'l $ACC0, $ACC1 : $AX1.L, @$AR1
  27. // 025a 1c5e mrr $AR2, $AC0.M
  28. // 025b 1a59 srr @$AR2, $AX1.L // AR2 isn't changed till updates are done
  29.  
  30. // Write updates from update_block to pb in dram
  31. for (int i = 0; i < *pUpdates_this_ms; i+=2) {
  32. // Looks like 0x03c0 is a struct of <offset, value> pairs to write into PB
  33. *(0x0b80 + *(pUpdate_block + i)) = *(pUpdate_block + i + 1)
  34. }
  35. pUpdates_this_ms++
  36.  
  37. // 025c 0083 0e05 lri $AR3, #0x0e05
  38. // 025e 1b61 srri @$AR3, $AR1
  39. // 025f 1b60 srri @$AR3, $AR0
  40. *0x0e05 = pUpdate_block
  41. *0x0e06 = pUpdates_this_ms
  42. // They are restored before jmping back to NextMillisecUpd
  43.  
  44. // 0260 00de 0b87 lr $AC0.M, @0x0b87
  45. // 0262 0601 cmpis $AC0.M, #0x01
  46. // 0263 0295 0267 jz 0x0267
  47. // 0265 029f 0332 jmp 0x0332
  48. if (pb.state == AX_PB_STATE_RUN) {
  49.  
  50. // 0267 00de 0e42 lr $AC0.M, @0x0e42
  51. // 0269 00fe 0e1c sr @0x0e1c, $AC0.M
  52. *0x0e1c = *0x0e42
  53.  
  54. // 026b 00c3 0e15 lr $AR3, @0x0e15
  55. // 026d 177f callr $AR3
  56. DoSelectedSRC()
  57.  
  58. // Volume Envelope Processing
  59. // 026e 8e00 set16
  60. // 026f 8a00 m2
  61. // 0270 8100 clr $ACC0
  62. // 0271 8900 clr $ACC1
  63. // 0272 00de 0bb3 lr $AC0.M, @0x0bb3 // currentDelta (s16)
  64. // 0274 00df 0bb2 lr $AC1.M, @0x0bb2 // currentVolume (u16)
  65. // 0276 1f1f mrr $AX0.L, $AC1.M
  66. // 0277 4d00 add $ACC1, $ACC0
  67. // 0278 1481 asl $ACC0, #1
  68. // 0279 8d1e set15'mv : $AX1.H, $AC0.M // unsigned mulx,
  69. // 027a 1fd8 mrr $AC0.M, $AX0.L
  70. // 027b 0098 8000 lri $AX0.L, #0x8000
  71. // 027d 0080 0e44 lri $AR0, #0x0e44
  72. // 027f a830 mulx's $AX0.L, $AX1.H : @$AR0, $AC0.M
  73. // 0280 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  74. // 0281 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  75. // 0282 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  76. // 0283 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  77. // 0284 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  78. // 0285 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  79. // 0286 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  80. // 0287 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  81. // 0288 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  82. // 0289 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  83. // 028a ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  84. // 028b ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  85. // 028c ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  86. // 028d ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  87. // 028e ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  88. // 028f ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  89. // 0290 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  90. // 0291 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  91. // 0292 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  92. // 0293 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  93. // 0294 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  94. // 0295 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  95. // 0296 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  96. // 0297 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  97. // 0298 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  98. // 0299 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  99. // 029a ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  100. // 029b ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  101. // 029c ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  102. // 029d ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
  103. // 029e ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
  104. // 029f 00fe 0bb2 sr @0x0bb2, $AC0.M
  105.  
  106. u40 temp1 = pb.ve.currentVolume << 16
  107. u40 temp2 = (pb.ve.currentVolume + pb.ve.currentDelta) << 16
  108. *0x0e44 = temp1 >> 16
  109. *0x0e45 = temp2 >> 16
  110.  
  111. u40 PROD = (u16)0x8000 * (u16)(pb.ve.currentDelta << 1) * 2
  112. for (u16* i = 0x0e46; i < 0x0e46 + 30; i+=2) {
  113. temp1 += PROD
  114. temp2 += PROD
  115.  
  116. *i = temp1 >> 16
  117. *(i + 1) = temp2 >> 16
  118. }
  119. temp1 += PROD
  120. pb.ve.currentVolume = temp1 >> 16
  121.  
  122. // 02a1 8f00 set40
  123. // 02a2 0080 0e44 lri $AR0, #0x0e44
  124. // 02a4 00c1 0e43 lr $AR1, @0x0e43
  125. // 02a6 1c61 mrr $AR3, $AR1
  126. // 02a7 193a lrri $AX0.H, @$AR1
  127. // 02a8 1918 lrri $AX0.L, @$AR0
  128. // 02a9 9059 mul'l $AX0.L, $AX0.H : $AX1.H, @$AR1
  129. // 02aa 1919 lrri $AX1.L, @$AR0
  130. // 02ab 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  131. // 02ac 8080 nx'ls : $AX0.L, $AC0.M
  132. // 02ad 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  133. // 02ae 8091 nx'ls : $AX1.L, $AC1.M
  134. // 02af 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  135. // 02b0 8080 nx'ls : $AX0.L, $AC0.M
  136. // 02b1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  137. // 02b2 8091 nx'ls : $AX1.L, $AC1.M
  138. // 02b3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  139. // 02b4 8080 nx'ls : $AX0.L, $AC0.M
  140. // 02b5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  141. // 02b6 8091 nx'ls : $AX1.L, $AC1.M
  142. // 02b7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  143. // 02b8 8080 nx'ls : $AX0.L, $AC0.M
  144. // 02b9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  145. // 02ba 8091 nx'ls : $AX1.L, $AC1.M
  146. // 02bb 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  147. // 02bc 8080 nx'ls : $AX0.L, $AC0.M
  148. // 02bd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  149. // 02be 8091 nx'ls : $AX1.L, $AC1.M
  150. // 02bf 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  151. // 02c0 8080 nx'ls : $AX0.L, $AC0.M
  152. // 02c1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  153. // 02c2 8091 nx'ls : $AX1.L, $AC1.M
  154. // 02c3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  155. // 02c4 8080 nx'ls : $AX0.L, $AC0.M
  156. // 02c5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  157. // 02c6 8091 nx'ls : $AX1.L, $AC1.M
  158. // 02c7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  159. // 02c8 8080 nx'ls : $AX0.L, $AC0.M
  160. // 02c9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  161. // 02ca 8091 nx'ls : $AX1.L, $AC1.M
  162. // 02cb 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  163. // 02cc 8080 nx'ls : $AX0.L, $AC0.M
  164. // 02cd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  165. // 02ce 8091 nx'ls : $AX1.L, $AC1.M
  166. // 02cf 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  167. // 02d0 8080 nx'ls : $AX0.L, $AC0.M
  168. // 02d1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  169. // 02d2 8091 nx'ls : $AX1.L, $AC1.M
  170. // 02d3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  171. // 02d4 8080 nx'ls : $AX0.L, $AC0.M
  172. // 02d5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  173. // 02d6 8091 nx'ls : $AX1.L, $AC1.M
  174. // 02d7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  175. // 02d8 8080 nx'ls : $AX0.L, $AC0.M
  176. // 02d9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  177. // 02da 8091 nx'ls : $AX1.L, $AC1.M
  178. // 02db 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  179. // 02dc 8080 nx'ls : $AX0.L, $AC0.M
  180. // 02dd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  181. // 02de 8091 nx'ls : $AX1.L, $AC1.M
  182. // 02df 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  183. // 02e0 8080 nx'ls : $AX0.L, $AC0.M
  184. // 02e1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  185. // 02e2 8091 nx'ls : $AX1.L, $AC1.M
  186. // 02e3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
  187. // 02e4 8080 nx'ls : $AX0.L, $AC0.M
  188. // 02e5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
  189. // 02e6 8091 nx'ls : $AX1.L, $AC1.M
  190. // 02e7 9e00 mulmv $AX1.L, $AX1.H, $ACC0
  191. // 02e8 6f33 movp's $ACC1 : @$AR3, $AC0.M
  192. // 02e9 1b7f srri @$AR3, $AC1.M
  193.  
  194. u16* dst = *0x0e43
  195. u16* temp1 = 0x0e44
  196.  
  197. for (x = 0; x < 0x20; x++) {
  198. *(dst + x) = ((u16)*(temp1 + x) * (u16)*(dst + x) * 2) >> 16
  199. }
  200.  
  201. // 02ea 00c3 0e14 lr $AR3, @0x0e14
  202. // 02ec 8f00 set40
  203. // 02ed 8d00 set15
  204. // 02ee 8a00 m2
  205. // 02ef 177f callr $AR3
  206. // Keep in mind: 40bit, unsigned, *2
  207. DoSelectedMixer()
  208.  
  209. // Note: 40bit, unsigned, *2 not changed till 0x0332
  210.  
  211. // 02f0 8100 clr $ACC0
  212. // 02f1 00de 0b9b lr $AC0.M, @0x0b9b
  213. // 02f3 b100 tst $ACC0
  214. // 02f4 0295 032a jz 0x032a
  215. if (pb.itd.flag != AX_PB_ITD_OFF) {
  216. // 02f6 00de 0e42 lr $AC0.M, @0x0e42
  217. // 02f8 00fe 0e43 sr @0x0e43, $AC0.M
  218. *0x0e43 = *0x0e42
  219.  
  220. // 02fa 8100 clr $ACC0
  221. // 02fb 8900 clr $ACC1
  222. // 02fc 00de 0b9e lr $AC0.M, @0x0b9e
  223. // 02fe 00df 0ba0 lr $AC1.M, @0x0ba0
  224. // 0300 8200 cmp
  225. // 0301 0293 0306 jle 0x0306
  226. if (pb.itd.shiftL > pb.itd.targetShiftL) {
  227. // 0303 7800 decm $AC0.M
  228. // 0304 029f 0309 jmp 0x0309
  229. pb.itd.shiftL--
  230. } else if (pb.itd.shiftL < pb.itd.targetShiftL) {
  231. // 0306 0295 0309 jz 0x0309
  232. // 0308 7400 incm $AC0.M
  233. pb.itd.shiftL++
  234. }
  235. // 0309 00fe 0b9e sr @0x0b9e, $AC0.M // Store pb.itd.shiftL
  236.  
  237. // 030b 00df 0e43 lr $AC1.M, @0x0e43
  238. // 030d 05e0 addis $AC1.M, #0xe0
  239. // 030e 4c00 add $ACC0, $ACC1
  240. // 030f 00fe 0e40 sr @0x0e40, $AC0.M
  241. *0x0e40 = *0x0e43 - 32
  242.  
  243. // 0311 8100 clr $ACC0
  244. // 0312 8900 clr $ACC1
  245. // 0313 00de 0b9f lr $AC0.M, @0x0b9f
  246. // 0315 00df 0ba1 lr $AC1.M, @0x0ba1
  247. // 0317 8200 cmp
  248. // 0318 0293 031d jle 0x031d
  249. if (pb.itd.shiftR > pb.itd.targetShiftR) {
  250. // 031a 7800 decm $AC0.M
  251. // 031b 029f 0320 jmp 0x0320
  252. pb.itd.shiftR--
  253. } else if (pb.itd.shiftR < pb.itd.targetShiftR) {
  254. // 031d 0295 0320 jz 0x0320
  255. // 031f 7400 incm $AC0.M
  256. pb.itd.shiftR++
  257. }
  258. // 0320 00fe 0b9f sr @0x0b9f, $AC0.M // Store pb.itd.shiftR
  259.  
  260. // 0322 00df 0e43 lr $AC1.M, @0x0e43
  261. // 0324 05e0 addis $AC1.M, #0xe0
  262. // 0325 4c00 add $ACC0, $ACC1
  263. // 0326 00fe 0e41 sr @0x0e41, $AC0.M
  264. *0x0e41 = *0x0e43 - 32
  265.  
  266. 0328 029f 0332 jmp 0x0332
  267.  
  268. } else { // pb.itd.flag == AX_PB_ITD_OFF
  269.  
  270. // 032a 00de 0e42 lr $AC0.M, @0x0e42
  271. // 032c 00fe 0e40 sr @0x0e40, $AC0.M
  272. // 032e 00fe 0e41 sr @0x0e41, $AC0.M
  273. // 0330 00fe 0e43 sr @0x0e43, $AC0.M
  274. *0x0e40 = *0x0e42
  275. *0x0e41 = *0x0e42
  276. *0x0e43 = *0x0e42
  277. }
  278. }
  279.  
  280.  
  281. // 0332 8100 clr $ACC0
  282. // 0333 8e00 set16
  283. // 0334 8400 clrp
  284. // 0335 8900 clr $ACC1
  285. // 0336 1efe mrr $PROD.M2, $AC0.M
  286. // 0337 0e40 lris $AC0.M, #0x40
  287. // 0338 1ebe mrr $PROD.M1, $AC0.M
  288. // 0339 0083 0e08 lri $AR3, #0x0e08
  289. // 033b 1c03 mrr $AR0, $AR3
  290. // 033c 1ff5 mrr $AC1.M, $PROD.M1
  291. // 033d 191a lrri $AX0.H, @$AR0
  292. // 033e f858 addpaxz'l $ACC0, $AX0.H : $AX1.H, @$AR0
  293. // 033f fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
  294. // 0340 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
  295. // 0341 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
  296. // 0342 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
  297. // 0343 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
  298. // 0344 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
  299. // 0345 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
  300. // 0346 f83b addpaxz's $ACC0, $AX0.H : @$AR3, $AC1.M
  301. // 0347 1b7e srri @$AR3, $AC0.M
  302.  
  303. for (u16* i = 0x0e08; i <= 0x0e10; i++) {
  304. *i = (u16)( (0xff00400000 + (u40)(*i << 16)) >> 16 )
  305. }
  306.  
  307. // 0348 0083 0e04 lri $AR3, #0x0e04
  308. // 034a 8100 clr $ACC0
  309. // 034b 8973 clr'l $ACC1 : $AC0.M, @$AR3
  310. // 034c 1961 lrri $AR1, @$AR3 // 0x0e05
  311. // 034d 1960 lrri $AR0, @$AR3 // 0x0e06
  312. // 034e 7800 decm $AC0.M
  313. // 034f 00fe 0e04 sr @0x0e04, $AC0.M
  314. // 0351 0294 0253 jnz 0x0253
  315. ms_remaining--
  316. if (ms_remaining)
  317. goto NextMillisecUpd
  318.  
  319. // 0353 8e00 set16
  320. // 0354 8100 clr $ACC0
  321. // 0355 00de 0b9b lr $AC0.M, @0x0b9b
  322. // 0357 b100 tst $ACC0
  323. // 0358 0295 036a jz 0x036a
  324. if (pb.itd.flag != AX_PB_ITD_OFF) {
  325.  
  326. // 035a 00de 0b9c lr $AC0.M, @0x0b9c
  327. // 035c 00dc 0b9d lr $AC0.L, @0x0b9d
  328. // 035e 2ece srs @DSMAH, $AC0.M
  329. // 035f 2ccf srs @DSMAL, $AC0.L
  330. // 0360 8100 clr $ACC0
  331. // 0361 00de 0e1c lr $AC0.M, @0x0e1c
  332. // 0363 2ecd srs @DSPA, $AC0.M
  333. // 0364 16c9 0001 si @DSCR, #0x0001
  334. // 0366 16cb 0040 si @DSBL, #0x0040
  335.  
  336. // DMA 0x40bytes from DRAM @ (*0x0e1c) to CPU @ ((pb.itd.bufferHi << 16) | pb.itd.bufferLo)
  337.  
  338. // 0368 02bf 055c call 0x055c
  339. WaitDMA();
  340. }
  341.  
  342. // 036a 8100 clr $ACC0
  343. // 036b 8900 clr $ACC1
  344. // 036c 00de 0b82 lr $AC0.M, @0x0b82
  345. // 036e 00df 0b83 lr $AC1.M, @0x0b83
  346. u16 maddrh = pb.currHi
  347. u16 maddrl = pb.currLo
  348.  
  349. // This writes back the whole PB to mram from dsp
  350. // 0370 2ece srs @DSMAH, $AC0.M
  351. // 0371 2fcf srs @DSMAL, $AC1.M
  352. // 0372 16cd 0b80 si @DSPA, #0x0b80
  353. // 0374 16c9 0001 si @DSCR, #0x0001
  354. // 0376 16cb 00c0 si @DSBL, #0x00c0
  355.  
  356. // DMA 0xc0bytes from DRAM @ 0x0b80 to CPU @ maddr
  357.  
  358. // 0378 02bf 055c call 0x055c
  359. WaitDMA();
  360.  
  361. // 037a 8100 clr $ACC0
  362. // 037b 00de 0b80 lr $AC0.M, @0x0b80
  363. // 037d 00dc 0b81 lr $AC0.L, @0x0b81
  364. // 037f b100 tst $ACC0
  365. // 0380 0294 0386 jnz 0x0386
  366. if (((pb.nextHi << 16) | pb.nextLo) == 0) {
  367. // No more PBs!
  368.  
  369. // Restore CmdBlockBuf ptr
  370. 0382 00c0 0e07 lr $AR0, @0x0e07
  371. // 0384 029f 0068 jmp 0x0068
  372. goto DoNextCommand;
  373. }
  374.  
  375. // DMA in the next PB
  376. // From here on out, it's the same as Cmd2, except it calls itself to process the PB it just loaded
  377.  
  378. // 0386 2ece srs @DSMAH, $AC0.M
  379. // 0387 2ccf srs @DSMAL, $AC0.L
  380. // 0388 16cd 0b80 si @DSPA, #0x0b80
  381. // 038a 16c9 0000 si @DSCR, #0x0000
  382. // 038c 16cb 00c0 si @DSBL, #0x00c0
  383.  
  384. // DMA 0xc0bytes from CPU @ ((pb.nextHi << 16) | pb.nextLo) to DRAM @ 0x0b80
  385.  
  386. // 038e 0082 0e08 lri $AR2, #0x0e08
  387. // 0390 009f 0000 lri $AC1.M, #0x0000
  388. // 0392 1b5f srri @$AR2, $AC1.M
  389. // 0393 009f 0140 lri $AC1.M, #0x0140
  390. // 0395 1b5f srri @$AR2, $AC1.M
  391. // 0396 009f 0280 lri $AC1.M, #0x0280
  392. // 0398 1b5f srri @$AR2, $AC1.M
  393. // 0399 009f 0400 lri $AC1.M, #0x0400
  394. // 039b 1b5f srri @$AR2, $AC1.M
  395. // 039c 009f 0540 lri $AC1.M, #0x0540
  396. // 039e 1b5f srri @$AR2, $AC1.M
  397. // 039f 009f 0680 lri $AC1.M, #0x0680
  398. // 03a1 1b5f srri @$AR2, $AC1.M
  399. // 03a2 009f 07c0 lri $AC1.M, #0x07c0
  400. // 03a4 1b5f srri @$AR2, $AC1.M
  401. // 03a5 009f 0900 lri $AC1.M, #0x0900
  402. // 03a7 1b5f srri @$AR2, $AC1.M
  403. // 03a8 009f 0a40 lri $AC1.M, #0x0a40
  404. // 03aa 1b5f srri @$AR2, $AC1.M
  405. *0x0e08 = 0x0000
  406. *0x0e09 = 0x0140
  407. *0x0e0a = 0x0280
  408. *0x0e0b = 0x0400
  409. *0x0e0c = 0x0540
  410. *0x0e0d = 0x0680
  411. *0x0e0e = 0x07c0
  412. *0x0e0f = 0x0900
  413. *0x0e10 = 0x0a40
  414.  
  415. // 03ab 02bf 055c call 0x055c
  416. WaitDMA();
  417.  
  418. // 03ad 00de 0ba7 lr $AC0.M, @0x0ba7
  419. // 03af 00df 0ba8 lr $AC1.M, @0x0ba8
  420. // 03b1 2ece srs @DSMAH, $AC0.M
  421. // 03b2 2fcf srs @DSMAL, $AC1.M
  422. // 03b3 16cd 03c0 si @DSPA, #0x03c0
  423. // 03b5 16c9 0000 si @DSCR, #0x0000
  424. // 03b7 16cb 0080 si @DSBL, #0x0080
  425.  
  426. // DMA 0x80bytes from CPU @ ((pb.update.dataHi << 16) | pb.update.dataLo) to DRAM @ 0x03c0
  427.  
  428. // 03b9 8100 clr $ACC0
  429. // 03ba 8900 clr $ACC1
  430.  
  431. // 03bb 00de 0b84 lr $AC0.M, @0x0b84
  432. // 03bd 009f 0b31 lri $AC1.M, #0x0b31
  433. // 03bf 4c00 add $ACC0, $ACC1
  434. // 03c0 1c7e mrr $AR3, $AC0.M
  435. // 03c1 0213 ilrr $AC0.M, @$AR3
  436. // 03c2 00fe 0e15 sr @0x0e15, $AC0.M
  437. *0x0e15 = *(0x0b31 + pb.srcSelect) // func ptr for src
  438.  
  439. // 03c4 00de 0b85 lr $AC0.M, @0x0b85
  440. // 03c6 009f 0b34 lri $AC1.M, #0x0b34
  441. // 03c8 4c00 add $ACC0, $ACC1
  442. // 03c9 1c7e mrr $AR3, $AC0.M
  443. // 03ca 0213 ilrr $AC0.M, @$AR3
  444. // 03cb 00fe 0e16 sr @0x0e16, $AC0.M
  445. *0x0e16 = *(0x0b34 + pb.coefSelect) // ptr to coef table
  446.  
  447. // 03cd 00de 0b86 lr $AC0.M, @0x0b86
  448. // 03cf 009f 0b11 lri $AC1.M, #0x0b11
  449. // 03d1 4c00 add $ACC0, $ACC1
  450. // 03d2 1c7e mrr $AR3, $AC0.M
  451. // 03d3 0213 ilrr $AC0.M, @$AR3
  452. // 03d4 00fe 0e14 sr @0x0e14, $AC0.M
  453. *0x0e14 = *(0x0b11 + pb.mixerCtrl) // func ptr for mixer
  454.  
  455. // 03d6 8100 clr $ACC0
  456. // 03d7 00de 0b9b lr $AC0.M, @0x0b9b
  457. // 03d9 b100 tst $ACC0
  458. // 03da 0295 0403 jz 0x0403
  459. if (pb.itd.flag != AX_PB_ITD_OFF) {
  460. // 03dc 8900 clr $ACC1
  461. // 03dd 00df 0b9e lr $AC1.M, @0x0b9e
  462. // 03df 0300 0cc0 addi $AC1.M, #0x0cc0
  463. // 03e1 00ff 0e40 sr @0x0e40, $AC1.M
  464. *0x0e40 = 0x0cc0 + pb.itd.shiftL
  465.  
  466. // 03e3 00df 0b9f lr $AC1.M, @0x0b9f
  467. // 03e5 0300 0cc0 addi $AC1.M, #0x0cc0
  468. // 03e7 00ff 0e41 sr @0x0e41, $AC1.M
  469. *0x0e41 = 0x0cc0 + pb.itd.shiftR
  470.  
  471. // 03e9 009f 0ce0 lri $AC1.M, #0x0ce0
  472. // 03eb 00ff 0e42 sr @0x0e42, $AC1.M
  473. // 03ed 00ff 0e43 sr @0x0e43, $AC1.M
  474. *0x0e42 = 0x0ce0
  475. *0x0e43 = 0x0ce0
  476.  
  477. // 03ef 02bf 055c call 0x055c
  478. WaitDMA();
  479.  
  480. // 03f1 00de 0b9c lr $AC0.M, @0x0b9c
  481. // 03f3 2ece srs @DSMAH, $AC0.M
  482. // 03f4 00de 0b9d lr $AC0.M, @0x0b9d
  483. // 03f6 2ecf srs @DSMAL, $AC0.M
  484. // 03f7 16cd 0cc0 si @DSPA, #0x0cc0
  485. // 03f9 16c9 0000 si @DSCR, #0x0000
  486. // 03fb 16cb 0040 si @DSBL, #0x0040
  487.  
  488. // DMA 0x0040bytes to DMEM @ 0x0cc0 from CPU @ (pb.itd.bufferHi << 16) | pb.itd.bufferLo
  489.  
  490. // 03fd 02bf 055c call 0x055c
  491. WaitDMA();
  492.  
  493. // Restore CmdBlockBuf ptr
  494. 03ff 00c0 0e07 lr $AR0, @0x0e07
  495. // 0401 029f 0248 jmp 0x0248
  496. goto Cmd_3() // Calls itself till there are no more PBs linked
  497.  
  498. } else {
  499.  
  500. // 0403 009f 0ce0 lri $AC1.M, #0x0ce0
  501. // 0405 00ff 0e42 sr @0x0e42, $AC1.M
  502. // 0407 00ff 0e40 sr @0x0e40, $AC1.M
  503. // 0409 00ff 0e41 sr @0x0e41, $AC1.M
  504. // 040b 00ff 0e43 sr @0x0e43, $AC1.M
  505. *0x0e42 = 0x0ce0
  506. *0x0e40 = 0x0ce0
  507. *0x0e41 = 0x0ce0
  508. *0x0e43 = 0x0ce0
  509.  
  510. // 040d 02bf 055c call 0x055c
  511. WaitDMA();
  512.  
  513. // Restore CmdBlockBuf ptr
  514. 040f 00c0 0e07 lr $AR0, @0x0e07
  515. // 0411 029f 0248 jmp 0x0248
  516. goto Cmd_3() // Calls itself till there are no more PBs linked
  517. }
  518. }
Add Comment
Please, Sign In to add comment