summaryrefslogtreecommitdiff
path: root/apps/dsp_cf.S
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp_cf.S')
-rw-r--r--apps/dsp_cf.S40
1 files changed, 30 insertions, 10 deletions
diff --git a/apps/dsp_cf.S b/apps/dsp_cf.S
index e4869b7c9a..fec00020b5 100644
--- a/apps/dsp_cf.S
+++ b/apps/dsp_cf.S
@@ -415,11 +415,11 @@ channels_process_sound_chan_karaoke:
415 .align 2 415 .align 2
416 .global sample_output_stereo 416 .global sample_output_stereo
417sample_output_stereo: 417sample_output_stereo:
418 lea.l -44(%sp), %sp | save registers 418 lea.l -48(%sp), %sp | save registers
419 move.l %macsr, %d1 | do it now as at many lines will 419 move.l %macsr, %d1 | do it now as at many lines will
420 movem.l %d1-%d7/%a2-%a5, (%sp) | be the far more common condition 420 movem.l %d1-%d7/%a2-%a6, (%sp) | be the far more common condition
421 move.l #0x80, %macsr | put emac unit in signed int mode 421 move.l #0x80, %macsr | put emac unit in signed int mode
422 movem.l 48(%sp), %a0-%a2/%a4 | 422 movem.l 52(%sp), %a0-%a2/%a4 |
423 lea.l (%a4, %a0.l*4), %a0 | %a0 = end address 423 lea.l (%a4, %a0.l*4), %a0 | %a0 = end address
424 move.l (%a1), %d1 | %a1 = multiplier: (1 << (16 - scale)) 424 move.l (%a1), %d1 | %a1 = multiplier: (1 << (16 - scale))
425 sub.l #16, %d1 | 425 sub.l #16, %d1 |
@@ -427,6 +427,7 @@ sample_output_stereo:
427 moveq.l #1, %d0 | 427 moveq.l #1, %d0 |
428 asl.l %d1, %d0 | 428 asl.l %d1, %d0 |
429 move.l %d0, %a1 | 429 move.l %d0, %a1 |
430 move.l #0x8000, %a6 | %a6 = rounding term
430 movem.l (%a2), %a2-%a3 | get L/R channel pointers 431 movem.l (%a2), %a2-%a3 | get L/R channel pointers
431 moveq.l #28, %d0 | %d0 = second line bound 432 moveq.l #28, %d0 | %d0 = second line bound
432 add.l %a4, %d0 | 433 add.l %a4, %d0 |
@@ -438,6 +439,8 @@ sample_output_stereo:
438 bls.b 20f | line loop start | no? start line loop 439 bls.b 20f | line loop start | no? start line loop
43910: | long loop 0 | 44010: | long loop 0 |
440 move.l (%a2)+, %d1 | read longword from L and R 441 move.l (%a2)+, %d1 | read longword from L and R
442 move.l %a6, %acc0 |
443 move.l %acc0, %acc1 |
441 mac.l %d1, %a1, (%a3)+, %d2, %acc0 | shift L to high word 444 mac.l %d1, %a1, (%a3)+, %d2, %acc0 | shift L to high word
442 mac.l %d2, %a1, %acc1 | shift R to high word 445 mac.l %d2, %a1, %acc1 | shift R to high word
443 movclr.l %acc0, %d1 | get possibly saturated results 446 movclr.l %acc0, %d1 | get possibly saturated results
@@ -451,6 +454,10 @@ sample_output_stereo:
451 lea.l -12(%a0), %a5 | %a5 = at or just before last line bound 454 lea.l -12(%a0), %a5 | %a5 = at or just before last line bound
45230: | line loop | 45530: | line loop |
453 move.l (%a3)+, %d4 | get next 4 R samples and scale 456 move.l (%a3)+, %d4 | get next 4 R samples and scale
457 move.l %a6, %acc0 |
458 move.l %acc0, %acc1 |
459 move.l %acc1, %acc2 |
460 move.l %acc2, %acc3 |
454 mac.l %d4, %a1, (%a3)+, %d5, %acc0 | with saturation 461 mac.l %d4, %a1, (%a3)+, %d5, %acc0 | with saturation
455 mac.l %d5, %a1, (%a3)+, %d6, %acc1 | 462 mac.l %d5, %a1, (%a3)+, %d6, %acc1 |
456 mac.l %d6, %a1, (%a3)+, %d7, %acc2 | 463 mac.l %d6, %a1, (%a3)+, %d7, %acc2 |
@@ -460,6 +467,10 @@ sample_output_stereo:
460 movclr.l %acc1, %d5 | 467 movclr.l %acc1, %d5 |
461 movclr.l %acc2, %d6 | 468 movclr.l %acc2, %d6 |
462 movclr.l %acc3, %d7 | 469 movclr.l %acc3, %d7 |
470 move.l %a6, %acc0 |
471 move.l %acc0, %acc1 |
472 move.l %acc1, %acc2 |
473 move.l %acc2, %acc3 |
463 mac.l %d0, %a1, (%a2)+, %d1, %acc0 | get next 4 L samples and scale 474 mac.l %d0, %a1, (%a2)+, %d1, %acc0 | get next 4 L samples and scale
464 mac.l %d1, %a1, (%a2)+, %d2, %acc1 | with saturation 475 mac.l %d1, %a1, (%a2)+, %d2, %acc1 | with saturation
465 mac.l %d2, %a1, (%a2)+, %d3, %acc2 | 476 mac.l %d2, %a1, (%a2)+, %d3, %acc2 |
@@ -484,6 +495,8 @@ sample_output_stereo:
484 bls.b 60f | output end | no? stop 495 bls.b 60f | output end | no? stop
48550: | long loop 1 | 49650: | long loop 1 |
486 move.l (%a2)+, %d1 | handle trailing longwords 497 move.l (%a2)+, %d1 | handle trailing longwords
498 move.l %a6, %acc0 |
499 move.l %acc0, %acc1 |
487 mac.l %d1, %a1, (%a3)+, %d2, %acc0 | the same way as leading ones 500 mac.l %d1, %a1, (%a3)+, %d2, %acc0 | the same way as leading ones
488 mac.l %d2, %a1, %acc1 | 501 mac.l %d2, %a1, %acc1 |
489 movclr.l %acc0, %d1 | 502 movclr.l %acc0, %d1 |
@@ -494,9 +507,9 @@ sample_output_stereo:
494 cmp.l %a4, %a0 | 507 cmp.l %a4, %a0 |
495 bhi.b 50b | long loop 1 508 bhi.b 50b | long loop 1
49660: | output end | 50960: | output end |
497 movem.l (%sp), %d1-%d7/%a2-%a5 | restore registers 510 movem.l (%sp), %d1-%d7/%a2-%a6 | restore registers
498 move.l %d1, %macsr | 511 move.l %d1, %macsr |
499 lea.l 44(%sp), %sp | cleanup 512 lea.l 48(%sp), %sp | cleanup
500 rts | 513 rts |
501 .size sample_output_stereo, .-sample_output_stereo 514 .size sample_output_stereo, .-sample_output_stereo
502 515
@@ -510,17 +523,18 @@ sample_output_stereo:
510 .align 2 523 .align 2
511 .global sample_output_mono 524 .global sample_output_mono
512sample_output_mono: 525sample_output_mono:
513 lea.l -28(%sp), %sp | save registers 526 lea.l -32(%sp), %sp | save registers
514 move.l %macsr, %d1 | do it now as at many lines will 527 move.l %macsr, %d1 | do it now as at many lines will
515 movem.l %d1-%d5/%a2-%a3, (%sp) | be the far more common condition 528 movem.l %d1-%d5/%a2-%a4, (%sp) | be the far more common condition
516 move.l #0x80, %macsr | put emac unit in signed int mode 529 move.l #0x80, %macsr | put emac unit in signed int mode
517 movem.l 32(%sp), %a0-%a3 | 530 movem.l 36(%sp), %a0-%a3 |
518 lea.l (%a3, %a0.l*4), %a0 | %a0 = end address 531 lea.l (%a3, %a0.l*4), %a0 | %a0 = end address
519 move.l (%a1), %d1 | %d5 = multiplier: (1 << (16 - scale)) 532 move.l (%a1), %d1 | %d5 = multiplier: (1 << (16 - scale))
520 sub.l #16, %d1 | 533 sub.l #16, %d1 |
521 neg.l %d1 | 534 neg.l %d1 |
522 moveq.l #1, %d5 | 535 moveq.l #1, %d5 |
523 asl.l %d1, %d5 | 536 asl.l %d1, %d5 |
537 move.l #0x8000, %a4 | %a4 = rounding term
524 movem.l (%a2), %a2 | get source channel pointer 538 movem.l (%a2), %a2 | get source channel pointer
525 moveq.l #28, %d0 | %d0 = second line bound 539 moveq.l #28, %d0 | %d0 = second line bound
526 add.l %a3, %d0 | 540 add.l %a3, %d0 |
@@ -532,6 +546,7 @@ sample_output_mono:
532 bls.b 20f | line loop start | no? start line loop 546 bls.b 20f | line loop start | no? start line loop
53310: | long loop 0 | 54710: | long loop 0 |
534 move.l (%a2)+, %d1 | read longword from L and R 548 move.l (%a2)+, %d1 | read longword from L and R
549 move.l %a4, %acc0 |
535 mac.l %d1, %d5, %acc0 | shift L to high word 550 mac.l %d1, %d5, %acc0 | shift L to high word
536 movclr.l %acc0, %d1 | get possibly saturated results 551 movclr.l %acc0, %d1 | get possibly saturated results
537 move.l %d1, %d2 | 552 move.l %d1, %d2 |
@@ -544,6 +559,10 @@ sample_output_mono:
544 lea.l -12(%a0), %a1 | %a1 = at or just before last line bound 559 lea.l -12(%a0), %a1 | %a1 = at or just before last line bound
54530: | line loop | 56030: | line loop |
546 move.l (%a2)+, %d0 | get next 4 L samples and scale 561 move.l (%a2)+, %d0 | get next 4 L samples and scale
562 move.l %a4, %acc0 |
563 move.l %acc0, %acc1 |
564 move.l %acc1, %acc2 |
565 move.l %acc2, %acc3 |
547 mac.l %d0, %d5, (%a2)+, %d1, %acc0 | with saturation 566 mac.l %d0, %d5, (%a2)+, %d1, %acc0 | with saturation
548 mac.l %d1, %d5, (%a2)+, %d2, %acc1 | 567 mac.l %d1, %d5, (%a2)+, %d2, %acc1 |
549 mac.l %d2, %d5, (%a2)+, %d3, %acc2 | 568 mac.l %d2, %d5, (%a2)+, %d3, %acc2 |
@@ -573,6 +592,7 @@ sample_output_mono:
573 bls.b 60f | output end | no? stop 592 bls.b 60f | output end | no? stop
57450: | loop loop 1 | 59350: | loop loop 1 |
575 move.l (%a2)+, %d1 | handle trailing longwords 594 move.l (%a2)+, %d1 | handle trailing longwords
595 move.l %a4, %acc0 |
576 mac.l %d1, %d5, %acc0 | the same way as leading ones 596 mac.l %d1, %d5, %acc0 | the same way as leading ones
577 movclr.l %acc0, %d1 | 597 movclr.l %acc0, %d1 |
578 move.l %d1, %d2 | 598 move.l %d1, %d2 |
@@ -582,8 +602,8 @@ sample_output_mono:
582 cmp.l %a3, %a0 | 602 cmp.l %a3, %a0 |
583 bhi.b 50b | long loop 1 | 603 bhi.b 50b | long loop 1 |
58460: | output end | 60460: | output end |
585 movem.l (%sp), %d1-%d5/%a2-%a3 | restore registers 605 movem.l (%sp), %d1-%d5/%a2-%a4 | restore registers
586 move.l %d1, %macsr | 606 move.l %d1, %macsr |
587 lea.l 28(%sp), %sp | cleanup 607 lea.l 32(%sp), %sp | cleanup
588 rts | 608 rts |
589 .size sample_output_mono, .-sample_output_mono 609 .size sample_output_mono, .-sample_output_mono