Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function calls itself until there are no more linked PBs
- void Cmd_3() {
- 0248 8e00 set16
- // Save CmdBlockBuf ptr
- 0249 00e0 0e07 sr @0x0e07, $AR0
- // Processes pb.update.updNum[0] to pb.update.updNum[5]
- // Applies specified number of updates for every millisecond of voice frame (5 millisecs)
- // first millisec's updates are ignored <- not proven, yet
- // 024b 0080 0ba2 lri $AR0, #0x0ba2 // pb.update.updNum[0]
- // 024d 0081 03c0 lri $AR1, #0x03c0
- // 024f 0e05 lris $AC0.M, #0x05
- // 0250 00fe 0e04 sr @0x0e04, $AC0.M // counter to decrement
- // 0252 8900 clr $ACC1
- u16* pUpdates_this_ms = 0x0ba2
- u16* pUpdate_block = 0x03c0
- u16 ms_remaining = 5
- NextMillisecUpd:
- // 0253 8150 clr'l $ACC0 : $AX0.H, @$AR0
- // 0254 009f 0b80 lri $AC1.M, #0x0b80
- // 0256 007a 025b bloop $AX0.H, 0x025b
- // 0258 193e lrri $AC0.M, @$AR1
- // 0259 4c49 add'l $ACC0, $ACC1 : $AX1.L, @$AR1
- // 025a 1c5e mrr $AR2, $AC0.M
- // 025b 1a59 srr @$AR2, $AX1.L // AR2 isn't changed till updates are done
- // Write updates from update_block to pb in dram
- for (int i = 0; i < *pUpdates_this_ms; i+=2) {
- // Looks like 0x03c0 is a struct of <offset, value> pairs to write into PB
- *(0x0b80 + *(pUpdate_block + i)) = *(pUpdate_block + i + 1)
- }
- pUpdates_this_ms++
- // 025c 0083 0e05 lri $AR3, #0x0e05
- // 025e 1b61 srri @$AR3, $AR1
- // 025f 1b60 srri @$AR3, $AR0
- *0x0e05 = pUpdate_block
- *0x0e06 = pUpdates_this_ms
- // They are restored before jmping back to NextMillisecUpd
- // 0260 00de 0b87 lr $AC0.M, @0x0b87
- // 0262 0601 cmpis $AC0.M, #0x01
- // 0263 0295 0267 jz 0x0267
- // 0265 029f 0332 jmp 0x0332
- if (pb.state == AX_PB_STATE_RUN) {
- // 0267 00de 0e42 lr $AC0.M, @0x0e42
- // 0269 00fe 0e1c sr @0x0e1c, $AC0.M
- *0x0e1c = *0x0e42
- // 026b 00c3 0e15 lr $AR3, @0x0e15
- // 026d 177f callr $AR3
- DoSelectedSRC()
- // Volume Envelope Processing
- // 026e 8e00 set16
- // 026f 8a00 m2
- // 0270 8100 clr $ACC0
- // 0271 8900 clr $ACC1
- // 0272 00de 0bb3 lr $AC0.M, @0x0bb3 // currentDelta (s16)
- // 0274 00df 0bb2 lr $AC1.M, @0x0bb2 // currentVolume (u16)
- // 0276 1f1f mrr $AX0.L, $AC1.M
- // 0277 4d00 add $ACC1, $ACC0
- // 0278 1481 asl $ACC0, #1
- // 0279 8d1e set15'mv : $AX1.H, $AC0.M // unsigned mulx,
- // 027a 1fd8 mrr $AC0.M, $AX0.L
- // 027b 0098 8000 lri $AX0.L, #0x8000
- // 027d 0080 0e44 lri $AR0, #0x0e44
- // 027f a830 mulx's $AX0.L, $AX1.H : @$AR0, $AC0.M
- // 0280 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0281 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0282 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0283 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0284 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0285 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0286 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0287 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0288 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0289 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 028a ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 028b ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 028c ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 028d ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 028e ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 028f ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0290 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0291 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0292 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0293 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0294 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0295 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0296 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0297 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 0298 ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 0299 ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 029a ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 029b ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 029c ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 029d ad30 mulxac's $AX0.L, $AX1.H, $ACC1 : @$AR0, $AC0.M
- // 029e ac38 mulxac's $AX0.L, $AX1.H, $ACC0 : @$AR0, $AC1.M
- // 029f 00fe 0bb2 sr @0x0bb2, $AC0.M
- u40 temp1 = pb.ve.currentVolume << 16
- u40 temp2 = (pb.ve.currentVolume + pb.ve.currentDelta) << 16
- *0x0e44 = temp1 >> 16
- *0x0e45 = temp2 >> 16
- u40 PROD = (u16)0x8000 * (u16)(pb.ve.currentDelta << 1) * 2
- for (u16* i = 0x0e46; i < 0x0e46 + 30; i+=2) {
- temp1 += PROD
- temp2 += PROD
- *i = temp1 >> 16
- *(i + 1) = temp2 >> 16
- }
- temp1 += PROD
- pb.ve.currentVolume = temp1 >> 16
- // 02a1 8f00 set40
- // 02a2 0080 0e44 lri $AR0, #0x0e44
- // 02a4 00c1 0e43 lr $AR1, @0x0e43
- // 02a6 1c61 mrr $AR3, $AR1
- // 02a7 193a lrri $AX0.H, @$AR1
- // 02a8 1918 lrri $AX0.L, @$AR0
- // 02a9 9059 mul'l $AX0.L, $AX0.H : $AX1.H, @$AR1
- // 02aa 1919 lrri $AX1.L, @$AR0
- // 02ab 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02ac 8080 nx'ls : $AX0.L, $AC0.M
- // 02ad 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02ae 8091 nx'ls : $AX1.L, $AC1.M
- // 02af 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02b0 8080 nx'ls : $AX0.L, $AC0.M
- // 02b1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02b2 8091 nx'ls : $AX1.L, $AC1.M
- // 02b3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02b4 8080 nx'ls : $AX0.L, $AC0.M
- // 02b5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02b6 8091 nx'ls : $AX1.L, $AC1.M
- // 02b7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02b8 8080 nx'ls : $AX0.L, $AC0.M
- // 02b9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02ba 8091 nx'ls : $AX1.L, $AC1.M
- // 02bb 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02bc 8080 nx'ls : $AX0.L, $AC0.M
- // 02bd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02be 8091 nx'ls : $AX1.L, $AC1.M
- // 02bf 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02c0 8080 nx'ls : $AX0.L, $AC0.M
- // 02c1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02c2 8091 nx'ls : $AX1.L, $AC1.M
- // 02c3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02c4 8080 nx'ls : $AX0.L, $AC0.M
- // 02c5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02c6 8091 nx'ls : $AX1.L, $AC1.M
- // 02c7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02c8 8080 nx'ls : $AX0.L, $AC0.M
- // 02c9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02ca 8091 nx'ls : $AX1.L, $AC1.M
- // 02cb 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02cc 8080 nx'ls : $AX0.L, $AC0.M
- // 02cd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02ce 8091 nx'ls : $AX1.L, $AC1.M
- // 02cf 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02d0 8080 nx'ls : $AX0.L, $AC0.M
- // 02d1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02d2 8091 nx'ls : $AX1.L, $AC1.M
- // 02d3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02d4 8080 nx'ls : $AX0.L, $AC0.M
- // 02d5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02d6 8091 nx'ls : $AX1.L, $AC1.M
- // 02d7 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02d8 8080 nx'ls : $AX0.L, $AC0.M
- // 02d9 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02da 8091 nx'ls : $AX1.L, $AC1.M
- // 02db 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02dc 8080 nx'ls : $AX0.L, $AC0.M
- // 02dd 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02de 8091 nx'ls : $AX1.L, $AC1.M
- // 02df 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02e0 8080 nx'ls : $AX0.L, $AC0.M
- // 02e1 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02e2 8091 nx'ls : $AX1.L, $AC1.M
- // 02e3 9e51 mulmv'l $AX1.L, $AX1.H, $ACC0 : $AX0.H, @$AR1
- // 02e4 8080 nx'ls : $AX0.L, $AC0.M
- // 02e5 9759 mulmv'l $AX0.L, $AX0.H, $ACC1 : $AX1.H, @$AR1
- // 02e6 8091 nx'ls : $AX1.L, $AC1.M
- // 02e7 9e00 mulmv $AX1.L, $AX1.H, $ACC0
- // 02e8 6f33 movp's $ACC1 : @$AR3, $AC0.M
- // 02e9 1b7f srri @$AR3, $AC1.M
- u16* dst = *0x0e43
- u16* temp1 = 0x0e44
- for (x = 0; x < 0x20; x++) {
- *(dst + x) = ((u16)*(temp1 + x) * (u16)*(dst + x) * 2) >> 16
- }
- // 02ea 00c3 0e14 lr $AR3, @0x0e14
- // 02ec 8f00 set40
- // 02ed 8d00 set15
- // 02ee 8a00 m2
- // 02ef 177f callr $AR3
- // Keep in mind: 40bit, unsigned, *2
- DoSelectedMixer()
- // Note: 40bit, unsigned, *2 not changed till 0x0332
- // 02f0 8100 clr $ACC0
- // 02f1 00de 0b9b lr $AC0.M, @0x0b9b
- // 02f3 b100 tst $ACC0
- // 02f4 0295 032a jz 0x032a
- if (pb.itd.flag != AX_PB_ITD_OFF) {
- // 02f6 00de 0e42 lr $AC0.M, @0x0e42
- // 02f8 00fe 0e43 sr @0x0e43, $AC0.M
- *0x0e43 = *0x0e42
- // 02fa 8100 clr $ACC0
- // 02fb 8900 clr $ACC1
- // 02fc 00de 0b9e lr $AC0.M, @0x0b9e
- // 02fe 00df 0ba0 lr $AC1.M, @0x0ba0
- // 0300 8200 cmp
- // 0301 0293 0306 jle 0x0306
- if (pb.itd.shiftL > pb.itd.targetShiftL) {
- // 0303 7800 decm $AC0.M
- // 0304 029f 0309 jmp 0x0309
- pb.itd.shiftL--
- } else if (pb.itd.shiftL < pb.itd.targetShiftL) {
- // 0306 0295 0309 jz 0x0309
- // 0308 7400 incm $AC0.M
- pb.itd.shiftL++
- }
- // 0309 00fe 0b9e sr @0x0b9e, $AC0.M // Store pb.itd.shiftL
- // 030b 00df 0e43 lr $AC1.M, @0x0e43
- // 030d 05e0 addis $AC1.M, #0xe0
- // 030e 4c00 add $ACC0, $ACC1
- // 030f 00fe 0e40 sr @0x0e40, $AC0.M
- *0x0e40 = *0x0e43 - 32
- // 0311 8100 clr $ACC0
- // 0312 8900 clr $ACC1
- // 0313 00de 0b9f lr $AC0.M, @0x0b9f
- // 0315 00df 0ba1 lr $AC1.M, @0x0ba1
- // 0317 8200 cmp
- // 0318 0293 031d jle 0x031d
- if (pb.itd.shiftR > pb.itd.targetShiftR) {
- // 031a 7800 decm $AC0.M
- // 031b 029f 0320 jmp 0x0320
- pb.itd.shiftR--
- } else if (pb.itd.shiftR < pb.itd.targetShiftR) {
- // 031d 0295 0320 jz 0x0320
- // 031f 7400 incm $AC0.M
- pb.itd.shiftR++
- }
- // 0320 00fe 0b9f sr @0x0b9f, $AC0.M // Store pb.itd.shiftR
- // 0322 00df 0e43 lr $AC1.M, @0x0e43
- // 0324 05e0 addis $AC1.M, #0xe0
- // 0325 4c00 add $ACC0, $ACC1
- // 0326 00fe 0e41 sr @0x0e41, $AC0.M
- *0x0e41 = *0x0e43 - 32
- 0328 029f 0332 jmp 0x0332
- } else { // pb.itd.flag == AX_PB_ITD_OFF
- // 032a 00de 0e42 lr $AC0.M, @0x0e42
- // 032c 00fe 0e40 sr @0x0e40, $AC0.M
- // 032e 00fe 0e41 sr @0x0e41, $AC0.M
- // 0330 00fe 0e43 sr @0x0e43, $AC0.M
- *0x0e40 = *0x0e42
- *0x0e41 = *0x0e42
- *0x0e43 = *0x0e42
- }
- }
- // 0332 8100 clr $ACC0
- // 0333 8e00 set16
- // 0334 8400 clrp
- // 0335 8900 clr $ACC1
- // 0336 1efe mrr $PROD.M2, $AC0.M
- // 0337 0e40 lris $AC0.M, #0x40
- // 0338 1ebe mrr $PROD.M1, $AC0.M
- // 0339 0083 0e08 lri $AR3, #0x0e08
- // 033b 1c03 mrr $AR0, $AR3
- // 033c 1ff5 mrr $AC1.M, $PROD.M1
- // 033d 191a lrri $AX0.H, @$AR0
- // 033e f858 addpaxz'l $ACC0, $AX0.H : $AX1.H, @$AR0
- // 033f fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
- // 0340 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
- // 0341 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
- // 0342 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
- // 0343 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
- // 0344 f8b1 addpaxz'ls $ACC0, $AX0.H : $AX1.H, $AC1.M
- // 0345 fba0 addpaxz'ls $ACC1, $AX1.H : $AX0.H, $AC0.M
- // 0346 f83b addpaxz's $ACC0, $AX0.H : @$AR3, $AC1.M
- // 0347 1b7e srri @$AR3, $AC0.M
- for (u16* i = 0x0e08; i <= 0x0e10; i++) {
- *i = (u16)( (0xff00400000 + (u40)(*i << 16)) >> 16 )
- }
- // 0348 0083 0e04 lri $AR3, #0x0e04
- // 034a 8100 clr $ACC0
- // 034b 8973 clr'l $ACC1 : $AC0.M, @$AR3
- // 034c 1961 lrri $AR1, @$AR3 // 0x0e05
- // 034d 1960 lrri $AR0, @$AR3 // 0x0e06
- // 034e 7800 decm $AC0.M
- // 034f 00fe 0e04 sr @0x0e04, $AC0.M
- // 0351 0294 0253 jnz 0x0253
- ms_remaining--
- if (ms_remaining)
- goto NextMillisecUpd
- // 0353 8e00 set16
- // 0354 8100 clr $ACC0
- // 0355 00de 0b9b lr $AC0.M, @0x0b9b
- // 0357 b100 tst $ACC0
- // 0358 0295 036a jz 0x036a
- if (pb.itd.flag != AX_PB_ITD_OFF) {
- // 035a 00de 0b9c lr $AC0.M, @0x0b9c
- // 035c 00dc 0b9d lr $AC0.L, @0x0b9d
- // 035e 2ece srs @DSMAH, $AC0.M
- // 035f 2ccf srs @DSMAL, $AC0.L
- // 0360 8100 clr $ACC0
- // 0361 00de 0e1c lr $AC0.M, @0x0e1c
- // 0363 2ecd srs @DSPA, $AC0.M
- // 0364 16c9 0001 si @DSCR, #0x0001
- // 0366 16cb 0040 si @DSBL, #0x0040
- // DMA 0x40bytes from DRAM @ (*0x0e1c) to CPU @ ((pb.itd.bufferHi << 16) | pb.itd.bufferLo)
- // 0368 02bf 055c call 0x055c
- WaitDMA();
- }
- // 036a 8100 clr $ACC0
- // 036b 8900 clr $ACC1
- // 036c 00de 0b82 lr $AC0.M, @0x0b82
- // 036e 00df 0b83 lr $AC1.M, @0x0b83
- u16 maddrh = pb.currHi
- u16 maddrl = pb.currLo
- // This writes back the whole PB to mram from dsp
- // 0370 2ece srs @DSMAH, $AC0.M
- // 0371 2fcf srs @DSMAL, $AC1.M
- // 0372 16cd 0b80 si @DSPA, #0x0b80
- // 0374 16c9 0001 si @DSCR, #0x0001
- // 0376 16cb 00c0 si @DSBL, #0x00c0
- // DMA 0xc0bytes from DRAM @ 0x0b80 to CPU @ maddr
- // 0378 02bf 055c call 0x055c
- WaitDMA();
- // 037a 8100 clr $ACC0
- // 037b 00de 0b80 lr $AC0.M, @0x0b80
- // 037d 00dc 0b81 lr $AC0.L, @0x0b81
- // 037f b100 tst $ACC0
- // 0380 0294 0386 jnz 0x0386
- if (((pb.nextHi << 16) | pb.nextLo) == 0) {
- // No more PBs!
- // Restore CmdBlockBuf ptr
- 0382 00c0 0e07 lr $AR0, @0x0e07
- // 0384 029f 0068 jmp 0x0068
- goto DoNextCommand;
- }
- // DMA in the next PB
- // From here on out, it's the same as Cmd2, except it calls itself to process the PB it just loaded
- // 0386 2ece srs @DSMAH, $AC0.M
- // 0387 2ccf srs @DSMAL, $AC0.L
- // 0388 16cd 0b80 si @DSPA, #0x0b80
- // 038a 16c9 0000 si @DSCR, #0x0000
- // 038c 16cb 00c0 si @DSBL, #0x00c0
- // DMA 0xc0bytes from CPU @ ((pb.nextHi << 16) | pb.nextLo) to DRAM @ 0x0b80
- // 038e 0082 0e08 lri $AR2, #0x0e08
- // 0390 009f 0000 lri $AC1.M, #0x0000
- // 0392 1b5f srri @$AR2, $AC1.M
- // 0393 009f 0140 lri $AC1.M, #0x0140
- // 0395 1b5f srri @$AR2, $AC1.M
- // 0396 009f 0280 lri $AC1.M, #0x0280
- // 0398 1b5f srri @$AR2, $AC1.M
- // 0399 009f 0400 lri $AC1.M, #0x0400
- // 039b 1b5f srri @$AR2, $AC1.M
- // 039c 009f 0540 lri $AC1.M, #0x0540
- // 039e 1b5f srri @$AR2, $AC1.M
- // 039f 009f 0680 lri $AC1.M, #0x0680
- // 03a1 1b5f srri @$AR2, $AC1.M
- // 03a2 009f 07c0 lri $AC1.M, #0x07c0
- // 03a4 1b5f srri @$AR2, $AC1.M
- // 03a5 009f 0900 lri $AC1.M, #0x0900
- // 03a7 1b5f srri @$AR2, $AC1.M
- // 03a8 009f 0a40 lri $AC1.M, #0x0a40
- // 03aa 1b5f srri @$AR2, $AC1.M
- *0x0e08 = 0x0000
- *0x0e09 = 0x0140
- *0x0e0a = 0x0280
- *0x0e0b = 0x0400
- *0x0e0c = 0x0540
- *0x0e0d = 0x0680
- *0x0e0e = 0x07c0
- *0x0e0f = 0x0900
- *0x0e10 = 0x0a40
- // 03ab 02bf 055c call 0x055c
- WaitDMA();
- // 03ad 00de 0ba7 lr $AC0.M, @0x0ba7
- // 03af 00df 0ba8 lr $AC1.M, @0x0ba8
- // 03b1 2ece srs @DSMAH, $AC0.M
- // 03b2 2fcf srs @DSMAL, $AC1.M
- // 03b3 16cd 03c0 si @DSPA, #0x03c0
- // 03b5 16c9 0000 si @DSCR, #0x0000
- // 03b7 16cb 0080 si @DSBL, #0x0080
- // DMA 0x80bytes from CPU @ ((pb.update.dataHi << 16) | pb.update.dataLo) to DRAM @ 0x03c0
- // 03b9 8100 clr $ACC0
- // 03ba 8900 clr $ACC1
- // 03bb 00de 0b84 lr $AC0.M, @0x0b84
- // 03bd 009f 0b31 lri $AC1.M, #0x0b31
- // 03bf 4c00 add $ACC0, $ACC1
- // 03c0 1c7e mrr $AR3, $AC0.M
- // 03c1 0213 ilrr $AC0.M, @$AR3
- // 03c2 00fe 0e15 sr @0x0e15, $AC0.M
- *0x0e15 = *(0x0b31 + pb.srcSelect) // func ptr for src
- // 03c4 00de 0b85 lr $AC0.M, @0x0b85
- // 03c6 009f 0b34 lri $AC1.M, #0x0b34
- // 03c8 4c00 add $ACC0, $ACC1
- // 03c9 1c7e mrr $AR3, $AC0.M
- // 03ca 0213 ilrr $AC0.M, @$AR3
- // 03cb 00fe 0e16 sr @0x0e16, $AC0.M
- *0x0e16 = *(0x0b34 + pb.coefSelect) // ptr to coef table
- // 03cd 00de 0b86 lr $AC0.M, @0x0b86
- // 03cf 009f 0b11 lri $AC1.M, #0x0b11
- // 03d1 4c00 add $ACC0, $ACC1
- // 03d2 1c7e mrr $AR3, $AC0.M
- // 03d3 0213 ilrr $AC0.M, @$AR3
- // 03d4 00fe 0e14 sr @0x0e14, $AC0.M
- *0x0e14 = *(0x0b11 + pb.mixerCtrl) // func ptr for mixer
- // 03d6 8100 clr $ACC0
- // 03d7 00de 0b9b lr $AC0.M, @0x0b9b
- // 03d9 b100 tst $ACC0
- // 03da 0295 0403 jz 0x0403
- if (pb.itd.flag != AX_PB_ITD_OFF) {
- // 03dc 8900 clr $ACC1
- // 03dd 00df 0b9e lr $AC1.M, @0x0b9e
- // 03df 0300 0cc0 addi $AC1.M, #0x0cc0
- // 03e1 00ff 0e40 sr @0x0e40, $AC1.M
- *0x0e40 = 0x0cc0 + pb.itd.shiftL
- // 03e3 00df 0b9f lr $AC1.M, @0x0b9f
- // 03e5 0300 0cc0 addi $AC1.M, #0x0cc0
- // 03e7 00ff 0e41 sr @0x0e41, $AC1.M
- *0x0e41 = 0x0cc0 + pb.itd.shiftR
- // 03e9 009f 0ce0 lri $AC1.M, #0x0ce0
- // 03eb 00ff 0e42 sr @0x0e42, $AC1.M
- // 03ed 00ff 0e43 sr @0x0e43, $AC1.M
- *0x0e42 = 0x0ce0
- *0x0e43 = 0x0ce0
- // 03ef 02bf 055c call 0x055c
- WaitDMA();
- // 03f1 00de 0b9c lr $AC0.M, @0x0b9c
- // 03f3 2ece srs @DSMAH, $AC0.M
- // 03f4 00de 0b9d lr $AC0.M, @0x0b9d
- // 03f6 2ecf srs @DSMAL, $AC0.M
- // 03f7 16cd 0cc0 si @DSPA, #0x0cc0
- // 03f9 16c9 0000 si @DSCR, #0x0000
- // 03fb 16cb 0040 si @DSBL, #0x0040
- // DMA 0x0040bytes to DMEM @ 0x0cc0 from CPU @ (pb.itd.bufferHi << 16) | pb.itd.bufferLo
- // 03fd 02bf 055c call 0x055c
- WaitDMA();
- // Restore CmdBlockBuf ptr
- 03ff 00c0 0e07 lr $AR0, @0x0e07
- // 0401 029f 0248 jmp 0x0248
- goto Cmd_3() // Calls itself till there are no more PBs linked
- } else {
- // 0403 009f 0ce0 lri $AC1.M, #0x0ce0
- // 0405 00ff 0e42 sr @0x0e42, $AC1.M
- // 0407 00ff 0e40 sr @0x0e40, $AC1.M
- // 0409 00ff 0e41 sr @0x0e41, $AC1.M
- // 040b 00ff 0e43 sr @0x0e43, $AC1.M
- *0x0e42 = 0x0ce0
- *0x0e40 = 0x0ce0
- *0x0e41 = 0x0ce0
- *0x0e43 = 0x0ce0
- // 040d 02bf 055c call 0x055c
- WaitDMA();
- // Restore CmdBlockBuf ptr
- 040f 00c0 0e07 lr $AR0, @0x0e07
- // 0411 029f 0248 jmp 0x0248
- goto Cmd_3() // Calls itself till there are no more PBs linked
- }
- }
Add Comment
Please, Sign In to add comment