⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncrt0.a30

📁 名厂车载GPS通信终端
💻 A30
字号:
;*************************************************************************** ;
; C COMPILER for R8C/Tiny, M16C/60,30,20,10
; COPYRIGHT(C) 1999(2000-2002) RENESAS TECHNOLOGY CORPORATION
; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED
;
;
; ncrt0.a30 : NC30 startup program
;
; This program is applicable when using the basic I/O library
;       
; $Id: ncrt0.a30,v 1.21 2003/07/09 02:28:54 muranaka Exp $
;
;***************************************************************************

;---------------------------------------------------------------------
; HEEP SIZE definition
;---------------------------------------------------------------------
;__HEAP__	.equ	1

.if	__HEAP__ == 1 
HEAPSIZE	.equ	0H
.else

.if	__HEAPSIZE__ == 0
HEAPSIZE	.equ	800H
.else
HEAPSIZE	.equ	__HEAPSIZE__
.endif

.endif

;---------------------------------------------------------------------
; STACK SIZE definition
;---------------------------------------------------------------------
.if	__USTACKSIZE__ == 0
STACKSIZE	.equ	0100h
.else
STACKSIZE	.equ	__USTACKSIZE__
.endif

;---------------------------------------------------------------------
; INTERRUPT STACK SIZE definition
;---------------------------------------------------------------------
.if	__ISTACKSIZE__ == 0
ISTACKSIZE	.equ	200h
.else
ISTACKSIZE	.equ	__ISTACKSIZE__
.endif

;---------------------------------------------------------------------
; INTERRUPT VECTOR ADDRESS  definition
;---------------------------------------------------------------------
.if	__R8C__ != 1
VECTOR_ADR 	.equ	0ffd00h
.else
VECTOR_ADR 	.equ	0fedch
.endif

;---------------------------------------------------------------------
; Section allocation
;---------------------------------------------------------------------
	.list OFF
	.include sect30.inc
	.list ON

;---------------------------------------------------------------------
; SBDATA area definition
;---------------------------------------------------------------------
	.glb	__SB__
__SB__	.equ	data_SE_top

;====================================================================
; Initialize Macro declaration
;---------------------------------------------------------------------
N_BZERO	.macro	TOP_ ,SECT_
	mov.b	#00H, R0L
	mov.w	#(TOP_ & 0FFFFH), A1
	mov.w	#sizeof SECT_ , R3
	sstr.b	
	.endm
;for copy SECT_ from FROM_ to TO_ 
N_BCOPY .macro	FROM_,TO_,SECT_
	mov.w	#(FROM_ & 0FFFFH),A0
	mov.b	#(FROM_ >>16),R1H
	mov.w	#TO_ ,A1
	mov.w	#sizeof SECT_ , R3
	smovf.b
	.endm
; unkow what's meaning now!!
BZERO	.macro	TOP_,SECT_
	push.w	#sizeof SECT_ >> 16
	push.w	#sizeof SECT_  & 0ffffh
	pusha	TOP_ >>16
	pusha	TOP_ & 0ffffh
	.stk	8                  ;??
	.glb	_bzero	
	.call	_bzero,G           ;???
	jsr.a	_bzero
	.endm

BCOPY	.macro	FROM_ ,TO_ ,SECT_
	push.w	#sizeof SECT_  >> 16
	push.w	#sizeof SECT_  & 0ffffh
	pusha	TO_ >>16
	pusha	TO_  & 0ffffh
	pusha	FROM_ >>16
	pusha	FROM_  & 0ffffh
	.stk	12
	.glb	_bcopy
	.call   _bcopy,G
	jsr.a	_bcopy
	.endm

.if	__R8C__ != 1
;
; for M16C/60,30,20,10 series
;
;		.glb	__BankSelect
;__BankSelect	.equ	0BH

;---------------------------------------------------------------
; special page definition
;---------------------------------------------------------------
;       macro define for special page
;
;Format:
;	SPECIAL	number
;

SPECIAL	.macro	NUM
	.org	0FFFFEH-(NUM*2)
	.glb	__SPECIAL_@NUM
	.word	__SPECIAL_@NUM  & 0FFFFH
.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	#03h,0ah		;enable PRC1 and PRC0 bits
;	bset	1,0ah
	mov.b	#81h,04h		;set processor mode  by lrx
	mov.b #30h,05H    ;by  lrx select expansion mode two
