Statistics
| Revision:

root / branch / CHAMBELLON / sp4b1 / SP4b1 / ncrt0.a30 @ 544

History | View | Annotate | Download (10.8 KB)

1
;*******************************************************************************
2
;
3
;     C COMPILER for M16C/80
4
; Copyright (C) 1999 (2000 - 2010) Renesas Electronics Corporation.
5
; and Renesas Solutions Corporation. All rights reserved.
6
;
7
;
8
;     ncrt0.a30 : NC308 startup program
9
;
10
;     This program is applicable when using the basic I/O library
11
;       
12
;     $Date: 2005/10/12 11:03:05 $
13
;     $Revision: 1.30 $
14
;
15
;*******************************************************************************
16

    
17
;---------------------------------------------------------------------
18
; HEEP SIZE definition
19
;---------------------------------------------------------------------
20
.if __HEAP__ == 1		; for HEW
21

    
22
HEAPSIZE	.equ	0h
23

    
24
.else
25
.if __HEAPSIZE__ == 0
26

    
27
HEAPSIZE	.equ	300h
28

    
29
.else				; for HEW
30

    
31
HEAPSIZE	.equ	__HEAPSIZE__
32

    
33
.endif
34
.endif
35

    
36
;---------------------------------------------------------------------
37
; STACK SIZE definition
38
;---------------------------------------------------------------------
39
.if __USTACKSIZE__ == 0
40

    
41
STACKSIZE	.equ	300h
42

    
43
.else				; for HEW
44

    
45
STACKSIZE	.equ	__USTACKSIZE__
46

    
47
.endif
48

    
49
;---------------------------------------------------------------------
50
; INTERRUPT STACK SIZE definition
51
;---------------------------------------------------------------------
52
.if __ISTACKSIZE__ == 0
53

    
54
ISTACKSIZE	.equ	300h
55

    
56
.else				; for HEW
57

    
58
ISTACKSIZE	.equ	__ISTACKSIZE__
59

    
60
.endif
61

    
62
;---------------------------------------------------------------------
63
; INTERRUPT VECTOR ADDRESS  definition
64
;---------------------------------------------------------------------
65
VECTOR_ADR 	.equ	0fffd00h
66
SVECTOR_ADR 	.equ	0fffe00h
67

    
68
;---------------------------------------------------------------
69
; special page definition
70
;---------------------------------------------------------------
71
;       macro define for special page
72
;
73
;Format:
74
;	SPECIAL	number
75
;
76

    
77
SPECIAL	.macro	NUM
78
	.org	0FFFFFEH-(NUM*2)
79
	.glb	__SPECIAL_@NUM
80
	.word	__SPECIAL_@NUM  & 0FFFFH
81
.endm
82
;---------------------------------------------------------------------
83
; Section allocation
84
;---------------------------------------------------------------------
85
	.list OFF
86
	.include sect308.inc
87
	.list ON
88

    
89
;---------------------------------------------------------------------
90
; SBDATA area definition
91
;---------------------------------------------------------------------
92
	.glb	__SB__
93
__SB__	.equ	data_SE_top
94

    
95
;====================================================================
96
; Initialize Macro declaration
97
;---------------------------------------------------------------------
98
;
99
; when copy less 64K byte
100
BZERO	.macro	TOP_ ,SECT_
101
	mov.b	#00H, R0L
102
	mov.l	#TOP_, A1
103
	mov.w	#sizeof SECT_ , R3
104
	sstr.b	
105
	.endm
106

    
107
BCOPY .macro	FROM_,TO_,SECT_
108
	mov.l	#FROM_ ,A0
109
	mov.l	#TO_ ,A1
110
	mov.w	#sizeof SECT_ , R3
111
	smovf.b
112
	.endm
