823 |
|
return i->stype == 3; |
824 |
|
} |
825 |
|
|
826 |
– |
static const char * cflow_string_of(uae_u32 opcode) |
827 |
– |
{ |
828 |
– |
const char * cflow_type_str; |
829 |
– |
|
830 |
– |
int cflow_type = table68k[opcode].cflow & ~fl_trap; |
831 |
– |
switch (cflow_type) { |
832 |
– |
case fl_branch: cflow_type_str = "CFLOW_BRANCH"; break; |
833 |
– |
case fl_jump: cflow_type_str = "CFLOW_JUMP"; break; |
834 |
– |
case fl_return: cflow_type_str = "CFLOW_RETURN"; break; |
835 |
– |
default: cflow_type_str = "CFLOW_NORMAL"; |
836 |
– |
} |
837 |
– |
|
838 |
– |
/* Patch M68K_EXEC_RETURN instruction */ |
839 |
– |
if (table68k[opcode].mnemo == i_EMULOP_RETURN) |
840 |
– |
cflow_type_str = "CFLOW_EXEC_RETURN"; |
841 |
– |
|
842 |
– |
return cflow_type_str; |
843 |
– |
} |
844 |
– |
|
826 |
|
static void gen_opcode (unsigned long int opcode) |
827 |
|
{ |
828 |
|
struct instr *curi = table68k + opcode; |
1326 |
|
} |
1327 |
|
printf ("\tm68k_incpc ((uae_s32)src + 2);\n"); |
1328 |
|
fill_prefetch_0 (); |
1329 |
< |
printf ("cpuop_return(%s);\n", cflow_string_of(opcode)); |
1329 |
> |
printf ("return;\n"); |
1330 |
|
printf ("didnt_jump:;\n"); |
1331 |
|
need_endlabel = 1; |
1332 |
|
} |
1359 |
|
} |
1360 |
|
printf ("\t\t\tm68k_incpc((uae_s32)offs + 2);\n"); |
1361 |
|
fill_prefetch_0 (); |
1362 |
< |
printf ("cpuop_return(%s);\n", cflow_string_of(opcode)); |
1362 |
> |
printf ("return;\n"); |
1363 |
|
printf ("\t\t}\n"); |
1364 |
|
printf ("\t}\n"); |
1365 |
|
need_endlabel = 1; |
2251 |
|
return; |
2252 |
|
|
2253 |
|
if (opcode_next_clev[rp] != cpu_level) { |
2254 |
+ |
if (table68k[opcode].flagdead == 0) |
2255 |
+ |
/* force to the "ff" variant since the instruction doesn't set at all the condition codes */ |
2256 |
+ |
fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp], |
2257 |
+ |
opcode, lookuptab[i].name); |
2258 |
+ |
else |
2259 |
|
fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp], |
2260 |
|
opcode, lookuptab[i].name); |
2261 |
|
return; |
2269 |
|
|
2270 |
|
fprintf (headerfile, "extern cpuop_func op_%lx_%d_nf;\n", opcode, postfix); |
2271 |
|
fprintf (headerfile, "extern cpuop_func op_%lx_%d_ff;\n", opcode, postfix); |
2286 |
– |
printf ("cpuop_rettype REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name); |
2287 |
– |
printf ("\tcpuop_begin();\n"); |
2272 |
|
|
2273 |
|
/* gb-- The "nf" variant for an instruction that doesn't set the condition |
2274 |
|
codes at all is the same as the "ff" variant, so we don't need the "nf" |
2277 |
|
if (table68k[opcode].flagdead == 0) |
2278 |
|
printf ("#ifndef NOFLAGS\n"); |
2279 |
|
|
2280 |
+ |
printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name); |
2281 |
+ |
printf ("\tcpuop_begin();\n"); |
2282 |
+ |
|
2283 |
|
switch (table68k[opcode].stype) { |
2284 |
|
case 0: smsk = 7; break; |
2285 |
|
case 1: smsk = 255; break; |
2399 |
|
gen_opcode (opcode); |
2400 |
|
if (need_endlabel) |
2401 |
|
printf ("%s: ;\n", endlabelstr); |
2402 |
+ |
printf ("\tcpuop_end();\n"); |
2403 |
+ |
printf ("}\n"); |
2404 |
|
if (table68k[opcode].flagdead == 0) |
2405 |
|
printf ("\n#endif\n"); |
2417 |
– |
printf ("\tcpuop_end(%s);\n", cflow_string_of(opcode)); |
2418 |
– |
printf ("}\n"); |
2406 |
|
opcode_next_clev[rp] = next_cpu_level; |
2407 |
|
opcode_last_postfix[rp] = postfix; |
2408 |
|
} |
2463 |
|
|
2464 |
|
int main (int argc, char **argv) |
2465 |
|
{ |
2466 |
+ |
FILE *out; |
2467 |
|
read_table68k (); |
2468 |
|
do_merges (); |
2469 |
|
|
2477 |
|
* cputbl.h that way), but cpuopti can't cope. That could be fixed, but |
2478 |
|
* I don't dare to touch the 68k version. */ |
2479 |
|
|
2480 |
< |
headerfile = fopen ("cputbl.h", "wb"); |
2481 |
< |
stblfile = fopen ("cpustbl.cpp", "wb"); |
2482 |
< |
freopen ("cpuemu.cpp", "wb", stdout); |
2480 |
> |
headerfile = fopen ("cputbl.h", "w"); |
2481 |
> |
stblfile = fopen ("cpustbl.cpp", "w"); |
2482 |
> |
out = freopen ("cpuemu.cpp", "w", stdout); |
2483 |
|
|
2484 |
|
generate_includes (stdout); |
2485 |
|
generate_includes (stblfile); |
2487 |
|
generate_func (); |
2488 |
|
|
2489 |
|
free (table68k); |
2490 |
+ |
fclose (headerfile); |
2491 |
+ |
fclose (stblfile); |
2492 |
+ |
fflush (out); |
2493 |
|
return 0; |
2494 |
|
} |