Skip to content

Commit

Permalink
MOS65XX: Fix instruction length for indirect addressing modes (capsto…
Browse files Browse the repository at this point in the history
…ne-engine#1402)

Signed-off-by: Sebastian Macke <[email protected]>
  • Loading branch information
s-macke authored and aquynh committed Feb 27, 2019
1 parent a759a14 commit 9baa075
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions arch/MOS65XX/MOS65XXDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,13 @@ static int getInstructionLength(mos65xx_address_mode am)
case MOS65XX_AM_ZPY:
case MOS65XX_AM_ZP:
case MOS65XX_AM_REL:
case MOS65XX_AM_INDX:
case MOS65XX_AM_INDY:
return 2;

case MOS65XX_AM_ABS:
case MOS65XX_AM_ABSX:
case MOS65XX_AM_ABSY:
case MOS65XX_AM_INDX:
case MOS65XX_AM_INDY:
case MOS65XX_AM_IND:
return 3;
default:
Expand Down Expand Up @@ -496,11 +496,11 @@ void MOS65XX_printInst(MCInst *MI, struct SStream *O, void *PrinterInfo)
break;

case MOS65XX_AM_INDX:
SStream_concat(O, " ($%04X,x)", value);
SStream_concat(O, " ($%02X,x)", value);
break;

case MOS65XX_AM_INDY:
SStream_concat(O, " ($%04X),y", value);
SStream_concat(O, " ($%02X),y", value);
break;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/test_mos65xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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"
MOS65XX_CODE = b"\x0d\x34\x12\x00\x81\x65\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"

address_modes=[
'No address mode',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void test()
#endif

#ifdef CAPSTONE_HAS_MOS65XX
#define MOS65XX_CODE "\x0d\x34\x12\x00\x81\x65\x87\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"
#define MOS65XX_CODE "\x0d\x34\x12\x00\x81\x65\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"
#endif


Expand Down
2 changes: 1 addition & 1 deletion tests/test_mos65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void print_insn_detail(cs_insn *ins)

static void test()
{
#define MOS65XX_CODE "\x0d\x34\x12\x00\x81\x65\x87\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"
#define MOS65XX_CODE "\x0d\x34\x12\x00\x81\x87\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42"

struct platform platforms[] = {
{
Expand Down

0 comments on commit 9baa075

Please sign in to comment.