summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/bl_handhelds_menucontrol.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/bl_handhelds_menucontrol.h')
-rw-r--r--src/devices/machine/bl_handhelds_menucontrol.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/devices/machine/bl_handhelds_menucontrol.h b/src/devices/machine/bl_handhelds_menucontrol.h
new file mode 100644
index 00000000000..bb3d68677c9
--- /dev/null
+++ b/src/devices/machine/bl_handhelds_menucontrol.h
@@ -0,0 +1,64 @@
+// license:BSD-3-Clause
+// copyright-holders:David Haywood
+
+#ifndef MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H
+#define MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H
+
+#pragma once
+
+DECLARE_DEVICE_TYPE(BL_HANDHELDS_MENUCONTROL, bl_handhelds_menucontrol_device)
+
+class bl_handhelds_menucontrol_device : public device_t
+{
+public:
+ // construction/destruction
+ bl_handhelds_menucontrol_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ // the chip is the same between systems, but there's some logic not fully understood that is causing off-by-1 errors on some calcs
+ void set_is_unsp_type_hack() { m_is_unsp_type_hack = true; }
+
+ DECLARE_READ_LINE_MEMBER(status_r);
+ DECLARE_READ_LINE_MEMBER(data_r);
+ DECLARE_WRITE_LINE_MEMBER(clock_w);
+ DECLARE_WRITE_LINE_MEMBER(data_w);
+ DECLARE_WRITE_LINE_MEMBER(reset_w);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+ // config
+ bool m_is_unsp_type_hack;
+
+ // internal state
+ int m_menupos;
+
+ // command handling
+ int m_clockstate;
+ int m_datashifterpos;
+
+ int m_responsebit;
+ uint8_t m_response;
+
+ int m_commandbit;
+ uint8_t m_command;
+
+ void handle_command();
+
+ enum menustate : const int
+ {
+ MENU_READY_FOR_COMMAND = 0,
+
+ MENU_COMMAND_00_IN,
+ MENU_COMMAND_01_IN,
+ MENU_COMMAND_02_IN,
+ MENU_COMMAND_03_IN,
+ MENU_COMMAND_04_IN,
+ MENU_COMMAND_05_IN,
+ };
+
+ menustate m_menustate;
+};
+
+#endif // MAME_MACHINE_BL_HANDHELDS_MENUCONTROL_H