dsp_rom: add pseudo code and fix small accuracy issues

Doesn't fix anything, hence not upstreaming this.
This commit is contained in:
Tillmann Karras 2021-08-13 05:28:15 +01:00 committed by Pokechu22
parent d0b40528e5
commit c881f4db22

View File

@ -145,9 +145,15 @@ ORG 0xe7
; Returns: ; Returns:
; AX0.L is the value of the last sample from input 1 ; AX0.L is the value of the last sample from input 1
; AX1.H is the value of the last sample from input 2 ; 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: mix_two_add:
call mix_add+#IROM_BASE call mix_add+#IROM_BASE
iar $AR1
mrr $AR0, $IX0 mrr $AR0, $IX0
mrr $AR2, $IX1 mrr $AR2, $IX1
mrr $AR3, $IX1 mrr $AR3, $IX1
@ -183,8 +189,14 @@ ORG 0x1f9
; Returns: ; Returns:
; AX0.L is the value of the last sample ; AX0.L is the value of the last sample
; AX1.H is the first address after the output ; 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: mix_add:
lrri $AX1.L, @$AR1 lrri $AX1.L, @$AR1
iar $AR1
bloopi #32, ____mix_add_end_loop+#IROM_BASE bloopi #32, ____mix_add_end_loop+#IROM_BASE
lrri $AC0.M, @$AR2 lrri $AC0.M, @$AR2
lrri $AC0.L, @$AR2 lrri $AC0.L, @$AR2
@ -203,6 +215,13 @@ ____mix_add_end_loop:
WARNPC 0x282 WARNPC 0x282
ORG 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: mix_two_add_ramp:
call mix_add_ramp+#IROM_BASE call mix_add_ramp+#IROM_BASE
mrr $AR0, $IX0 mrr $AR0, $IX0
@ -227,6 +246,10 @@ sub_8458:
WARNPC 0x45d WARNPC 0x45d
ORG 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: mix_add_ramp:
clr $ACC0 clr $ACC0
clr $ACC1 clr $ACC1
@ -259,7 +282,6 @@ ____mix_add_ramp_end_loop:
srri @$AR3, $AC0.L srri @$AR3, $AC0.L
movp $ACC0 movp $ACC0
mrr $AX0.L, $AC0.M mrr $AX0.L, $AC0.M
mrr $AX1.H, $AR3
mrr $AR1, $IX3 mrr $AR1, $IX3
mrr $AR3, $IX2 mrr $AR3, $IX2
ret ret