mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
Extract a function to do the clearing of the buffer
This commit is contained in:
parent
4969672c73
commit
2ace226db8
|
@ -143,26 +143,39 @@ constant_zero:
|
||||||
.word 0
|
.word 0
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
|
agb_arm_func agb_rs__init_buffer
|
||||||
|
@ arguments:
|
||||||
|
@ r0 = target buffer
|
||||||
|
@ r1 = size in bytes (must be a multiple of 16)
|
||||||
|
push {r4-r5}
|
||||||
|
|
||||||
|
@ zero registers r3-r5
|
||||||
|
mov r2, #constant_zero
|
||||||
|
ldm r2, {r3-r5,r12}
|
||||||
|
|
||||||
|
1:
|
||||||
|
@ zero 4 words worth of the buffer
|
||||||
|
stmia r0, {r3-r5,r12}
|
||||||
|
subs r1, r1, #16
|
||||||
|
@ loop if we haven't zeroed everything
|
||||||
|
bne 1b
|
||||||
|
|
||||||
|
pop {r4-r5}
|
||||||
|
bx lr
|
||||||
|
agb_arm_end agb_rs__init_buffer
|
||||||
|
|
||||||
agb_arm_func agb_rs__mixer_collapse
|
agb_arm_func agb_rs__mixer_collapse
|
||||||
@ Arguments:
|
@ Arguments:
|
||||||
@ r0 = target buffer (i8)
|
@ r0 = target buffer (i8)
|
||||||
@ r1 = input buffer (i16) of fixnums with 4 bits of precision (read in sets of i16 in an i32)
|
@ r1 = input buffer (i16) of fixnums with 4 bits of precision (read in sets of i16 in an i32)
|
||||||
push {r4-r11}
|
|
||||||
|
|
||||||
@ zero registers r4-r7 (4 of them)
|
@ firstly clear the buffer
|
||||||
mov r8, #constant_zero
|
push {r0, r1, r4-r11, lr}
|
||||||
ldm r8, {r4-r7}
|
ldr r1, agb_rs__buffer_size
|
||||||
|
|
||||||
@ get the size of the buffer
|
bl agb_rs__init_buffer
|
||||||
ldr r9, agb_rs__buffer_size
|
|
||||||
@ make a copy of the output buffer pointer
|
pop {r0, r1}
|
||||||
mov r10, r0
|
|
||||||
1:
|
|
||||||
@ zero 4 words worth of the output buffer
|
|
||||||
stmia r10, {r4-r7}
|
|
||||||
subs r9, r9, #16
|
|
||||||
@ loop if we haven't zeroed everything
|
|
||||||
bne 1b
|
|
||||||
|
|
||||||
CONST_0 .req r7
|
CONST_0 .req r7
|
||||||
CONST_FF .req r8
|
CONST_FF .req r8
|
||||||
|
@ -239,6 +252,6 @@ SWAP_SIGN .req r11
|
||||||
subs r2, r2, #16 @ r2 -= 16
|
subs r2, r2, #16 @ r2 -= 16
|
||||||
bne 1b @ loop if not 0
|
bne 1b @ loop if not 0
|
||||||
|
|
||||||
pop {r4-r11}
|
pop {r4-r11, lr}
|
||||||
bx lr
|
bx lr
|
||||||
agb_arm_end agb_rs__mixer_collapse
|
agb_arm_end agb_rs__mixer_collapse
|
||||||
|
|
Loading…
Reference in a new issue