/************************************************************************/
/* CQBBEL GNU CC Common Control Software / (C) Toshio MURAI 2011, 2012	*/
/*      This is Free Software;   You can redistribute this software     */
/*      and/or modify it under the terms of the GNU General Public      */
/*      License version 3, or (at your option) any later version.       */
/************************************************************************/
	/*	Crt0.s	*/

	.section .text

	.global _start
_start:
	mvtc	#_systemStack,USP	/* initialise user stack pointer */
	mvtc	#_interruptStack,ISP	/* initialise interrupt stack pointer */

	bsr	_initializeMemory
	bsr	_main		
_exit:	bra	_exit

	.global _interruptEnable
_interruptEnable:		/* setup intb */
	mvtc	#_RelocatableVectors, intb	/* set INTERRUPT VECTOR ADDRESS  */
	mvtc	#10000h, psw			/* Set Ubit & Ibit for PSW */
	rts

	.global _interruptDisable
_interruptDisable:
	mvtc	#00000h, psw	/* ReSet Ubit & Ibit for PSW */
	rts

#	__builtin_rx_mvtc (0, 0);	/*	mvtc	r10, psw	*/
#	__builtin_rx_mvtc (2, 0);	/*	mvtc	r10, usp	*/
#	__builtin_rx_mvtc (3, 0);	/*	mvtc	r10, fpsw	0x100 */
#	__builtin_rx_mvtc (4, 0);	/*	mvtc	r10, cpen	*/
#	__builtin_rx_mvtc (8, 0);	/*	mvtc	r10, bpsw	*/
#	__builtin_rx_mvtc (9, 0);	/*	mvtc	r10, bpc	*/
#	__builtin_rx_mvtc (10,0);	/*	mvtc	r10, isp	*/
#	__builtin_rx_mvtc (11, 0);	/*	mvtc	r10, fintv	*/
#	__builtin_rx_mvtc (12, 0);	/*	mvtc	r10, intb	*/
#	__builtin_rx_mvtipl(0);		/*	et the interrupt priority level.	*/



