-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
74 lines (64 loc) · 1.17 KB
/
types.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
#ifndef TYPES_H
#define TYPES_H
#include "consts.h"
typedef enum {
CODE,
DATA
} label_section_t;
typedef enum {
ENTRY,
EXTERNAL,
REGULAR
} label_type_t;
typedef enum {
ABSOLUTE_LINKAGE = 'a',
RELOCATBLE_LINKAGE = 'r',
EXTERNAL_LINKAGE = 'e'
} linker_data_t;
typedef struct {
label_section_t section;
label_type_t type;
char name[MAX_LABEL_LENGTH];
int address;
int has_address;
} label_t;
typedef enum {
NO_ADDRESS = 1,
IMMEDIATE_ADDRESS = 2,
DIRECT_ADDRESS = 4,
INDEX_ADDRESS = 8,
DIRECT_REGISTER_ADDRESS = 16
} address_mode_t;
typedef struct {
address_mode_t type;
union {
long immediate;
int reg;
char label[MAX_LABEL_LENGTH];
} value;
enum {
IMMEDIATE,
REGISTER,
LABEL
} index_type;
union {
long immediate;
int reg;
char label[MAX_LABEL_LENGTH];
} index;
} operand_t;
typedef struct {
char name[INSTRUCTION_NAME_LENGTH];
address_mode_t src_address_modes;
address_mode_t dest_address_modes;
unsigned int num_opernads;
int opcode;
} instruction_t;
typedef struct {
instruction_t *instruction;
int type;
int comb;
operand_t src_operand;
operand_t dest_operand;
} full_instruction_t;
#endif /* end of include guard: TYPES_H */