-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_CPU.cpp
122 lines (102 loc) · 1.98 KB
/
run_CPU.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include "run_CPU.h"
#include <QThread>
// #include "ui_mainwindow.h"
// #include "Display.h"
// #include "K1003_sys.h"
// #include "cpu_8008.h"
run_CPU::run_CPU(QObject* parent) : QThread(parent)
{
// my_Timer = new MyTimer();
timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(slotTimerAlarm()));
timer->start(1); // 1ms
abort = true;
PC_runCPU = 0; // program counter
// my_runCPU = this;
// my_runCPU->
// myCPU->set_run_CPU(this);
// my_runCPU->set_K1003(myK1003);
// my_runCPU->set_Display(myDisplay);
// my_runCPU->set_UI(ui);
// doWork();
}
run_CPU::~run_CPU()
{
abort = true;
}
void run_CPU::run()
{
for (uint16_t count = 0; count < 2000; count++) { // 2000 Khz
if (abort == false)
{
PC_runCPU = myCPU->iSet(memory(PC_runCPU));
}
}
}
void run_CPU::slotTimerAlarm()
{
/* Every second update data on the current time
* Restart timer is not required
* */
// ui->label->setText(QTime::currentTime().toString("hh:mm:ss"));
run();
}
void run_CPU::start_CPU(cpu_8008* myCPU_n)
{
abort = false;
PC_runCPU = 0; // program counter
// slow_down = 0;
this->myCPU = myCPU_n;
}
void run_CPU::stop_CPU()
{
abort = true;
}
void run_CPU::reStart_CPU()
{
abort = false;
}
void run_CPU::set_run_CPU(run_CPU* n_runCPU)
{
my_runCPU = n_runCPU;
}
void run_CPU::set_K1003(K1003_sys* m_K1003)
{
myK1003 = m_K1003;
}
void run_CPU::set_Display(Display* n_display)
{
myDisplay = n_display;
}
/*
void run_CPU::set_UI(Ui::MainWindow* n_user)
{
ui = n_user;
}
*/
void run_CPU::set_cpu_8008(cpu_8008* n_myCPU)
{
myCPU = n_myCPU;
}
uint8_t run_CPU::memory(uint16_t PC_n)
{
// return 0; // failure
if (PC_n < 16384) {
return KRom_KRam[PC_n];
}
else {
return 0; // failure
}
}
/*
void run_CPU::Pi_Clicked()
{
// myCPU->Pi_Clicked(); // defekt
// myDisplay->DisplayDigit(); // defekt
// myK1003->Test(); // defekt
// myCPU->Test(); // o.k.
// doWork();
// PC = myCPU->iSet(81); // Display Test -
// ui->label->setText("PiClicked"); // defekt
}
*/