;	mov.b	#03h,0ah		;enable PRC1 and PRC0 bits
	mov.b	#08h,06h		;set to no division mode on main clock
	mov.b	#20h,07h
	mov.b	#00h,0ah		;disable PRC1 and PRC0 bits
	mov.b #00h,0bh    ;by  lrx select flash bank 0;

	ldc	#0080h,	flg
	ldc	#stack_top,	sp		;set stack pointer 
	ldc	#data_SE_top,	sb	;set sb register 
	fclr	I
	ldintb	#VECTOR_ADR
;	fset	I
;====================================================================
; NEAR area initialize.
;--------------------------------------------------------------------
; bss zero clear
;--------------------------------------------------------------------
;//////////////////////////////////////////////////////added by lxo 1229121 for warm reset distinguish
	.glb _ResetMemory
	cmp.b #5ah,_ResetMemory
	jeq start1
;////////////////////////////////////////////////////

	N_BZERO	bss_SE_top,bss_SE
	N_BZERO	bss_SO_top,bss_SO
	N_BZERO	bss_NE_top,bss_NE
	N_BZERO	bss_NO_top,bss_NO

;---------------------------------------------------------------------
; initialize data section
;---------------------------------------------------------------------
	N_BCOPY data_SEI_top,data_SE_top,data_SE
	N_BCOPY	data_SOI_top,data_SO_top,data_SO
	N_BCOPY	data_NEI_top,data_NE_top,data_NE
	N_BCOPY	data_NOI_top,data_NO_top,data_NO

;====================================================================
; FAR area initialize.
;---------------------------------------------------------------------
; bss zero clear
;---------------------------------------------------------------------
	BZERO	bss_FE_top,bss_FE
	BZERO	bss_FO_top,bss_FO

;---------------------------------------------------------------------
; Copy edata_E(O) section from edata_EI(OI) section
;---------------------------------------------------------------------
	BCOPY	data_FEI_top,data_FE_top,data_FE
	BCOPY	data_FOI_top,data_FO_top,data_FO
;//////////////////////////////////////////////////////added by lxo 1229122 for warm reset distinguish
start1:
;////////////////////////////////////////////////////
	ldc	#stack_top,sp
	.stk	-40

;====================================================================
; heap area initialize
;---------------------------------------------------------------------
.if __HEAP__ != 1
	.glb	__mbase
	.glb	__mnext
	.glb	__msize
	mov.w	#(heap_top&0FFFFH), __mbase
	mov.w	#(heap_top>>16), __mbase+2
	mov.w	#(heap_top&0FFFFH), __mnext
	mov.w	#(heap_top>>16), __mnext+2
	mov.w	#(HEAPSIZE&0FFFFH), __msize
	mov.w	#(HEAPSIZE>>16), __msize+2
.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

.else	; __R8C__

;---------------------------------------------------------------------
; for R8C/Tiny
;---------------------------------------------------------------------

;====================================================================
; 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 
	ldintb	#VECTOR_ADR

;====================================================================
; NEAR area initialize.
;--------------------------------------------------------------------
; bss zero clear
;--------------------------------------------------------------------
	N_BZERO	bss_SE_top,bss_SE
	N_BZERO	bss_SO_top,bss_SO
	N_BZERO	bss_NE_top,bss_NE
	N_BZERO	bss_NO_top,bss_NO

;---------------------------------------------------------------------
; initialize data section
;---------------------------------------------------------------------
	N_BCOPY data_SEI_top,data_SE_top,data_SE
	N_BCOPY	data_SOI_top,data_SO_top,data_SO
	N_BCOPY	data_NEI_top,data_NE_top,data_NE
	N_BCOPY	data_NOI_top,data_NO_top,data_NO

;====================================================================
; FAR area initialize.
;---------------------------------------------------------------------
; bss zero clear
;---------------------------------------------------------------------
	BZERO	bss_FE_top,bss_FE
	BZERO	bss_FO_top,bss_FO

;---------------------------------------------------------------------
; Copy edata_E(O) section from edata_EI(OI) section
;---------------------------------------------------------------------
;	BCOPY	data_FEI_top,data_FE_top,data_FE
;	BCOPY	data_FOI_top,data_FO_top,data_FO

	ldc	#stack_top,sp
;	.stk	-40

;====================================================================
; heap area initialize
;---------------------------------------------------------------------
.if __HEAP__ != 1
	.glb	__mbase
	.glb	__mnext
	.glb	__msize
	mov.w	#(heap_top&0FFFFH), __mbase
	mov.w	#(heap_top&0FFFFH), __mnext
	mov.w	#(HEAPSIZE&0FFFFH), __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

.endif	; __R8C__

;====================================================================
; exit() function
;---------------------------------------------------------------------
	.glb	_exit
	.glb	$exit
_exit:			   ; End program
$exit:
	jmp	_exit
	.einsf

