ncurses: show switch register / clean terminate
This commit is contained in:
parent
7173688bfb
commit
b470d2ad41
3 changed files with 17 additions and 3 deletions
5
bus.cpp
5
bus.cpp
|
@ -423,6 +423,11 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a == 0177570) { // switch register
|
||||||
|
switch_register = value;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
|
|
||||||
if (a == 0177374) { // FIXME
|
if (a == 0177374) { // FIXME
|
||||||
|
|
4
bus.h
4
bus.h
|
@ -33,6 +33,8 @@ private:
|
||||||
|
|
||||||
uint16_t MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 };
|
uint16_t MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 };
|
||||||
|
|
||||||
|
uint16_t switch_register { 0 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bus();
|
bus();
|
||||||
~bus();
|
~bus();
|
||||||
|
@ -59,5 +61,7 @@ public:
|
||||||
|
|
||||||
void setMMR2(const uint16_t value) { MMR2 = value; }
|
void setMMR2(const uint16_t value) { MMR2 = value; }
|
||||||
|
|
||||||
|
uint16_t get_switch_register() const { return switch_register; }
|
||||||
|
|
||||||
uint32_t calculate_full_address(const uint16_t a);
|
uint32_t calculate_full_address(const uint16_t a);
|
||||||
};
|
};
|
||||||
|
|
11
main.cpp
11
main.cpp
|
@ -16,10 +16,14 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
struct termios org_tty_opts { 0 };
|
struct termios org_tty_opts { 0 };
|
||||||
|
bool withUI = false;
|
||||||
|
|
||||||
void reset_terminal()
|
void reset_terminal()
|
||||||
{
|
{
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &org_tty_opts);
|
if (withUI)
|
||||||
|
endwin();
|
||||||
|
else
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &org_tty_opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadbin(bus *const b, uint16_t base, const char *const file)
|
void loadbin(bus *const b, uint16_t base, const char *const file)
|
||||||
|
@ -225,7 +229,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
c -> setEmulateMFPT(true);
|
c -> setEmulateMFPT(true);
|
||||||
|
|
||||||
bool testMode = false, testCases = false, withUI = false;
|
bool testMode = false, testCases = false;
|
||||||
int opt = -1;
|
int opt = -1;
|
||||||
while((opt = getopt(argc, argv, "hm:T:R:p:nL:")) != -1)
|
while((opt = getopt(argc, argv, "hm:T:R:p:nL:")) != -1)
|
||||||
{
|
{
|
||||||
|
@ -333,9 +337,10 @@ int main(int argc, char *argv[])
|
||||||
tty_->sendChar(ch);
|
tty_->sendChar(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icount % 1000000 == 0 && withUI) {
|
if (icount % 100000 == 0 && withUI) {
|
||||||
unsigned long now = get_ms();
|
unsigned long now = get_ms();
|
||||||
mvwprintw(w_main_b -> win, 0, 24, "%.1f/s ", icount * 1000.0 / (now - start));
|
mvwprintw(w_main_b -> win, 0, 24, "%.1f/s ", icount * 1000.0 / (now - start));
|
||||||
|
mvwprintw(w_main_b -> win, 0, 42, "%06o", b->get_switch_register());
|
||||||
mydoupdate();
|
mydoupdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue