summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/electron/fbjoy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/electron/fbjoy.cpp')
-rw-r--r--src/devices/bus/electron/fbjoy.cpp66
1 files changed, 30 insertions, 36 deletions
diff --git a/src/devices/bus/electron/fbjoy.cpp b/src/devices/bus/electron/fbjoy.cpp
index e5a4042cfeb..07c99d22bf6 100644
--- a/src/devices/bus/electron/fbjoy.cpp
+++ b/src/devices/bus/electron/fbjoy.cpp
@@ -11,55 +11,44 @@
#include "emu.h"
#include "fbjoy.h"
-//**************************************************************************
-// DEVICE DEFINITIONS
-//**************************************************************************
+#include "bus/vcs_ctrl/ctrl.h"
-DEFINE_DEVICE_TYPE(ELECTRON_FBJOY, electron_fbjoy_device, "electron_fbjoy", "First Byte Joystick Interface")
+namespace {
-static INPUT_PORTS_START( fbjoy )
- PORT_START("JOY")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Fire")
-INPUT_PORTS_END
-
-
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor electron_fbjoy_device::device_input_ports() const
+class electron_fbjoy_device
+ : public device_t
+ , public device_electron_expansion_interface
{
- return INPUT_PORTS_NAME( fbjoy );
-}
+public:
+ electron_fbjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ELECTRON_FBJOY, tag, owner, clock)
+ , device_electron_expansion_interface(mconfig, *this)
+ , m_joy(*this, "joy")
+ {
+ }
+ virtual uint8_t expbus_r(offs_t offset) override;
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
+protected:
+ // device_t overrides
+ virtual void device_start() override ATTR_COLD { }
-//-------------------------------------------------
-// electron_fbjoy_device - constructor
-//-------------------------------------------------
+ // optional information overrides
+ virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
-electron_fbjoy_device::electron_fbjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_FBJOY, tag, owner, clock)
- , device_electron_expansion_interface(mconfig, *this)
- , m_joy(*this, "JOY")
-{
-}
+private:
+ required_device<vcs_control_port_device> m_joy;
+};
//-------------------------------------------------
-// device_start - device-specific startup
+// device_add_mconfig - add device configuration
//-------------------------------------------------
-void electron_fbjoy_device::device_start()
+void electron_fbjoy_device::device_add_mconfig(machine_config &config)
{
+ VCS_CONTROL_PORT(config, m_joy, vcs_control_port_devices, "joy");
}
@@ -73,8 +62,13 @@ uint8_t electron_fbjoy_device::expbus_r(offs_t offset)
if (offset == 0xfcc0)
{
- data = m_joy->read() | 0xe0;
+ data = bitswap<8>(m_joy->read_joy(), 7, 6, 4, 5, 3, 2, 1, 0);
}
return data;
}
+
+} // anonymous namespace
+
+
+DEFINE_DEVICE_TYPE_PRIVATE(ELECTRON_FBJOY, device_electron_expansion_interface, electron_fbjoy_device, "electron_fbjoy", "First Byte Joystick Interface")