diff options
author | Karel Kočí <cynerd@email.cz> | 2017-12-15 22:45:28 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-12-15 22:45:28 +0100 |
commit | e6ca4b4568e311b47239bfe83de15ed9e91c57b9 (patch) | |
tree | 3da2f72faf360058bae02c35b0c724233bd64d61 /qtmips_machine/qtmipsmachine.cpp | |
parent | bbea996112eb7ac81ec50d2af08f4bd681d0e50d (diff) | |
download | qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.gz qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.bz2 qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.zip |
Implement few initial graphic elements
Diffstat (limited to 'qtmips_machine/qtmipsmachine.cpp')
-rw-r--r-- | qtmips_machine/qtmipsmachine.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp index 7b44a7b..191a7c7 100644 --- a/qtmips_machine/qtmipsmachine.cpp +++ b/qtmips_machine/qtmipsmachine.cpp @@ -9,6 +9,7 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) { program.to_memory(mem); program_end = program.end(); + program_ended = false; MemoryAccess *coremem; switch (cc.cache()) { @@ -35,6 +36,8 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) { void QtMipsMachine::set_speed(unsigned val) { run_speed = val; + if (run_t->isActive()) + play(); } const Registers *QtMipsMachine::registers() { @@ -54,19 +57,31 @@ const Core *QtMipsMachine::core() { } void QtMipsMachine::play() { + if (program_ended) + return; run_t->start(run_speed); } void QtMipsMachine::pause() { + if (program_ended) + return; run_t->stop(); } void QtMipsMachine::step() { + if (program_ended) // Ignore if program ended + return; + emit tick(); cr->step(); - if (regs->read_pc() >= program_end) + if (regs->read_pc() >= program_end) { + program_ended = true; + run_t->stop(); emit program_exit(); + } } void QtMipsMachine::restart() { + if (!program_ended) + run_t->stop(); // Stop timer if program is still running // TODO } |