diff --git a/bus.cpp b/bus.cpp index 680cc5e..974a0f5 100644 --- a/bus.cpp +++ b/bus.cpp @@ -50,6 +50,11 @@ void bus::clearmem() m -> reset(); } +void bus::init() +{ + MMR0 = 0; +} + uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev) { uint16_t temp = 0; diff --git a/bus.h b/bus.h index 2adf99d..9fe7bc1 100644 --- a/bus.h +++ b/bus.h @@ -51,6 +51,8 @@ public: tty *getTty() { return this->tty_; } + void init(); // invoked by 'RESET' command + uint16_t read(const uint16_t a, const bool word_mode, const bool use_prev=false); uint16_t readByte(const uint16_t a) { return read(a, true); } uint16_t readWord(const uint16_t a); diff --git a/cpu.cpp b/cpu.cpp index c765527..0326d6a 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -30,7 +30,7 @@ void cpu::reset() pc = 0; psw = 7 << 5; fpsr = 0; - runMode = resetFlag = false; + runMode = false; } void cpu::setDisassemble(const bool state) @@ -1145,7 +1145,7 @@ bool cpu::misc_operations(const uint16_t instr) return true; case 0b0000000000000101: // RESET - resetFlag = true; + b->init(); return true; } diff --git a/cpu.h b/cpu.h index 2aee9bd..949e422 100644 --- a/cpu.h +++ b/cpu.h @@ -19,7 +19,6 @@ private: uint16_t psw { 0 }; uint16_t fpsr { 0 }; uint16_t stackLimitRegister { 0 }; - bool resetFlag { false }; bool runMode { false }; bool emulateMFPT { false }; @@ -61,7 +60,6 @@ public: void reset(); void step(); - void resetReset() { resetFlag = false; } void pushStack(const uint16_t v); uint16_t popStack();