summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author shattered <shattered@users.noreply.github.com>2025-09-28 18:01:44 +0300
committer GitHub <noreply@github.com>2025-09-28 17:01:44 +0200
commit0c20a8a380fd856a2099b23c3871962699712844 (patch)
tree8b54732fa986ab782f605c1c76f1f0743871aa4d
parent7bb5a3da64bfe2c3c4702e19abea565dee102b97 (diff)
qbus: add bus error and BEVENT (periodic timer) callbacks. (#14207)
Support systems with entire memory space covered by a view (uknc) -- views are not initialized at device_start() time. Correct initial state of PC11 device.
-rw-r--r--src/devices/bus/qbus/dvk_kgd.cpp13
-rw-r--r--src/devices/bus/qbus/dvk_kgd.h2
-rw-r--r--src/devices/bus/qbus/dvk_mx.cpp14
-rw-r--r--src/devices/bus/qbus/dvk_mx.h2
-rw-r--r--src/devices/bus/qbus/pc11.cpp21
-rw-r--r--src/devices/bus/qbus/pc11.h1
-rw-r--r--src/devices/bus/qbus/qbus.cpp8
-rw-r--r--src/devices/bus/qbus/qbus.h10
8 files changed, 58 insertions, 13 deletions
diff --git a/src/devices/bus/qbus/dvk_kgd.cpp b/src/devices/bus/qbus/dvk_kgd.cpp
index 1c7f28c5fc8..75dbfe6a7c8 100644
--- a/src/devices/bus/qbus/dvk_kgd.cpp
+++ b/src/devices/bus/qbus/dvk_kgd.cpp
@@ -33,6 +33,7 @@ DEFINE_DEVICE_TYPE(DVK_KGD, dvk_kgd_device, "kgd", "DVK KGD framebuffer")
dvk_kgd_device::dvk_kgd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DVK_KGD, tag, owner, clock)
, device_qbus_card_interface(mconfig, *this)
+ , m_installed(false)
, m_screen(*this, "screen")
{
}
@@ -80,10 +81,8 @@ void dvk_kgd_device::device_add_mconfig(machine_config &config)
void dvk_kgd_device::device_start()
{
- m_bus->install_device(0176640, 0176647, read16sm_delegate(*this, FUNC(dvk_kgd_device::read)),
- write16sm_delegate(*this, FUNC(dvk_kgd_device::write)));
-
// save state
+ save_item(NAME(m_installed));
save_item(NAME(m_cr));
save_item(NAME(m_dr));
save_item(NAME(m_ar));
@@ -91,6 +90,8 @@ void dvk_kgd_device::device_start()
m_videoram_base = std::make_unique<uint8_t[]>(16384);
m_videoram = m_videoram_base.get();
+
+ m_installed = false;
}
@@ -100,6 +101,12 @@ void dvk_kgd_device::device_start()
void dvk_kgd_device::device_reset()
{
+ if (!m_installed)
+ {
+ m_bus->install_device(0176640, 0176647, read16sm_delegate(*this, FUNC(dvk_kgd_device::read)),
+ write16sm_delegate(*this, FUNC(dvk_kgd_device::write)));
+ m_installed = true;
+ }
m_cr = m_dr = m_ar = m_ct = 0;
}
diff --git a/src/devices/bus/qbus/dvk_kgd.h b/src/devices/bus/qbus/dvk_kgd.h
index dfcb027706d..948290c5143 100644
--- a/src/devices/bus/qbus/dvk_kgd.h
+++ b/src/devices/bus/qbus/dvk_kgd.h
@@ -46,6 +46,8 @@ protected:
virtual void device_reset() override ATTR_COLD;
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
+ bool m_installed;
+
required_device<screen_device> m_screen;
private:
diff --git a/src/devices/bus/qbus/dvk_mx.cpp b/src/devices/bus/qbus/dvk_mx.cpp
index 757262481ec..c95914df805 100644
--- a/src/devices/bus/qbus/dvk_mx.cpp
+++ b/src/devices/bus/qbus/dvk_mx.cpp
@@ -97,6 +97,7 @@ dvk_mx_device::dvk_mx_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, DVK_MX, tag, owner, clock)
, device_qbus_card_interface(mconfig, *this)
, m_connectors(*this, "%u", 0U)
+ , m_installed(false)
{
}
@@ -126,6 +127,7 @@ void dvk_mx_device::device_start()
}
// save state
+ save_item(NAME(m_installed));
save_item(NAME(m_mxcs));
save_item(NAME(m_rbuf));
save_item(NAME(m_wbuf));
@@ -133,11 +135,10 @@ void dvk_mx_device::device_start()
m_timer_2khz = timer_alloc(FUNC(dvk_mx_device::twokhz_tick), this);
- m_bus->install_device(0177130, 0177133, read16sm_delegate(*this, FUNC(dvk_mx_device::read)),
- write16sm_delegate(*this, FUNC(dvk_mx_device::write)));
-
m_mxcs = 0;
selected_drive = -1;
+
+ m_installed = false;
}
//-------------------------------------------------
@@ -146,6 +147,13 @@ void dvk_mx_device::device_start()
void dvk_mx_device::device_reset()
{
+ if (!m_installed)
+ {
+ m_bus->install_device(0177130, 0177133, read16sm_delegate(*this, FUNC(dvk_mx_device::read)),
+ write16sm_delegate(*this, FUNC(dvk_mx_device::write)));
+ m_installed = true;
+ }
+
m_rbuf = m_wbuf = 0;
m_mxcs &= ~MXCSR_ERR;
diff --git a/src/devices/bus/qbus/dvk_mx.h b/src/devices/bus/qbus/dvk_mx.h
index 556ec5839fb..536b877a017 100644
--- a/src/devices/bus/qbus/dvk_mx.h
+++ b/src/devices/bus/qbus/dvk_mx.h
@@ -126,6 +126,8 @@ private:
required_device_array<floppy_connector, 4> m_connectors;
+ bool m_installed;
+
uint16_t m_mxcs;
uint16_t m_rbuf;
uint16_t m_wbuf;
diff --git a/src/devices/bus/qbus/pc11.cpp b/src/devices/bus/qbus/pc11.cpp
index c27e240cc08..4ce89b58f7a 100644
--- a/src/devices/bus/qbus/pc11.cpp
+++ b/src/devices/bus/qbus/pc11.cpp
@@ -56,6 +56,7 @@ const char* pc11_regnames[] = {
pc11_device::pc11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: paper_tape_reader_device(mconfig, DEC_PC11, tag, owner, clock)
, device_qbus_card_interface(mconfig, *this)
+ , m_installed(false)
, m_rxvec(070)
, m_txvec(074)
{
@@ -69,12 +70,8 @@ pc11_device::pc11_device(const machine_config &mconfig, const char *tag, device_
void pc11_device::device_start()
{
- m_bus->install_device(0177550, 0177557, read16sm_delegate(*this, FUNC(pc11_device::read)),
- write16sm_delegate(*this, FUNC(pc11_device::write)));
-
- // resolve callbacks
-
// save state
+ save_item(NAME(m_installed));
save_item(NAME(m_rcsr));
save_item(NAME(m_rbuf));
save_item(NAME(m_tcsr));
@@ -83,6 +80,11 @@ void pc11_device::device_start()
// about 300 cps
m_read_timer = timer_alloc(FUNC(pc11_device::read_tick), this);
m_read_timer->adjust(attotime::from_usec(333), 0, attotime::from_usec(333));
+
+ m_fd = nullptr;
+ m_rcsr = CSR_ERR;
+
+ m_installed = false;
}
@@ -94,7 +96,14 @@ void pc11_device::device_reset()
{
LOG("Reset, rxvec %03o txvec %03o\n", m_rxvec, m_txvec);
- m_rcsr = m_rbuf = m_tbuf = 0;
+ if (!m_installed)
+ {
+ m_bus->install_device(0177550, 0177557, read16sm_delegate(*this, FUNC(pc11_device::read)),
+ write16sm_delegate(*this, FUNC(pc11_device::write)));
+ m_installed = true;
+ }
+
+ m_rbuf = m_tbuf = 0;
m_tcsr = CSR_DONE;
m_rxrdy = m_txrdy = CLEAR_LINE;
diff --git a/src/devices/bus/qbus/pc11.h b/src/devices/bus/qbus/pc11.h
index 1793808826c..527a293fe63 100644
--- a/src/devices/bus/qbus/pc11.h
+++ b/src/devices/bus/qbus/pc11.h
@@ -59,6 +59,7 @@ protected:
TIMER_CALLBACK_MEMBER(read_tick);
private:
+ bool m_installed;
int m_rxvec;
int m_txvec;
diff --git a/src/devices/bus/qbus/qbus.cpp b/src/devices/bus/qbus/qbus.cpp
index d3b639c801f..85bd1d03db3 100644
--- a/src/devices/bus/qbus/qbus.cpp
+++ b/src/devices/bus/qbus/qbus.cpp
@@ -98,6 +98,8 @@ qbus_device::qbus_device(const machine_config &mconfig, const char *tag, device_
device_z80daisy_interface(mconfig, *this),
m_program_config("a18", ENDIANNESS_BIG, 16, 16, 0, address_map_constructor()),
m_space(*this, finder_base::DUMMY_TAG, -1),
+ m_out_bus_error_cb(*this),
+ m_out_bevnt_cb(*this),
m_out_birq4_cb(*this),
m_out_birq5_cb(*this),
m_out_birq6_cb(*this),
@@ -124,6 +126,7 @@ device_memory_interface::space_config_vector qbus_device::memory_space_config()
void qbus_device::device_start()
{
+ m_view = nullptr;
}
@@ -156,7 +159,10 @@ void qbus_device::add_card(device_qbus_card_interface &card)
void qbus_device::install_device(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler, uint32_t mask)
{
- m_space->install_readwrite_handler(start, end, rhandler, whandler, mask);
+ if (m_view)
+ m_view->install_readwrite_handler(start, end, rhandler, whandler, mask);
+ else
+ m_space->install_readwrite_handler(start, end, rhandler, whandler, mask);
}
diff --git a/src/devices/bus/qbus/qbus.h b/src/devices/bus/qbus/qbus.h
index c33af439080..b36ffce16d6 100644
--- a/src/devices/bus/qbus/qbus.h
+++ b/src/devices/bus/qbus/qbus.h
@@ -71,10 +71,14 @@ public:
// inline configuration
template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
+ void set_view(memory_view::memory_view_entry &view) { m_view = &view; };
virtual space_config_vector memory_space_config() const override;
address_space &program_space() const { return *m_space; }
+ auto bus_error_callback() { return m_out_bus_error_cb.bind(); }
+
+ auto bevnt() { return m_out_bevnt_cb.bind(); }
auto birq4() { return m_out_birq4_cb.bind(); }
auto birq5() { return m_out_birq6_cb.bind(); }
auto birq6() { return m_out_birq6_cb.bind(); }
@@ -84,7 +88,9 @@ public:
void install_device(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler, uint32_t mask=0xffffffff);
void init_w();
+ void bus_error_w(int state) { m_out_bus_error_cb(state); }
+ void bevnt_w(int state) { m_out_bevnt_cb(state); }
void birq4_w(int state) { m_out_birq4_cb(state); }
void birq5_w(int state) { m_out_birq5_cb(state); }
void birq6_w(int state) { m_out_birq6_cb(state); }
@@ -106,10 +112,14 @@ protected:
// internal state
required_address_space m_space;
+ memory_view::memory_view_entry *m_view;
private:
using card_vector = std::vector<std::reference_wrapper<device_qbus_card_interface> >;
+ devcb_write_line m_out_bus_error_cb;
+
+ devcb_write_line m_out_bevnt_cb;
devcb_write_line m_out_birq4_cb;
devcb_write_line m_out_birq5_cb;
devcb_write_line m_out_birq6_cb;