-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
40 lines (34 loc) · 899 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
#include <iostream>
#include "8080emuCPP.h"
#include "gtuos.h"
#include "memory.h"
// This is just a sample main function, you should rewrite this file to handle problems
// with new multitasking and virtual memory additions.
int main (int argc, char**argv)
{
if (argc != 3){
std::cerr << "Usage: prog exeFile debugOption\n";
exit(1);
}
int DEBUG = atoi(argv[2]);
Memory mem(0x100000);
CPU8080 theCPU(&mem);
GTUOS theOS;
theCPU.ReadFileIntoMemoryAt(argv[1], 0x0000);
for(int i=0;i<1000;i++){
//std::cout <<(int)mem.physicalAt(i);
}
int i=1;
do
{
setbuf(stdout, 0);
fflush(stdout);
theCPU.Emulate8080p(DEBUG);
if(theCPU.isSystemCall() && theCPU.interrupt==0){
theOS.handleCall(theCPU,DEBUG);
}
i++;
} while (!theCPU.isHalted())
;
return 0;
}