-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputer.cpp
More file actions
34 lines (29 loc) · 835 Bytes
/
computer.cpp
File metadata and controls
34 lines (29 loc) · 835 Bytes
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
#include "computer.hpp"
#include "logic.hpp"
#include "misc.hpp"
using namespace BITMAN;
using namespace LOGIC_GATES;
using namespace PROCESSOR;
namespace COMPUTER {
//class Computer
void Computer::run() {
while ((AND(getBitFromWord(ROM.get(pc.get()), 14), getBitFromWord(ROM.get(pc.get()), MISC::CI)) != true)) {
tick();
}
}
void Computer::tick() {
ProcessResult pr = processor.process(ROM.get(pc.get()));
lastA = pr.A;
if (pr.jump) {
pc.set(pr.A);
} else {
pc.tick();
}
}
WORD Computer::getLastA() {
return lastA;
}
Computer::Computer(MEMORY::ROM NROM) {
ROM = NROM;
}
}