From c881f4db22e963941bcaabcae9b1ce005e24c49c Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Fri, 13 Aug 2021 05:28:15 +0100 Subject: [PATCH] dsp_rom: add pseudo code and fix small accuracy issues Doesn't fix anything, hence not upstreaming this. --- docs/DSP/free_dsp_rom/dsp_rom.ds | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/DSP/free_dsp_rom/dsp_rom.ds b/docs/DSP/free_dsp_rom/dsp_rom.ds index 7e845f8a02..5106836658 100644 --- a/docs/DSP/free_dsp_rom/dsp_rom.ds +++ b/docs/DSP/free_dsp_rom/dsp_rom.ds @@ -145,9 +145,15 @@ ORG 0xe7 ; Returns: ; AX0.L is the value of the last sample from input 1 ; AX1.H is the value of the last sample from input 2 +; +; for i = 0..31: +; ar3[i] = ((ar2[i] << 16) + ar0[i] * ar1[0]) >> 16 +; for i = 0..31: +; ix1[i] = ((ix1[i] << 16) + ix0[i] * ar1[2]) >> 16 +; ax0.l = ar0[31] * ar1[0] +; ax1.h = ix0[31] * ar1[2] mix_two_add: call mix_add+#IROM_BASE - iar $AR1 mrr $AR0, $IX0 mrr $AR2, $IX1 mrr $AR3, $IX1 @@ -183,8 +189,14 @@ ORG 0x1f9 ; Returns: ; AX0.L is the value of the last sample ; AX1.H is the first address after the output +; +; for i = 0..31: +; ar3[i] = ((ar2[i] << 16) + ar0[i] * ar1[0]) >> 16 +; ax0.l = ar0[31] * ar1[0] +; ax1.h = ar3 + 32 // assuming ar3 is a s32 pointer mix_add: lrri $AX1.L, @$AR1 + iar $AR1 bloopi #32, ____mix_add_end_loop+#IROM_BASE lrri $AC0.M, @$AR2 lrri $AC0.L, @$AR2 @@ -203,6 +215,13 @@ ____mix_add_end_loop: WARNPC 0x282 ORG 0x282 +; for i = 0..31: +; ar3[i] = ar1[0] + i * ar1[1] +; ar2[i] = ((ar2[i] << 16) + ar0[i] * ar3[i]) >> 16 +; ar3[i+32] = ar1[2] + i * ar1[3] +; ix1[i] = ((ix1[i] << 16) + ix0[i] * ar3[i+32]) >> 16 +; ax0.l = ar0[31] * ar3[31] +; ax1.h = ix0[31] * ar3[63] mix_two_add_ramp: call mix_add_ramp+#IROM_BASE mrr $AR0, $IX0 @@ -227,6 +246,10 @@ sub_8458: WARNPC 0x45d ORG 0x45d +; for i = 0..31: +; ar3[i] = ar1[0] + i * ar1[1] +; ar2[i] = ((ar2[i] << 16) + ar0[i] * ar3[i]) >> 16 +; ax0.l = ar0[31] * ar3[31] mix_add_ramp: clr $ACC0 clr $ACC1 @@ -259,7 +282,6 @@ ____mix_add_ramp_end_loop: srri @$AR3, $AC0.L movp $ACC0 mrr $AX0.L, $AC0.M - mrr $AX1.H, $AR3 mrr $AR1, $IX3 mrr $AR3, $IX2 ret