1 | /*
|
---|
2 | * TOPPERS/JSP Kernel
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | * Just Standard Profile Kernel
|
---|
5 | *
|
---|
6 | * Copyright (C) 2000-2002 by Embedded and Real-Time Systems Laboratory
|
---|
7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
8 | * Copyright (C) 2003-2004 by Ryosuke Takeuchi
|
---|
9 | * Platform Development Center RIOCH COMPANY,LTD. JAPAN
|
---|
10 | * Copyright (C) 2006-2010 by Witz Corporation, JAPAN
|
---|
11 | *
|
---|
12 | * The above copyright holders grant permission gratis to use,
|
---|
13 | * duplicate, modify, or redistribute (hereafter called use) this
|
---|
14 | * software (including the one made by modifying this software),
|
---|
15 | * provided that the following four conditions (1) through (4) are
|
---|
16 | * satisfied.
|
---|
17 | *
|
---|
18 | * (1) When this software is used in the form of source code, the above
|
---|
19 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
20 | * below must be retained in the source code without modification.
|
---|
21 | *
|
---|
22 | * (2) When this software is redistributed in the forms usable for the
|
---|
23 | * development of other software, such as in library form, the above
|
---|
24 | * copyright notice, this use conditions, and the disclaimer shown
|
---|
25 | * below must be shown without modification in the document provided
|
---|
26 | * with the redistributed software, such as the user manual.
|
---|
27 | *
|
---|
28 | * (3) When this software is redistributed in the forms unusable for the
|
---|
29 | * development of other software, such as the case when the software
|
---|
30 | * is embedded in a piece of equipment, either of the following two
|
---|
31 | * conditions must be satisfied:
|
---|
32 | *
|
---|
33 | * (a) The above copyright notice, this use conditions, and the
|
---|
34 | * disclaimer shown below must be shown without modification in
|
---|
35 | * the document provided with the redistributed software, such as
|
---|
36 | * the user manual.
|
---|
37 | *
|
---|
38 | * (b) How the software is to be redistributed must be reported to the
|
---|
39 | * TOPPERS Project according to the procedure described
|
---|
40 | * separately.
|
---|
41 | *
|
---|
42 | * (4) The above copyright holders and the TOPPERS Project are exempt
|
---|
43 | * from responsibility for any type of damage directly or indirectly
|
---|
44 | * caused from the use of this software and are indemnified by any
|
---|
45 | * users or end users of this software from any and all causes of
|
---|
46 | * action whatsoever.
|
---|
47 | *
|
---|
48 | * THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
|
---|
49 | * THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
|
---|
50 | * INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
|
---|
51 | * PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
|
---|
52 | * TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
|
---|
53 | * INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
|
---|
54 | *
|
---|
55 | * ä¸è¨è使¨©è
|
---|
56 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
57 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»
|
---|
58 | * åé
|
---|
59 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
60 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®è使¨©
|
---|
61 | * 表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼ã¹
|
---|
62 | * ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
63 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
64 | * ã§ããå½¢ã§åé
|
---|
65 | å¸ããå ´åã«ã¯ï¼åé
|
---|
66 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
67 | ã
|
---|
68 | * ãã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿
|
---|
69 | * 証è¦å®ãæ²è¼ãããã¨ï¼
|
---|
70 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
71 | * ã§ããªãå½¢ã§åé
|
---|
72 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
73 | * (a) åé
|
---|
74 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
75 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½
|
---|
76 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
77 | * (b) åé
|
---|
78 | å¸ã®å½¢æ
|
---|
79 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«å ±
|
---|
80 | * åãããã¨ï¼
|
---|
81 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³
|
---|
82 | * ãããï¼ä¸è¨è使¨©è
|
---|
83 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
84 | 責ãããã¨ï¼ã¾ãï¼
|
---|
85 | * æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãçç±ã«åºã¥
|
---|
86 | * ãè«æ±ãããï¼ä¸è¨è使¨©è
|
---|
87 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
88 | 責ãããã¨ï¼
|
---|
89 | *
|
---|
90 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
91 | ãã
|
---|
92 | * ã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®çã«å¯¾ã
|
---|
93 | * ãé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨
|
---|
94 | * ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè²
|
---|
95 | * ããªãï¼
|
---|
96 | *
|
---|
97 | * @(#) $Id: tlcs900vec.cpp,v 1.4 2007/04/17 05:08:07 honda Exp $
|
---|
98 | */
|
---|
99 | // tlcs900vec.cpp : ã³ã³ã½ã¼ã« ã¢ããªã±ã¼ã·ã§ã³ç¨ã®ã¨ã³ã㪠ãã¤ã³ãã®å®ç¾©
|
---|
100 | //
|
---|
101 | //------------------------------------------------------------------------------
|
---|
102 | // 夿´å±¥æ´
|
---|
103 | //version yyyy/mm/dd æ¦è¦
|
---|
104 | //---------- -------------------------------------------------------------------
|
---|
105 | // 01.00 2004/01/02 åç
|
---|
106 | // 01.01 2004/08/06 FIX VECTOR ãåºå®å¤ã§æã£ãã®ããã©ã¡ã¿ã«ã¦å¤æ´å¯è½ã¨ãã
|
---|
107 | // EXCINIB ã®é
|
---|
108 | åãï¼ã®å ´åã®åé¡ä¿®æ£ã
|
---|
109 | // M30262F8FGã®çææãå²ãè¾¼ã¿ãã¯ã¿ã1è¡å¤ãä¸å
|
---|
110 | ·åä¿®æ£ã
|
---|
111 | // M30620FCAFPã®JSP1.3ç¨ãã¯ã¿çæã³ã¼ããæ¡ä»¶ã³ã³ãã¤ã«åã
|
---|
112 | //-----------------------------------------------------------------------------
|
---|
113 |
|
---|
114 | #include <stdio.h>
|
---|
115 | #include <stdlib.h>
|
---|
116 | #include <string.h>
|
---|
117 |
|
---|
118 | #define MAX_INCLUDE 8
|
---|
119 | #define MAX_INT 64
|
---|
120 | #define MAX_EXC 9
|
---|
121 | #define MAX_VEC MAX_INT
|
---|
122 | #define BUF_SIZE 512
|
---|
123 | #define STR_SIZE 128
|
---|
124 |
|
---|
125 | #define INT_STATE 0
|
---|
126 | #define EXC_STATE 1
|
---|
127 | #define NORMAL_STATE 2
|
---|
128 |
|
---|
129 | struct VEC {
|
---|
130 | int no;
|
---|
131 | char no_name[STR_SIZE];
|
---|
132 | char no_label[STR_SIZE];
|
---|
133 | };
|
---|
134 |
|
---|
135 | static char const default_input_file[] = "kernel_cfg.i";
|
---|
136 | static char const default_output_file[] = "tlcs900vec.inc";
|
---|
137 | static char const default_unused_int[] = "unused_interrupt";
|
---|
138 |
|
---|
139 | //startåºåè¨å®
|
---|
140 | static char const start_extern[] ="\n\textern large _start";
|
---|
141 | static char const start_vector[] = "\tdl\t_start\t; 01 0xffff00";
|
---|
142 | static char const lf[] = "\n";
|
---|
143 |
|
---|
144 | static char input_file[STR_SIZE];
|
---|
145 | static char output_file[STR_SIZE];
|
---|
146 | static char include_file[MAX_INCLUDE][STR_SIZE];
|
---|
147 | static int num_include = 0;
|
---|
148 | static int num_vec[2] = {0, 0};
|
---|
149 | static int max_int = 47;
|
---|
150 | static int num_nodec = 0;
|
---|
151 | static int vec_state = NORMAL_STATE;
|
---|
152 | static struct VEC vec_table[2][MAX_VEC];
|
---|
153 | static char unused_vec[2][STR_SIZE];
|
---|
154 |
|
---|
155 | static void set_TLSS_TLCS900(FILE* pfo, int m);
|
---|
156 | static void set_global(FILE* pfo, char const * t);
|
---|
157 | static void set_global_function(FILE* pfo, char const * t);
|
---|
158 | static void set_vector(FILE* pfo, int kind, int no);
|
---|
159 | static bool test_string(char** s, char const * t);
|
---|
160 | static bool skip_space(char** s);
|
---|
161 | static bool skip_char(char** s, char const c);
|
---|
162 |
|
---|
163 | int main(int argc, char* argv[])
|
---|
164 | {
|
---|
165 | FILE* pfi;
|
---|
166 | FILE* pfo;
|
---|
167 | FILE* pfw;
|
---|
168 | char buf[BUF_SIZE];
|
---|
169 | struct VEC *v;
|
---|
170 | int i, j, k;
|
---|
171 | bool cnv, dec;
|
---|
172 | char* s;
|
---|
173 | char* p;
|
---|
174 | char* q;
|
---|
175 | char c;
|
---|
176 |
|
---|
177 | strcpy(input_file, default_input_file);
|
---|
178 | strcpy(output_file, default_output_file);
|
---|
179 | strcpy(unused_vec[0], default_unused_int);
|
---|
180 | strcpy(unused_vec[1], default_unused_int);
|
---|
181 |
|
---|
182 | //ãªãã·ã§ã³æå®
|
---|
183 | for(i = 1 ; i < argc ; i++){
|
---|
184 | s = argv[i];
|
---|
185 | if(*s++ == '-'){
|
---|
186 | c = *s++;
|
---|
187 | skip_space(&s);
|
---|
188 | switch(c){
|
---|
189 | case 'O': // ã¢ã¦ãããããã¡ã¤ã«ã®è¨å®
|
---|
190 | case 'o':
|
---|
191 | strcpy(output_file, s);
|
---|
192 | break;
|
---|
193 | case 'R': // ã¤ã³ããããã¡ã¤ã«ã®è¨å®
|
---|
194 | case 'r':
|
---|
195 | strcpy(input_file, s);
|
---|
196 | break;
|
---|
197 | default:
|
---|
198 | printf("m16cvec -R<input_file> -O<output_file> -I<include_file> -M<mode> -F<fixvector>\n");
|
---|
199 | break;
|
---|
200 | }
|
---|
201 | }
|
---|
202 | }
|
---|
203 | printf("input file = %s\n", input_file);
|
---|
204 | printf("output file = %s\n", output_file);
|
---|
205 | if((pfi = fopen(input_file, "r")) == NULL){
|
---|
206 | fprintf(stderr, "can't open input file !");
|
---|
207 | exit(1);
|
---|
208 | }
|
---|
209 | if((pfo = fopen(output_file, "w")) == NULL){
|
---|
210 | fclose(pfi);
|
---|
211 | fprintf(stderr, "can't open output file !");
|
---|
212 | exit(1);
|
---|
213 | }
|
---|
214 | for(i = 0 ; i < num_include ; i++){
|
---|
215 | printf("include file = %s\n", include_file[i]);
|
---|
216 | }
|
---|
217 | //ãã¡ã¤ã«å
|
---|
218 | ¥å
|
---|
219 | for(;;){
|
---|
220 | if((fgets(buf, BUF_SIZE, pfi)) == NULL)
|
---|
221 | break;
|
---|
222 | s = buf;
|
---|
223 | switch(vec_state){
|
---|
224 | case INT_STATE:
|
---|
225 | case EXC_STATE:
|
---|
226 | //å
|
---|
227 | ¥åæã®ææ«ã¾ã§ããæã®å¦ç
|
---|
228 | if(test_string(&s, ";"))
|
---|
229 | vec_state = NORMAL_STATE;
|
---|
230 | //æååæ½åºéå§
|
---|
231 | else if(test_string(&s, "{")){
|
---|
232 | v = &vec_table[vec_state][num_vec[vec_state]];
|
---|
233 | p = &v->no_name[0];
|
---|
234 | if(skip_space(&s))
|
---|
235 | continue;
|
---|
236 | dec = true;
|
---|
237 |
|
---|
238 | while(*s != ','){
|
---|
239 | if(*s == 0)
|
---|
240 | continue;
|
---|
241 | //(,),spaceã®å ´åã¯æ¬¡ã®ãã¤ã³ã¿ãé²ãã
|
---|
242 | if(*s == '(' || *s == ')'|| *s <= ' '){
|
---|
243 | s++;
|
---|
244 | continue;
|
---|
245 | }
|
---|
246 | //sã[0-9]ã§ãªãå ´å
|
---|
247 | if(*s < '0' || *s > '9')
|
---|
248 | dec = false;
|
---|
249 | *p++ = *s++;
|
---|
250 | }
|
---|
251 | s++;
|
---|
252 | *p++ = 0;
|
---|
253 | if(dec)
|
---|
254 | v->no = atoi(v->no_name);
|
---|
255 | else{
|
---|
256 | v->no = -1;
|
---|
257 | num_nodec++;
|
---|
258 | }
|
---|
259 | p = &v->no_label[0];
|
---|
260 |
|
---|
261 | if(skip_char(&s, ','))
|
---|
262 | continue;
|
---|
263 |
|
---|
264 | test_string(&s, "(FP)");
|
---|
265 |
|
---|
266 | if(skip_space(&s))
|
---|
267 | continue;
|
---|
268 | while(*s != ')' && *s != ',' && *s > ' ' && *s != '}'){
|
---|
269 | *p++ = *s++;
|
---|
270 | }
|
---|
271 | *p++ = 0;
|
---|
272 | num_vec[vec_state]++;
|
---|
273 |
|
---|
274 | printf("%s\n",v->no_label);
|
---|
275 | }
|
---|
276 | else
|
---|
277 | continue;
|
---|
278 | break;
|
---|
279 | default:
|
---|
280 | if(!test_string(&s, "const"))
|
---|
281 | continue;
|
---|
282 | if(test_string(&s, "INHINIB"))
|
---|
283 | vec_state = INT_STATE;
|
---|
284 | else if(test_string(&s, "EXCINIB"))
|
---|
285 | vec_state = EXC_STATE;
|
---|
286 | break;
|
---|
287 | }
|
---|
288 | }
|
---|
289 | do{
|
---|
290 | cnv = false;
|
---|
291 | for(i = 0 ; i < num_include ; i++){
|
---|
292 | if((pfw = fopen(include_file[i], "r")) != NULL){
|
---|
293 | for(;;){
|
---|
294 | if((fgets(buf, BUF_SIZE, pfw)) == NULL)
|
---|
295 | break;
|
---|
296 | s = buf;
|
---|
297 | if(!test_string(&s, "#define"))
|
---|
298 | continue;
|
---|
299 | if(skip_space(&s))
|
---|
300 | continue;
|
---|
301 | for(k = 0 ; k < 2 ; k++){
|
---|
302 | for(j = 0 ; j < num_vec[k] ; j++){
|
---|
303 | v = &vec_table[k][j];
|
---|
304 | if(v->no < 0){
|
---|
305 | p = s;
|
---|
306 | dec = true;
|
---|
307 | if(test_string(&p, v->no_name)){
|
---|
308 | q = &v->no_name[0];
|
---|
309 | if(!skip_space(&p)){
|
---|
310 | while(*p > ' '){
|
---|
311 | if(*p == '(' || *p == ')'){
|
---|
312 | p++;
|
---|
313 | continue;
|
---|
314 | }
|
---|
315 | if(*p < '0' || *p > '9')
|
---|
316 | dec = false;
|
---|
317 | *q++ = *p++;
|
---|
318 | }
|
---|
319 | }
|
---|
320 | *q++ = 0;
|
---|
321 | }
|
---|
322 | else
|
---|
323 | dec = false;
|
---|
324 | if(dec){
|
---|
325 | v->no = atoi(v->no_name);
|
---|
326 | num_nodec--;
|
---|
327 | }
|
---|
328 | }
|
---|
329 | }
|
---|
330 | }
|
---|
331 | }
|
---|
332 | fclose(pfw);
|
---|
333 | }
|
---|
334 | else
|
---|
335 | printf("open error %s !!\n", include_file[i]);
|
---|
336 | }
|
---|
337 | }while(cnv);
|
---|
338 |
|
---|
339 | for(i = 0 ; i < num_vec[EXC_STATE] ; i++){
|
---|
340 | v = &vec_table[EXC_STATE][i];
|
---|
341 | if(v->no >= 32 && v->no < MAX_INT){
|
---|
342 | vec_table[INT_STATE][num_vec[INT_STATE]] = vec_table[EXC_STATE][i];
|
---|
343 | num_vec[INT_STATE]++;
|
---|
344 | for(j = i ; j < (num_vec[EXC_STATE]-1) ; j++)
|
---|
345 | vec_table[EXC_STATE][j] = vec_table[EXC_STATE][j+1];
|
---|
346 | num_vec[EXC_STATE]--;
|
---|
347 | }
|
---|
348 | }
|
---|
349 | for(j = 0 ; j < num_vec[INT_STATE] ; j++){
|
---|
350 | v = &vec_table[INT_STATE][j];
|
---|
351 | if(v->no >= MAX_INT)
|
---|
352 | strcpy(unused_vec[INT_STATE], v->no_label);
|
---|
353 | else if(max_int < v->no)
|
---|
354 | max_int = v->no;
|
---|
355 | }
|
---|
356 | for(j = 0 ; j < num_vec[EXC_STATE] ; j++){
|
---|
357 | v = &vec_table[EXC_STATE][j];
|
---|
358 | if((v->no >= MAX_EXC && v->no < 32) || v->no >= MAX_INT)
|
---|
359 | strcpy(unused_vec[EXC_STATE], v->no_label);
|
---|
360 | }
|
---|
361 | //extern startãåºå
|
---|
362 | fputs(start_extern, pfo);
|
---|
363 |
|
---|
364 | if(num_nodec > 0)
|
---|
365 | printf("%dã®ã¨ã¯ã»ãã·ã§ã³çªå·ãç¹å®ã§ãã¾ããï¼\n", num_nodec);
|
---|
366 | else{
|
---|
367 | fputs(lf, pfo);
|
---|
368 | for(i = 0 ; i < 2 ; i++){
|
---|
369 | for(j = 0 ; j < num_vec[i] ; j++)
|
---|
370 | set_global_function(pfo, vec_table[i][j].no_label);
|
---|
371 | }
|
---|
372 | if(!strcmp(default_unused_int, unused_vec[0]))
|
---|
373 | set_global(pfo, unused_vec[0]);
|
---|
374 | else if(!strcmp(default_unused_int, unused_vec[1]))
|
---|
375 | set_global(pfo, unused_vec[1]);
|
---|
376 | set_TLSS_TLCS900(pfo, max_int);
|
---|
377 |
|
---|
378 | }
|
---|
379 | fclose(pfi);
|
---|
380 | fclose(pfo);
|
---|
381 | return 0;
|
---|
382 | }
|
---|
383 |
|
---|
384 | static void set_TLSS_TLCS900(FILE* pfo, int m)
|
---|
385 | {
|
---|
386 | int iVec_num;
|
---|
387 |
|
---|
388 | fputs("\nf_vecter section code large align=4", pfo);
|
---|
389 | fputs(lf, pfo);
|
---|
390 |
|
---|
391 | for(iVec_num = 0 ; iVec_num < MAX_INT ; iVec_num++){
|
---|
392 | if(iVec_num == 0){
|
---|
393 | fputs(start_vector, pfo);
|
---|
394 | fputs(lf, pfo);}
|
---|
395 | else
|
---|
396 | //ãã®é¨åã§è¨å®
|
---|
397 | set_vector(pfo, INT_STATE, iVec_num+1);
|
---|
398 | }
|
---|
399 | }
|
---|
400 |
|
---|
401 | /*
|
---|
402 | * extern 宣è¨ããã(ååã®åã«ã¢ã³ãã¼ãã¼ãä¸è¦ãªãã®)
|
---|
403 | */
|
---|
404 | static void set_global(FILE* pfo, char const * t)
|
---|
405 | {
|
---|
406 | fputs("\textern large ", pfo);
|
---|
407 | fputs(t, pfo);
|
---|
408 | fputs(lf, pfo);
|
---|
409 | }
|
---|
410 | /*
|
---|
411 | * extern 宣è¨ããã(ååã®åã«ã¢ã³ãã¼ãã¼ãå¿
|
---|
412 | è¦ãªãã®)
|
---|
413 | */
|
---|
414 | static void set_global_function(FILE* pfo, char const * t)
|
---|
415 | {
|
---|
416 | fputs("\textern large _", pfo);
|
---|
417 | fputs(t, pfo);
|
---|
418 | fputs(lf, pfo);
|
---|
419 | }
|
---|
420 |
|
---|
421 | /*
|
---|
422 | * ãã¯ãã«ãè¨å®ãã
|
---|
423 | */
|
---|
424 | static void set_vector(FILE* pfo, int kind, int no)
|
---|
425 | {
|
---|
426 | struct VEC* v = &vec_table[kind][0];
|
---|
427 | int vec_cnt;
|
---|
428 | int address;
|
---|
429 | int address_high;
|
---|
430 | int address_low;
|
---|
431 | char comment[15];
|
---|
432 | char comment_high[2];
|
---|
433 | char comment_low[2];
|
---|
434 |
|
---|
435 |
|
---|
436 | address = (no - 1) * 4;
|
---|
437 | address_high = address/16;
|
---|
438 | address_low = address%16;
|
---|
439 |
|
---|
440 | sprintf(comment_high, "%x", address_high);
|
---|
441 | sprintf(comment_low, "%x", address_low);
|
---|
442 |
|
---|
443 | fputs("\tdl\t", pfo);
|
---|
444 |
|
---|
445 | comment[0] = '\t';
|
---|
446 | comment[1] = ';';
|
---|
447 | comment[2] = ' ';
|
---|
448 | comment[3] = (no/10)+'0';
|
---|
449 | comment[4] = (no%10)+'0';
|
---|
450 | comment[5] = ' ';
|
---|
451 | comment[6] = '0';
|
---|
452 | comment[7] = 'x';
|
---|
453 | comment[8] = 'f';
|
---|
454 | comment[9] = 'f';
|
---|
455 | comment[10] = 'f';
|
---|
456 | comment[11] = 'f';
|
---|
457 | comment[12] = comment_high[0];
|
---|
458 | comment[13] = comment_low[0];
|
---|
459 | comment[14] = 0;
|
---|
460 |
|
---|
461 | for(vec_cnt = 0 ; vec_cnt < num_vec[kind] ; vec_cnt++, v++){
|
---|
462 | if(v->no == no){
|
---|
463 | fputs("_", pfo);
|
---|
464 | fputs(v->no_label, pfo);
|
---|
465 | fputs(comment, pfo);
|
---|
466 | fputs(lf, pfo);
|
---|
467 | return;
|
---|
468 | }
|
---|
469 | }
|
---|
470 | //unused interrupt
|
---|
471 | fputs(unused_vec[kind], pfo);
|
---|
472 | fputs(comment, pfo);
|
---|
473 | fputs(lf, pfo);
|
---|
474 | }
|
---|
475 |
|
---|
476 |
|
---|
477 | /*
|
---|
478 | * æååãæ¯è¼ãã¦åä¸ãªãã°TURE
|
---|
479 | */
|
---|
480 | static bool test_string(char** s, char const *t)
|
---|
481 | {
|
---|
482 | char* p;
|
---|
483 | char c;
|
---|
484 |
|
---|
485 | p = *s;
|
---|
486 | while(*p <= ' '){
|
---|
487 | if(*p == 0)
|
---|
488 | return false;
|
---|
489 | p++;
|
---|
490 | }
|
---|
491 | while((c = *p++) != 0){
|
---|
492 | if(c != *t++)
|
---|
493 | break;
|
---|
494 | if(*t == 0){
|
---|
495 | *s = p;
|
---|
496 | return true;
|
---|
497 | }
|
---|
498 | }
|
---|
499 | return false;
|
---|
500 | }
|
---|
501 |
|
---|
502 | /*
|
---|
503 | * æå®ã®ãã£ã©ã¯ã¿ã¾ã§ã¹ããã
|
---|
504 | */
|
---|
505 | static bool skip_char(char** s, char const c)
|
---|
506 | {
|
---|
507 | char* p;
|
---|
508 |
|
---|
509 | p = *s;
|
---|
510 | while(*p != c){
|
---|
511 | if(*p == 0)
|
---|
512 | break;
|
---|
513 | p++;
|
---|
514 | }
|
---|
515 | if(*p){
|
---|
516 | p++;
|
---|
517 | *s = p;
|
---|
518 | return false;
|
---|
519 | }
|
---|
520 | else{
|
---|
521 | *s = p;
|
---|
522 | return true;
|
---|
523 | }
|
---|
524 | }
|
---|
525 |
|
---|
526 | /*
|
---|
527 | * ã¹ãã¼ã¹ã¾ãã¯ã¿ããã¹ããããã
|
---|
528 | */
|
---|
529 | static bool skip_space(char** s)
|
---|
530 | {
|
---|
531 | char* p;
|
---|
532 |
|
---|
533 | p = *s;
|
---|
534 | while(*p <= ' ' ){
|
---|
535 | if(*p == 0)
|
---|
536 | break;
|
---|
537 | p++;
|
---|
538 | }
|
---|
539 | *s = p;
|
---|
540 | if(*p)
|
---|
541 | return false;
|
---|
542 | else
|
---|
543 | return true;
|
---|
544 | }
|
---|