113

    
114
; when copy over 64K byte
115
;BZEROL	.macro	TOP_,SECT_
116
;	push.w	#sizeof SECT_ >> 16
117
;	push.w	#sizeof SECT_  & 0ffffh
118
;	pusha	TOP_
119
;	.stk	8
120
;
121
;	.glb	_bzero	
122
;	.call	_bzero,G
123
;	jsr.a	_bzero
124
;	.endm
125
;
126
;
127
;BCOPYL	.macro	FROM_ ,TO_ ,SECT_
128
;	push.w	#sizeof SECT_  >> 16
129
;	push.w	#sizeof SECT_  & 0ffffh
130
;	pusha	TO_
131
;	pusha	FROM_
132
;	.stk	12
133
;
134
;	.glb	_bcopy
135
;	.call	_bcopy,G
136
;	jsr.a	_bcopy
137
;	.endm
138
;
139

    
140

    
141
;====================================================================
142
; Interrupt section start
143
;---------------------------------------------------------------------
144
	.insf	start,S,0
145
	.glb	start
146
	.section	interrupt
147
start:
148
;---------------------------------------------------------------------
149
; after reset,this program will start
150
;---------------------------------------------------------------------
151
	ldc	#istack_top,	isp	;set istack pointer
152
	mov.b	#02h,0ah
153
	mov.b	#00h,04h		;set processer mode 
154
	mov.b	#00h,0ah
155
	ldc	#0080h,	flg
156
	ldc	#stack_top,	sp	;set stack pointer 
157
	ldc	#data_SE_top,	sb	;set sb register 
158

    
159
	fset	b			;switch to bank 1
160
	ldc	#data_SE_top,	sb	;set sb register 
161
	fclr	b			;switch to bank 0
162

    
163
	ldc	#VECTOR_ADR,intb
164

    
165
;====================================================================
166
; NEAR area initialize.
167
;--------------------------------------------------------------------
168
; bss zero clear
169
;--------------------------------------------------------------------
170
	BZERO	bss_SE_top,bss_SE
171
	BZERO	bss_SO_top,bss_SO
172
	BZERO	bss_NE_top,bss_NE
173
	BZERO	bss_NO_top,bss_NO
174

    
175
; for NSD
176
	BZERO	bss_MON1_SE_top,bss_MON1_SE
177
	BZERO	bss_MON2_SE_top,bss_MON2_SE
178
	BZERO	bss_MON3_SE_top,bss_MON3_SE
179
	BZERO	bss_MON4_SE_top,bss_MON4_SE
180

    
181
	BZERO	bss_MON1_SO_top,bss_MON1_SO
182
	BZERO	bss_MON2_SO_top,bss_MON2_SO
183
	BZERO	bss_MON3_SO_top,bss_MON3_SO
184
	BZERO	bss_MON4_SO_top,bss_MON4_SO
185

    
186
	BZERO	bss_MON1_E_top,bss_MON1_E
187
	BZERO	bss_MON2_E_top,bss_MON2_E
188
	BZERO	bss_MON3_E_top,bss_MON3_E
189
	BZERO	bss_MON4_E_top,bss_MON4_E
190

    
191
	BZERO	bss_MON1_O_top,bss_MON1_O
192
	BZERO	bss_MON2_O_top,bss_MON2_O
193
	BZERO	bss_MON3_O_top,bss_MON3_O
194
	BZERO	bss_MON4_O_top,bss_MON4_O
195

    
196

    
197

    
198
;---------------------------------------------------------------------
199
; initialize data section
200
;---------------------------------------------------------------------
201
	BCOPY	data_SEI_top,data_SE_top,data_SE
202
	BCOPY	data_SOI_top,data_SO_top,data_SO
203
	BCOPY	data_NEI_top,data_NE_top,data_NE
204
	BCOPY	data_NOI_top,data_NO_top,data_NO
205

    
206
; for NSD
207
	BCOPY	data_MON1_SEI_top,data_MON1_SE_top,data_MON1_SE
208
	BCOPY	data_MON2_SEI_top,data_MON2_SE_top,data_MON2_SE
209
	BCOPY	data_MON3_SEI_top,data_MON3_SE_top,data_MON3_SE
210
	BCOPY	data_MON4_SEI_top,data_MON4_SE_top,data_MON4_SE
211

    
212
	BCOPY	data_MON1_SOI_top,data_MON1_SO_top,data_MON1_SO
213
	BCOPY	data_MON2_SOI_top,data_MON2_SO_top,data_MON2_SO
