summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/mackbd/mackbd.h
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-07-01 02:23:16 +1000
committer Vas Crabb <vas@vastheman.com>2020-07-01 02:37:55 +1000
commit802de3995db875fcc09c912b0ff40fb74a5ffda3 (patch)
treebe547782be0d90bc86c9212cb921248cdc9be231 /src/devices/bus/mackbd/mackbd.h
parent706c599f7356b1749626e10cc6ef150c78a30064 (diff)
Slotified Mac 128k/512k/512ke/Plus keyboard port.
Available keyboards are us (M0110, U.S.), gb (M0110B, British), fr (M0110F, French), pad (M0120F, numeric keypad with passthrough port) and plus (M0110A, U.S. with integrated numeric keypad). The mac128k, mac512k and mac512ke drivers default to the numeric keypad with the U.S. keyboard connected to the passthrough port; the macplus driver defaults to the U.S. keyboard with integrated numeric keypad. Note that the numeric keypad may seem strange. Four of the operators work as cursor arrows if you don't hold shift. There is a comma on one of the keys, but by the time System 6 was released, Apple had decided an equals sign was more useful, so that's what it will produces on newer system versions. The U.S. keyboard with integrated numeric keypad emulates these aspects of the stand-alone keypad - pressing the operator keys on the keypad sends fake shit key down/up events, and using the arrow keys while holding shift will produces operator characters rather than selecting text. The ISO layout keyboards (M0110B and M0110F) produce different scan codes to the ANSI keyboards (M0110 and M0110A) but they don't report a different identification byte. To use an ISO keyboard, you must open the Keyboard control panel and change the layout to International (and change it back to Domestic if you switch back to an ANSI keyboard). This doesn't actually work at the moment due to issues with 6522 VIA emulation, but it will work with macplus sys603 if applied on top of revision 963a2c166d080e78e6de7fe432ed7944c59a6083. -----------------------------------------------------------------------
Diffstat (limited to 'src/devices/bus/mackbd/mackbd.h')
-rw-r--r--src/devices/bus/mackbd/mackbd.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/devices/bus/mackbd/mackbd.h b/src/devices/bus/mackbd/mackbd.h
new file mode 100644
index 00000000000..29be2d6e4ea
--- /dev/null
+++ b/src/devices/bus/mackbd/mackbd.h
@@ -0,0 +1,91 @@
+// license: BSD-3-Clause
+// copyright-holders: Vas Crabb
+/***************************************************************************
+
+ Mac 128k/512k/Plus keyboard interface (pre-ADB)
+
+ 4p4c RJ11 connector (cables wired straight through):
+ 1: power/signal ground (black)
+ 2: clock (red, peripheral to host)
+ 3: data (green, bidirectional)
+ 4: +5V power (yellow, maximum 200mA for all peripherals)
+
+***************************************************************************/
+#ifndef MAME_BUS_MACKBD_MACKBD_H
+#define MAME_BUS_MACKBD_MACKBD_H
+
+#pragma once
+
+
+class device_mac_keyboard_interface;
+
+DECLARE_DEVICE_TYPE(MAC_KEYBOARD_PORT, mac_keyboard_port_device)
+
+void mac_keyboard_devices(device_slot_interface &device);
+
+
+//**************************************************************************
+// HOST PORT
+//**************************************************************************
+
+class mac_keyboard_port_device : public device_t, public device_single_card_slot_interface<device_mac_keyboard_interface>
+{
+public:
+ template <typename T>
+ mac_keyboard_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
+ : mac_keyboard_port_device(mconfig, tag, owner, 0U)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+ mac_keyboard_port_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0U);
+ virtual ~mac_keyboard_port_device() override;
+
+ auto clock_cb() { return m_clock_cb.bind(); }
+ auto data_cb() { return m_data_cb.bind(); }
+
+ DECLARE_WRITE_LINE_MEMBER(data_w);
+
+protected:
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+private:
+ devcb_write_line m_clock_cb;
+ devcb_write_line m_data_cb;
+
+ device_mac_keyboard_interface *m_peripheral;
+
+ friend class device_mac_keyboard_interface;
+};
+
+
+//**************************************************************************
+// PERIPHERAL INTERFACE
+//**************************************************************************
+
+class device_mac_keyboard_interface : public device_interface
+{
+public:
+ virtual ~device_mac_keyboard_interface() override;
+
+protected:
+ device_mac_keyboard_interface(machine_config const &mconfig, device_t &device);
+
+ virtual void interface_validity_check(validity_checker &valid) const override;
+
+ DECLARE_WRITE_LINE_MEMBER(write_clock) { if (m_host) m_host->m_clock_cb(state); }
+ DECLARE_WRITE_LINE_MEMBER(write_data) { if (m_host) m_host->m_data_cb(state); }
+
+ virtual DECLARE_WRITE_LINE_MEMBER(data_w) = 0;
+
+private:
+ mac_keyboard_port_device *const m_host;
+
+ friend class mac_keyboard_port_device;
+};
+
+
+#endif // MAME_BUS_MACKBD_MACKBD_H