summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2019-06-27 23:05:06 +0200
committer Olivier Galibert <galibert@pobox.com>2019-06-27 23:05:34 +0200
commitc770602d4119fd4153915fd9f099babd96c1b95f (patch)
treedfbbd0c5345697e80964e88db3011667de74cf54
parent32a51e28e2718760ca4005d0122757edb324c1cf (diff)
ncd16: Make bert qlc mode work, the terminal boots [O. Galibert]
-rw-r--r--src/mame/drivers/ncd68k.cpp16
-rw-r--r--src/mame/machine/bert.cpp22
-rw-r--r--src/mame/machine/bert.h3
3 files changed, 39 insertions, 2 deletions
diff --git a/src/mame/drivers/ncd68k.cpp b/src/mame/drivers/ncd68k.cpp
index 7ca0ed06f55..617832bc373 100644
--- a/src/mame/drivers/ncd68k.cpp
+++ b/src/mame/drivers/ncd68k.cpp
@@ -40,7 +40,7 @@
/*
* WIP status
- * - ncd16 QLC/BERT test failures, boots from prom, crc error booting from network
+ * - ncd16 boots from prom, crc error booting from network
* - ncd17c nvram timeout or checksum failure
* - ncd19 loads server from network, then hangs
*
@@ -503,6 +503,20 @@ void ncd16_state::configure(machine_config &config)
BERT(config, m_bert, 0).set_memory(m_maincpu, AS_PROGRAM);
common(config);
+
+ m_duart->outport_cb().set(
+ [this](u8 data)
+ {
+ m_serial[0]->write_rts(BIT(data, 0));
+ m_serial[1]->write_rts(BIT(data, 1));
+ m_serial[0]->write_dtr(BIT(data, 2));
+ m_serial[1]->write_dtr(BIT(data, 3));
+ m_bert->set_qlc_mode(BIT(data, 5));
+
+ // TODO: bit 4 - usually set
+ // TODO: bit 6 - usually set
+ // TODO: bit 7 - set/cleared continuously
+ });
}
void ncd17c_state::configure(machine_config &config)
diff --git a/src/mame/machine/bert.cpp b/src/mame/machine/bert.cpp
index 9aca9bfb267..4311a861e65 100644
--- a/src/mame/machine/bert.cpp
+++ b/src/mame/machine/bert.cpp
@@ -25,7 +25,8 @@ void bert_device::device_start()
save_item(NAME(m_control));
save_item(NAME(m_history));
save_item(NAME(m_step));
-
+ save_item(NAME(m_qlc_mode));
+ save_item(NAME(m_qlc_src));
m_memory = m_memory_space->cache<1, 0, ENDIANNESS_BIG>();
}
@@ -34,6 +35,8 @@ void bert_device::device_reset()
m_control = 0;
m_history = 0;
m_step = 0;
+ m_qlc_mode = false;
+ m_qlc_src = 0;
}
void bert_device::map(address_map &map)
@@ -41,8 +44,18 @@ void bert_device::map(address_map &map)
map(0x000000, 0x7fffff).rw(FUNC(bert_device::read), FUNC(bert_device::write));
}
+void bert_device::set_qlc_mode(bool state)
+{
+ m_qlc_mode = state;
+}
+
u16 bert_device::read(offs_t offset)
{
+ if(m_qlc_mode) {
+ m_qlc_src = offset << 1;
+ return 0;
+ }
+
constexpr u16 type = 0x00ca;
u16 data = m_memory->read_word(offset << 1);
u16 res;
@@ -66,6 +79,13 @@ u16 bert_device::read(offs_t offset)
void bert_device::write(offs_t offset, u16 data, u16 mem_mask)
{
+ if(m_qlc_mode) {
+ u32 dest = offset << 1;
+ for(u32 i=0; i<512; i+=2)
+ m_memory->write_word(dest + i, m_memory->read_word(m_qlc_src + i));
+ return;
+ }
+
m_step = 0;
m_memory->write_word(offset << 1, data, mem_mask);
if(!offset) {
diff --git a/src/mame/machine/bert.h b/src/mame/machine/bert.h
index 58c67ec5e1e..628e8e8753e 100644
--- a/src/mame/machine/bert.h
+++ b/src/mame/machine/bert.h
@@ -15,6 +15,7 @@ public:
bert_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
void map(address_map &map);
+ void set_qlc_mode(bool state);
protected:
virtual void device_start() override;
@@ -30,6 +31,8 @@ private:
u16 m_control;
u16 m_history;
u32 m_step;
+ bool m_qlc_mode;
+ u32 m_qlc_src;
};
DECLARE_DEVICE_TYPE(BERT, bert_device)