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

Comparing BasiliskII/src/uae_cpu/readcpu.cpp (file contents):
Revision 1.9 by gbeauche, 2005-06-06T19:22:56Z vs.
Revision 1.11 by asvitkine, 2012-03-30T01:25:46Z

# Line 4 | Line 4
4   * Read 68000 CPU specs from file "table68k"
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 <stdio.h>
# Line 908 | Line 922 | int get_no_mismatches (void)
922   {
923      return mismatch;
924   }
925 +
926 + const char *get_instruction_name (unsigned int opcode)
927 + {
928 +    struct instr *ins = &table68k[opcode];
929 +    for (int i = 0; lookuptab[i].name[0]; i++) {
930 +        if (ins->mnemo == lookuptab[i].mnemo)
931 +            return lookuptab[i].name;
932 +    }
933 +    abort();
934 +    return NULL;
935 + }
936 +
937 + static char *get_ea_string (amodes mode, wordsizes size)
938 + {
939 +    static char buffer[80];
940 +
941 +    buffer[0] = 0;
942 +    switch (mode){
943 +     case Dreg:
944 +        strcpy (buffer,"Dn");
945 +        break;
946 +     case Areg:
947 +        strcpy (buffer,"An");
948 +        break;
949 +     case Aind:
950 +        strcpy (buffer,"(An)");
951 +        break;
952 +     case Aipi:
953 +        strcpy (buffer,"(An)+");
954 +        break;
955 +     case Apdi:
956 +        strcpy (buffer,"-(An)");
957 +        break;
958 +     case Ad16:
959 +        strcpy (buffer,"(d16,An)");
960 +        break;
961 +     case Ad8r:
962 +        strcpy (buffer,"(d8,An,Xn)");
963 +        break;
964 +     case PC16:
965 +        strcpy (buffer,"(d16,PC)");
966 +        break;
967 +     case PC8r:
968 +         strcpy (buffer,"(d8,PC,Xn)");
969 +        break;
970 +     case absw:
971 +        strcpy (buffer,"(xxx).W");
972 +        break;
973 +     case absl:
974 +        strcpy (buffer,"(xxx).L");
975 +        break;
976 +     case imm:
977 +        switch (size){
978 +         case sz_byte:
979 +            strcpy (buffer,"#<data>.B");
980 +            break;
981 +         case sz_word:
982 +            strcpy (buffer,"#<data>.W");
983 +            break;
984 +         case sz_long:
985 +            strcpy (buffer,"#<data>.L");
986 +            break;
987 +         default:
988 +            break;
989 +        }
990 +        break;
991 +     case imm0:
992 +        strcpy (buffer,"#<data>.B");
993 +        break;
994 +     case imm1:
995 +        strcpy (buffer,"#<data>.W");
996 +        break;
997 +     case imm2:
998 +        strcpy (buffer,"#<data>.L");
999 +        break;
1000 +     case immi:
1001 +        strcpy (buffer,"#<data>");
1002 +        break;
1003 +
1004 +     default:
1005 +        break;
1006 +    }
1007 +    return buffer;
1008 + }
1009 +
1010 + const char *get_instruction_string (unsigned int opcode)
1011 + {
1012 +    static char out[100];
1013 +    struct instr *ins;
1014 +
1015 +    strcpy (out, get_instruction_name (opcode));
1016 +
1017 +    ins = &table68k[opcode];
1018 +    if (ins->size == sz_byte)
1019 +        strcat (out,".B");
1020 +    if (ins->size == sz_word)
1021 +        strcat (out,".W");
1022 +    if (ins->size == sz_long)
1023 +        strcat (out,".L");
1024 +    strcat (out," ");
1025 +    if (ins->suse)
1026 +        strcat (out, get_ea_string (ins->smode, ins->size));
1027 +    if (ins->duse) {
1028 +        if (ins->suse)
1029 +            strcat (out,",");
1030 +        strcat (out, get_ea_string (ins->dmode, ins->size));
1031 +    }
1032 +    return out;
1033 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines