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

Comparing BasiliskII/src/uae_cpu/gencpu.c (file contents):
Revision 1.20 by gbeauche, 2002-11-02T18:13:27Z vs.
Revision 1.24 by gbeauche, 2007-06-29T16:32:05Z

# Line 2234 | Line 2234 | static int postfix;
2234  
2235   static void generate_one_opcode (int rp)
2236   {
2237    int i;
2237      uae_u16 smsk, dmsk;
2238      long int opcode = opcode_map[rp];
2239 +    const char *opcode_str;
2240  
2241      if (table68k[opcode].mnemo == i_ILLG
2242          || table68k[opcode].clev > cpu_level)
2243          return;
2244  
2245    for (i = 0; lookuptab[i].name[0]; i++) {
2246        if (table68k[opcode].mnemo == lookuptab[i].mnemo)
2247            break;
2248    }
2249
2245      if (table68k[opcode].handler != -1)
2246          return;
2247  
2248 +    opcode_str = get_instruction_string (opcode);
2249 +
2250      if (opcode_next_clev[rp] != cpu_level) {
2251 +        if (table68k[opcode].flagdead == 0)
2252 +        /* force to the "ff" variant since the instruction doesn't set at all the condition codes */
2253 +        fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
2254 +                 opcode, opcode_str);
2255 +        else
2256          fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
2257 <                 opcode, lookuptab[i].name);
2257 >                 opcode, opcode_str);
2258          return;
2259      }
2260          
2261          if (table68k[opcode].flagdead == 0)
2262          /* force to the "ff" variant since the instruction doesn't set at all the condition codes */
2263 <    fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
2263 >    fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, opcode_str);
2264          else
2265 <    fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
2265 >    fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, opcode_str);
2266  
2267      fprintf (headerfile, "extern cpuop_func op_%lx_%d_nf;\n", opcode, postfix);
2268      fprintf (headerfile, "extern cpuop_func op_%lx_%d_ff;\n", opcode, postfix);
2267    printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
2268        printf ("\tcpuop_begin();\n");
2269          
2270          /* gb-- The "nf" variant for an instruction that doesn't set the condition
2271             codes at all is the same as the "ff" variant, so we don't need the "nf"
# Line 2274 | Line 2274 | static void generate_one_opcode (int rp)
2274          if (table68k[opcode].flagdead == 0)
2275          printf ("#ifndef NOFLAGS\n");
2276  
2277 +        printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, opcode_str);
2278 +        printf ("\tcpuop_begin();\n");
2279 +
2280      switch (table68k[opcode].stype) {
2281       case 0: smsk = 7; break;
2282       case 1: smsk = 255; break;
# Line 2393 | Line 2396 | static void generate_one_opcode (int rp)
2396      gen_opcode (opcode);
2397      if (need_endlabel)
2398          printf ("%s: ;\n", endlabelstr);
2396        if (table68k[opcode].flagdead == 0)
2397        printf ("\n#endif\n");
2399          printf ("\tcpuop_end();\n");
2400      printf ("}\n");
2401 +        if (table68k[opcode].flagdead == 0)
2402 +        printf ("\n#endif\n");
2403      opcode_next_clev[rp] = next_cpu_level;
2404      opcode_last_postfix[rp] = postfix;
2405   }
# Line 2457 | Line 2460 | static void generate_func (void)
2460  
2461   int main (int argc, char **argv)
2462   {
2463 +    FILE *out;
2464      read_table68k ();
2465      do_merges ();
2466  
# Line 2470 | Line 2474 | int main (int argc, char **argv)
2474       * cputbl.h that way), but cpuopti can't cope.  That could be fixed, but
2475       * I don't dare to touch the 68k version.  */
2476  
2477 <    headerfile = fopen ("cputbl.h", "wb");
2478 <    stblfile = fopen ("cpustbl.cpp", "wb");
2479 <    freopen ("cpuemu.cpp", "wb", stdout);
2477 >    headerfile = fopen ("cputbl.h", "w");
2478 >    stblfile = fopen ("cpustbl.cpp", "w");
2479 >    out = freopen ("cpuemu.cpp", "w", stdout);
2480  
2481      generate_includes (stdout);
2482      generate_includes (stblfile);
# Line 2480 | Line 2484 | int main (int argc, char **argv)
2484      generate_func ();
2485  
2486      free (table68k);
2487 +    fclose (headerfile);
2488 +    fclose (stblfile);
2489 +    fflush (out);
2490      return 0;
2491   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines