;************************************************************************
;*	H8/300H C startup rouitne with Monitor
;*	V1.00  98/10/17 O.IMAIZUMI
;************************************************************************
	.PROGRAM  CStartT
	.CPU	  300HA					; CPU is H8/3048 Single chip Advanced mode

	.EXPORT _start
	.IMPORT __INITSCT
	.IMPORT ___INITSCT
	.IMPORT __stdopen
	.IMPORT _monitor
	.IMPORT _main
	.IMPORT INT00,MAIN,RET_TBL,VECTOR_TBL,OUT_CHAR
	.IMPORT SMR,BRR,SCR,TDR,SSR,RDR

	.SECTION UV,DATA,ALIGN=2
	.SECTION P,CODE,ALIGN=2
_start:
	MOV.L	#H'FFFF00,ER7		; set stack pointer
	STC.W	CCR,@-ER7			; Save User CCR
	LDC.B	#H'C0:8,CCR			; Disable Interrupt
	MOV.W	#(SIZEOF UV):16,R4	;
	MOV.L	#(STARTOF UV),ER5	; User Vector Table(ROM) -> ER5
	MOV.L	@VECTOR_TBL,ER6		; User Vector Address --> ER6
	EEPMOV.W					; Copy
	LDC.W	@ER7+,CCR			; Restore User CCR
	JSR		@___INITSCT:24		; __INITSCT for ROMed routine
	JSR		@__INITSCT:24		; initialize variable
	JSR		@__stdopen:24		; initialize console
	JSR		@_main:24			; do main
	JMP		@_monitor			; ->Restart Monitor

__option_:
	.EXPORT _vsci_eri0
	.EXPORT _vsci_rxi0
;	.EXPORT _vsci_txi0
;	.EXPORT _vsci_eri1
;	.EXPORT _vsci_rxi1
;	.EXPORT _vsci_txi1
	.IMPORT _int_sci0
;	.IMPORT _int_sco0
	.IMPORT _int_sce0
_vsci_eri0:
	PUSH.L	ER0
	PUSH.L	ER1
	JSR	@_int_sce0:24
	POP.L	ER1
	POP.L	ER0
	RTE
_vsci_rxi0:
	PUSH.L	ER0
	PUSH.L	ER1
	JSR	@_int_sci0:24
	POP.L	ER1
	POP.L	ER0
	RTE
;_vsci_txi0:
;	PUSH.L	ER0
;	PUSH.L	ER1
;	JSR	@_int_sco0:24
;	POP.L	ER1
;	POP.L	ER0
;	RTE
;_vsci_eri1:
;	PUSH.L	ER0
;	PUSH.L	ER1
;	JSR	@_int_sce1:24
;	POP.L	ER1
;	POP.L	ER0
;	RTE
;_vsci_rxi1:
;	PUSH.L	ER0
;	PUSH.L	ER1
;	JSR	@_int_sci0:24
;	POP.L	ER1
;	POP.L	ER0
;	RTE
;_vsci_txi1:
;	PUSH.L	ER0
;	PUSH.L	ER1
;	JSR	@_int_sco1:24
;	POP.L	ER1
;	POP.L	ER0
;	RTE
	.END