214
	BCOPY	data_MON3_SOI_top,data_MON3_SO_top,data_MON3_SO
215
	BCOPY	data_MON4_SOI_top,data_MON4_SO_top,data_MON4_SO
216

    
217
	BCOPY	data_MON1_EI_top,data_MON1_E_top,data_MON1_E
218
	BCOPY	data_MON2_EI_top,data_MON2_E_top,data_MON2_E
219
	BCOPY	data_MON3_EI_top,data_MON3_E_top,data_MON3_E
220
	BCOPY	data_MON4_EI_top,data_MON4_E_top,data_MON4_E
221

    
222
	BCOPY	data_MON1_OI_top,data_MON1_O_top,data_MON1_O
223
	BCOPY	data_MON2_OI_top,data_MON2_O_top,data_MON2_O
224
	BCOPY	data_MON3_OI_top,data_MON3_O_top,data_MON3_O
225
	BCOPY	data_MON4_OI_top,data_MON4_O_top,data_MON4_O
226

    
227

    
228
;====================================================================
229
; FAR area initialize.
230
;---------------------------------------------------------------------
231
; bss zero clear
232
;---------------------------------------------------------------------
233
;	BZERO	bss_SE_top,bss_SE
234
;	BZERO	bss_SO_top,bss_SO
235
;	BZERO	bss_6E_top,bss_6E
236
;	BZERO	bss_6O_top,bss_6O
237
	BZERO	bss_FE_top,bss_FE
238
	BZERO	bss_FO_top,bss_FO
239

    
240
; for NSD
241
;	BZERO	bss_MON1_SE_top,bss_MON1_SE
242
;	BZERO	bss_MON2_SE_top,bss_MON2_SE
243
;	BZERO	bss_MON3_SE_top,bss_MON3_SE
244
;	BZERO	bss_MON4_SE_top,bss_MON4_SE
245
;
246
;	BZERO	bss_MON1_SO_top,bss_MON1_SO
247
;	BZERO	bss_MON2_SO_top,bss_MON2_SO
248
;	BZERO	bss_MON3_SO_top,bss_MON3_SO
249
;	BZERO	bss_MON4_SO_top,bss_MON4_SO
250
;
251
;	BZERO	bss_MON1_6E_top,bss_MON1_6E
252
;	BZERO	bss_MON2_6E_top,bss_MON2_6E
253
;	BZERO	bss_MON3_6E_top,bss_MON3_6E
254
;	BZERO	bss_MON4_6E_top,bss_MON4_6E
255
;
256
;	BZERO	bss_MON1_6O_top,bss_MON1_6O
257
;	BZERO	bss_MON2_6O_top,bss_MON2_6O
258
;	BZERO	bss_MON3_6O_top,bss_MON3_6O
259
;	BZERO	bss_MON4_6O_top,bss_MON4_6O
260
;
261
;	BZERO	bss_MON1_E_top,bss_MON1_E
262
;	BZERO	bss_MON2_E_top,bss_MON2_E
263
;	BZERO	bss_MON3_E_top,bss_MON3_E
264
;	BZERO	bss_MON4_E_top,bss_MON4_E
265
;
266
;	BZERO	bss_MON1_O_top,bss_MON1_O
267
;	BZERO	bss_MON2_O_top,bss_MON2_O
268
;	BZERO	bss_MON3_O_top,bss_MON3_O
269
;	BZERO	bss_MON4_O_top,bss_MON4_O
270

    
271

    
272
;---------------------------------------------------------------------
273
; Copy edata_E(O) section from edata_EI(OI) section
274
;---------------------------------------------------------------------
275
;	BCOPY	data_SEI_top,data_SE_top,data_SE
276
;	BCOPY	data_SOI_top,data_SO_top,data_SO
277
;	BCOPY	data_6EI_top,data_6E_top,data_6E
278
;	BCOPY	data_6OI_top,data_6O_top,data_6O
279
	BCOPY	data_FEI_top,data_FE_top,data_FE
280
	BCOPY	data_FOI_top,data_FO_top,data_FO
