-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathncrt0.a30
138 lines (124 loc) · 4.49 KB
/
ncrt0.a30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
;***************************************************************************
; C Compiler for R8C/Tiny, M16C/60,30,20,10
; Copyright(C) 1999(2000-2006). Renesas Technology Corp.
; and Renesas Solutions Corp., All rights reserved.
;
; ncrt0.a30 : Startup Program for M16C family
;
; $Date: 2006/11/22 04:13:23 $
; $Revision: 1.1.4.1 $
;***************************************************************************
;---------------------------------------------------------------------
; include files
;---------------------------------------------------------------------
.list OFF
.include nc_define.inc
.include sect30.inc
.list ON
;---------------------------------------------------------------------
; BankSelect definition for 4M mode
;---------------------------------------------------------------------
; .glb __BankSelect
;__BankSelect .equ 0BH
;=====================================================================
; 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
.if __STACKSIZE__ != 0
ldc #0080h,flg
ldc #stack_top,sp ;set stack pointer
.else
ldc #0000h,flg
.endif
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
;---------------------------------------------------------------------
.if __FAR_RAM_FLG__ != 0
BZERO bss_FE_top,bss_FE
BZERO bss_FO_top,bss_FO
.endif
;---------------------------------------------------------------------
; initialize data section
;---------------------------------------------------------------------
.if __FAR_RAM_FLG__ != 0
BCOPY data_FEI_top,data_FE_top,data_FE
BCOPY data_FOI_top,data_FO_top,data_FO
ldc #stack_top,sp
.stk -40
.endif
;=====================================================================
; heap area initialize
;---------------------------------------------------------------------
.if __HEAPSIZE__ != 0
.glb __mnext
.glb __msize
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
;=====================================================================
; 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 R8C/Tiny, M16C/60,30,20,10
; Copyright(C) 1999(2000-2006). Renesas Technology Corp.
; and Renesas Solutions Corp., All rights reserved.
;***************************************************************************