Skip to content

Commit

Permalink
Fix typos of MOS65XX (capstone-engine#1390)
Browse files Browse the repository at this point in the history
* Fix typos

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

* mox65xx -> mos65xx
  • Loading branch information
david942j authored and aquynh committed Feb 18, 2019
1 parent 6a69f43 commit 0b37390
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bindings/python/capstone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
'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',
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/test_mos65xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)))


Expand Down
6 changes: 3 additions & 3 deletions cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,12 +1381,12 @@ 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
break;
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)
for (i = 0; i < insn->detail->mos65xx.op_count; i++)
if (insn->detail->mos65xx.operands[i].type == (mos65xx_op_type)op_type)
count++;
break;
break;
}

return count;
Expand Down
6 changes: 3 additions & 3 deletions cstool/cstool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions include/capstone/mos65xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion suite/capstone_get_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main()
}

if (cs_support(CS_ARCH_MOS65XX)) {
printf("mox65xx=1 ");
printf("mos65xx=1 ");
}

if (cs_support(CS_SUPPORT_DIET)) {
Expand Down
3 changes: 2 additions & 1 deletion tests/test_mos65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 0b37390

Please sign in to comment.