-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasm.cpp
60 lines (43 loc) · 979 Bytes
/
asm.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
#include <iostream>
#include "Assembler.h"
using std::cin;
using std::cout;
using namespace std;
int main(int argc, char **argv)
{
if(argc==1)
{
cout<<"Fatal Error: No input file specified."<<endl;
exit(EXIT_FAILURE);
}
ifstream src;
src.open(argv[1], ofstream::in);
if(!src)
{
cout<<"Error in opening file"<<endl;
exit(EXIT_FAILURE);
}
Assembler a1(src, argv[1]);
a1.assemble();
a1.generate_listing_file();
a1.generate_log_file();
if(a1.get_assembly_status()==false)
{
cout<<endl<<"Errors: "<<endl;
a1.print_errors(cout);
cout<<endl;
}
if(a1.get_assembly_status()==true)
{
cout<<"Assembled successfully"<<endl;
cout<<endl;
}
if(a1.get_warning_status()==true)
{
cout<<endl<<"Warnings: "<<endl;
a1.print_warnings(cout);
cout<<endl;
}
src.close();
exit(EXIT_SUCCESS);
}