/****************************************************************************/
/*	Copyright (c) 2009, Bendor Research Pty. Ltd. All rights reserved.		*/
/*	This software is released under the GNU General Public License, version	*/
/*	3, with the exemptions that 1) the header files installed by this 	 	*/
/*	package can be included in closed-source code and 2) the libraries		*/
/*	built by this package can be statically linked into a closed-source 	*/
/*	binary. See the file LICENSE for the details.							*/
/*	This software is provided "AS IS", without any warranty or guarantee.	*/
/*	By using this software you acknowledge that neither Bendor Research nor	*/
/*	any of its personnel or affiliates can be held liable for any damages,	*/
/*	including, but not limited to, loss of business, loss of money, loss of */
/*	life, loss or reputation, arising out of this software being faulty or	*/
/*	not performing as advertised, even if Bendor Research was aware of such	*/
/*	faults in the software. You use this software at your own risk, any and */
/*	all liabilities that arise out of your using this software are strictly	*/
/*	yours.																	*/
/****************************************************************************/

#define	ASSEMBLY_SOURCE
#include <nanu-nanu.h>
#include <arm_func.h>

#if NANU_ASM_SUB

	afunc	_bc_NanuSub2
	stmdb	sp!,{r4}
	subs	r4,r4,r4
	b		1f
0:
	ldr		r4,[r1],#4
	ldr		r12,[r2],#4
	sbcs	r4,r12
	str		r4,[r0],#4
	sub		r3,r3,#1
1:
	tst		r3,r3
	bne		0b
	sbc		r0,r0,r0
	ldmia	sp!,{r4}
	bx		lr
	.endfunc

	afunc	_bc_NanuSub1
	tst		r2,r2
	movne	r2,#1
	subs	r12,r12,r12
	ldr		r12,[r1],#4
	subs	r12,r12,r2
	str		r12,[r0],#4
	b		1f
0:
	ldr		r12,[r1],#4
	sbcs	r12,r12,#0
	str		r12,[r0],#4
1:
	sub		r3,r3,#1
	tst		r3,r3
	bne		0b
	sbc		r0,r0,r0
	bx		lr
	.endfunc

#endif