;====================================================================
;user dedifinition
;--------------------------------------------------------------------
PUSHREG	.macro
   FCLR	I
	pushc	sb
	pushc	fb
	push.w	r0
	push.w	r1
	push.w	r2
	push.w	r3
	push.w	a0
	push.w	a1
	.endm

POPREG	.macro	
	pop.w	a1
	pop.w	a0
	pop.w	r3
	pop.w	r2
	pop.w	r1
	pop.w	r0
	popc	fb
	popc	sb
	FSET	I
	.endm
	
	.glb	_TimerA0Int
__TimerA0Int:
	PUSHREG
	jsr.a	_TimerA0Int
	POPREG
	reit
	
.if  USETIMERA1==1	
	.glb	_TimerA1Int
__TimerA1Int:
	PUSHREG
	jsr.a	_TimerA1Int
	POPREG
	reit
.endif

.if  USETIMERA2==1	
	.glb	_TimerA2Int
__TimerA2Int:
	PUSHREG
	jsr.a	_TimerA2Int
	POPREG
	reit
.endif

.if  USETIMERA3==1	
	.glb	_TimerA3Int
__TimerA3Int:
	PUSHREG
	jsr.a	_TimerA3Int
	POPREG
	reit
.endif

.if USEUART0==1
	.glb	_Uart0RxInt
__Uart0RxInt:
	PUSHREG
	jsr.a	_Uart0RxInt
	POPREG
	reit
.endif

.if USEUART0==1
	.glb	_Uart0TxInt
__Uart0TxInt:
	PUSHREG
	jsr.a	_Uart0TxInt
	POPREG
	reit
.endif

.if USEUART1==1
	.glb	_Uart1RxInt
__Uart1RxInt:
	PUSHREG
	jsr.a	_Uart1RxInt
	POPREG
	reit
.endif

.if USEUART1==1
	.glb	_Uart1TxInt
__Uart1TxInt:
	PUSHREG
	jsr.a	_Uart1TxInt
	POPREG
	reit
.endif

.if USEUART2==1
	.glb	_Uart2RxInt

__Uart2RxInt:
	PUSHREG
	jsr.a	_Uart2RxInt
	POPREG
	reit
.endif

.if USEUART2==1
	.glb	_Uart2TxInt
__Uart2TxInt:
	PUSHREG
	jsr.a	_Uart2TxInt
	POPREG
	reit
.endif

.if USEWATCHDOG==1
	.glb	_WatchdogInt
__WatchdogInt:
	PUSHREG
	jsr.a	_WatchdogInt
	POPREG
	reit
.endif

.if USEODOMETER==1
	.glb	_TimerB3Int
__TimerB3Int:
	PUSHREG
	jsr.a	_TimerB3Int
	POPREG
	reit
.endif

.if USEKEYPAD==1
	.glb	_KeypadInt
__KeypadInt:
	PUSHREG
	jsr.a	_KeypadInt
	POPREG
	reit
.endif

.if USEINT0==1
	.glb	_Int0Int
__Int0Int:
	PUSHREG
	jsr.a	_Int0Int
	POPREG
	reit
.endif

.if USEINT1==1
	.glb	_Int1Int
__Int1Int:
	PUSHREG
	jsr.a	_Int1Int
	POPREG
	reit
.endif

.if USEINT2==1
	.glb	_Int2Int
__Int2Int:
	PUSHREG
	jsr.a	_Int2Int
	POPREG
	reit
.endif

.if USEINT3==1
	.glb	_Int3Int
__Int3Int:
	PUSHREG
	jsr.a	_Int3Int
	POPREG
	reit
.endif

.if USEINT4==1
	.glb	_Int4Int
__Int4Int:
	PUSHREG
	jsr.a	_Int4Int
	POPREG
	reit
.endif

.if USEINT5==1
	.glb	_Int5Int
__Int5Int:
	PUSHREG
	jsr.a	_Int5Int
	POPREG
	reit
.endif

.if USENMI==1
	.glb	_NmiInt
__NmiInt:
	PUSHREG
	jsr.a	_NmiInt
	POPREG
	reit
.endif

.if USEADC==1
	.glb	_ADCint
__ADCint:
	PUSHREG
	jsr.a	_ADCint
	POPREG
	reit
.endif

;====================================================================
; dummy interrupt function
;---------------------------------------------------------------------
dummy_int:
	reit

	.end
;***************************************************************************
;
; C COMPILER for R8C/Tiny, M16C/60,30,20,10
; COPYRIGHT(C) 1999(2000-2002) RENESAS TECHNOLOGY CORPORATION
; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED
;
;***************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -