Rizin
unix-like reverse engineering framework and cli tools
8051_ops.h File Reference
#include <rz_types.h>

Go to the source code of this file.

Classes

struct  _8051_op_t
 

Macros

#define T(op)   RZ_ANALYSIS_OP_TYPE_##op
 

Enumerations

enum  op8051 {
  OP_INVALID = 0 , OP_ADD , OP_ADDC , OP_ANL ,
  OP_CALL , OP_CJNE , OP_CLR , OP_CPL ,
  OP_DA , OP_DEC , OP_DIV , OP_DJNZ ,
  OP_INC , OP_JB , OP_JBC , OP_JC ,
  OP_JMP , OP_JNB , OP_JNC , OP_JNZ ,
  OP_JZ , OP_MOV , OP_MUL , OP_NOP ,
  OP_ORL , OP_POP , OP_PUSH , OP_RET ,
  OP_RL , OP_RLC , OP_RR , OP_RRC ,
  OP_SETB , OP_SUBB , OP_SWAP , OP_XCH ,
  OP_XRL
}
 
enum  argtype8051 {
  A_NONE = 0 , A_RI , A_RN , A_ADDR11 ,
  A_ADDR16 , A_DIRECT , A_BIT , A_IMMEDIATE ,
  A_IMM16 , A_OFFSET
}
 
enum  argmask8051 { M_NONE = 0 , M_RI = 0x01 , M_RN = 0x07 , M_ADDR11 = 0xe0 }
 

Functions

static ut64 apply_bank (ut64 ref, ut16 addr)
 Construct an address with the higher bits from ref (determining the bank) and the lower from addr (offset in the bank) More...
 
static ut64 arg_offset (ut64 bank, ut16 pc, ut8 offset)
 
static ut64 arg_addr11 (ut64 bank, ut16 pc, const ut8 *buf)
 
static ut8 arg_bit (ut8 bit_addr)
 

Variables

static _8051_op_t _8051_ops []
 

Macro Definition Documentation

◆ T

#define T (   op)    RZ_ANALYSIS_OP_TYPE_##op

Enumeration Type Documentation

◆ argmask8051

Enumerator
M_NONE 
M_RI 
M_RN 
M_ADDR11 

Definition at line 93 of file 8051_ops.h.

93  {
94  M_NONE = 0,
95  M_RI = 0x01,
96  M_RN = 0x07,
97  M_ADDR11 = 0xe0
98 } argmask8051;
argmask8051
Definition: 8051_ops.h:93
@ M_RI
Definition: 8051_ops.h:95
@ M_RN
Definition: 8051_ops.h:96
@ M_ADDR11
Definition: 8051_ops.h:97
@ M_NONE
Definition: 8051_ops.h:94

◆ argtype8051

Enumerator
A_NONE 
A_RI 
A_RN 
A_ADDR11 
A_ADDR16 
A_DIRECT 
A_BIT 
A_IMMEDIATE 
A_IMM16 
A_OFFSET 

Definition at line 80 of file 8051_ops.h.

80  {
81  A_NONE = 0,
82  A_RI, // @Ri
83  A_RN, // Rn
84  A_ADDR11,
85  A_ADDR16,
86  A_DIRECT,
87  A_BIT,
89  A_IMM16,
90  A_OFFSET
91 } argtype8051;
argtype8051
Definition: 8051_ops.h:80
@ A_ADDR11
Definition: 8051_ops.h:84
@ A_IMMEDIATE
Definition: 8051_ops.h:88
@ A_NONE
Definition: 8051_ops.h:81
@ A_DIRECT
Definition: 8051_ops.h:86
@ A_RN
Definition: 8051_ops.h:83
@ A_BIT
Definition: 8051_ops.h:87
@ A_OFFSET
Definition: 8051_ops.h:90
@ A_RI
Definition: 8051_ops.h:82
@ A_ADDR16
Definition: 8051_ops.h:85
@ A_IMM16
Definition: 8051_ops.h:89

◆ op8051

enum op8051
Enumerator
OP_INVALID 
OP_ADD 
OP_ADDC 
OP_ANL 
OP_CALL 
OP_CJNE 
OP_CLR 
OP_CPL 
OP_DA 
OP_DEC 
OP_DIV 
OP_DJNZ 
OP_INC 
OP_JB 
OP_JBC 
OP_JC 
OP_JMP 
OP_JNB 
OP_JNC 
OP_JNZ 
OP_JZ 
OP_MOV 
OP_MUL 
OP_NOP 
OP_ORL 
OP_POP 
OP_PUSH 
OP_RET 
OP_RL 
OP_RLC 
OP_RR 
OP_RRC 
OP_SETB 
OP_SUBB 
OP_SWAP 
OP_XCH 
OP_XRL 

Definition at line 40 of file 8051_ops.h.

