-
Notifications
You must be signed in to change notification settings - Fork 2
/
operands.h
141 lines (122 loc) · 3 KB
/
operands.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef _OPERANDS_H
#define _OPERANDS_H
#pragma once
#include "base_operand.h"
#include "base_parameter.h"
class saved_state;
class operand_two : public base_operand
{
public:
operand_two(){_param[0]=0;_param[1]=0;};
operand_two(base_parameter *p1,base_parameter *p2){_param[0]=p1;_param[1]=p2;};
virtual ~operand_two(){delete _param[0];delete _param[1];};
virtual char *tostr();
void setparameter(base_parameter *p,int i){_param[i]=p;};
base_parameter* getparameter(int i){return _param[i];};
virtual int parameter_flags(int i);
virtual void generate(int flags);
virtual base_operand *reverse();
private:
base_parameter *_param[2];
static char _buffer[255];
};
class operand_two_rev : public operand_two
{
public:
virtual base_operand *reverse();
};
class operand_one : public base_operand
{
public:
operand_one(){_param[0]=0;};
operand_one(base_parameter *p1){_param[0]=p1;};
virtual ~operand_one(){delete _param[0];};
char *tostr();
virtual base_operand *reverse();
void setparameter(base_parameter *p,int i){_param[0]=p;};
base_parameter* getparameter(int i){return _param[0];};
virtual void generate(int flags);
virtual int parameter_flags(int i);
private:
base_parameter *_param[1];
static char _buffer[255];
};
class operand_add : public operand_two
{
public:
virtual void generate(int flags);
virtual char *name(){return "add %s,%s\n";};
base_operand *reverseop();
static char _name[];
};
class operand_sub : public operand_two
{
public:
virtual void generate(int flags);
virtual char *name(){return "sub %s,%s\n";};
protected:
base_operand *reverseop();
static char _name[];
};
class operand_xor : public operand_two
{
public:
virtual void generate(int flags);
virtual char *name(){return "xor %s,%s\n";};
protected:
base_operand *reverseop();
static char _name[];
};
class operand_ror : public operand_two
{
public:
virtual void generate(int flags);
virtual char *name(){return "ror %s,%s\n";};
virtual int parameter_flags(int i);
protected:
base_operand *reverseop();
static char _name[];
};
class operand_rol : public operand_two
{
public:
virtual void generate(int flags);
virtual char *name(){return "rol %s,%s\n";};
virtual int parameter_flags(int i);
protected:
base_operand *reverseop();
static char _name[];
};
class operand_mov : public operand_two_rev
{
virtual char *name(){return "mov %s,%s\n";};
virtual bool reversible(){return false;};
virtual void generate(int flags);
virtual int parameter_flags(int i);
protected:
base_operand *reverseop();
static char _name[];
};
class operand_push : public operand_one
{
public:
operand_push(){op(op::OP_PUSH);};
~operand_push();
virtual char *name(){return "push %s\n";};
virtual void generate(int flags);
virtual base_operand *reverse();
protected:
base_operand *reverseop();
saved_state *_saved_state;
static char _name[];
};
class operand_pop : public operand_one
{
public:
virtual void generate(int flags);
virtual char *name(){return "pop %s\n";};
protected:
base_operand *reverseop();
static char _name[];
};
#endif