forked from schuylerdaddy/Assembler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (44 loc) · 1.09 KB
/
main.cpp
File metadata and controls
56 lines (44 loc) · 1.09 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
//#include "VM.h"
#include "Assembler.h"
#include "OS.h"
int main(int argc, const char * argv[]) {
OS::runShell();
/*bool logging = false;
string fName = "";
if (argc == 3)
{
fName = argv[2];
if (string(argv[1]) == "-l") //flag to add logging at command line
logging = true;
else
{
cout << "Unkown flag '"<< argv[1] << "'" << endl;
return 1;
}
}
else if (argc == 2)
{
fName = argv[1];
}
else if (argc<2)
{
cout << "Please give .asm file as argument." << endl;
return 1;
}
else
{
cout << "Too many arguments. Please only provide optional flag and .asm file." << endl;
return 1;
}
//run assembler and get compiled code
Assembler assembler = Assembler();
char* assembly = assembler.AssembleCode(fName,BYTECODE_SIZE);
//create table for PC-> instructions or data for debugging
if (logging)
assembler.MakePC_InstructionTable(fName, "byteCodeTble.txt");
//execute virtual machine using bytecode
VirtualMachine vm(assembly, assembler.heapStart, BYTECODE_SIZE);
vm.exeLog = logging;
vm.Run(0);*/
return 0;
}