281

    
282
; for NSD
283
;	BCOPY	data_MON1_SEI_top,data_MON1_SE_top,data_MON1_SE
284
;	BCOPY	data_MON2_SEI_top,data_MON2_SE_top,data_MON2_SE
285
;	BCOPY	data_MON3_SEI_top,data_MON3_SE_top,data_MON3_SE
286
;	BCOPY	data_MON4_SEI_top,data_MON4_SE_top,data_MON4_SE
287
;
288
;	BCOPY	data_MON1_SOI_top,data_MON1_SO_top,data_MON1_SO
289
;	BCOPY	data_MON2_SOI_top,data_MON2_SO_top,data_MON2_SO
290
;	BCOPY	data_MON3_SOI_top,data_MON3_SO_top,data_MON3_SO
291
;	BCOPY	data_MON4_SOI_top,data_MON4_SO_top,data_MON4_SO
292
;
293
;	BCOPY	data_MON1_6EI_top,data_MON1_6E_top,data_MON1_6E
294
;	BCOPY	data_MON2_6EI_top,data_MON2_6E_top,data_MON2_6E
295
;	BCOPY	data_MON3_6EI_top,data_MON3_6E_top,data_MON3_6E
296
;	BCOPY	data_MON4_6EI_top,data_MON4_6E_top,data_MON4_6E
297
;
298
;	BCOPY	data_MON1_6OI_top,data_MON1_6O_top,data_MON1_6O
299
;	BCOPY	data_MON2_6OI_top,data_MON2_6O_top,data_MON2_6O
300
;	BCOPY	data_MON3_6OI_top,data_MON3_6O_top,data_MON3_6O
301
;	BCOPY	data_MON4_6OI_top,data_MON4_6O_top,data_MON4_6O
302
;
303
;	BCOPY	data_MON1_EI_top,data_MON1_E_top,data_MON1_E
304
;	BCOPY	data_MON2_EI_top,data_MON2_E_top,data_MON2_E
305
;	BCOPY	data_MON3_EI_top,data_MON3_E_top,data_MON3_E
306
;	BCOPY	data_MON4_EI_top,data_MON4_E_top,data_MON4_E
307
;
308
;	BCOPY	data_MON1_OI_top,data_MON1_O_top,data_MON1_O
309
;	BCOPY	data_MON2_OI_top,data_MON2_O_top,data_MON2_O
310
;	BCOPY	data_MON3_OI_top,data_MON3_O_top,data_MON3_O
311
;	BCOPY	data_MON4_OI_top,data_MON4_O_top,data_MON4_O
312

    
313

    
314
	ldc	#stack_top,sp
315

    
316
;	.stk	-??	; Validate this when use BZEROL,BCOPYL
317

    
318
;====================================================================
319
; heap area initialize
320
;---------------------------------------------------------------------
321
.if __HEAP__ != 1
322
	.glb	__mnext
323
	.glb	__msize
324
	mov.l	#(heap_top&0FFFFFFH), __mnext
325
	mov.l	#(HEAPSIZE&0FFFFFFH), __msize
326
.endif
327
;====================================================================
328
; Initialize standard I/O
329
;---------------------------------------------------------------------
330
.if __STANDARD_IO__ == 1
331
	.glb	__init
332
	.call	__init,G
333
	jsr.a	__init
334
.endif
335

    
336
;====================================================================
337
; Call main() function
338
;---------------------------------------------------------------------
339
	ldc	#0h,fb	; for debuger
340

    
341
	.glb	_main
342
	jsr.a	_main
343

    
344
;====================================================================
345
; exit() function
346
;---------------------------------------------------------------------
347
	.glb	_exit
348
	.glb	$exit
349
_exit:			   ; End program
350
$exit:
351
	jmp	_exit
352
	.einsf
353

    
354
;====================================================================
355
; dummy interrupt function
356
;---------------------------------------------------------------------
357
	.glb	dummy_int
358
dummy_int:
359
	reit
360
	.end
361
;*******************************************************************************
362
;
363
;     C COMPILER for M16C/80
364
; Copyright (C) 1999 (2000 - 2010) Renesas Electronics Corporation.
365
; and Renesas Solutions Corporation. All rights reserved.
366
;
367
;
368
;*******************************************************************************