-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobjectCodeTable.h
More file actions
133 lines (125 loc) · 4.98 KB
/
objectCodeTable.h
File metadata and controls
133 lines (125 loc) · 4.98 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
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
//
// Created by walid on 5/27/20.
//
#include "bits/stdc++.h"
using namespace std;
#ifndef ASSEMBLER_OBJECTCODETABLE_H
#define ASSEMBLER_OBJECTCODETABLE_H
class objectCodeTable {
public:
unordered_map<string, pair<int, string>> table;
unordered_map<string, string> registersTable;
objectCodeTable() {
table["add"] = make_pair(3, "18");
table["+add"] = make_pair(3, "18");
table["addr"] = make_pair(2, "90");
table["addf"] = make_pair(3, "58");
table["+addf"] = make_pair(4, "58");
table["and"] = make_pair(3, "40");
table["+and"] = make_pair(4, "40");
table["clear"] = make_pair(2, "B4");
table["comp"] = make_pair(3, "28");
table["+comp"] = make_pair(4, "28");
table["compf"] = make_pair(3, "88");
table["+compf"] = make_pair(4, "88");
table["compr"] = make_pair(2, "A0");
table["div"] = make_pair(3, "24");
table["+div"] = make_pair(4, "24");
table["divf"] = make_pair(3, "64");
table["+divf"] = make_pair(4, "64");
table["divr"] = make_pair(2, "9C");
table["fix"] = make_pair(1, "C0");
table["float"] = make_pair(1, "C4");
table["hio"] = make_pair(1, "F4");
table["j"] = make_pair(3, "3C");
table["+j"] = make_pair(4, "3C");
table["jeq"] = make_pair(3, "30");
table["+jeq"] = make_pair(4, "30");
table["jgt"] = make_pair(3, "34");
table["+jgt"] = make_pair(4, "34");
table["jlt"] = make_pair(3, "38");
table["+jlt"] = make_pair(4, "38");
table["jsub"] = make_pair(3, "48");
table["+jsub"] = make_pair(4, "48");
table["lda"] = make_pair(3, "00");
table["+lda"] = make_pair(4, "00");
table["ldb"] = make_pair(3, "68");
table["+ldb"] = make_pair(4, "68");
table["ldch"] = make_pair(3, "50");
table["+ldch"] = make_pair(4, "50");
table["ldf"] = make_pair(3, "70");
table["+ldf"] = make_pair(4, "70");
table["ldl"] = make_pair(3, "08");
table["+ldl"] = make_pair(4, "08");
table["lds"] = make_pair(3, "6C");
table["+lds"] = make_pair(4, "6C");
table["ldt"] = make_pair(3, "74");
table["+ldt"] = make_pair(4, "74");
table["ldx"] = make_pair(3, "04");
table["+ldx"] = make_pair(4, "04");
table["lps"] = make_pair(3, "D0");
table["+lps"] = make_pair(4, "D0");
table["mul"] = make_pair(3, "20");
table["+mul"] = make_pair(4, "20");
table["mulf"] = make_pair(3, "60");
table["+mulf"] = make_pair(4, "60");
table["mulr"] = make_pair(2, "98");
table["or"] = make_pair(3, "44");
table["+or"] = make_pair(4, "44");
table["rd"] = make_pair(3, "D8");
table["+rd"] = make_pair(4, "D8");
table["norm"] = make_pair(1, "C8");
table["rmo"] = make_pair(2, "AC");
table["rsub"] = make_pair(3, "4C");
table["+rsub"] = make_pair(4, "4C");
table["shiftl"] = make_pair(2, "A4");
table["shiftr"] = make_pair(2, "A8");
table["sio"] = make_pair(1, "F0");
table["ssk"] = make_pair(3, "EC");
table["+ssk"] = make_pair(4, "EC");
table["sta"] = make_pair(3, "0C");
table["+sta"] = make_pair(4, "0C");
table["stb"] = make_pair(3, "78");
table["+stb"] = make_pair(4, "78");
table["stch"] = make_pair(3, "54");
table["+stch"] = make_pair(4, "54");
table["stf"] = make_pair(3, "80");
table["+stf"] = make_pair(4, "80");
table["sti"] = make_pair(3, "D4");
table["+sti"] = make_pair(4, "D4");
table["stl"] = make_pair(3, "14");
table["+stl"] = make_pair(4, "14");
table["sts"] = make_pair(3, "7C");
table["+sts"] = make_pair(4, "7C");
table["stsw"] = make_pair(3, "E8");
table["+stsw"] = make_pair(4, "E8");
table["stt"] = make_pair(3, "84");
table["+stt"] = make_pair(4, "84");
table["stx"] = make_pair(3, "10");
table["+stx"] = make_pair(4, "10");
table["sub"] = make_pair(3, "1C");
table["+sub"] = make_pair(4, "1C");
table["subf"] = make_pair(3, "5C");
table["+subf"] = make_pair(4, "5C");
table["td"] = make_pair(3, "E0");
table["+td"] = make_pair(4, "E0");
table["tix"] = make_pair(3, "2C");
table["+tix"] = make_pair(4, "2C");
table["wd"] = make_pair(3, "DC");
table["+wd"] = make_pair(4, "DC");
table["subr"] = make_pair(2, "94");
table["svc"] = make_pair(2, "B0");
table["tio"] = make_pair(1, "F8");
table["tixr"] = make_pair(2, "B8");
registersTable["a"] = "0";
registersTable["x"] = "1";
registersTable["l"] = "2";
registersTable["b"] = "3";
registersTable["s"] = "4";
registersTable["t"] = "5";
registersTable["f"] = "6";
registersTable["pc"] = "8";
registersTable["sw"] = "9";
}
};
#endif //ASSEMBLER_OBJECTCODETABLE_H