summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--hash/astrocde.xml2
-rw-r--r--scripts/src/bus.lua6
-rw-r--r--src/devices/bus/astrocde/cassette.cpp47
-rw-r--r--src/devices/bus/astrocde/cassette.h47
-rw-r--r--src/devices/bus/astrocde/ctrl.cpp109
-rw-r--r--src/devices/bus/astrocde/ctrl.h91
-rw-r--r--src/devices/bus/astrocde/joy.cpp56
-rw-r--r--src/devices/bus/astrocde/joy.h45
-rw-r--r--src/devices/sound/astrocde.cpp6
-rw-r--r--src/devices/sound/astrocde.h4
-rw-r--r--src/emu/device.h3
-rw-r--r--src/mame/drivers/astrocde.cpp4
-rw-r--r--src/mame/drivers/astrohome.cpp63
13 files changed, 426 insertions, 57 deletions
diff --git a/hash/astrocde.xml b/hash/astrocde.xml
index a9d04e40760..1d2cd390505 100644
--- a/hash/astrocde.xml
+++ b/hash/astrocde.xml
@@ -128,7 +128,7 @@
<software name="astrobas">
<description>Bally BASIC (Astrovision)</description>
-<!-- <note>The updated release of BASIC used an internal 2000 baud interface (not emulated) to load and save programs.</note> -->
+<!-- <note>The updated release of BASIC used an internal 2000 baud interface to load and save programs.</note> -->
<year>1981</year>
<publisher>Astrovision</publisher>
<part name="cart" interface="astrocde_cart">
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 142927e64e0..8f292e082af 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -260,6 +260,12 @@ if (BUSES["ASTROCADE"]~=null) then
MAME_DIR .. "src/devices/bus/astrocde/exp.h",
MAME_DIR .. "src/devices/bus/astrocde/ram.cpp",
MAME_DIR .. "src/devices/bus/astrocde/ram.h",
+ MAME_DIR .. "src/devices/bus/astrocde/ctrl.cpp",
+ MAME_DIR .. "src/devices/bus/astrocde/ctrl.h",
+ MAME_DIR .. "src/devices/bus/astrocde/joy.cpp",
+ MAME_DIR .. "src/devices/bus/astrocde/joy.h",
+ MAME_DIR .. "src/devices/bus/astrocde/cassette.cpp",
+ MAME_DIR .. "src/devices/bus/astrocde/cassette.h",
}
end
diff --git a/src/devices/bus/astrocde/cassette.cpp b/src/devices/bus/astrocde/cassette.cpp
new file mode 100644
index 00000000000..789b0d7e175
--- /dev/null
+++ b/src/devices/bus/astrocde/cassette.cpp
@@ -0,0 +1,47 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "emu.h"
+#include "cassette.h"
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device, "astrocade_cass", "Bally Astrocade Cassette")
+
+
+//**************************************************************************
+// Bally Astrocade cassette input
+//**************************************************************************
+
+astrocade_cassette_device::astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ASTROCADE_CASSETTE, tag, owner, clock)
+ , device_astrocade_ctrl_interface(mconfig, *this)
+ , m_cassette(*this, "cassette")
+{
+}
+
+astrocade_cassette_device::~astrocade_cassette_device()
+{
+}
+
+uint8_t astrocade_cassette_device::read_handle()
+{
+ uint8_t data = m_cassette->input() > 0.0 ? 0 : 1;
+ logerror("%s: Cassette Handle Read: %d\n", machine().describe_context(), data);
+ return data;
+}
+
+uint8_t astrocade_cassette_device::read_knob()
+{
+ logerror("%s: Cassette Knob Read\n", machine().describe_context());
+ return 0;
+}
+
+void astrocade_cassette_device::device_add_mconfig(machine_config &config)
+{
+ CASSETTE(config, m_cassette);
+ m_cassette->set_default_state(CASSETTE_STOPPED);
+ m_cassette->set_interface("astrocade_cass");
+}
diff --git a/src/devices/bus/astrocde/cassette.h b/src/devices/bus/astrocde/cassette.h
new file mode 100644
index 00000000000..15635dee3bf
--- /dev/null
+++ b/src/devices/bus/astrocde/cassette.h
@@ -0,0 +1,47 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+#ifndef MAME_BUS_ASTROCDE_CASSETTE_H
+#define MAME_BUS_ASTROCDE_CASSETTE_H
+
+#pragma once
+
+#include "ctrl.h"
+#include "imagedev/cassette.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+ ***************************************************************************/
+
+// ======================> astrocade_cassette_device
+
+class astrocade_cassette_device : public device_t,
+ public device_astrocade_ctrl_interface
+{
+public:
+ static constexpr feature_type imperfect_features() { return feature::CASSETTE; }
+
+ // construction/destruction
+ astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
+ virtual ~astrocade_cassette_device();
+
+ // device_astrocade_ctrl_interface implementation
+ virtual uint8_t read_handle() override;
+ virtual uint8_t read_knob() override;
+
+protected:
+ // device_t implementation
+ virtual void device_start() override { }
+ virtual void device_add_mconfig(machine_config &config) override;
+
+private:
+ required_device<cassette_image_device> m_cassette;
+};
+
+
+/***************************************************************************
+ DEVICE TYPES
+ ***************************************************************************/
+
+DECLARE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device)
+
+#endif // MAME_BUS_ASTROCDE_CASSETTE_H
diff --git a/src/devices/bus/astrocde/ctrl.cpp b/src/devices/bus/astrocde/ctrl.cpp
new file mode 100644
index 00000000000..16b8537eae4
--- /dev/null
+++ b/src/devices/bus/astrocde/ctrl.cpp
@@ -0,0 +1,109 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "emu.h"
+#include "ctrl.h"
+
+#include <cassert>
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device, "astrocade_ctrl_port", "Bally Astrocade Control Port")
+
+
+//**************************************************************************
+// Bally Astrocade controller interface
+//**************************************************************************
+
+device_astrocade_ctrl_interface::device_astrocade_ctrl_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig, device)
+ , m_port(dynamic_cast<astrocade_ctrl_port_device *>(device.owner()))
+{
+}
+
+device_astrocade_ctrl_interface::~device_astrocade_ctrl_interface()
+{
+}
+
+void device_astrocade_ctrl_interface::interface_validity_check(validity_checker &valid) const
+{
+ device_slot_card_interface::interface_validity_check(valid);
+
+ if (device().owner() && !m_port)
+ {
+ osd_printf_error("Owner device %s (%s) is not an astrocade_ctrl_port_device\n", device().owner()->tag(), device().owner()->name());
+ }
+}
+
+void device_astrocade_ctrl_interface::interface_pre_start()
+{
+ device_slot_card_interface::interface_pre_start();
+
+ if (m_port && !m_port->started())
+ throw device_missing_dependencies();
+}
+
+
+//**************************************************************************
+// Bally Astrocade controller port
+//**************************************************************************
+
+astrocade_ctrl_port_device::astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ASTROCADE_CTRL_PORT, tag, owner, clock)
+ , device_slot_interface(mconfig, *this)
+{
+}
+
+astrocade_ctrl_port_device::~astrocade_ctrl_port_device()
+{
+}
+
+void astrocade_ctrl_port_device::device_validity_check(validity_checker &valid) const
+{
+ device_t *const card(get_card_device());
+ if (card && !dynamic_cast<device_astrocade_ctrl_interface *>(card))
+ {
+ osd_printf_error("Card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name());
+ }
+}
+
+void astrocade_ctrl_port_device::device_resolve_objects()
+{
+ device_astrocade_ctrl_interface *const card(dynamic_cast<device_astrocade_ctrl_interface *>(get_card_device()));
+ if (card)
+ m_device = card;
+}
+
+void astrocade_ctrl_port_device::device_start()
+{
+ device_t *const card(get_card_device());
+ if (card)
+ {
+ if (!m_device)
+ {
+ throw emu_fatalerror("astrocade_ctrl_port_device: card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name());
+ }
+ }
+}
+
+uint8_t astrocade_ctrl_port_device::read_handle()
+{
+ return m_device ? m_device->read_handle() : 0;
+}
+
+uint8_t astrocade_ctrl_port_device::read_knob()
+{
+ return m_device ? m_device->read_knob() : 0;
+}
+
+#include "joy.h"
+#include "cassette.h"
+
+void astrocade_controllers(device_slot_interface &device)
+{
+ device.option_add("joy", ASTROCADE_JOY);
+ device.option_add("cassette", ASTROCADE_CASSETTE);
+}
diff --git a/src/devices/bus/astrocde/ctrl.h b/src/devices/bus/astrocde/ctrl.h
new file mode 100644
index 00000000000..7ff8acbde52
--- /dev/null
+++ b/src/devices/bus/astrocde/ctrl.h
@@ -0,0 +1,91 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+#ifndef MAME_BUS_ASTROCDE_CTRL_H
+#define MAME_BUS_ASTROCDE_CTRL_H
+
+#pragma once
+
+
+/***************************************************************************
+ FORWARD DECLARATIONS
+ ***************************************************************************/
+
+class astrocade_ctrl_port_device;
+
+
+/***************************************************************************
+ TYPE DEFINITIONS
+ ***************************************************************************/
+
+// ======================> device_astrocade_ctrl_interface
+
+class device_astrocade_ctrl_interface : public device_slot_card_interface
+{
+public:
+ virtual ~device_astrocade_ctrl_interface();
+
+ virtual uint8_t read_handle() { return 0; }
+ virtual uint8_t read_knob() { return 0; }
+
+protected:
+ device_astrocade_ctrl_interface(machine_config const &mconfig, device_t &device);
+
+ // device_interface implementation
+ virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD;
+ virtual void interface_pre_start() override;
+
+private:
+ astrocade_ctrl_port_device *const m_port;
+
+ friend class astrocade_ctrl_port_device;
+};
+
+
+// ======================> astrocade_ctrl_port_device
+
+class astrocade_ctrl_port_device : public device_t, public device_slot_interface
+{
+public:
+ // construction/destruction
+ template <typename T>
+ astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
+ : astrocade_ctrl_port_device(mconfig, tag, owner, 0U)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+ astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
+ virtual ~astrocade_ctrl_port_device();
+
+ uint8_t read_handle();
+ uint8_t read_knob();
+
+protected:
+ // device_t implementation
+ virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD;
+ virtual void device_resolve_objects() override;
+ virtual void device_start() override;
+
+private:
+ device_astrocade_ctrl_interface *m_device;
+
+ friend class device_astrocade_ctrl_interface;
+};
+
+
+/***************************************************************************
+ FUNCTIONS
+ ***************************************************************************/
+
+void astrocade_controllers(device_slot_interface &device);
+
+
+/***************************************************************************
+ DEVICE TYPES
+ ***************************************************************************/
+
+DECLARE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device)
+
+#endif // MAME_BUS_ASTROCDE_CTRL_H
diff --git a/src/devices/bus/astrocde/joy.cpp b/src/devices/bus/astrocde/joy.cpp
new file mode 100644
index 00000000000..cbf75da0c5c
--- /dev/null
+++ b/src/devices/bus/astrocde/joy.cpp
@@ -0,0 +1,56 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+
+#include "emu.h"
+#include "joy.h"
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device, "astrocade_joy", "Bally Astrocade Joystick")
+
+
+//**************************************************************************
+// Bally Astrocade joystick control
+//**************************************************************************
+
+astrocade_joy_device::astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, ASTROCADE_JOY, tag, owner, clock)
+ , device_astrocade_ctrl_interface(mconfig, *this)
+ , m_handle(*this, "HANDLE")
+ , m_knob(*this, "KNOB")
+{
+}
+
+astrocade_joy_device::~astrocade_joy_device()
+{
+}
+
+uint8_t astrocade_joy_device::read_handle()
+{
+ return m_handle->read();
+}
+
+uint8_t astrocade_joy_device::read_knob()
+{
+ return m_knob->read();
+}
+
+static INPUT_PORTS_START( astrocade_joy )
+ PORT_START("HANDLE")
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY
+ PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY
+ PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY
+ PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY
+ PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)
+ PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
+
+ PORT_START("KNOB")
+ PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
+INPUT_PORTS_END
+
+ioport_constructor astrocade_joy_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( astrocade_joy );
+}
diff --git a/src/devices/bus/astrocde/joy.h b/src/devices/bus/astrocde/joy.h
new file mode 100644
index 00000000000..1db02b9d28f
--- /dev/null
+++ b/src/devices/bus/astrocde/joy.h
@@ -0,0 +1,45 @@
+// license:BSD-3-Clause
+// copyright-holders:Ryan Holtz
+#ifndef MAME_BUS_ASTROCDE_JOY_H
+#define MAME_BUS_ASTROCDE_JOY_H
+
+#pragma once
+
+#include "ctrl.h"
+
+/***************************************************************************
+ TYPE DEFINITIONS
+ ***************************************************************************/
+
+// ======================> astrocade_joy_device
+
+class astrocade_joy_device : public device_t,
+ public device_astrocade_ctrl_interface
+{
+public:
+ // construction/destruction
+ astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
+ virtual ~astrocade_joy_device();
+
+ // device_astrocade_ctrl_interface implementation
+ virtual uint8_t read_handle() override;
+ virtual uint8_t read_knob() override;
+
+protected:
+ // device_t implementation
+ virtual ioport_constructor device_input_ports() const override;
+ virtual void device_start() override { }
+
+private:
+ required_ioport m_handle;
+ required_ioport m_knob;
+};
+
+
+/***************************************************************************
+ DEVICE TYPES
+ ***************************************************************************/
+
+DECLARE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device)
+
+#endif // MAME_BUS_ASTROCDE_JOY_H
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index e3600a88286..33ae926f34c 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -86,7 +86,7 @@ astrocade_io_device::astrocade_io_device(const machine_config &mconfig, const ch
, m_c_state(0)
, m_si_callback(*this)
, m_so_callback{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}}
- , m_pots(*this, {finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG})
+ , m_pots{{*this}, {*this}, {*this}, {*this}}
{
memset(m_reg, 0, sizeof(uint8_t)*8);
memset(m_bitswap, 0, sizeof(uint8_t)*256);
@@ -104,6 +104,8 @@ void astrocade_io_device::device_resolve_objects()
m_si_callback.resolve_safe(0);
for (auto &cb : m_so_callback)
cb.resolve_safe();
+ for (auto &pot : m_pots)
+ pot.resolve_safe(0);
}
@@ -323,7 +325,7 @@ READ8_MEMBER(astrocade_io_device::read)
return m_si_callback(space, offset & 7);
}
else if ((offset & 0x0f) >= 0x0c)
- return m_pots[offset & 3].read_safe(0);
+ return m_pots[offset & 3]();
else
return 0xff;
}
diff --git a/src/devices/sound/astrocde.h b/src/devices/sound/astrocde.h
index 7eaae126f4f..eddde3a12bb 100644
--- a/src/devices/sound/astrocde.h
+++ b/src/devices/sound/astrocde.h
@@ -49,7 +49,7 @@ public:
// configuration access
auto si_cb() { return m_si_callback.bind(); }
template <std::size_t Bit> auto so_cb() { return m_so_callback[Bit].bind(); }
- template <std::size_t Pot> void set_pot_tag(const char *tag) { m_pots[Pot].set_tag(tag); }
+ template <std::size_t Pot> auto pot_cb() { return m_pots[Pot].bind(); }
protected:
// device-level overrides
@@ -90,7 +90,7 @@ private:
devcb_read8 m_si_callback;
devcb_write8 m_so_callback[8];
- optional_ioport_array<4> m_pots;
+ devcb_read8 m_pots[4];
};
DECLARE_DEVICE_TYPE(ASTROCADE_IO, astrocade_io_device)
diff --git a/src/emu/device.h b/src/emu/device.h
index abaea74cb12..708b28a0fb9 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -104,9 +104,10 @@ struct device_feature
LAN = u32(1) << 11,
WAN = u32(1) << 12,
TIMING = u32(1) << 13,
+ CASSETTE = u32(1) << 14,
NONE = u32(0),
- ALL = (u32(1) << 14) - 1U
+ ALL = (u32(1) << 15) - 1U
};
};
diff --git a/src/mame/drivers/astrocde.cpp b/src/mame/drivers/astrocde.cpp
index 9008ba5b7aa..a9e5c09ba90 100644
--- a/src/mame/drivers/astrocde.cpp
+++ b/src/mame/drivers/astrocde.cpp
@@ -1475,8 +1475,8 @@ void demndrgn_state::demndrgn(machine_config &config)
outlatch.bit_handler<4>().set(FUNC(demndrgn_state::input_select_w));
m_astrocade_sound1->so_cb<4>().set("outlatch", FUNC(output_latch_device::bus_w));
- m_astrocade_sound1->set_pot_tag<0>("FIREX");
- m_astrocade_sound1->set_pot_tag<1>("FIREY");
+ m_astrocade_sound1->pot_cb<0>().set_ioport("FIREX");
+ m_astrocade_sound1->pot_cb<1>().set_ioport("FIREY");
}
void tenpindx_state::tenpindx(machine_config &config)
diff --git a/src/mame/drivers/astrohome.cpp b/src/mame/drivers/astrohome.cpp
index 4924462bd15..b04948e5487 100644
--- a/src/mame/drivers/astrohome.cpp
+++ b/src/mame/drivers/astrohome.cpp
@@ -17,6 +17,7 @@
#include "bus/astrocde/rom.h"
#include "bus/astrocde/exp.h"
#include "bus/astrocde/ram.h"
+#include "bus/astrocde/ctrl.h"
#include "softlist.h"
#include "speaker.h"
@@ -29,6 +30,7 @@ public:
: astrocde_state(mconfig, type, tag)
, m_cart(*this, "cartslot")
, m_exp(*this, "exp")
+ , m_ctrl(*this, "ctrl%u", 1U)
, m_keypad(*this, "KEYPAD%u", 0U)
{ }
@@ -42,6 +44,7 @@ private:
required_device<astrocade_cart_slot_device> m_cart;
required_device<astrocade_exp_device> m_exp;
+ required_device_array<astrocade_ctrl_port_device, 4> m_ctrl;
required_ioport_array<4> m_keypad;
};
@@ -104,42 +107,10 @@ READ8_MEMBER(astrocde_home_state::inputs_r)
if (BIT(offset, 2))
return m_keypad[offset & 3]->read();
else
- return m_handle[offset & 3]->read();
+ return m_ctrl[offset & 3]->read_handle();
}
static INPUT_PORTS_START( astrocde )
- PORT_START("P1HANDLE")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
- PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("P2HANDLE")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
- PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("P3HANDLE")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3)
- PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("P4HANDLE")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY
- PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY
- PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY
- PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4)
- PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
PORT_START("KEYPAD0")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD)
@@ -175,18 +146,6 @@ static INPUT_PORTS_START( astrocde )
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1)
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E)
PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("P1_KNOB")
- PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1)
-
- PORT_START("P2_KNOB")
- PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
-
- PORT_START("P3_KNOB")
- PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3)
-
- PORT_START("P4_KNOB")
- PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4)
INPUT_PORTS_END
@@ -232,14 +191,20 @@ void astrocde_home_state::astrocde(machine_config &config)
PALETTE(config, "palette", FUNC(astrocde_home_state::astrocade_palette), 512);
+ /* control ports */
+ ASTROCADE_CTRL_PORT(config, m_ctrl[0], astrocade_controllers, "joy");
+ ASTROCADE_CTRL_PORT(config, m_ctrl[1], astrocade_controllers, nullptr);
+ ASTROCADE_CTRL_PORT(config, m_ctrl[2], astrocade_controllers, nullptr);
+ ASTROCADE_CTRL_PORT(config, m_ctrl[3], astrocade_controllers, nullptr);
+
/* sound hardware */
SPEAKER(config, "mono").front_center();
ASTROCADE_IO(config, m_astrocade_sound1, ASTROCADE_CLOCK/4);
m_astrocade_sound1->si_cb().set(FUNC(astrocde_home_state::inputs_r));
- m_astrocade_sound1->set_pot_tag<0>("P1_KNOB");
- m_astrocade_sound1->set_pot_tag<1>("P2_KNOB");
- m_astrocade_sound1->set_pot_tag<2>("P3_KNOB");
- m_astrocade_sound1->set_pot_tag<3>("P4_KNOB");
+ m_astrocade_sound1->pot_cb<0>().set(m_ctrl[0], FUNC(astrocade_ctrl_port_device::read_knob));
+ m_astrocade_sound1->pot_cb<1>().set(m_ctrl[1], FUNC(astrocade_ctrl_port_device::read_knob));
+ m_astrocade_sound1->pot_cb<2>().set(m_ctrl[2], FUNC(astrocade_ctrl_port_device::read_knob));
+ m_astrocade_sound1->pot_cb<3>().set(m_ctrl[3], FUNC(astrocade_ctrl_port_device::read_knob));
m_astrocade_sound1->add_route(ALL_OUTPUTS, "mono", 1.0);
/* expansion port */