summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/wangpckb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mess/machine/wangpckb.h')
-rw-r--r--src/mess/machine/wangpckb.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/mess/machine/wangpckb.h b/src/mess/machine/wangpckb.h
new file mode 100644
index 00000000000..4385b87f2fb
--- /dev/null
+++ b/src/mess/machine/wangpckb.h
@@ -0,0 +1,87 @@
+/**********************************************************************
+
+ Wang PC keyboard emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+*********************************************************************/
+
+#pragma once
+
+#ifndef __WANGPC_KEYBOARD__
+#define __WANGPC_KEYBOARD__
+
+
+#include "emu.h"
+#include "cpu/mcs51/mcs51.h"
+#include "sound/sn76496.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define WANGPC_KEYBOARD_TAG "wangpckb"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_WANGPC_KEYBOARD_ADD() \
+ MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> wangpc_keyboard_device
+
+class wangpc_keyboard_device : public device_t,
+ public device_serial_interface
+{
+public:
+ // construction/destruction
+ wangpc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ // not really public
+ DECLARE_READ8_MEMBER( kb_p1_r );
+ DECLARE_WRITE8_MEMBER( kb_p1_w );
+ DECLARE_WRITE8_MEMBER( kb_p2_w );
+ DECLARE_WRITE8_MEMBER( kb_p3_w );
+
+ static int mcs51_rx_callback(device_t *device);
+ static void mcs51_tx_callback(device_t *device, int data);
+
+protected:
+ // device-level overrides
+ virtual void device_config_complete() { m_shortname = "wangpckb"; }
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_serial_interface overrides
+ virtual void input_callback(UINT8 state);
+
+private:
+ required_device<cpu_device> m_maincpu;
+
+ UINT8 m_y;
+};
+
+
+// device type definition
+extern const device_type WANGPC_KEYBOARD;
+
+
+
+#endif