Index: branch/beaufour/sp4c12/SP4c12/ncrt0.a30
===================================================================
--- branch/beaufour/sp4c12/SP4c12/ncrt0.a30	(nonexistent)
+++ branch/beaufour/sp4c12/SP4c12/ncrt0.a30	(revision 874)
@@ -0,0 +1,368 @@
+;*******************************************************************************
+;
+;     C COMPILER for M16C/80
+; Copyright (C) 1999 (2000 - 2010) Renesas Electronics Corporation.
+; and Renesas Solutions Corporation. All rights reserved.
+;
+;
+;     ncrt0.a30 : NC308 startup program
+;
+;     This program is applicable when using the basic I/O library
+;       
+;     $Date: 2005/10/12 11:03:05 $
+;     $Revision: 1.30 $
+;
+;*******************************************************************************
+
+;---------------------------------------------------------------------
+; HEEP SIZE definition
+;---------------------------------------------------------------------
+.if __HEAP__ == 1		; for HEW
+
+HEAPSIZE	.equ	0h
+
+.else
+.if __HEAPSIZE__ == 0
+
+HEAPSIZE	.equ	300h
+
+.else				; for HEW
+
+HEAPSIZE	.equ	__HEAPSIZE__
+
+.endif
+.endif
+
+;---------------------------------------------------------------------
+; STACK SIZE definition
+;---------------------------------------------------------------------
+.if __USTACKSIZE__ == 0
+
+STACKSIZE	.equ	300h
+
+.else				; for HEW
+
+STACKSIZE	.equ	__USTACKSIZE__
+
+.endif
+
+;---------------------------------------------------------------------
+; INTERRUPT STACK SIZE definition
+;---------------------------------------------------------------------
+.if __ISTACKSIZE__ == 0
+
+ISTACKSIZE	.equ	300h
+
+.else				; for HEW
+
+ISTACKSIZE	.equ	__ISTACKSIZE__
+
+.endif
+
+;---------------------------------------------------------------------
+; INTERRUPT VECTOR ADDRESS  definition
+;---------------------------------------------------------------------
+VECTOR_ADR 	.equ	0fffd00h
+SVECTOR_ADR 	.equ	0fffe00h
+
+;---------------------------------------------------------------
+; special page definition
+;---------------------------------------------------------------
+;       macro define for special page
+;
+;Format:
+;	SPECIAL	number
+;
+
+SPECIAL	.macro	NUM
+	.org	0FFFFFEH-(NUM*2)
+	.glb	__SPECIAL_@NUM
+	.word	__SPECIAL_@NUM  & 0FFFFH
+.endm
+;---------------------------------------------------------------------
+; Section allocation
+;---------------------------------------------------------------------
+	.list OFF
+	.include sect308.inc
+	.list ON
+
+;---------------------------------------------------------------------
+; SBDATA area definition
+;---------------------------------------------------------------------
+	.glb	__SB__
+__SB__	.equ	data_SE_top
+
+;====================================================================
+; Initialize Macro declaration
+;---------------------------------------------------------------------
+;
+; when copy less 64K byte
+BZERO	.macro	TOP_ ,SECT_
+	mov.b	#00H, R0L
+	mov.l	#TOP_, A1
+	mov.w	#sizeof SECT_ , R3
+	sstr.b	
+	.endm
+
+BCOPY .macro	FROM_,TO_,SECT_
+	mov.l	#FROM_ ,A0
+	mov.l	#TO_ ,A1
+	mov.w	#sizeof SECT_ , R3
+	smovf.b
+	.endm
+
+; when copy over 64K byte
+;BZEROL	.macro	TOP_,SECT_
+;	push.w	#sizeof SECT_ >> 16
+;	push.w	#sizeof SECT_  & 0ffffh
+;	pusha	TOP_
+;	.stk	8
+;
+;	.glb	_bzero	
+;	.call	_bzero,G
+;	jsr.a	_bzero
+;	.endm
+;
+;
+;BCOPYL	.macro	FROM_ ,TO_ ,SECT_
+;	push.w	#sizeof SECT_  >> 16
+;	push.w	#sizeof SECT_  & 0ffffh
+;	pusha	TO_
+;	pusha	FROM_
+;	.stk	12
+;
+;	.glb	_bcopy
+;	.call	_bcopy,G
+;	jsr.a	_bcopy
+;	.endm
+;
+
+
+;====================================================================
+; Interrupt section start
+;---------------------------------------------------------------------
+	.insf	start,S,0
+	.glb	start
+	.section	interrupt
+start:
+;---------------------------------------------------------------------
+; after reset,this program will start
+;---------------------------------------------------------------------
+	ldc	#istack_top,	isp	;set istack pointer
+	mov.b	#02h,0ah
+	mov.b	#00h,04h		;set processer mode 
+	mov.b	#00h,0ah
+	ldc	#0080h,	flg
+	ldc	#stack_top,	sp	;set stack pointer 
+	ldc	#data_SE_top,	sb	;set sb register 
+
+	fset	b			;switch to bank 1
+	ldc	#data_SE_top,	sb	;set sb register 
+	fclr	b			;switch to bank 0
+
+	ldc	#VECTOR_ADR,intb
+
+;====================================================================
+; NEAR area initialize.
+;--------------------------------------------------------------------
+; bss zero clear
+;--------------------------------------------------------------------
+	BZERO	bss_SE_top,bss_SE
+	BZERO	bss_SO_top,bss_SO
+	BZERO	bss_NE_top,bss_NE
+	BZERO	bss_NO_top,bss_NO
+
+; for NSD
+	BZERO	bss_MON1_SE_top,bss_MON1_SE
+	BZERO	bss_MON2_SE_top,bss_MON2_SE
+	BZERO	bss_MON3_SE_top,bss_MON3_SE
+	BZERO	bss_MON4_SE_top,bss_MON4_SE
+
+	BZERO	bss_MON1_SO_top,bss_MON1_SO
+	BZERO	bss_MON2_SO_top,bss_MON2_SO
+	BZERO	bss_MON3_SO_top,bss_MON3_SO
+	BZERO	bss_MON4_SO_top,bss_MON4_SO
+
+	BZERO	bss_MON1_E_top,bss_MON1_E
+	BZERO	bss_MON2_E_top,bss_MON2_E
+	BZERO	bss_MON3_E_top,bss_MON3_E
+	BZERO	bss_MON4_E_top,bss_MON4_E
+
+	BZERO	bss_MON1_O_top,bss_MON1_O
+	BZERO	bss_MON2_O_top,bss_MON2_O
+	BZERO	bss_MON3_O_top,bss_MON3_O
+	BZERO	bss_MON4_O_top,bss_MON4_O
+
+
+
+;---------------------------------------------------------------------
+; initialize data section
+;---------------------------------------------------------------------
+	BCOPY	data_SEI_top,data_SE_top,data_SE
+	BCOPY	data_SOI_top,data_SO_top,data_SO
+	BCOPY	data_NEI_top,data_NE_top,data_NE
+	BCOPY	data_NOI_top,data_NO_top,data_NO
+
+; for NSD
+	BCOPY	data_MON1_SEI_top,data_MON1_SE_top,data_MON1_SE
+	BCOPY	data_MON2_SEI_top,data_MON2_SE_top,data_MON2_SE
+	BCOPY	data_MON3_SEI_top,data_MON3_SE_top,data_MON3_SE
+	BCOPY	data_MON4_SEI_top,data_MON4_SE_top,data_MON4_SE
+
+	BCOPY	data_MON1_SOI_top,data_MON1_SO_top,data_MON1_SO
+	BCOPY	data_MON2_SOI_top,data_MON2_SO_top,data_MON2_SO
+	BCOPY	data_MON3_SOI_top,data_MON3_SO_top,data_MON3_SO
+	BCOPY	data_MON4_SOI_top,data_MON4_SO_top,data_MON4_SO
+
+	BCOPY	data_MON1_EI_top,data_MON1_E_top,data_MON1_E
+	BCOPY	data_MON2_EI_top,data_MON2_E_top,data_MON2_E
+	BCOPY	data_MON3_EI_top,data_MON3_E_top,data_MON3_E
+	BCOPY	data_MON4_EI_top,data_MON4_E_top,data_MON4_E
+
+	BCOPY	data_MON1_OI_top,data_MON1_O_top,data_MON1_O
+	BCOPY	data_MON2_OI_top,data_MON2_O_top,data_MON2_O
+	BCOPY	data_MON3_OI_top,data_MON3_O_top,data_MON3_O
+	BCOPY	data_MON4_OI_top,data_MON4_O_top,data_MON4_O
+
+
+;====================================================================
+; FAR area initialize.
+;---------------------------------------------------------------------
+; bss zero clear
+;---------------------------------------------------------------------
+;	BZERO	bss_SE_top,bss_SE
+;	BZERO	bss_SO_top,bss_SO
+;	BZERO	bss_6E_top,bss_6E
+;	BZERO	bss_6O_top,bss_6O
+	BZERO	bss_FE_top,bss_FE
+	BZERO	bss_FO_top,bss_FO
+
+; for NSD
+;	BZERO	bss_MON1_SE_top,bss_MON1_SE
+;	BZERO	bss_MON2_SE_top,bss_MON2_SE
+;	BZERO	bss_MON3_SE_top,bss_MON3_SE
+;	BZERO	bss_MON4_SE_top,bss_MON4_SE
+;
+;	BZERO	bss_MON1_SO_top,bss_MON1_SO
+;	BZERO	bss_MON2_SO_top,bss_MON2_SO
+;	BZERO	bss_MON3_SO_top,bss_MON3_SO
+;	BZERO	bss_MON4_SO_top,bss_MON4_SO
+;
+;	BZERO	bss_MON1_6E_top,bss_MON1_6E
+;	BZERO	bss_MON2_6E_top,bss_MON2_6E
+;	BZERO	bss_MON3_6E_top,bss_MON3_6E
+;	BZERO	bss_MON4_6E_top,bss_MON4_6E
+;
+;	BZERO	bss_MON1_6O_top,bss_MON1_6O
+;	BZERO	bss_MON2_6O_top,bss_MON2_6O
+;	BZERO	bss_MON3_6O_top,bss_MON3_6O
+;	BZERO	bss_MON4_6O_top,bss_MON4_6O
+;
+;	BZERO	bss_MON1_E_top,bss_MON1_E
+;	BZERO	bss_MON2_E_top,bss_MON2_E
+;	BZERO	bss_MON3_E_top,bss_MON3_E
+;	BZERO	bss_MON4_E_top,bss_MON4_E
+;
+;	BZERO	bss_MON1_O_top,bss_MON1_O
+;	BZERO	bss_MON2_O_top,bss_MON2_O
+;	BZERO	bss_MON3_O_top,bss_MON3_O
+;	BZERO	bss_MON4_O_top,bss_MON4_O
+
+
+;---------------------------------------------------------------------
+; Copy edata_E(O) section from edata_EI(OI) section
+;---------------------------------------------------------------------
+;	BCOPY	data_SEI_top,data_SE_top,data_SE
+;	BCOPY	data_SOI_top,data_SO_top,data_SO
+;	BCOPY	data_6EI_top,data_6E_top,data_6E
+;	BCOPY	data_6OI_top,data_6O_top,data_6O
+	BCOPY	data_FEI_top,data_FE_top,data_FE
+	BCOPY	data_FOI_top,data_FO_top,data_FO
+
+; for NSD
+;	BCOPY	data_MON1_SEI_top,data_MON1_SE_top,data_MON1_SE
+;	BCOPY	data_MON2_SEI_top,data_MON2_SE_top,data_MON2_SE
+;	BCOPY	data_MON3_SEI_top,data_MON3_SE_top,data_MON3_SE
+;	BCOPY	data_MON4_SEI_top,data_MON4_SE_top,data_MON4_SE
+;
+;	BCOPY	data_MON1_SOI_top,data_MON1_SO_top,data_MON1_SO
+;	BCOPY	data_MON2_SOI_top,data_MON2_SO_top,data_MON2_SO
+;	BCOPY	data_MON3_SOI_top,data_MON3_SO_top,data_MON3_SO
+;	BCOPY	data_MON4_SOI_top,data_MON4_SO_top,data_MON4_SO
+;
+;	BCOPY	data_MON1_6EI_top,data_MON1_6E_top,data_MON1_6E
+;	BCOPY	data_MON2_6EI_top,data_MON2_6E_top,data_MON2_6E
+;	BCOPY	data_MON3_6EI_top,data_MON3_6E_top,data_MON3_6E
+;	BCOPY	data_MON4_6EI_top,data_MON4_6E_top,data_MON4_6E
+;
+;	BCOPY	data_MON1_6OI_top,data_MON1_6O_top,data_MON1_6O
+;	BCOPY	data_MON2_6OI_top,data_MON2_6O_top,data_MON2_6O
+;	BCOPY	data_MON3_6OI_top,data_MON3_6O_top,data_MON3_6O
+;	BCOPY	data_MON4_6OI_top,data_MON4_6O_top,data_MON4_6O
+;
+;	BCOPY	data_MON1_EI_top,data_MON1_E_top,data_MON1_E
+;	BCOPY	data_MON2_EI_top,data_MON2_E_top,data_MON2_E
+;	BCOPY	data_MON3_EI_top,data_MON3_E_top,data_MON3_E
+;	BCOPY	data_MON4_EI_top,data_MON4_E_top,data_MON4_E
+;
+;	BCOPY	data_MON1_OI_top,data_MON1_O_top,data_MON1_O
+;	BCOPY	data_MON2_OI_top,data_MON2_O_top,data_MON2_O
+;	BCOPY	data_MON3_OI_top,data_MON3_O_top,data_MON3_O
+;	BCOPY	data_MON4_OI_top,data_MON4_O_top,data_MON4_O
+
+
+	ldc	#stack_top,sp
+
+;	.stk	-??	; Validate this when use BZEROL,BCOPYL
+
+;====================================================================
+; heap area initialize
+;---------------------------------------------------------------------
+.if __HEAP__ != 1
+	.glb	__mnext
+	.glb	__msize
+	mov.l	#(heap_top&0FFFFFFH), __mnext
+	mov.l	#(HEAPSIZE&0FFFFFFH), __msize
+.endif
+;====================================================================
+; Initialize standard I/O
+;---------------------------------------------------------------------
+.if __STANDARD_IO__ == 1
+	.glb	__init
+	.call	__init,G
+	jsr.a	__init
+.endif
+
+;====================================================================
+; Call main() function
+;---------------------------------------------------------------------
+	ldc	#0h,fb	; for debuger
+
+	.glb	_main
+	jsr.a	_main
+
+;====================================================================
+; exit() function
+;---------------------------------------------------------------------
+	.glb	_exit
+	.glb	$exit
+_exit:			   ; End program
+$exit:
+	jmp	_exit
+	.einsf
+
+;====================================================================
+; dummy interrupt function
+;---------------------------------------------------------------------
+	.glb	dummy_int
+dummy_int:
+	reit
+	.end
+;*******************************************************************************
+;
+;     C COMPILER for M16C/80
+; Copyright (C) 1999 (2000 - 2010) Renesas Electronics Corporation.
+; and Renesas Solutions Corporation. All rights reserved.
+;
+;
+;*******************************************************************************
