Furter rearranging for more sense making

This commit is contained in:
Gwilym Kuiper 2021-08-01 20:41:56 +01:00
parent 80e03073fd
commit 09ad082f3f

View file

@ -26,15 +26,11 @@ agb_rs__mixer_add:
1:
add r4, r0, r5, asr #8 @ calculate the address of the next read form the sound buffer
add r5, r5, r2 @ calculate the position to read the next step from
mov r6, r1 @ r6 = current buffer location
ldrh r9, [r6, r12]! @ load the current buffer value (r12 being the offset)
@ but pre-increment r6 by r12
ldrsb r10, [r4] @ load the current value we want to read
add r12, r12, #2 @ increment the current write offset in the resulting buffer
mov r6, r1 @ r6 = current buffer location
ldrh r9, [r6, r12]! @ load the current buffer value (r12 being the offset) but pre-increment r6 by r12
mla r7, r10, r3, r9 @ r7 = r10 * r3 + r9 = current sound value * left amount + previous buffer value
strh r7, [r6], r8 @ *(r6 + r8) = r7, r8 = 352 = offset for the right hand side
@ -42,6 +38,7 @@ agb_rs__mixer_add:
mla r4, r10, lr, r7
strh r4, [r6]
add r12, r12, #2 @ increment the current write offset in the resulting buffer
cmp r12, #352 @ check if we're done
bne 1b