diff --git a/agb/src/sound/mixer/mixer.s b/agb/src/sound/mixer/mixer.s index c66922b9..8c2ebe3b 100644 --- a/agb/src/sound/mixer/mixer.s +++ b/agb/src/sound/mixer/mixer.s @@ -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