* Test case for PR 18452.
[binutils-gdb.git] / sim / h8300 / writecode.c
blobba875edff9f92616250aab4cafdee8d3572fb20e
1 /* code generator for the Hitachi H8/300 architecture simulator.
2 Copyright (C) 1993 Free Software Foundation, Inc.
3 Hacked by Steve Chamberlain of Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* This program reads the H8/300 opcode table and writes out
22 a large switch statement to understand the opcodes (with ifs if
23 there is more than one opcode per case) and code to do the stuff */
25 #include "bfd.h"
26 #include "sysdep.h"
28 #define DEFINE_TABLE
29 #define INSIM
30 #include"opcode/h8300.h"
32 #define MAXSAME 14
34 #define PTWO 256
35 static struct h8_opcode *h8_opcodes_sorted[PTWO][MAXSAME];
37 char *cs = "/*";
38 char *ce = "*/";
40 /* How to get at nibble n from the instruction */
41 char *nibs[] =
43 "foo",
44 "(b0&0xf)",
45 "((b1>>4)&0xf)",
46 "((b1)&0xf)",
47 "((pc[1]>>12)&0xf)",
48 "((pc[1]>>8)&0xf)",
49 "((pc[1]>>4)&0xf)",
50 "((pc[1])&0xf)",
51 0, 0};
53 /* how to get at the 3 bit immediate in the instruction */
54 char *imm3[] =
55 {"foo",
56 "foo",
57 "((b1>>4)&0x7)",
58 "foo",
59 "foo",
60 "foo",
61 "(pc[1]>>4)&0x7"};
63 /* How to get at a byte register from an index in the instruction at
64 nibble n */
65 char *breg[] =
66 {"foo",
67 "*(blow[b0])",
68 "*(bhigh[b1])",
69 "*(blow[b1])"};
71 /* How to get at a word register from an index in the instruction at
72 nibble n */
74 char *wreg[] =
75 {"foo",
76 "*(wlow[b0])",
77 "*(whigh[b1])",
78 "*(wlow[b1])"};
80 #define sorted_key noperands
82 /* sort the opcode table into h8_opcodes_sorted[0..255] */
83 static void
84 init ()
86 unsigned int i;
87 struct h8_opcode *p;
89 for (p = h8_opcodes; p->name; p++)
91 int n1 = 0;
92 int n2 = 0;
93 int j;
95 for (j = 0; p->data.nib[j] != E; j++)
97 if ((int) p->data.nib[j] == ABS16ORREL8SRC)
98 p->data.nib[j] = ABS16SRC;
99 if ((int) p->data.nib[j] == ABS16OR8SRC)
100 p->data.nib[j] = ABS16SRC;
101 if ((int) p->data.nib[j] == ABS16OR8DST)
102 p->data.nib[j] = ABS16DST;
104 if ((int) p->data.nib[0] < 16)
106 n1 = (int) p->data.nib[0];
108 else
109 n1 = 0;
110 if ((int) p->data.nib[1] < 16)
112 n2 = (int) p->data.nib[1];
114 else
115 n2 = 0;
116 for (i = 0; i < MAXSAME; i++)
118 int j = /* ((n3 >> 3) * 512) + ((n4 >> 3) * 256) + */ n1 * 16 + n2;
120 if (h8_opcodes_sorted[j][i] == (struct h8_opcode *) NULL)
122 h8_opcodes_sorted[j][i] = p;
123 p->sorted_key = j;
124 break;
128 if (i == MAXSAME)
129 abort ();
131 /* Just make sure there are an even number of nibbles in it, and
132 that the count is the same s the length */
133 for (i = 0; p->data.nib[i] != E; i++)
134 /*EMPTY*/ ;
135 if (i & 1)
136 abort ();
137 p->length = i / 2;
139 for (i = 0; i < PTWO; i++)
141 if (h8_opcodes_sorted[i][0])
142 p = h8_opcodes_sorted[i][0];
143 else
144 h8_opcodes_sorted[i][0] = p;
148 /* either fetch srca&srcb or store dst */
150 void
151 decode (p, fetch, size)
152 struct h8_opcode *p;
153 int fetch;
154 int size;
156 int i;
157 char *ss = size == 8 ? "BYTE" : "WORD";
159 for (i = 0; p->data.nib[i] != E; i++)
161 switch (p->data.nib[i])
163 case RS8:
164 if (fetch)
165 printf ("srca = %s;\n", breg[i]);
166 break;
167 case RS16 | B30:
168 case RS16 | B31:
169 case RS16:
170 if (fetch)
171 printf ("srca = %s;\n", wreg[i]);
172 break;
173 case RD8:
174 if (fetch)
175 printf ("srcb = %s;\n", breg[i]);
176 else
177 printf ("%s = dst;\n", breg[i]);
178 break;
179 case RD16 | B30:
180 case RD16 | B31:
181 case RD16:
182 if (fetch)
183 printf ("srcb = %s;\n", wreg[i]);
184 else
185 printf ("%s =dst;\n", wreg[i]);
186 break;
187 case IMM8:
188 if (fetch)
189 printf ("srca = b1;\n");
190 break;
191 case RSINC:
192 case RSINC | B30:
193 case RSINC | B31:
195 if (fetch)
197 printf ("srca = %s_MEM(%s);\n", ss, wreg[i]);
198 printf ("%s+=%d;\n", wreg[i], size / 8);
200 break;
201 case RSIND:
202 case RSIND | B30:
203 case RSIND | B31:
204 if (fetch)
206 printf ("lval = %s;\n", wreg[i]);
207 printf ("srca = %s_MEM(lval);\n", ss);
209 break;
211 case RDIND:
212 case RDIND | B30:
213 case RDIND | B31:
214 if (fetch)
216 printf ("lval = %s;\n", wreg[i]);
217 printf ("srcb = %s_MEM(lval);\n", ss);
219 else
221 printf ("SET_%s_MEM(lval,dst);\n", ss);
223 break;
225 case MEMIND:
226 if (fetch)
228 printf ("lval = pc[1];\n");
230 break;
231 case RDDEC:
232 case RDDEC | B30:
233 case RDDEC | B31:
234 if (!fetch)
236 printf ("%s -=%d;\n", wreg[i], size / 8);
237 printf ("SET_%s_MEM(%s, dst);\n", ss, wreg[i]);
239 break;
240 case IMM3:
241 case IMM3 | B31:
242 case IMM3 | B30:
244 if (fetch)
245 printf ("srca = %s;\n", imm3[i]);
246 break;
247 case IMM16:
248 if (fetch)
249 printf ("srca =( pc[1]);\n");
250 break;
251 case ABS8SRC:
252 if (fetch)
255 printf ("lval = (0xff00) + b1;\n");
256 printf ("srca = BYTE_MEM(lval);\n");
259 break;
260 case ABS8DST:
261 if (fetch)
263 printf ("lval = (0xff00) + b1;\n");
264 printf ("srcb = BYTE_MEM(lval);\n");
266 else
268 printf ("SET_BYTE_MEM(lval,dst);\n");
270 break;
271 case KBIT:
272 if (fetch)
273 printf ("srca = ((b1&0x80)?2:1);\n");
274 break;
275 case ABS16ORREL8SRC:
276 case ABS16SRC:
277 if (fetch)
279 printf ("lval = pc[1];\n");
280 printf ("srca = %s_MEM(lval);\n", size == 8 ? "BYTE" : "WORD");
282 break;
283 case DISPREG | B30:
284 case DISPREG | B31:
285 case DISPREG:
286 printf ("rn = %s & 0x7;\n", nibs[i]);
287 break;
288 case DISPSRC:
289 if (fetch)
291 printf ("lval = 0xffff&(pc[1] +reg[rn]);\n");
292 printf ("srca = %s_MEM(lval);\n", size == 8 ? "BYTE" : "WORD");
294 break;
295 case DISPDST:
296 if (fetch)
298 printf ("lval = 0xffff&(pc[1] +reg[rn]);\n");
299 printf ("srcb = %s_MEM(lval);\n", size == 8 ? "BYTE" : "WORD");
301 else
303 printf ("SET_%s_MEM(lval,dst);\n", ss);
305 break;
306 case ABS16DST:
307 if (fetch)
309 printf ("lval = (pc[1]);\n");
310 printf ("srcb = %s_MEM(lval);\n", ss);
312 else
314 printf ("SET_%s_MEM(lval,dst);\n", ss);
316 break;
317 case IGNORE:
318 break;
319 case DISP8:
320 printf (" /* DISP8 handled in opcode */\n");
321 break;
322 default:
323 if (p->data.nib[i] > HexF)
325 printf ("saved_state.exception = SIGILL;\n");
331 static void
332 esleep ()
334 printf ("saved_state.exception = SIGSTOP;\n");
337 static void
338 mov (p, s, sz)
339 struct h8_opcode *p;
340 char *s;
341 int sz;
343 printf ("dst = srca;\n");
346 static void
347 andc (p)
348 struct h8_opcode *p;
350 printf ("SET_CCR(GET_CCR() & srca);\n");
353 static void
354 addx (p)
355 struct h8_opcode *p;
357 printf ("dst = srca + srcb+ (c != 0);\n");
360 static void
361 subx (p)
362 struct h8_opcode *p;
364 printf ("dst = srcb - srca - (c != 0);\n");
367 static void
368 add (p, s, sz)
369 struct h8_opcode *p;
370 char *s;
371 int sz;
373 printf ("%s;\n", s);
376 static void
377 adds (p, s)
378 struct h8_opcode *p;
379 char *s;
381 printf ("%s;\n", s);
384 static void
385 bra (p, a)
386 struct h8_opcode *p;
387 char *a;
389 printf ("if (%s) npc += ((char )b1)>>1;\n", a);
392 static void
393 bsr (p, a)
394 struct h8_opcode *p;
395 char *a;
397 printf ("reg[7]-=2;\n");
398 printf ("tmp = reg[7];\n");
399 printf ("SET_WORD_MEM(tmp, (npc-saved_state.mem)*2);\n");
400 printf ("npc += ((char)b1)>>1;\n");
403 static void
404 cmp (p, a, s)
405 struct h8_opcode *p;
406 char *a;
407 int s;
409 decode (p, 1, s);
410 printf ("srca = -srca;\n");
411 printf ("dst = srca + srcb;\n");
414 static
415 void
416 jsr (p, a, s)
417 struct h8_opcode *p;
418 char *a;
419 int s;
421 printf ("if (b1 == 0xc4) {\n");
422 printf ("printf(\"%%c\", reg[2]);\n");
423 printf ("}\n");
424 printf ("else {\n");
425 printf ("reg[7]-=2;\n");
426 printf ("tmp = reg[7];\n");
427 printf ("SET_WORD_MEM(tmp, (npc-saved_state.mem)*2);\n");
428 printf ("npc = (lval>>1) + saved_state.mem;\n");
429 printf ("}");
432 static void
433 jmp (p, a, s)
434 struct h8_opcode *p;
435 char *a;
436 int s;
438 printf ("npc = (lval>>1) + saved_state.mem;\n");
441 static void
442 rts (p, a, s)
443 struct h8_opcode *p;
444 char *a;
445 int s;
447 printf ("tmp = reg[7];\n");
448 printf ("reg[7]+=2;\n");
449 printf ("npc = saved_state.mem + (WORD_MEM(tmp)>>1);\n");
452 static void
453 rte (p, a, s)
454 struct h8_opcode *p;
455 char *a;
456 int s;
458 printf ("reg[7]+=2;\n");
459 printf ("tmp = reg[7];\n");
460 printf ("reg[7]+=2;\n");
461 printf ("SET_CCR(tmp);\n");
462 printf ("npc = saved_state.mem + (WORD_MEM(tmp)>>1);\n");
465 static void
466 setf (p, a, s)
467 struct h8_opcode *p;
468 char *a;
469 int s;
471 printf ("tmp = GET_CCR();\n");
472 printf ("tmp %s= srca;\n", a);
475 static void
476 bpt (p, a, s)
477 struct h8_opcode *p;
478 char *a;
479 int s;
481 printf ("saved_state.exception = SIGTRAP;\n");
482 printf ("npc = pc;\n");
485 static void
486 log (p, a, s)
487 struct h8_opcode *p;
488 char *a;
489 int s;
491 printf ("dst = srcb %s srca;\n", a);
494 static void
495 ulog (p, a, s)
496 struct h8_opcode *p;
497 char *a;
498 int s;
500 printf ("dst = %s srcb ;\n", a);
503 static void
504 nop ()
508 static void
509 rotl ()
511 printf ("c = srcb & 0x80;\n");
512 printf ("dst = srcb << 1;\n");
513 printf ("if (c) dst|=1;\n");
516 static void
517 rotr ()
519 printf ("c = srcb & 1;\n");
520 printf ("dst = srcb >> 1;\n");
521 printf ("if (c) dst|=0x80;\n");
524 static void
525 rotxl ()
527 printf ("tmp = srcb & 0x80;\n");
528 printf ("dst = srcb << 1;\n");
529 printf ("if (c) dst|=1;\n");
530 printf ("c = tmp;\n");
533 static void
534 rotxr ()
536 printf ("tmp = srcb & 1;\n");
537 printf ("dst = srcb >> 1;\n");
538 printf ("if (c) dst|=0x80;\n");
539 printf ("c = tmp;\n");
542 static void
543 shal ()
545 printf ("c = srcb&0x80;\n");
546 printf ("dst = srcb << 1;\n");
549 static
550 void
551 shar ()
553 printf ("c = srcb&0x1;\n");
554 printf ("if (srcb&0x80) dst = (srcb>>1) | 0x80;\n");
555 printf ("else dst = (srcb>>1) &~ 0x80;\n");
558 static
559 void
560 shll ()
562 printf ("c = srcb&0x80;\n");
563 printf ("dst = srcb << 1;\n");
566 static
567 void
568 shlr ()
570 printf ("c = srcb&0x1;\n");
571 printf ("dst = (srcb>>1) &~ 0x80;\n");
574 static
575 void
576 divxu ()
578 printf ("srca = %s;\n", breg[2]);
579 printf ("srcb = %s;\n", wreg[3]);
580 printf ("n = srca & 0x80;\n");
581 printf ("z = !srca;\n");
582 printf ("if (srca) dst = srcb / srca;tmp = srcb %% srca;\n");
583 printf ("%s = (dst & 0xff) | (tmp << 8);\n", wreg[3]);
586 static
587 void
588 mulxu ()
590 printf ("srca = %s;\n", breg[2]);
591 printf ("srcb = %s;\n", wreg[3]);
593 printf ("dst = (srcb&0xff) * srca;\n");
594 printf ("%s = dst;\n", wreg[3]);
597 static
598 void
599 inc ()
601 printf ("dst = %s;\n", breg[3]);
602 printf ("v = (dst==0x7f);\n");
603 printf ("dst++;\n");
604 printf ("%s= dst;\n", breg[3]);
607 static
608 void
609 bit (p, a, s)
610 struct h8_opcode *p;
611 char *a;
612 int s;
614 printf ("%s\n", a);
617 static
618 void
619 dec ()
621 printf ("dst = %s;\n", breg[3]);
622 printf ("v = (dst==0x80);\n");
623 printf ("dst--;\n");
624 printf ("%s = dst;\n", breg[3]);
627 char saf[] = "goto setflags;";
628 char sf[] = "goto shiftflags;";
629 char af8[] = "goto aluflags8;";
630 char af16[] = "goto aluflags16;";
631 char lf[] = "goto logflags;";
632 char icf[] = "goto incflags;";
633 char mf8[] = "goto movflags8;";
634 char mf16[] = "goto movflags16;";
635 char nx[] = "goto next;";
637 struct
639 char *ftype;
640 int decode;
641 char *name;
642 void (*func) ();
643 char *arg;
644 int size;
648 table [] =
651 nx, 1, "bld", bit, "dst = srcb; c = (srcb>>srca)&1;", 8
655 nx, 1, "bild", bit, "dst = srcb; c = !((srcb>>srca)&1);", 8
659 nx, 1, "band", bit, "dst = srcb; c = C &&((srcb>>srca)&1);", 8
663 nx, 1, "biand", bit, "dst = srcb; c = C &&(!((srcb>>srca)&1));", 8
667 nx, 1, "bior", bit, "dst = srcb; c = C ||(!((srcb>>srca)&1));", 8
671 nx, 1, "bor", bit, "dst = srcb; c = C ||(((srcb>>srca)&1));", 8
675 nx, 1, "bixor", bit, "dst = srcb; c = C ^(!((srcb>>srca)&1));", 8
679 nx, 1, "bxor", bit, "dst = srcb; c = C ^(((srcb>>srca)&1));", 8
683 nx, 1, "bnot", bit, "dst = srcb ^ (1<<srca);", 8
687 nx, 1, "bclr", bit, "dst = srcb & ~(1<<srca);", 8
691 nx, 1, "bset", bit, "dst = srcb | (1<<srca);", 8
695 nx, 1, "bst", bit, "dst = (srcb & ~(1<<srca))| ((C)<<srca);", 8
699 nx, 1, "bist", bit, "dst = (srcb & ~(1<<srca))| ((!C)<<srca);", 8
703 nx, 1, "btst", bit, "dst = srcb; z = !((srcb>>srca)&1);", 8
707 icf, 0, "dec", dec, 0, 0
711 icf, 0, "inc", inc, 0, 0
715 saf, 1, "orc", setf, "|", 0
719 saf, 1, "xorc", setf, "^", 0
723 saf, 1, "andc", setf, "&", 0
727 nx, 1, "nop", nop, 0, 0
731 nx, 1, "bra", bra, "1", 0
735 nx, 1, "brn", bra, "0", 0
739 nx, 1, "bhi", bra, "(C||Z)==0", 0
743 nx, 1, "bls", bra, "(C||Z)==1", 0
747 nx, 1, "bcs", bra, "C==1", 0
751 nx, 1, "bcc", bra, "C==0", 0
755 nx, 1, "bpl", bra, "N==0", 0
759 nx, 1, "bmi", bra, "N==1", 0
763 nx, 1, "bvs", bra, "V==1", 0
767 nx, 1, "bvc", bra, "V==0", 0
771 nx, 1, "bge", bra, "(N^V)==0", 0
775 nx, 1, "bgt", bra, "(Z|(N^V))==0", 0
779 nx, 1, "blt", bra, "(N^V)==1", 0
783 nx, 1, "ble", bra, "(Z|(N^V))==1", 0
787 nx, 1, "beq", bra, "Z==1", 0
791 nx, 1, "bne", bra, "Z==0", 0
795 nx, 1, "bsr", bsr, "", 0
799 nx, 1, "jsr", jsr, 0, 0
803 nx, 1, "jmp", jmp, 0, 0
807 nx, 0, "rts", rts, 0, 0
811 nx, 0, "rte", rte, 0, 0
815 nx, 1, "andc", andc, 0, 0
819 sf, 1, "shal", shal, 0, 0
823 sf, 1, "shar", shar, 0, 0
827 sf, 1, "shll", shll, 0, 0
831 sf, 1, "shlr", shlr, 0, 0
835 sf, 1, "rotxl", rotxl, 0, 0
839 sf, 1, "rotxr", rotxr, 0, 0
843 sf, 1, "rotl", rotl, 0, 0
847 sf, 1, "rotr", rotr, 0, 0
851 lf, 1, "xor", log, "^", 0
855 lf, 1, "and", log, "&", 0
859 lf, 1, "or", log, "|", 0
863 lf, 1, "not", ulog, " ~", 0
867 lf, 1, "neg", ulog, " - ", 0
871 nx, 1, "adds", adds, "dst = srca + srcb", 0
875 nx, 1, "subs", adds, "srca = -srca; dst = srcb + srca", 0
879 af8, 1, "add.b", add, "dst = srca + srcb", 8
883 af16, 1, "add.w", add, "dst = srca + srcb", 16
887 af16, 1, "sub.w", add, "srca = -srca; dst = srcb + srca", 16
891 af8, 1, "sub.b", add, "srca = -srca; dst = srcb + srca", 8
895 af8, 1, "addx", addx, 0, 8
899 af8, 1, "subx", subx, 0, 8
903 af8, 0, "cmp.b", cmp, 0, 8
907 af16, 0, "cmp.w", cmp, 0, 16
911 nx, 1, "sleep", esleep, 0, 0
915 nx, 0, "bpt", bpt, 0, 8
919 nx, 0, "divxu", divxu, 0, 0
923 nx, 0, "mulxu", mulxu, 0, 0
927 mf8, 1, "mov.b", mov, 0, 8
931 mf8, 1, "movtpe", mov, 0, 8
935 mf8, 1, "movfpe", mov, 0, 8
939 mf16, 1, "mov.w", mov, 0, 16
947 static
948 void
949 edo (p)
950 struct h8_opcode *p;
952 int i;
954 printf ("%s %s %s\n", cs, p->name, ce);
956 for (i = 0; table[i].name; i++)
958 if (strcmp (table[i].name, p->name) == 0)
960 printf ("{\n");
961 if (table[i].decode)
962 decode (p, 1, table[i].size);
963 printf ("cycles += %d;\n", p->time);
964 printf ("npc = pc + %d;\n", p->length / 2);
965 table[i].func (p, table[i].arg, table[i].size);
966 if (table[i].decode)
967 decode (p, 0, table[i].size);
968 if (table[i].ftype)
969 printf (table[i].ftype);
970 else
971 printf ("goto next;\n");
972 printf ("}\n");
973 return;
976 printf ("%s not found %s\n", cs, ce);
977 printf ("saved_state.exception = SIGILL;\n");
978 printf ("break;\n");
981 static
983 owrite (i)
984 int i;
986 /* write if statements to select the right opcode */
987 struct h8_opcode **p;
988 int needand = 1;
990 p = h8_opcodes_sorted[i];
991 printf ("case 0x%03x:\n", i);
993 if (p[1] == 0)
995 /* See if the next few also match */
996 while (h8_opcodes_sorted[i + 1][0] == *p)
998 i++;
999 printf ("case 0x%03x:\n", i);
1002 /* Dont need any if's this is the only one */
1003 edo (*p);
1005 else
1007 while (*p)
1009 /* start two nibbles in since we know we match in the first byte */
1010 int c;
1011 int nib = 2;
1012 int byte = 1;
1013 int mask1[5];
1014 int mask0[5];
1015 int nibshift = 4;
1016 int any = 0;
1018 for (c = 0; c < 5; c++)
1020 mask1[c] = 0;
1021 mask0[c] = 0;
1023 printf ("%s %x%x", cs, (*p)->data.nib[0], (*p)->data.nib[1]);
1024 while ((c = (*p)->data.nib[nib]) != E)
1026 if (c & B30)
1028 /* bit 3 must be zero */
1029 mask0[byte] |= 0x8 << nibshift;
1030 printf ("0");
1031 any = 1;
1033 else if (c & B31)
1035 /* bit 3 must be one */
1036 mask1[byte] |= 0x8 << nibshift;
1037 printf ("8");
1038 any = 1;
1040 else if (c <= HexF)
1042 mask0[byte] |= ((~c) & 0xf) << nibshift;
1043 mask1[byte] |= (c & 0xf) << nibshift;
1044 printf ("%x", c);
1045 any = 1;
1047 else
1049 printf ("x");
1051 nib++;
1052 if (nibshift == 4)
1054 nibshift = 0;
1056 else
1058 byte++;
1059 nibshift = 4;
1062 printf ("*/\n");
1063 if (any)
1065 printf ("if (");
1066 needand = 0;
1067 for (c = 1; c < byte; c++)
1069 if (mask0[c] | mask1[c])
1071 int sh;
1073 if (needand)
1074 printf ("\n&&");
1075 if (c & 1)
1076 sh = 0;
1077 else
1078 sh = 8;
1079 if (c / 2 == 0 && sh == 0)
1080 printf ("((b1&0x%x)==0x%x)", mask0[c] | mask1[c],
1081 mask1[c]);
1082 else
1084 printf ("((pc[%d]&(0x%02x<<%d))==(0x%x<<%d))",
1085 c / 2, mask0[c] | mask1[c], sh,
1086 mask1[c], sh);
1089 needand = 1;
1092 printf (")\n");
1094 edo (*p);
1095 p++;
1099 return i;
1102 static
1103 void
1104 remove_dups ()
1106 struct h8_opcode *s;
1107 struct h8_opcode *d;
1109 for (d = s = h8_opcodes; s->name; s++)
1111 int doit = 1;
1113 if (strcmp (s->name, "push") == 0)
1114 doit = 0;
1115 if (strcmp (s->name, "bhs") == 0)
1116 doit = 0;
1117 if (strcmp (s->name, "blo") == 0)
1118 doit = 0;
1119 if (strcmp (s->name, "bt") == 0)
1120 doit = 0;
1121 if (strcmp (s->name, "bf") == 0)
1122 doit = 0;
1123 if (strcmp (s->name, "pop") == 0)
1124 doit = 0;
1125 if (doit)
1127 *d++ = *s;
1130 *d++ = *s++;
1134 main ()
1136 int i;
1138 remove_dups ();
1139 init ();
1141 printf ("%s do the operation %s\n", cs, ce);
1142 printf ("switch (b0) \n{\n");
1143 for (i = 0; i < PTWO; i++)
1145 i = owrite (i);
1147 printf ("}\n");
1149 return 0;