Rizin
unix-like reverse engineering framework and cli tools
m680x.py
Go to the documentation of this file.
1 # Capstone Python bindings, by Wolfgang Schwotzer <wolfgang.schwotzer@gmx.net>
2 
3 import ctypes
4 from . import copy_ctypes_list
5 from .m680x_const import *
6 
7 # define the API
8 class M680xOpIdx(ctypes.Structure):
9  _fields_ = (
10  ('base_reg', ctypes.c_uint),
11  ('offset_reg', ctypes.c_uint),
12  ('offset', ctypes.c_int16),
13  ('offset_addr', ctypes.c_uint16),
14  ('offset_bits', ctypes.c_uint8),
15  ('inc_dec', ctypes.c_int8),
16  ('flags', ctypes.c_uint8),
17  )
18 
19 class M680xOpRel(ctypes.Structure):
20  _fields_ = (
21  ('address', ctypes.c_uint16),
22  ('offset', ctypes.c_int16),
23  )
24 
25 class M680xOpExt(ctypes.Structure):
26  _fields_ = (
27  ('address', ctypes.c_uint16),
28  ('indirect', ctypes.c_bool),
29  )
30 
31 class M680xOpValue(ctypes.Union):
32  _fields_ = (
33  ('imm', ctypes.c_int32),
34  ('reg', ctypes.c_uint),
35  ('idx', M680xOpIdx),
36  ('rel', M680xOpRel),
37  ('ext', M680xOpExt),
38  ('direct_addr', ctypes.c_uint8),
39  ('const_val', ctypes.c_uint8),
40  )
41 
42 class M680xOp(ctypes.Structure):
43  _fields_ = (
44  ('type', ctypes.c_uint),
45  ('value', M680xOpValue),
46  ('size', ctypes.c_uint8),
47  ('access', ctypes.c_uint8),
48  )
49 
50  @property
51  def imm(self):
52  return self.value.imm
53 
54  @property
55  def reg(self):
56  return self.value.reg
57 
58  @property
59  def idx(self):
60  return self.value.idx
61 
62  @property
63  def rel(self):
64  return self.value.rel
65 
66  @property
67  def ext(self):
68  return self.value.ext
69 
70  @property
71  def direct_addr(self):
72  return self.value.direct_addr
73 
74  @property
75  def const_val(self):
76  return self.value.const_val
77 
78 
79 class CsM680x(ctypes.Structure):
80  _fields_ = (
81  ('flags', ctypes.c_uint8),
82  ('op_count', ctypes.c_uint8),
83  ('operands', M680xOp * 9),
84  )
85 
87  return (a.flags, copy_ctypes_list(a.operands[:a.op_count]))
88 
def const_val(self)
Definition: m680x.py:75
def ext(self)
Definition: m680x.py:67
def imm(self)
Definition: m680x.py:51
def rel(self)
Definition: m680x.py:63
def direct_addr(self)
Definition: m680x.py:71
def idx(self)
Definition: m680x.py:59
def reg(self)
Definition: m680x.py:55
def get_arch_info(a)
Definition: m680x.py:86
def copy_ctypes_list(src)
Definition: __init__.py:326