ui changes
This commit is contained in:
parent
1fb7d52842
commit
d3ab78e76c
6 changed files with 131 additions and 17 deletions
|
|
@ -45,12 +45,12 @@ Machine::~Machine()
|
|||
|
||||
int Machine::getSpeed() const
|
||||
{
|
||||
return speedkHz.load();
|
||||
return speedHz.load();
|
||||
}
|
||||
|
||||
void Machine::setSpeed(int kHz)
|
||||
void Machine::setSpeed(int Hz)
|
||||
{
|
||||
speedkHz.store(kHz);
|
||||
speedHz.store(Hz);
|
||||
}
|
||||
|
||||
// TODO: implement errors
|
||||
|
|
@ -138,10 +138,10 @@ void Machine::setVT(const int *values)
|
|||
|
||||
void Machine::tick()
|
||||
{
|
||||
const int speed = speedkHz.load();
|
||||
const int speed = speedHz.load();
|
||||
if (speed <= 0) throw std::runtime_error("Invalid speed setting in Machine::tick");
|
||||
|
||||
const auto delay = std::chrono::microseconds(1000 / speed);
|
||||
const auto delay = std::chrono::milliseconds(1000 / speed);
|
||||
std::this_thread::sleep_for(delay);
|
||||
}
|
||||
|
||||
|
|
@ -150,6 +150,27 @@ void Machine::halt()
|
|||
_stopped = true;
|
||||
}
|
||||
|
||||
void Machine::reset()
|
||||
{
|
||||
// Reset all registers
|
||||
A = B = X = L = S = T = PC = SW = 0;
|
||||
F = 0.0;
|
||||
|
||||
// Clear memory
|
||||
for (int i = 0; i < MEMORY_SIZE; i++) {
|
||||
memory[i] = 0;
|
||||
}
|
||||
|
||||
// Reset execution state
|
||||
_stopped = false;
|
||||
running.store(false);
|
||||
|
||||
// Reset vector registers
|
||||
for (int i = 0; i < VECTOR_REG_SIZE; i++) {
|
||||
VA[i] = VS[i] = VT[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int Machine::getReg(int regNum) const
|
||||
{
|
||||
switch (regNum) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue