-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIC.cpp
68 lines (47 loc) · 1.5 KB
/
SIC.cpp
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
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "pass1.h"
#include "pass2.h"
#include "optable.h"
#include "hte.h"
using namespace std;
int main(){
bool battleRoyale = false;
vector<vector<string>> code(1000);
vector<int> location;
map<string,int> symbolTable;
map<string,string>opTable;
vector<string>objectCode;
vector<string>hteRecord;
int lines = readFile(code);
addressCounter(code,location,lines-1);
createSymbolTable(code,location,symbolTable,lines-1);
printSymbolTable(symbolTable);
initOpTable(opTable);
generateOpcode(code,objectCode,opTable,lines-1);
generateAddresses(code,objectCode,symbolTable,lines-1);
createHead(code,location,hteRecord);
createText(code,location,hteRecord,objectCode,lines-1);
createEnd(location,hteRecord);
generateHTEFile(hteRecord);
//FOR DEBUGGING
// for(int i=0 ; i<hteRecord.size(); i++)
// cout<<hteRecord[i]<<endl;
for(int i=0 ; i<location.size(); i++)
cout<<hex<<location[i]<<endl;
// for( std::map<string,string>::const_iterator it = opTable.begin(); it != opTable.end(); ++it )
// {
// string value = it->first;
// string key = it->second;
// cout<<value<<"\t"<<key<<endl;
//
// }
// for(int i=0;i<objectCode.size();i++)
// cout<<objectCode[i]<<endl;
// for(int c=0;c<code.size();c++)
// for(int j=0;j<code[c].size();j++)
// cout<<code[c][j]<<endl;
return 0;
}