1@ Tremolo library
2@-----------------------------------------------------------------------
3@ Copyright (C) 2002-2009, Xiph.org Foundation
4@ Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
5@ All rights reserved.
6
7@ Redistribution and use in source and binary forms, with or without
8@ modification, are permitted provided that the following conditions
9@ are met:
10
11@     * Redistributions of source code must retain the above copyright
12@ notice, this list of conditions and the following disclaimer.
13@     * Redistributions in binary form must reproduce the above
14@ copyright notice, this list of conditions and the following disclaimer
15@ in the documentation and/or other materials provided with the
16@ distribution.
17@     * Neither the names of the Xiph.org Foundation nor Pinknoise
18@ Productions Ltd nor the names of its contributors may be used to
19@ endorse or promote products derived from this software without
20@ specific prior written permission.
21@
22@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23@ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26@ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27@ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33@ ----------------------------------------------------------------------
34
35    .text
36
37	.global	render_lineARM
38
39render_lineARM:
40	@ r0 = n
41	@ r1 = d
42	@ r2 = floor
43	@ r3 = base
44	@ <> = err
45	@ <> = adx
46	@ <> = ady
47	MOV	r12,r13
48	STMFD	r13!,{r4-r6,r11,r14}
49	LDMFD	r12,{r11,r12,r14}	@ r11 = err
50					@ r12 = adx
51					@ r14 = ady
52rl_loop:
53	LDR	r4, [r1]		@ r4 = *d
54	LDR	r5, [r2], r3,LSL #2	@ r5 = *floor    r2 = floor+base
55	SUBS	r11,r11,r14		@ err -= ady
56	MOV	r4, r4, ASR #6
57	MUL	r5, r4, r5		@ r5 = MULT31_SHIFT15
58	ADDLT	r11,r11,r12		@ if (err < 0) err+=adx
59	ADDLT	r2, r2, #4		@              floor+=1
60	SUBS	r0, r0, #1
61	STR	r5, [r1], #4
62	BGT	rl_loop
63
64	LDMFD	r13!,{r4-r6,r11,PC}
65
66	@ END
67