-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathgainstruction.h
More file actions
55 lines (43 loc) · 1.6 KB
/
gainstruction.h
File metadata and controls
55 lines (43 loc) · 1.6 KB
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
#ifndef GAINSTRUCTION_H
#define GAINSTRUCTION_H
#include<QString>
#include<stdint.h>
/* This represents one instruction decoded from a binary or built
* from source code. It's how the program is walked to produce a
* listing.
*/
class GoodASM;
class GALanguage;
class GAMnemonic;
class GAParser;
class GAInstruction {
friend class GAMnemonic;
friend class GoodASM;
friend class GAParser;
public:
GAInstruction(GoodASM *gasm);
GAInstruction(GoodASM *gasm, QString str);
GAInstruction(GoodASM *gasm, uint8_t byte); //Single byte.
GAInstruction(GoodASM *gasm, QByteArray bytes); //Array of data bytes.
QString source(); //Return source code disassembly.
QString sourceNasm(); //Return source code disassembly in NASM format.
QByteArray code(); //Return binary machine code.
uint32_t len=-1; //Length in bytes.
uint64_t adr=-1; //Start address.
QString label=""; //pre-instruction label.
QString verb="unset"; //Mnemonic string.
GAMnemonic *mnem=0; //Mnemonic pointer from the language parsing.
QString params="unset"; //Parameter strings.
QString helpstr=""; //Help string.
//Next instruction.
GAInstruction next();
enum {NONE, MNEMONIC, DIRECTIVE, DATA, COMMENT} type=NONE;
QString comment=""; //Comment after bytes.
QString override=""; //Overrides string.
GoodASM* gasm=0; //Pointer to the local context.
QByteArray data; //Bytes of the instruction, or data bytes.
private:
GALanguage* lang=0;
QString bitstring(uint8_t b);
};
#endif // GAINSTRUCTION_H