cstool_mos65xx.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 
4 #include <capstone/capstone.h>
5 
6 void print_string_hex(char *comment, unsigned char *str, size_t len);
7 
9 {
10  switch(mode) {
11  default:
12  case MOS65XX_AM_NONE:
13  return "No address mode";
14  case MOS65XX_AM_IMP:
15  return "implied addressing (no addressing mode)";
16  case MOS65XX_AM_ACC:
17  return "accumulator addressing";
18  case MOS65XX_AM_ABS:
19  return "absolute addressing";
20  case MOS65XX_AM_ZP:
21  return "zeropage addressing";
22  case MOS65XX_AM_IMM:
23  return "8 Bit immediate value";
24  case MOS65XX_AM_ABSX:
25  return "indexed absolute addressing by the X index register";
26  case MOS65XX_AM_ABSY:
27  return "indexed absolute addressing by the Y index register";
28  case MOS65XX_AM_INDX:
29  return "indexed indirect addressing by the X index register";
30  case MOS65XX_AM_INDY:
31  return "indirect indexed addressing by the Y index register";
32  case MOS65XX_AM_ZPX:
33  return "indexed zeropage addressing by the X index register";
34  case MOS65XX_AM_ZPY:
35  return "indexed zeropage addressing by the Y index register";
36  case MOS65XX_AM_REL:
37  return "relative addressing used by branches";
38  case MOS65XX_AM_IND:
39  return "absolute indirect addressing";
40  }
41 }
42 
43 
45 {
46  int i;
47  cs_mos65xx *mos65xx;
48 
49  // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
50  if (ins->detail == NULL)
51  return;
52 
53  mos65xx = &(ins->detail->mos65xx);
54  printf("\taddress mode: %s\n", get_am_name(mos65xx->am));
55  printf("\tmodifies flags: %s\n", mos65xx->modifies_flags ? "true": "false");
56 
57  if (mos65xx->op_count)
58  printf("\top_count: %u\n", mos65xx->op_count);
59 
60  for (i = 0; i < mos65xx->op_count; i++) {
61  cs_mos65xx_op *op = &(mos65xx->operands[i]);
62  switch((int)op->type) {
63  default:
64  break;
65  case MOS65XX_OP_REG:
66  printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
67  break;
68  case MOS65XX_OP_IMM:
69  printf("\t\toperands[%u].type: IMM = 0x%x\n", i, op->imm);
70  break;
71  case MOS65XX_OP_MEM:
72  printf("\t\toperands[%u].type: MEM = 0x%x\n", i, op->mem);
73  break;
74  }
75  }
76 }
xds_interop_client.str
str
Definition: xds_interop_client.py:487
MOS65XX_AM_IMM
@ MOS65XX_AM_IMM
8 Bit immediate value
Definition: mos65xx.h:31
MOS65XX_AM_ABS
@ MOS65XX_AM_ABS
absolute addressing
Definition: mos65xx.h:29
MOS65XX_AM_INDX
@ MOS65XX_AM_INDX
indexed indirect addressing by the X index register
Definition: mos65xx.h:34
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition: cs_driver.c:91
cs_mos65xx::am
mos65xx_address_mode am
Definition: mos65xx.h:135
MOS65XX_AM_ZPX
@ MOS65XX_AM_ZPX
indexed zeropage addressing by the X index register
Definition: mos65xx.h:36
mode
const char int mode
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
MOS65XX_AM_IMP
@ MOS65XX_AM_IMP
implied addressing (no addressing mode)
Definition: mos65xx.h:27
MOS65XX_AM_ABSX
@ MOS65XX_AM_ABSX
indexed absolute addressing by the X index register
Definition: mos65xx.h:32
MOS65XX_AM_REL
@ MOS65XX_AM_REL
relative addressing used by branches
Definition: mos65xx.h:38
capstone.h
MOS65XX_AM_ZPY
@ MOS65XX_AM_ZPY
indexed zeropage addressing by the Y index register
Definition: mos65xx.h:37
print_string_hex
void print_string_hex(char *comment, unsigned char *str, size_t len)
MOS65XX_OP_REG
@ MOS65XX_OP_REG
= CS_OP_REG (Register operand).
Definition: mos65xx.h:118
MOS65XX_AM_NONE
@ MOS65XX_AM_NONE
No address mode.
Definition: mos65xx.h:26
cs_mos65xx::modifies_flags
bool modifies_flags
Definition: mos65xx.h:136
cs_reg_name
const CAPSTONE_EXPORT char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1176
MOS65XX_AM_ZP
@ MOS65XX_AM_ZP
zeropage addressing
Definition: mos65xx.h:30
print_insn_detail_mos65xx
void print_insn_detail_mos65xx(csh handle, cs_insn *ins)
Definition: cstool_mos65xx.c:44
MOS65XX_OP_MEM
@ MOS65XX_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: mos65xx.h:120
cs_mos65xx::operands
cs_mos65xx_op operands[3]
operands for this instruction.
Definition: mos65xx.h:141
mos65xx_address_mode
mos65xx_address_mode
MOS65XX Addressing Modes.
Definition: mos65xx.h:25
csh
size_t csh
Definition: capstone.h:71
cs_mos65xx
The MOS65XX address mode and it's operands.
Definition: mos65xx.h:134
cs_mos65xx::op_count
uint8_t op_count
Definition: mos65xx.h:140
get_am_name
static const char * get_am_name(mos65xx_address_mode mode)
Definition: cstool_mos65xx.c:8
MOS65XX_AM_IND
@ MOS65XX_AM_IND
absolute indirect addressing
Definition: mos65xx.h:39
cs_mos65xx_op
Instruction operand.
Definition: mos65xx.h:124
MOS65XX_OP_IMM
@ MOS65XX_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: mos65xx.h:119
handle
static csh handle
Definition: test_arm_regression.c:16
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
MOS65XX_AM_INDY
@ MOS65XX_AM_INDY
indirect indexed addressing by the Y index register
Definition: mos65xx.h:35
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
MOS65XX_AM_ACC
@ MOS65XX_AM_ACC
accumulator addressing
Definition: mos65xx.h:28
MOS65XX_AM_ABSY
@ MOS65XX_AM_ABSY
indexed absolute addressing by the Y index register
Definition: mos65xx.h:33
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:08