summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/a2gameio/gameio.cpp4
-rw-r--r--src/devices/bus/a2gameio/gizmo.cpp75
-rw-r--r--src/devices/bus/a2gameio/gizmo.h45
4 files changed, 125 insertions, 1 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 2d8a8a172f4..257571c1539 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2388,6 +2388,8 @@ if (BUSES["A2GAMEIO"]~=null) then
MAME_DIR .. "src/devices/bus/a2gameio/joyport.h",
MAME_DIR .. "src/devices/bus/a2gameio/paddles.cpp",
MAME_DIR .. "src/devices/bus/a2gameio/paddles.h",
+ MAME_DIR .. "src/devices/bus/a2gameio/gizmo.cpp",
+ MAME_DIR .. "src/devices/bus/a2gameio/gizmo.h",
}
end
diff --git a/src/devices/bus/a2gameio/gameio.cpp b/src/devices/bus/a2gameio/gameio.cpp
index 523176d6184..9a600776a90 100644
--- a/src/devices/bus/a2gameio/gameio.cpp
+++ b/src/devices/bus/a2gameio/gameio.cpp
@@ -53,7 +53,7 @@
#include "bus/a2gameio/joyport.h"
#include "bus/a2gameio/computereyes.h"
#include "bus/a2gameio/paddles.h"
-
+#include "bus/a2gameio/gizmo.h"
//**************************************************************************
// CONNECTOR DEVICE IMPLEMENTATION
@@ -75,6 +75,7 @@ void apple2_gameio_device::iiandplus_options(device_slot_interface &slot)
slot.option_add("joy", APPLE2_JOYSTICK);
slot.option_add("paddles", APPLE2_PADDLES);
slot.option_add("joyport", APPLE2_JOYPORT);
+ slot.option_add("gizmo", APPLE2_GIZMO);
slot.option_add("compeyes", APPLE2_COMPUTEREYES);
}
@@ -82,6 +83,7 @@ void apple2_gameio_device::default_options(device_slot_interface &slot)
{
slot.option_add("joy", APPLE2_JOYSTICK);
slot.option_add("paddles", APPLE2_PADDLES);
+ slot.option_add("gizmo", APPLE2_GIZMO);
slot.option_add("compeyes", APPLE2_COMPUTEREYES);
}
diff --git a/src/devices/bus/a2gameio/gizmo.cpp b/src/devices/bus/a2gameio/gizmo.cpp
new file mode 100644
index 00000000000..b3ffa9ea614
--- /dev/null
+++ b/src/devices/bus/a2gameio/gizmo.cpp
@@ -0,0 +1,75 @@
+// license:BSD-3-Clause
+// copyright-holders:R. Belmont
+/*********************************************************************
+
+ gizmo.cpp - HAL Labs Gizmo digital joystick adapter
+ Used by Vindicator and Super Taxman 2.
+
+*********************************************************************/
+
+#include "emu.h"
+#include "bus/a2gameio/gizmo.h"
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+DEFINE_DEVICE_TYPE(APPLE2_GIZMO, apple2_gizmo_device, "a2gizmo", "HAL Labs Gizmo")
+
+//**************************************************************************
+// INPUT PORTS
+//**************************************************************************
+
+static INPUT_PORTS_START( apple2_gizmo )
+ PORT_START("joystick_p1")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
+INPUT_PORTS_END
+
+//**************************************************************************
+// DEVICE IMPLEMENTATION
+//**************************************************************************
+
+apple2_gizmo_device::apple2_gizmo_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, APPLE2_GIZMO, tag, owner, clock)
+ , device_a2gameio_interface(mconfig, *this)
+ , m_player1(*this, "joystick_p1")
+{
+}
+
+ioport_constructor apple2_gizmo_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(apple2_gizmo);
+}
+
+void apple2_gizmo_device::device_start()
+{
+ save_item(NAME(m_an0));
+ save_item(NAME(m_an1));
+ save_item(NAME(m_an2));
+}
+
+READ_LINE_MEMBER(apple2_gizmo_device::sw0_r)
+{
+ static const int gizmo_bits[8] = { 1,3,2,0,4,5,5,5 };
+ return BIT(m_player1->read(),gizmo_bits[m_an0+(m_an1<<1)+(m_an2<<2)]);
+}
+
+WRITE_LINE_MEMBER(apple2_gizmo_device::an0_w)
+{
+ m_an0 = state;
+}
+
+WRITE_LINE_MEMBER(apple2_gizmo_device::an1_w)
+{
+ m_an1 = state;
+}
+
+WRITE_LINE_MEMBER(apple2_gizmo_device::an2_w)
+{
+ m_an2 = state;
+}
diff --git a/src/devices/bus/a2gameio/gizmo.h b/src/devices/bus/a2gameio/gizmo.h
new file mode 100644
index 00000000000..c0702bc7a41
--- /dev/null
+++ b/src/devices/bus/a2gameio/gizmo.h
@@ -0,0 +1,45 @@
+// license:BSD-3-Clause
+// copyright-holders:R. Belmont
+/*********************************************************************
+
+ gizmo.h - HAL Labs Gizmo digital joystick adapter
+ Used by Vindicator and Super Taxman 2.
+
+*********************************************************************/
+
+#ifndef MAME_BUS_A2GAMEIO_GIZMO_H
+#define MAME_BUS_A2GAMEIO_GIZMO_H
+
+#pragma once
+
+#include "bus/a2gameio/gameio.h"
+
+// ======================> apple2_gizmo_device
+
+class apple2_gizmo_device : public device_t, public device_a2gameio_interface
+{
+public:
+ // construction/destruction
+ apple2_gizmo_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+protected:
+ // device-level overrides
+ virtual ioport_constructor device_input_ports() const override;
+ virtual void device_start() override;
+
+ // device_a2gameio_interface overrides
+ virtual DECLARE_READ_LINE_MEMBER(sw0_r) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(an0_w) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(an1_w) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(an2_w) override;
+
+private:
+ // input ports
+ required_ioport m_player1;
+ int m_an0, m_an1, m_an2;
+};
+
+// device type declaration
+DECLARE_DEVICE_TYPE(APPLE2_GIZMO, apple2_gizmo_device)
+
+#endif // MAME_BUS_A2GAMEIO_GIZMO_H