Move the comments to a nicer place in the file

This commit is contained in:
Gwilym Kuiper 2021-08-01 20:23:05 +01:00
parent 9f259fdc0a
commit cc99aad4c5

View file

@ -16,46 +16,33 @@ agb_rs__mixer_add:
push {r4-r10, lr} push {r4-r10, lr}
@ load the right channel modification amount into lr ldr lr, [sp, #32] @ load the right channel modification amount into lr
ldr lr, [sp, #32]
@ current write offset into the resulting buffer mov r12, #0 @ current write offset into the resulting buffer
mov r12, #0 mov r8, #352 @ the offset for writing to the resulting buffer between left and right channels
mov r8, #352
@ current index mov r5, #0 @ current index we're reading from
mov r5, #0
1: 1:
@ load the current sound buffer location @ r6 = current buffer location, later gets set to the value we're reading and writing from
mov r6, r1 mov r6, r1 @ load the current sound buffer location
@ calculate the address of the next read form the sound buffer add r4, r0, r5, asr #8 @ calculate the address of the next read form the sound buffer
add r4, r0, r5, asr #8 add r5, r5, r2 @ calculate the position to read the next step from
@ calculate the position to read the next step from ldrh r9, [r6, r12]! @ load the current buffer value (r6 being the current location, r12 being the offset)
add r5, r5, r2 @ but pre-increment r6 by r12
@ load the current buffer value (r6 being the current location, r12 being the offset) ldrsb r10, [r4] @ load the current value we want to read
@ but pre-increment r6 by r12
ldrh r9, [r6, r12]!
@ load the current value we want to read add r12, r12, #2 @ increment the current write offset in the resulting buffer
ldrsb r10, [r4]
@ increment the current write offset in the resulting buffer cmp r12, #352 @ check if we're done
add r12, r12, #2
@ check if we're done mla r7, r10, r3, r9 @ r7 = r10 * r3 + r9 = current sound value * left amount + previous buffer value
cmp r12, #352 strh r7, [r6], r8 @ *(r6 + r8) = r7, r8 = 352 = offset for the right hand side
@ r7 = r10 * r3 + r9 = current sound value * left amount + previous buffer value ldrh r7, [r6] @ same for the right hand side (slightly confused here, but this is what was generated)
mla r7, r10, r3, r9
@ *(r6 + r8) = r7, r8 = 352 = offset for the right hand side
strh r7, [r6], r8
@ same for the left hand side (slightly confused here, but this is what was generated)
ldrh r7, [r6]
mla r4, r10, lr, r7 mla r4, r10, lr, r7
strh r4, [r6] strh r4, [r6]