reset in ESP32 mode now will not reset complete ESP32, only the emulation
This commit is contained in:
parent
5dec87aaa4
commit
0647819dd8
11 changed files with 66 additions and 24 deletions
29
bus.cpp
29
bus.cpp
|
@ -31,9 +31,7 @@ bus::bus()
|
|||
{
|
||||
m = new memory(n_pages * 8192l);
|
||||
|
||||
memset(pages, 0x00, sizeof pages);
|
||||
|
||||
CPUERR = MMR0 = MMR1 = MMR2 = MMR3 = PIR = CSR = 0;
|
||||
reset();
|
||||
|
||||
#if defined(BUILD_FOR_RP2040)
|
||||
xSemaphoreGive(lf_csr_lock); // initialize
|
||||
|
@ -50,6 +48,26 @@ bus::~bus()
|
|||
delete m;
|
||||
}
|
||||
|
||||
void bus::reset()
|
||||
{
|
||||
m->reset();
|
||||
|
||||
memset(pages, 0x00, sizeof pages);
|
||||
|
||||
CPUERR = MMR0 = MMR1 = MMR2 = MMR3 = PIR = CSR = 0;
|
||||
|
||||
if (c)
|
||||
c->reset();
|
||||
if (tm11)
|
||||
tm11->reset();
|
||||
if (rk05_)
|
||||
rk05_->reset();
|
||||
if (rl02_)
|
||||
rl02_->reset();
|
||||
if (tty_)
|
||||
tty_->reset();
|
||||
}
|
||||
|
||||
void bus::add_cpu(cpu *const c)
|
||||
{
|
||||
delete this->c;
|
||||
|
@ -80,11 +98,6 @@ void bus::add_tty(tty *const tty_)
|
|||
this->tty_ = tty_;
|
||||
}
|
||||
|
||||
void bus::clearmem()
|
||||
{
|
||||
m->reset();
|
||||
}
|
||||
|
||||
void bus::init()
|
||||
{
|
||||
MMR0 = 0;
|
||||
|
|
2
bus.h
2
bus.h
|
@ -123,7 +123,7 @@ public:
|
|||
bus();
|
||||
~bus();
|
||||
|
||||
void clearmem();
|
||||
void reset();
|
||||
|
||||
void set_console_switches(const uint16_t new_state) { console_switches = new_state; }
|
||||
void set_console_switch(const int bit, const bool state) { console_switches &= ~(1 << bit); console_switches |= state << bit; }
|
||||
|
|
|
@ -419,13 +419,8 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
|||
continue;
|
||||
}
|
||||
else if (cmd == "reset" || cmd == "r") {
|
||||
#if defined(ESP32)
|
||||
ESP.restart();
|
||||
#else
|
||||
*stop_event = EVENT_NONE;
|
||||
|
||||
c->reset();
|
||||
#endif
|
||||
b->reset();
|
||||
continue;
|
||||
}
|
||||
#if defined(ESP32) || defined(BUILD_FOR_RP2040)
|
||||
|
|
9
rk05.cpp
9
rk05.cpp
|
@ -28,9 +28,9 @@ rk05::rk05(const std::vector<disk_backend *> & files, bus *const b, std::atomic_
|
|||
disk_read_acitivity(disk_read_acitivity),
|
||||
disk_write_acitivity(disk_write_acitivity)
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers);
|
||||
|
||||
fhs = files;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
rk05::~rk05()
|
||||
|
@ -39,6 +39,11 @@ rk05::~rk05()
|
|||
delete fh;
|
||||
}
|
||||
|
||||
void rk05::reset()
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers);
|
||||
}
|
||||
|
||||
uint8_t rk05::readByte(const uint16_t addr)
|
||||
{
|
||||
uint16_t v = readWord(addr & ~1);
|
||||
|
|
4
rk05.h
4
rk05.h
|
@ -28,7 +28,7 @@ class rk05
|
|||
{
|
||||
private:
|
||||
bus *const b { nullptr };
|
||||
uint16_t registers [ 7];
|
||||
uint16_t registers [7];
|
||||
std::vector<disk_backend *> fhs;
|
||||
|
||||
std::atomic_bool *const disk_read_acitivity { nullptr };
|
||||
|
@ -38,6 +38,8 @@ public:
|
|||
rk05(const std::vector<disk_backend *> & files, bus *const b, std::atomic_bool *const disk_read_acitivity, std::atomic_bool *const disk_write_acitivity);
|
||||
virtual ~rk05();
|
||||
|
||||
void reset();
|
||||
|
||||
uint8_t readByte(const uint16_t addr);
|
||||
uint16_t readWord(const uint16_t addr);
|
||||
|
||||
|
|
17
rl02.cpp
17
rl02.cpp
|
@ -28,10 +28,9 @@ rl02::rl02(const std::vector<disk_backend *> & files, bus *const b, std::atomic_
|
|||
disk_read_acitivity(disk_read_acitivity),
|
||||
disk_write_acitivity(disk_write_acitivity)
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers);
|
||||
memset(xfer_buffer, 0x00, sizeof xfer_buffer);
|
||||
|
||||
fhs = files;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
rl02::~rl02()
|
||||
|
@ -40,6 +39,12 @@ rl02::~rl02()
|
|||
delete fh;
|
||||
}
|
||||
|
||||
void rl02::reset()
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers);
|
||||
memset(xfer_buffer, 0x00, sizeof xfer_buffer);
|
||||
}
|
||||
|
||||
uint8_t rl02::readByte(const uint16_t addr)
|
||||
{
|
||||
uint16_t v = readWord(addr & ~1);
|
||||
|
@ -118,13 +123,13 @@ void rl02::writeWord(const uint16_t addr, uint16_t v)
|
|||
else if (command == 6 || command == 7) { // read data / read data without header check
|
||||
*disk_read_acitivity = true;
|
||||
|
||||
bool proceed = true;
|
||||
bool proceed = true;
|
||||
|
||||
uint32_t temp_disk_offset = disk_offset;
|
||||
|
||||
uint32_t memory_address = registers[(RL02_BAR - RL02_BASE) / 2];
|
||||
uint32_t memory_address = registers[(RL02_BAR - RL02_BASE) / 2];
|
||||
|
||||
uint32_t count = (65536l - registers[(RL02_MPR - RL02_BASE) / 2]) * 2;
|
||||
uint32_t count = (65536l - registers[(RL02_MPR - RL02_BASE) / 2]) * 2;
|
||||
|
||||
DOLOG(debug, false, "RL02 read %d bytes (dec) from %d (dec) to %06o (oct)", count, disk_offset, memory_address);
|
||||
|
||||
|
|
2
rl02.h
2
rl02.h
|
@ -38,6 +38,8 @@ public:
|
|||
rl02(const std::vector<disk_backend *> & files, bus *const b, std::atomic_bool *const disk_read_acitivity, std::atomic_bool *const disk_write_acitivity);
|
||||
virtual ~rl02();
|
||||
|
||||
void reset();
|
||||
|
||||
uint8_t readByte(const uint16_t addr);
|
||||
uint16_t readWord(const uint16_t addr);
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
tm_11::tm_11(const std::string & file, memory *const m) : m(m)
|
||||
{
|
||||
fh = fopen(file.c_str(), "rb");
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
tm_11::~tm_11()
|
||||
|
@ -20,6 +22,13 @@ tm_11::~tm_11()
|
|||
fclose(fh);
|
||||
}
|
||||
|
||||
void tm_11::reset()
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers );
|
||||
memset(xfer_buffer, 0x00, sizeof xfer_buffer);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
uint8_t tm_11::readByte(const uint16_t addr)
|
||||
{
|
||||
uint16_t v = readWord(addr & ~1);
|
||||
|
|
2
tm-11.h
2
tm-11.h
|
@ -31,6 +31,8 @@ public:
|
|||
tm_11(const std::string & file, memory *const m);
|
||||
virtual ~tm_11();
|
||||
|
||||
void reset();
|
||||
|
||||
uint8_t readByte(const uint16_t addr);
|
||||
uint16_t readWord(const uint16_t addr);
|
||||
|
||||
|
|
7
tty.cpp
7
tty.cpp
|
@ -33,6 +33,8 @@ tty::tty(console *const c, bus *const b) :
|
|||
c(c),
|
||||
b(b)
|
||||
{
|
||||
reset();
|
||||
|
||||
#if defined(BUILD_FOR_RP2040)
|
||||
xSemaphoreGive(chars_lock); // initialize
|
||||
#endif
|
||||
|
@ -54,6 +56,11 @@ tty::~tty()
|
|||
#endif
|
||||
}
|
||||
|
||||
void tty::reset()
|
||||
{
|
||||
memset(registers, 0x00, sizeof registers);
|
||||
}
|
||||
|
||||
uint8_t tty::readByte(const uint16_t addr)
|
||||
{
|
||||
uint16_t v = readWord(addr & ~1);
|
||||
|
|
2
tty.h
2
tty.h
|
@ -50,6 +50,8 @@ public:
|
|||
tty(console *const c, bus *const b);
|
||||
virtual ~tty();
|
||||
|
||||
void reset();
|
||||
|
||||
uint8_t readByte(const uint16_t addr);
|
||||
uint16_t readWord(const uint16_t addr);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue