summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2020-09-22 19:50:26 +0100
committer Nigel Barnes <Pernod70@users.noreply.github.com>2020-09-22 19:52:14 +0100
commit70d8b5deb8c64d2249b80b3c85b9f812edbfa938 (patch)
tree94646bd6082b74d48fec757b6261c15b67e04545
parent2950d7e0fc8ba3a67e64a32e439e9ded3fad9335 (diff)
bus/bbc/userport: Added the Hybrid Music 4000 Keyboard.
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/bbc/userport/m4000.cpp170
-rw-r--r--src/devices/bus/bbc/userport/m4000.h58
-rw-r--r--src/devices/bus/bbc/userport/userport.cpp4
4 files changed, 232 insertions, 2 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 9b0c50556e2..35b082a3455 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -597,6 +597,8 @@ if (BUSES["BBC_USERPORT"]~=null) then
MAME_DIR .. "src/devices/bus/bbc/userport/beebspch.h",
MAME_DIR .. "src/devices/bus/bbc/userport/lcd.cpp",
MAME_DIR .. "src/devices/bus/bbc/userport/lcd.h",
+ MAME_DIR .. "src/devices/bus/bbc/userport/m4000.cpp",
+ MAME_DIR .. "src/devices/bus/bbc/userport/m4000.h",
MAME_DIR .. "src/devices/bus/bbc/userport/palext.cpp",
MAME_DIR .. "src/devices/bus/bbc/userport/palext.h",
MAME_DIR .. "src/devices/bus/bbc/userport/pointer.cpp",
diff --git a/src/devices/bus/bbc/userport/m4000.cpp b/src/devices/bus/bbc/userport/m4000.cpp
new file mode 100644
index 00000000000..910f2f8b3f1
--- /dev/null
+++ b/src/devices/bus/bbc/userport/m4000.cpp
@@ -0,0 +1,170 @@
+// license:BSD-3-Clause
+// copyright-holders:Nigel Barnes
+/**********************************************************************
+
+ Hybrid Music 4000 Keyboard (also known as ATPL Symphony)
+
+ https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-4000-Keyboard/
+ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music4000.html
+
+**********************************************************************/
+
+
+#include "emu.h"
+#include "m4000.h"
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(BBC_M4000, bbc_m4000_device, "bbc_m4000", "Hybrid Music 4000 Keyboard")
+
+
+//-------------------------------------------------
+// INPUT_PORTS( m4000 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( m4000 )
+ PORT_START("KBLOCK_1")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C2")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C2#")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D2")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D2#")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E2")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2#")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G2")
+
+ PORT_START("KBLOCK_2")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G2#")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A2")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A2#")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B2")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C3")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C3#")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D3")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D3#")
+
+ PORT_START("KBLOCK_3")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E3")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3#")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G3")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G3#")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A3")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A3#")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B3")
+
+ PORT_START("KBLOCK_4")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C4")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C4#")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D4")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D4#")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E4")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4#")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G4")
+
+ PORT_START("KBLOCK_5")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G4#")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A4")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A4#")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B4")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C5")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C5#")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D5")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("D5#")
+
+ PORT_START("KBLOCK_6")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("E5")
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5")
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5#")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G5")
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("G5#")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A5")
+ PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("A5#")
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("B5")
+
+ PORT_START("KBLOCK_7")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C6")
+ PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KBLOCK_8")
+ PORT_BIT(0x7f, IP_ACTIVE_LOW, IPT_UNUSED)
+ PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Foot Switch")
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor bbc_m4000_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( m4000 );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// bbc_m4000_device - constructor
+//-------------------------------------------------
+
+bbc_m4000_device::bbc_m4000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, BBC_M4000, tag, owner, clock)
+ , device_bbc_userport_interface(mconfig, *this)
+ , m_kbd(*this, "KBLOCK_%u", 1)
+ , m_clk(0)
+ , m_dsb(0)
+ , m_out(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bbc_m4000_device::device_start()
+{
+ save_item(NAME(m_clk));
+ save_item(NAME(m_dsb));
+ save_item(NAME(m_out));
+}
+
+
+//**************************************************************************
+// IMPLEMENTATION
+//**************************************************************************
+
+void bbc_m4000_device::write_cb1(int state)
+{
+ // 74hc164
+ if (!m_clk && state)
+ {
+ m_out = (m_out << 1) | m_dsb;
+ }
+ m_clk = state;
+}
+
+void bbc_m4000_device::write_cb2(int state)
+{
+ // 74hc164
+ m_dsb = state;
+}
+
+uint8_t bbc_m4000_device::pb_r()
+{
+ uint8_t data = 0xff;
+
+ for (int block = 0; block < 8; block++)
+ {
+ if (!BIT(m_out, block))
+ data = m_kbd[block]->read();
+ }
+
+ return data;
+}
diff --git a/src/devices/bus/bbc/userport/m4000.h b/src/devices/bus/bbc/userport/m4000.h
new file mode 100644
index 00000000000..df9c5e556cf
--- /dev/null
+++ b/src/devices/bus/bbc/userport/m4000.h
@@ -0,0 +1,58 @@
+// license:BSD-3-Clause
+// copyright-holders:Nigel Barnes
+/**********************************************************************
+
+ Hybrid Music 4000 Keyboard
+
+ https://www.retro-kit.co.uk/page.cfm/content/Hybrid-Music-4000-Keyboard/
+ http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Hybrid_Music4000.html
+
+**********************************************************************/
+
+
+#ifndef MAME_BUS_BBC_USERPORT_M4000_H
+#define MAME_BUS_BBC_USERPORT_M4000_H
+
+#pragma once
+
+#include "userport.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> bbc_m4000_device
+
+class bbc_m4000_device :
+ public device_t,
+ public device_bbc_userport_interface
+{
+public:
+ // construction/destruction
+ bbc_m4000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const override;
+
+ virtual uint8_t pb_r() override;
+ virtual void write_cb1(int state) override;
+ virtual void write_cb2(int state) override;
+
+private:
+ required_ioport_array<8> m_kbd;
+
+ int m_clk;
+ int m_dsb;
+ uint8_t m_out;
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(BBC_M4000, bbc_m4000_device)
+
+
+#endif // MAME_BUS_BBC_USERPORT_M4000_H
diff --git a/src/devices/bus/bbc/userport/userport.cpp b/src/devices/bus/bbc/userport/userport.cpp
index 5be7b7bd725..3091c04f816 100644
--- a/src/devices/bus/bbc/userport/userport.cpp
+++ b/src/devices/bus/bbc/userport/userport.cpp
@@ -132,7 +132,7 @@ void bbc_userport_slot_device::write_cb2(int state)
//#include "digitiser.h"
//#include "ev1.h"
#include "lcd.h"
-//#include "m4000.h"
+#include "m4000.h"
#include "palext.h"
#include "pointer.h"
#include "usersplit.h"
@@ -152,7 +152,7 @@ void bbc_userport_devices(device_slot_interface &device)
//device.option_add("ev1", BBC_EV1); /* Micro-Robotics EV1 */
//device.option_add("hobbit", BBC_HOBBIT); /* Hobbit Floppy Tape System (Ikon) */
device.option_add("lcd", BBC_LCD); /* Sprow LCD Display */
- //device.option_add("m4000", BBC_M4000); /* Hybrid Music 4000 Keyboard */
+ device.option_add("m4000", BBC_M4000); /* Hybrid Music 4000 Keyboard */
device.option_add("m512mouse", BBC_M512MOUSE); /* Acorn Mouse (provided with Master 512) */
device.option_add("tracker", BBC_TRACKER); /* Marconi RB2 Tracker Ball / Acorn Tracker Ball */
device.option_add("usersplit", BBC_USERSPLIT); /*User Port Splitter (Watford Electronics) */