/************************************************************************/
/* 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.       */
/************************************************************************/


	.text

	.extern		_main
	.extern		_CPU_IRQInterrupt
	.extern		_sp_base

	/*	Start up Program	*/
	.global _start
#	.org	0x500
_start:
	mov.l	_vectorTable_adr, r0
	ldc	r0, vbr		/* ユーザVBR設定 */

	mov.l	_sp_base_addr, r15	/* ユーザースタック設定 */

	mov.l	_initAddress, r0
	jsr	@r0	/* imp initializeMemory()関数にジャンプ */
	nop
	mov.l	_mainAddress, r0
	jsr	@r0	/* imp main()関数にジャンプ */
	nop

	.align	0x4

_vectorTable_adr:
	.long	_vectorTable
_sp_base_addr:
	.long	_systemStack
_initAddress:
	.long	_initializeMemory
_mainAddress:
	.long	_main


#	
#_function:
#	fmov.s	fr0,@-r15
#	fmov.s	fr1,@-r15
#	fmov.s	fr2,@-r15
#	fmov.s	fr3,@-r15
#	fmov.s	fr4,@-r15
#	fmov.s	fr5,@-r15
#	fmov.s	fr6,@-r15
#	fmov.s	fr7,@-r15
#	fmov.s	fr8,@-r15
#	fmov.s	fr9,@-r15
#	fmov.s	fr10,@-r15
#	fmov.s	fr11,@-r15
#	sts.l	mach,@-r15
#	sts.l	macl,@-r15
#	sts.l	fpul,@-r15
#	sts.l	fpscr,@-r15
#	movml.l	r7,@-r15
#	sts.l	pr,@-r15
#	mov.l	.L6,r1
#	mov.l	.L7,r2
#	lds.l	@r2+,fpscr
#	add	#-4,r2
#	jsr/n	@r1
#	lds.l   @r15+,pr
#	movml.l	@r15+,r7
#	lds.l	@r15+,fpscr
#	lds.l	@r15+,fpul
#	lds.l   @r15+,macl
#	lds.l   @r15+,mach
#	fmov.s	@r15+,fr11
#	fmov.s	@r15+,fr10
#	fmov.s	@r15+,fr9
#	fmov.s	@r15+,fr8
#	fmov.s	@r15+,fr7
#	fmov.s	@r15+,fr6
#	fmov.s	@r15+,fr5
#	fmov.s	@r15+,fr4
#	fmov.s	@r15+,fr3
#	fmov.s	@r15+,fr2
#	fmov.s	@r15+,fr1
#	fmov.s	@r15+,fr0
#	rte	
#	nop
#.L8:
#	.align 2
#.L6:
#	.long	_interruptHandler
#.L7:
#	.long	___fpscr_values+4
