Fix typos of MOS65XX (#1390)

* Fix typos

* make test_mos65xx.py and test_mos65xx.c have same output format

* mox65xx -> mos65xx
This commit is contained in:
david942j 2019-02-18 19:52:51 +08:00 committed by Nguyen Anh Quynh
parent 6a69f43f74
commit 0b37390f49
7 changed files with 19 additions and 18 deletions

View File

@ -31,11 +31,11 @@ __all__ = [
'CS_ARCH_SPARC',
'CS_ARCH_SYSZ',
'CS_ARCH_XCORE',
'CS_ARCH_MOS65XX',
'CS_ARCH_M68K',
'CS_ARCH_TMS320C64X',
'CS_ARCH_M680X',
'CS_ARCH_EVM',
'CS_ARCH_MOS65XX',
'CS_ARCH_ALL',
'CS_MODE_LITTLE_ENDIAN',

View File

@ -3,7 +3,7 @@
# Capstone Python bindings, by Sebastian Macke <Sebastian Macke>
from __future__ import print_function
from capstone import *
from capstone.mips import *
from capstone.mos65xx import *
from xprint import to_hex, to_x
MOS65XX_CODE = b"\x0d\x34\x12\x00\x81\x65\x87\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"
@ -33,18 +33,18 @@ def print_insn_detail(insn):
# "data" instruction generated by SKIPDATA option has no detail
if insn.id == 0:
return
print("\taddress mode = %s" % (address_modes[insn.am]))
print("\tmodifies flags = %r" % (insn.modifies_flags != 0))
print("\taddress mode: %s" % (address_modes[insn.am]))
print("\tmodifies flags: %s" % ('true' if insn.modifies_flags != 0 else 'false'))
if len(insn.operands) > 0:
print("\top_count: %u" % len(insn.operands))
c = -1
for i in insn.operands:
c += 1
if i.type == MIPS_OP_REG:
if i.type == MOS65XX_OP_REG:
print("\t\toperands[%u].type: REG = %s" % (c, insn.reg_name(i.reg)))
if i.type == MIPS_OP_IMM:
if i.type == MOS65XX_OP_IMM:
print("\t\toperands[%u].type: IMM = 0x%s" % (c, to_x(i.imm)))
if i.type == MIPS_OP_MEM:
if i.type == MOS65XX_OP_MEM:
print("\t\toperands[%u].type: MEM = 0x%s" % (c, to_x(i.mem)))

8
cs.c
View File

@ -1381,11 +1381,11 @@ int CAPSTONE_API cs_op_count(csh ud, const cs_insn *insn, unsigned int op_type)
if (insn->detail->evm.operands[i].type == (evm_op_type)op_type)
count++;
#endif
case CS_ARCH_MOS65XX:
for (i = 0; i < insn->detail->m680x.op_count; i++)
if (insn->detail->m680x.operands[i].type == (m680x_op_type)op_type)
count++;
break;
case CS_ARCH_MOS65XX:
for (i = 0; i < insn->detail->mos65xx.op_count; i++)
if (insn->detail->mos65xx.operands[i].type == (mos65xx_op_type)op_type)
count++;
break;
}

View File

@ -56,7 +56,7 @@ static struct {
{ "hd6309", CS_ARCH_M680X, CS_MODE_M680X_6309 },
{ "hcs08", CS_ARCH_M680X, CS_MODE_M680X_HCS08 },
{ "evm", CS_ARCH_EVM, 0 },
{ "mos65xx", CS_ARCH_MOS65XX, 0 },
{ "mos65xx", CS_ARCH_MOS65XX, 0 },
{ NULL }
};
@ -211,7 +211,7 @@ static void usage(char *prog)
}
if (cs_support(CS_ARCH_MOS65XX)) {
printf(" mox65xx MOS65XX family\n");
printf(" mos65xx MOS65XX family\n");
}
printf("\nExtra options:\n");
@ -360,7 +360,7 @@ int main(int argc, char **argv)
}
if (cs_support(CS_ARCH_MOS65XX)) {
printf("mox65xx=1 ");
printf("mos65xx=1 ");
}
if (cs_support(CS_SUPPORT_DIET)) {

View File

@ -39,7 +39,7 @@ typedef enum mos65xx_address_mode {
MOS65XX_AM_IND, ///< absolute indirect addressing
} mos65xx_address_mode;
/// M68K instruction
/// MOS65XX instruction
typedef enum mos65xx_insn {
MOS65XX_INS_INVALID = 0,
MOS65XX_INS_ADC,
@ -101,7 +101,7 @@ typedef enum mos65xx_insn {
MOS65XX_INS_ENDING, // <-- mark the end of the list of instructions
} mos65xx_insn;
/// Group of M68K instructions
/// Group of MOS65XX instructions
typedef enum mos65xx_group_type {
MOS65XX_GRP_INVALID = 0, ///< CS_GRP_INVALID
MOS65XX_GRP_JUMP, ///< = CS_GRP_JUMP

View File

@ -65,7 +65,7 @@ int main()
}
if (cs_support(CS_ARCH_MOS65XX)) {
printf("mox65xx=1 ");
printf("mos65xx=1 ");
}
if (cs_support(CS_SUPPORT_DIET)) {

View File

@ -23,7 +23,7 @@ static void print_string_hex(const char *comment, unsigned char *str, size_t len
printf("%s", comment);
for (c = str; c < str + len; c++) {
printf("0x%02x ", *c & 0xff);
printf(" 0x%02x", *c & 0xff);
}
printf("\n");
@ -142,6 +142,7 @@ static void test()
for (j = 0; j < count; j++) {
printf("0x%" PRIx64 ":\t%s\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str);
print_insn_detail(&insn[j]);
puts("");
}
printf("0x%" PRIx64 ":\n", insn[j-1].address + insn[j-1].size);