40  {
41  OP_INVALID = 0,
42  OP_ADD,
43  OP_ADDC,
44  OP_ANL,
45  OP_CALL,
46  OP_CJNE,
47  OP_CLR,
48  OP_CPL,
49  OP_DA,
50  OP_DEC,
51  OP_DIV,
52  OP_DJNZ,
53  OP_INC,
54  OP_JB,
55  OP_JBC,
56  OP_JC,
57  OP_JMP,
58  OP_JNB,
59  OP_JNC,
60  OP_JNZ,
61  OP_JZ,
62  OP_MOV,
63  OP_MUL,
64  OP_NOP,
65  OP_ORL,
66  OP_POP,
67  OP_PUSH,
68  OP_RET,
69  OP_RL,
70  OP_RLC,
71  OP_RR,
72  OP_RRC,
73  OP_SETB,
74  OP_SUBB,
75  OP_SWAP,
76  OP_XCH,
77  OP_XRL
78 } op8051;
op8051
Definition: 8051_ops.h:40
@ OP_RR
Definition: 8051_ops.h:71
@ OP_CALL
Definition: 8051_ops.h:45
@ OP_JZ
Definition: 8051_ops.h:61
@ OP_SWAP
Definition: 8051_ops.h:75
@ OP_MOV
Definition: 8051_ops.h:62
@ OP_INVALID
Definition: 8051_ops.h:41
@ OP_JNC
Definition: 8051_ops.h:59
@ OP_RRC
Definition: 8051_ops.h:72
@ OP_DA
Definition: 8051_ops.h:49
@ OP_ORL
Definition: 8051_ops.h:65
@ OP_CJNE
Definition: 8051_ops.h:46
@ OP_NOP
Definition: 8051_ops.h:64
@ OP_CLR
Definition: 8051_ops.h:47
@ OP_ANL
Definition: 8051_ops.h:44
@ OP_DIV
Definition: 8051_ops.h:51
@ OP_SETB
Definition: 8051_ops.h:73
@ OP_RL
Definition: 8051_ops.h:69
@ OP_RLC
Definition: 8051_ops.h:70
@ OP_INC
Definition: 8051_ops.h:53
@ OP_JBC
Definition: 8051_ops.h:55
@ OP_JC
Definition: 8051_ops.h:56
@ OP_RET
Definition: 8051_ops.h:68
@ OP_PUSH
Definition: 8051_ops.h:67
@ OP_ADD
Definition: 8051_ops.h:42
@ OP_MUL
Definition: 8051_ops.h:63
@ OP_SUBB
Definition: 8051_ops.h:74
@ OP_JB
Definition: 8051_ops.h:54
@ OP_ADDC
Definition: 8051_ops.h:43
@ OP_JNZ
Definition: 8051_ops.h:60
@ OP_DEC
Definition: 8051_ops.h:50
@ OP_XRL
Definition: 8051_ops.h:77
@ OP_CPL
Definition: 8051_ops.h:48
@ OP_XCH
Definition: 8051_ops.h:76
@ OP_JNB
Definition: 8051_ops.h:58
@ OP_POP
Definition: 8051_ops.h:66
@ OP_JMP
Definition: 8051_ops.h:57
@ OP_DJNZ
Definition: 8051_ops.h:52

Function Documentation

◆ apply_bank()

static ut64 apply_bank ( ut64  ref,
ut16  addr 
)
inlinestatic

Construct an address with the higher bits from ref (determining the bank) and the lower from addr (offset in the bank)

Definition at line 14 of file 8051_ops.h.

14  {
15  return (ref & ~0xffff) | (ut64)addr;
16 }
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58

References addr, and ut64().

Referenced by arg_addr11(), arg_offset(), i8051_op(), and rz_8051_disas().

◆ arg_addr11()

static ut64 arg_addr11 ( ut64  bank,
ut16  pc,
const ut8 buf 
)
inlinestatic

Definition at line 26 of file 8051_ops.h.

26  {
27  // ADDR11 is replacing lower 11 bits of (pre-incremented) PC
28  return apply_bank(bank, (pc & 0xf800) + ((buf[0] & 0xe0) << 3) + buf[1]);
29 }
static ut64 apply_bank(ut64 ref, ut16 addr)
Construct an address with the higher bits from ref (determining the bank) and the lower from addr (of...
Definition: 8051_ops.h:14
voidpf void * buf
Definition: ioapi.h:138

References apply_bank(), and pc.

Referenced by i8051_op(), and rz_8051_disas().

◆ arg_bit()

static ut8 arg_bit ( ut8  bit_addr)
inlinestatic

Definition at line 31 of file 8051_ops.h.

31  {
32  if (bit_addr < 0x80) {
33  // bit addresses 0x00-0x7f are mapped to bytes at 0x20-0x2f
34  return (bit_addr >> 3) + 0x20;
35  }
36  // bit addresses 0x80-0xff are mapped to bytes at 0x80, 0x88, 0x98, ...
37  return bit_addr & 0xf8;
38 }

Referenced by _replace_register(), i8051_op(), and rz_8051_disas().

◆ arg_offset()

static ut64 arg_offset ( ut64  bank,
ut16  pc,
ut8  offset 
)
inlinestatic

Definition at line 18 of file 8051_ops.h.

18  {
19  if (offset < 0x80) {
20  return apply_bank(bank, pc + offset);
21  }
22  offset = 0 - offset;
23  return apply_bank(bank, pc - offset);
24 }
voidpf uLong offset
Definition: ioapi.h:144

References apply_bank(), and pc.

Referenced by i8051_op(), and rz_8051_disas().

Variable Documentation

◆ _8051_ops

_8051_op_t _8051_ops[]
static

Definition at line 113 of file 8051_ops.h.

Referenced by i8051_op(), and rz_8051_disas().