diff --git a/ESP32/main.ino b/ESP32/main.ino index 058e257..40b8c35 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -348,6 +348,10 @@ void setup() { rl02_dev->begin(); b->add_rl02(rl02_dev); + auto rp06_dev = new rp06(b, cnsl->get_disk_read_activity_flag(), cnsl->get_disk_write_activity_flag()); + rp06_dev->begin(); + b->add_rp06(rp06_dev); + cs->println("* Adding TTY"); tty_ = new tty(cnsl, b); b->add_tty(tty_); diff --git a/ESP32/rp06.cpp b/ESP32/rp06.cpp new file mode 120000 index 0000000..4120cc4 --- /dev/null +++ b/ESP32/rp06.cpp @@ -0,0 +1 @@ +../rp06.cpp \ No newline at end of file diff --git a/ESP32/rp06.h b/ESP32/rp06.h new file mode 120000 index 0000000..29a8bbc --- /dev/null +++ b/ESP32/rp06.h @@ -0,0 +1 @@ +../rp06.h \ No newline at end of file diff --git a/bus.cpp b/bus.cpp index 4e5f5a0..044fa32 100644 --- a/bus.cpp +++ b/bus.cpp @@ -43,6 +43,7 @@ bus::~bus() delete mmu_; delete m; delete dc11_; + delete rp06_; } JsonDocument bus::serialize() const @@ -73,6 +74,9 @@ JsonDocument bus::serialize() const if (dc11_) j_out["dc11"] = dc11_->serialize(); + if (rp06_) + j_out["rp06"] = rp06_->serialize(); + // TODO: tm11 return j_out; @@ -109,6 +113,9 @@ bus *bus::deserialize(const JsonDocument j, console *const cnsl, std::atomic_uin if (j.containsKey("dc11")) b->add_DC11(dc11::deserialize(j["dc11"], b)); + if (j.containsKey("rp06")) + b->add_RP06(rp06::deserialize(j["rp06"], b)); + // TODO: tm11 return b; @@ -153,6 +160,14 @@ void bus::reset() kw11_l_->reset(); if (dc11_) dc11_->reset(); + if (rp06_) + rp06_->reset(); +} + +void bus::add_RP06(rp06 *const rp06_) +{ + delete this->rp06_; + this->rp06_ = rp06_; } void bus::add_KW11_L(kw11_l *const kw11_l_) @@ -465,6 +480,9 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm if (dc11_ && a >= DC11_BASE && a < DC11_END && !peek_only) return word_mode == wm_byte ? dc11_->read_byte(a) : dc11_->read_word(a); + if (rp06_ && a >= RP06_BASE && a < RP06_END && !peek_only) + return word_mode == wm_byte ? rp06_->read_byte(a) : rp06_->read_word(a); + // LO size register field must be all 1s, so subtract 1 uint32_t system_size = m->get_memory_size() / 64 - 1; @@ -721,6 +739,11 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1 return { false }; } + if (rp06_ && a >= RP06_BASE && a < RP06_END) { + word_mode == wm_byte ? rp06_->write_byte(a, value) : rp06_->write_word(a, value); + return { false }; + } + if (a >= 0172100 && a <= 0172137) { // MM11-LP parity TRACE("WRITE-I/O MM11-LP parity (%06o): %o", a, value); return { false }; diff --git a/bus.h b/bus.h index 4b9e571..1b399d9 100644 --- a/bus.h +++ b/bus.h @@ -15,6 +15,7 @@ #include "mmu.h" #include "rk05.h" #include "rl02.h" +#include "rp06.h" #include "tm-11.h" #if defined(BUILD_FOR_RP2040) @@ -70,6 +71,7 @@ private: mmu *mmu_ { nullptr }; memory *m { nullptr }; dc11 *dc11_ { nullptr }; + rp06 *rp06_ { nullptr }; uint16_t microprogram_break_register { 0 }; @@ -107,6 +109,7 @@ public: void add_DC11 (dc11 *const dc11_ ); // required to release devices when doing a reload void del_DC11 (); + void add_RP06 (rp06 *const rp06_ ); memory *getRAM() { return m; } cpu *getCpu() { return c; } diff --git a/debugger.cpp b/debugger.cpp index 8b61e81..a00c629 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -346,7 +346,7 @@ std::optional select_disk_backend(console *const cnsl) void configure_disk(bus *const b, console *const cnsl) { - int type_ch = wait_for_key("1. RK05, 2. RL02, 9. abort", cnsl, { '1', '2', '3', '9' }); + int type_ch = wait_for_key("1. RK05, 2. RL02, 3. RP06, 9. abort", cnsl, { '1', '2', '3', '9' }); bootloader_t bl = BL_NONE; disk_device *dd = nullptr; @@ -359,6 +359,10 @@ void configure_disk(bus *const b, console *const cnsl) dd = b->getRL02(); bl = BL_RL02; } + else if (type_ch == '3') { + dd = b->getRP06(); + bl = BL_RP06; + } else if (type_ch == '9') { return; } @@ -878,6 +882,8 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto b->getTM11()->show_state(cnsl); else if (parts[1] == "kw11l") b->getKW11_L()->show_state(cnsl); + else if (parts[1] == "rp06") + b->getRP06()->show_state(cnsl); else cnsl->put_string_lf(format("Device \"%s\" is not known", parts[1].c_str())); @@ -1000,8 +1006,14 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto continue; } else if (parts[0] == "bl" && parts.size() == 2) { - set_boot_loader(b, parts.at(1) == "rk05" ? BL_RK05 : BL_RL02); - cnsl->put_string_lf("Bootloader set"); + if (parts.at(1) == "rk05") + set_boot_loader(b, BL_RK05); + else if (parts.at(1) == "rl02") + set_boot_loader(b, BL_RL02); + else if (parts.at(1) == "rp06") + set_boot_loader(b, BL_RP06); + else + cnsl->put_string_lf("???"); continue; } @@ -1195,7 +1207,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto "strace x - start tracing from address - invoke without address to disable", "trl x - set trace run-level (0...3), empty for all", "regdump - dump register contents", - "state x - dump state of a device: rl02, rk05, mmu, tm11, kw11l or dc11", + "state x - dump state of a device: rl02, rk05, rp06, mmu, tm11, kw11l or dc11", "mmures x - resolve a virtual address", "qi - show queued interrupts", "setpc x - set PC to value", @@ -1209,7 +1221,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto "ult - unload tape", "stats - show run statistics", "ramsize x - set ram size (page (8 kB) count, decimal)", - "bl - set bootloader (rl02 or rk05)", + "bl - set bootloader (rl02, rk05 or rp06)", "cdc11 - configure DC11 device", "serdc11 - store DC11 device settings", "dserdc11 - load DC11 device settings", diff --git a/loaders.cpp b/loaders.cpp index cb354bf..f930713 100644 --- a/loaders.cpp +++ b/loaders.cpp @@ -137,6 +137,23 @@ void set_boot_loader(bus *const b, const bootloader_t which) bl = rl02_code; } + else if (which == BL_RP6) { + start = offset = 01000; + + static const uint16_t rp06_code[] = { + 0012700, // MOV #0176704,R0 + 0176704, + 0012740, // MOV #177000,-(R0) + 0177000, + 0012740, // MOV #071, -(R0) + 0000071, + 00, // HALT + }; + + size = sizeof(rp06_code)/sizeof(rp06_code[0]); + + bl = rp06_code; + } for(uint16_t i=0; iwrite_word(uint16_t(offset + i * 2), bl[i]); diff --git a/loaders.h b/loaders.h index 4b6846f..b1ecef7 100644 --- a/loaders.h +++ b/loaders.h @@ -8,7 +8,7 @@ #include "bus.h" -typedef enum { BL_NONE, BL_RK05, BL_RL02 } bootloader_t; +typedef enum { BL_NONE, BL_RK05, BL_RL02, BL_RP06 } bootloader_t; void loadbin(bus *const b, uint16_t base, const char *const file); void set_boot_loader(bus *const b, const bootloader_t which);