More human readable instruction names (from e-uae).

This commit is contained in:
gbeauche 2007-06-29 16:32:05 +00:00
parent e3f9d46556
commit b3f62598b7
4 changed files with 129 additions and 24 deletions

View File

@ -2768,9 +2768,9 @@ static int postfix;
static void
generate_one_opcode (int rp, int noflags)
{
int i;
uae_u16 smsk, dmsk;
long int opcode = opcode_map[rp];
const long int opcode = opcode_map[rp];
const char *opcode_str;
int aborted=0;
int have_srcreg=0;
int have_dstreg=0;
@ -2779,12 +2779,6 @@ generate_one_opcode (int rp, int noflags)
|| table68k[opcode].clev > cpu_level)
return;
for (i = 0; lookuptab[i].name[0]; i++)
{
if (table68k[opcode].mnemo == lookuptab[i].mnemo)
break;
}
if (table68k[opcode].handler != -1)
return;
@ -2936,6 +2930,8 @@ generate_one_opcode (int rp, int noflags)
comprintf("\tuae_u32 m68k_pc_offset_thisinst=m68k_pc_offset;\n");
comprintf("\tm68k_pc_offset+=2;\n");
opcode_str = get_instruction_string (opcode);
aborted=gen_opcode (opcode);
{
int flags=0;
@ -2949,19 +2945,19 @@ generate_one_opcode (int rp, int noflags)
comprintf ("}\n");
if (aborted) {
fprintf (stblfile, "{ NULL, 0x%08x, %ld }, /* %s */\n", flags, opcode, lookuptab[i].name);
fprintf (stblfile, "{ NULL, 0x%08x, %ld }, /* %s */\n", flags, opcode, opcode_str);
com_discard();
}
else {
if (noflags) {
fprintf (stblfile, "{ op_%lx_%d_comp_nf, 0x%08x, %ld }, /* %s */\n", opcode, postfix, flags, opcode, lookuptab[i].name);
fprintf (stblfile, "{ op_%lx_%d_comp_nf, 0x%08x, %ld }, /* %s */\n", opcode, postfix, flags, opcode, opcode_str);
fprintf (headerfile, "extern compop_func op_%lx_%d_comp_nf;\n", opcode, postfix);
printf ("void REGPARAM2 op_%lx_%d_comp_nf(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
printf ("void REGPARAM2 op_%lx_%d_comp_nf(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, opcode_str);
}
else {
fprintf (stblfile, "{ op_%lx_%d_comp_ff, 0x%08x, %ld }, /* %s */\n", opcode, postfix, flags, opcode, lookuptab[i].name);
fprintf (stblfile, "{ op_%lx_%d_comp_ff, 0x%08x, %ld }, /* %s */\n", opcode, postfix, flags, opcode, opcode_str);
fprintf (headerfile, "extern compop_func op_%lx_%d_comp_ff;\n", opcode, postfix);
printf ("void REGPARAM2 op_%lx_%d_comp_ff(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
printf ("void REGPARAM2 op_%lx_%d_comp_ff(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, opcode_str);
}
com_flush();
}

View File

@ -2234,38 +2234,35 @@ static int postfix;
static void generate_one_opcode (int rp)
{
int i;
uae_u16 smsk, dmsk;
long int opcode = opcode_map[rp];
const char *opcode_str;
if (table68k[opcode].mnemo == i_ILLG
|| table68k[opcode].clev > cpu_level)
return;
for (i = 0; lookuptab[i].name[0]; i++) {
if (table68k[opcode].mnemo == lookuptab[i].mnemo)
break;
}
if (table68k[opcode].handler != -1)
return;
opcode_str = get_instruction_string (opcode);
if (opcode_next_clev[rp] != cpu_level) {
if (table68k[opcode].flagdead == 0)
/* force to the "ff" variant since the instruction doesn't set at all the condition codes */
fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
opcode, lookuptab[i].name);
opcode, opcode_str);
else
fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
opcode, lookuptab[i].name);
opcode, opcode_str);
return;
}
if (table68k[opcode].flagdead == 0)
/* force to the "ff" variant since the instruction doesn't set at all the condition codes */
fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
fprintf (stblfile, "{ CPUFUNC_FF(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, opcode_str);
else
fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
fprintf (stblfile, "{ CPUFUNC(op_%lx_%d), 0, %ld }, /* %s */\n", opcode, postfix, opcode, opcode_str);
fprintf (headerfile, "extern cpuop_func op_%lx_%d_nf;\n", opcode, postfix);
fprintf (headerfile, "extern cpuop_func op_%lx_%d_ff;\n", opcode, postfix);
@ -2277,7 +2274,7 @@ static void generate_one_opcode (int rp)
if (table68k[opcode].flagdead == 0)
printf ("#ifndef NOFLAGS\n");
printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
printf ("void REGPARAM2 CPUFUNC(op_%lx_%d)(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, opcode_str);
printf ("\tcpuop_begin();\n");
switch (table68k[opcode].stype) {

View File

@ -908,3 +908,112 @@ int get_no_mismatches (void)
{
return mismatch;
}
const char *get_instruction_name (unsigned int opcode)
{
struct instr *ins = &table68k[opcode];
for (int i = 0; lookuptab[i].name[0]; i++) {
if (ins->mnemo == lookuptab[i].mnemo)
return lookuptab[i].name;
}
abort();
return NULL;
}
static char *get_ea_string (amodes mode, wordsizes size)
{
static char buffer[80];
buffer[0] = 0;
switch (mode){
case Dreg:
strcpy (buffer,"Dn");
break;
case Areg:
strcpy (buffer,"An");
break;
case Aind:
strcpy (buffer,"(An)");
break;
case Aipi:
strcpy (buffer,"(An)+");
break;
case Apdi:
strcpy (buffer,"-(An)");
break;
case Ad16:
strcpy (buffer,"(d16,An)");
break;
case Ad8r:
strcpy (buffer,"(d8,An,Xn)");
break;
case PC16:
strcpy (buffer,"(d16,PC)");
break;
case PC8r:
strcpy (buffer,"(d8,PC,Xn)");
break;
case absw:
strcpy (buffer,"(xxx).W");
break;
case absl:
strcpy (buffer,"(xxx).L");
break;
case imm:
switch (size){
case sz_byte:
strcpy (buffer,"#<data>.B");
break;
case sz_word:
strcpy (buffer,"#<data>.W");
break;
case sz_long:
strcpy (buffer,"#<data>.L");
break;
default:
break;
}
break;
case imm0:
strcpy (buffer,"#<data>.B");
break;
case imm1:
strcpy (buffer,"#<data>.W");
break;
case imm2:
strcpy (buffer,"#<data>.L");
break;
case immi:
strcpy (buffer,"#<data>");
break;
default:
break;
}
return buffer;
}
const char *get_instruction_string (unsigned int opcode)
{
static char out[100];
struct instr *ins;
strcpy (out, get_instruction_name (opcode));
ins = &table68k[opcode];
if (ins->size == sz_byte)
strcat (out,".B");
if (ins->size == sz_word)
strcat (out,".W");
if (ins->size == sz_long)
strcat (out,".L");
strcat (out," ");
if (ins->suse)
strcat (out, get_ea_string (ins->smode, ins->size));
if (ins->duse) {
if (ins->suse)
strcat (out,",");
strcat (out, get_ea_string (ins->dmode, ins->size));
}
return out;
}

View File

@ -120,6 +120,9 @@ extern void do_merges (void);
extern int get_no_mismatches (void);
extern int nr_cpuop_funcs;
extern const char *get_instruction_name (unsigned int opcode);
extern const char *get_instruction_string (unsigned int opcode);
#ifdef __cplusplus
}
#endif