diff --git a/bus.cpp b/bus.cpp index 5aa06a4..b19807c 100644 --- a/bus.cpp +++ b/bus.cpp @@ -833,9 +833,12 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1 return { false }; } - if (a == ADDR_LFC) // line frequency clock and status register + if (a == ADDR_LFC) { // line frequency clock and status register kw11_l_->writeWord(a, value); + return { false }; + } + if (tm11 && a >= TM_11_BASE && a < TM_11_END) { DOLOG(debug, false, "WRITE-I/O TM11 register %d: %06o", (a - TM_11_BASE) / 2, value); word_mode == wm_byte ? tm11->writeByte(a, value) : tm11->writeWord(a, value); diff --git a/kw11-l.cpp b/kw11-l.cpp index 1661ed0..449bfb2 100644 --- a/kw11-l.cpp +++ b/kw11-l.cpp @@ -34,8 +34,11 @@ kw11_l::~kw11_l() stop_flag = true; #if !defined(ESP32) && !defined(BUILD_FOR_RP2040) - th->join(); - delete th; + if (th) { + th->join(); + + delete th; + } #endif } @@ -62,7 +65,6 @@ void kw11_l::operator()() while(!stop_flag) { if (*cnsl->get_running_flag()) { - DOLOG(debug, true, "KW11-L tick"); set_lf_crs_b7(); if (get_lf_crs() & 64) diff --git a/kw11-l.h b/kw11-l.h index eb423a3..666ac40 100644 --- a/kw11-l.h +++ b/kw11-l.h @@ -11,18 +11,18 @@ class kw11_l { private: - bus *const b { nullptr }; - console *cnsl { nullptr }; + bus *const b { nullptr }; + console *cnsl { nullptr }; #if defined(BUILD_FOR_RP2040) SemaphoreHandle_t lf_csr_lock { xSemaphoreCreateBinary() }; #else - std::thread * th { nullptr }; - std::mutex lf_csr_lock; + std::thread *th { nullptr }; + std::mutex lf_csr_lock; #endif - uint16_t lf_csr { 0 }; + uint16_t lf_csr { 0 }; - std::atomic_bool stop_flag { false }; + std::atomic_bool stop_flag { false }; uint8_t get_lf_crs(); void set_lf_crs_b7();