ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/build68k.c
(Generate patch)

Comparing BasiliskII/src/uae_cpu/build68k.c (file contents):
Revision 1.1.1.1 by cebix, 1999-10-03T14:16:26Z vs.
Revision 1.7 by asvitkine, 2012-03-30T01:25:46Z

# Line 4 | Line 4
4   * Read 68000 CPU specs from file "table68k" and build table68k.c
5   *
6   * Copyright 1995,1996 Bernd Schmidt
7 + *
8 + * This program is free software; you can redistribute it and/or modify
9 + * it under the terms of the GNU General Public License as published by
10 + * the Free Software Foundation; either version 2 of the License, or
11 + * (at your option) any later version.
12 + *
13 + * This program is distributed in the hope that it will be useful,
14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 + * GNU General Public License for more details.
17 + *
18 + * You should have received a copy of the GNU General Public License
19 + * along with this program; if not, write to the Free Software
20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21   */
22  
23   #include <assert.h>
# Line 58 | Line 72 | int main(int argc, char **argv)
72      printf ("#include \"sysdeps.h\"\n");
73      printf ("#include \"readcpu.h\"\n");
74      printf ("struct instr_def defs68k[] = {\n");
75 < #if 0
76 <    tablef = fopen("table68k","r");
75 > #ifdef WIN32
76 >    tablef = fopen(argc > 1 ? argv[1] : "table68k","r");
77      if (tablef == NULL) {
78          fprintf(stderr, "table68k not found\n");
79          exit(1);
# Line 76 | Line 90 | int main(int argc, char **argv)
90          char opcstr[256];
91          int bitpos[16];
92          int flagset[5], flaguse[5];
93 +        char cflow;
94  
95          unsigned int bitmask,bitpattern;
96          int n_variable;
# Line 107 | Line 122 | int main(int argc, char **argv)
122               case 'r': currbit = bitr; break;
123               case 'R': currbit = bitR; break;
124               case 'z': currbit = bitz; break;
125 +                 case 'E': currbit = bitE; break;
126 +                 case 'p': currbit = bitp; break;
127               default: abort();
128              }
129              if (!(bitmask & 1)) {
# Line 131 | Line 148 | int main(int argc, char **argv)
148           case '2': cpulevel = 2; break;
149           case '3': cpulevel = 3; break;
150           case '4': cpulevel = 4; break;
151 +         case '5': cpulevel = 5; break;
152           default: abort();
153          }
154          getnextch();
# Line 154 | Line 172 | int main(int argc, char **argv)
172              getnextch();
173              switch(nextch){
174               case '-': flagset[i] = fa_unset; break;
157             case '/': flagset[i] = fa_isjmp; break;
175               case '0': flagset[i] = fa_zero; break;
176               case '1': flagset[i] = fa_one; break;
177               case 'x': flagset[i] = fa_dontcare; break;
# Line 174 | Line 191 | int main(int argc, char **argv)
191              getnextch();
192              switch(nextch){
193               case '-': flaguse[i] = fu_unused; break;
177             case '/': flaguse[i] = fu_isjmp; break;
178             case '+': flaguse[i] = fu_maybecc; break;
194               case '?': flaguse[i] = fu_unknown; break;
195               default: flaguse[i] = fu_used; break;
196              }
# Line 185 | Line 200 | int main(int argc, char **argv)
200          while (isspace(nextch))
201              getnextch();
202  
203 +        if (nextch != ':')                        /* Get control flow information */
204 +            abort();
205 +        
206 +        cflow = 0;
207 +        for(i = 0; i < 2; i++) {
208 +                getnextch();
209 +                switch(nextch){
210 +                 case '-': break;
211 +                 case 'R': cflow |= fl_return; break;
212 +                 case 'B': cflow |= fl_branch; break;
213 +                 case 'J': cflow |= fl_jump; break;
214 +                 case 'T': cflow |= fl_trap; break;
215 +                 default: abort();
216 +                }
217 +        }
218 +        
219 +        getnextch();
220 +        while (isspace(nextch))
221 +            getnextch();
222 +
223          if (nextch != ':')                        /* Get source/dest usage information */
224              abort();
225  
# Line 232 | Line 267 | int main(int argc, char **argv)
267              for(i = 0; i < 5; i++) {
268                  printf("{ %d, %d }%c ", flaguse[i], flagset[i], i == 4 ? ' ' : ',');
269              }
270 <            printf("}, %d, \"%s\"}", sduse, opstrp);
270 >            printf("}, %d, %d, \"%s\"}", cflow, sduse, opstrp);
271          }
272      }
273      printf("};\nint n_defs68k = %d;\n", no_insns);
274 <    fclose(tablef);
274 >    fflush(stdout);
275      return 0;
276   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines