-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (36 loc) · 768 Bytes
/
main.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
#include "virtual_machine.h"
// Test. Last address: 885
int main( int argc, char *argv[] )
{
if ( argc < 2)
{
std::cout << "There is nothing to execute.\n";
return 0;
}
VirtualMachine vm;
std::string arg1( argv[1] );
vm.LoadFile( arg1 );
if ( argc == 3 )
{
std::string arg2( argv[2] );
if ( arg2.compare( "asm" ) == 0 )
{
vm.Disassemble( arg1 + ".asm" );
}
}
else if ( argc == 4 )
{
std::string arg2( argv[2] );
std::string arg3( argv[3] );
if ( arg2.compare( "debug" ) == 0 )
{
vm.Run( true, (uint32)stoi( arg3 ) );
}
}
else
{
vm.Run( false );
}
vm.ShutDown();
return 0;
}