several fixes for serialization
This commit is contained in:
parent
5ded69d437
commit
0a2f508e61
9 changed files with 32 additions and 28 deletions
|
@ -25,9 +25,8 @@ void thread_wrapper_console(void *p)
|
|||
}
|
||||
#endif
|
||||
|
||||
console::console(std::atomic_uint32_t *const stop_event, bus *const b, const int t_width, const int t_height) :
|
||||
console::console(std::atomic_uint32_t *const stop_event, const int t_width, const int t_height) :
|
||||
stop_event(stop_event),
|
||||
b(b),
|
||||
t_width(t_width),
|
||||
t_height(t_height)
|
||||
{
|
||||
|
@ -49,6 +48,8 @@ console::~console()
|
|||
|
||||
void console::start_thread()
|
||||
{
|
||||
assert(b);
|
||||
|
||||
stop_thread_flag = false;
|
||||
|
||||
#if defined(BUILD_FOR_RP2040)
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
protected:
|
||||
std::atomic_uint32_t *const stop_event { nullptr };
|
||||
|
||||
bus *const b { nullptr };
|
||||
bus *b { nullptr };
|
||||
#if !defined(BUILD_FOR_RP2040)
|
||||
std::thread *th { nullptr };
|
||||
#endif
|
||||
|
@ -57,9 +57,11 @@ protected:
|
|||
virtual void put_char_ll(const char c) = 0;
|
||||
|
||||
public:
|
||||
console(std::atomic_uint32_t *const stop_event, bus *const b, const int t_width = 80, const int t_height = 25);
|
||||
console(std::atomic_uint32_t *const stop_event, const int t_width = 80, const int t_height = 25);
|
||||
virtual ~console();
|
||||
|
||||
void set_bus(bus *const b) { this->b = b; }
|
||||
|
||||
void start_thread();
|
||||
void stop_thread();
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include "utils.h"
|
||||
|
||||
|
||||
console_ncurses::console_ncurses(std::atomic_uint32_t *const stop_event, bus *const b) :
|
||||
console(stop_event, b)
|
||||
console_ncurses::console_ncurses(std::atomic_uint32_t *const stop_event): console(stop_event)
|
||||
{
|
||||
init_ncurses(true);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
void put_char_ll(const char c) override;
|
||||
|
||||
public:
|
||||
console_ncurses(std::atomic_uint32_t *const stop_event, bus *const b);
|
||||
console_ncurses(std::atomic_uint32_t *const stop_event);
|
||||
virtual ~console_ncurses();
|
||||
|
||||
void put_string_lf(const std::string & what) override;
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#include "error.h"
|
||||
|
||||
|
||||
console_posix::console_posix(std::atomic_uint32_t *const stop_event, bus *const b) :
|
||||
console(stop_event, b)
|
||||
console_posix::console_posix(std::atomic_uint32_t *const stop_event): console(stop_event)
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
if (tcgetattr(STDIN_FILENO, &org_tty_opts) == -1)
|
||||
|
|
|
@ -21,7 +21,7 @@ protected:
|
|||
void put_char_ll(const char c) override;
|
||||
|
||||
public:
|
||||
console_posix(std::atomic_uint32_t *const stop_event, bus *const b);
|
||||
console_posix(std::atomic_uint32_t *const stop_event);
|
||||
virtual ~console_posix();
|
||||
|
||||
void resize_terminal() override;
|
||||
|
|
|
@ -26,6 +26,7 @@ disk_backend *disk_backend::deserialize(const json_t *const j)
|
|||
return disk_backend_nbd::deserialize(j);
|
||||
|
||||
// should not be reached
|
||||
assert(false);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
36
main.cpp
36
main.cpp
|
@ -507,6 +507,17 @@ int main(int argc, char *argv[])
|
|||
if (validate_json.empty() == false)
|
||||
return run_cpu_validation(validate_json);
|
||||
|
||||
DOLOG(info, true, "This PDP-11 emulator is called \"kek\" (reason for that is forgotten) and was written by Folkert van Heusden.");
|
||||
|
||||
DOLOG(info, true, "Built on: " __DATE__ " " __TIME__);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
if (withUI)
|
||||
cnsl = new console_ncurses(&event);
|
||||
else
|
||||
#endif
|
||||
cnsl = new console_posix(&event);
|
||||
|
||||
bus *b = nullptr;
|
||||
|
||||
if (deserialize.empty()) {
|
||||
|
@ -542,10 +553,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (enable_bootloader)
|
||||
setBootLoader(b, bootloader);
|
||||
|
||||
tty *tty_ = new tty(cnsl, b);
|
||||
|
||||
b->add_tty(tty_);
|
||||
}
|
||||
else {
|
||||
FILE *fh = fopen(deserialize.c_str(), "r");
|
||||
|
@ -565,6 +572,14 @@ int main(int argc, char *argv[])
|
|||
json_decref(j);
|
||||
}
|
||||
|
||||
if (b->getTty() == nullptr) {
|
||||
tty *tty_ = new tty(cnsl, b);
|
||||
|
||||
b->add_tty(tty_);
|
||||
}
|
||||
|
||||
cnsl->set_bus(b);
|
||||
|
||||
running = cnsl->get_running_flag();
|
||||
|
||||
std::atomic_bool interrupt_emulation { false };
|
||||
|
@ -583,19 +598,6 @@ int main(int argc, char *argv[])
|
|||
if (sa_set)
|
||||
b->getCpu()->setRegister(7, start_addr);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
if (withUI)
|
||||
cnsl = new console_ncurses(&event, b);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
DOLOG(info, true, "This PDP-11 emulator is called \"kek\" (reason for that is forgotten) and was written by Folkert van Heusden.");
|
||||
|
||||
DOLOG(info, true, "Built on: " __DATE__ " " __TIME__);
|
||||
|
||||
cnsl = new console_posix(&event, b);
|
||||
}
|
||||
|
||||
DOLOG(info, true, "Start running at %06o", b->getCpu()->getRegister(7));
|
||||
|
||||
#if !defined(_WIN32)
|
||||
|
|
2
rl02.cpp
2
rl02.cpp
|
@ -33,7 +33,7 @@ static const char * const commands[] = {
|
|||
|
||||
rl02::rl02(const std::vector<disk_backend *> & files, bus *const b, std::atomic_bool *const disk_read_activity, std::atomic_bool *const disk_write_activity) :
|
||||
b(b),
|
||||
disk_read_activity (disk_read_activity),
|
||||
disk_read_activity (disk_read_activity ),
|
||||
disk_write_activity(disk_write_activity)
|
||||
{
|
||||
fhs = files;
|
||||
|
|
Loading…
Add table
Reference in a new issue