From 00db3c0c2141eac818174d3333ff8cf9cd765faa Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 29 Jul 2019 23:16:09 -0400 Subject: apple2: Add support for the 4Play Joystick Card [R. Belmont] --- scripts/src/bus.lua | 2 + src/devices/bus/a2bus/4play.cpp | 125 ++++++++++++++++++++++++++++++++++++++++ src/devices/bus/a2bus/4play.h | 45 +++++++++++++++ src/mame/drivers/apple2.cpp | 2 + src/mame/drivers/apple2e.cpp | 2 + src/mame/drivers/apple2gs.cpp | 2 + 6 files changed, 178 insertions(+) create mode 100644 src/devices/bus/a2bus/4play.cpp create mode 100644 src/devices/bus/a2bus/4play.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index c713f87cd94..e118edd3da1 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -2131,6 +2131,8 @@ if (BUSES["A2BUS"]~=null) then MAME_DIR .. "src/devices/bus/a2bus/ssbapple.h", MAME_DIR .. "src/devices/bus/a2bus/transwarp.cpp", MAME_DIR .. "src/devices/bus/a2bus/transwarp.h", + MAME_DIR .. "src/devices/bus/a2bus/4play.cpp", + MAME_DIR .. "src/devices/bus/a2bus/4play.h", } end diff --git a/src/devices/bus/a2bus/4play.cpp b/src/devices/bus/a2bus/4play.cpp new file mode 100644 index 00000000000..eab126e5a6d --- /dev/null +++ b/src/devices/bus/a2bus/4play.cpp @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + a2ssc.c + + 4 player digital joystick card for the Apple II by Lukazi + http://lukazi.blogspot.com/2016/05/apple-ii-4play-joystick-card-revb.html + +*********************************************************************/ + +#include "emu.h" +#include "4play.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(A2BUS_4PLAY, a2bus_4play_device, "a24play", "4play Joystick Card (rev. B)") + +static INPUT_PORTS_START( a24play ) + PORT_START("p1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + + PORT_START("p2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + + PORT_START("p3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(3) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) + + PORT_START("p4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(3) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor a2bus_4play_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a24play ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_4play_device::a2bus_4play_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_4play_device(mconfig, A2BUS_4PLAY, tag, owner, clock) +{ +} + +a2bus_4play_device::a2bus_4play_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_a2bus_card_interface(mconfig, *this), + m_p1(*this, "p1"), + m_p2(*this, "p2"), + m_p3(*this, "p3"), + m_p4(*this, "p4") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_4play_device::device_start() +{ +} + +/*------------------------------------------------- + read_c0nx - called for reads from this card's c0nx space +-------------------------------------------------*/ + +uint8_t a2bus_4play_device::read_c0nx(uint8_t offset) +{ + switch (offset) + { + case 0: + return m_p1->read(); + case 1: + return m_p2->read(); + case 2: + return m_p3->read(); + case 3: + return m_p4->read(); + + default: + return 0xff; + } + + return 0; +} diff --git a/src/devices/bus/a2bus/4play.h b/src/devices/bus/a2bus/4play.h new file mode 100644 index 00000000000..96c407d315e --- /dev/null +++ b/src/devices/bus/a2bus/4play.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + 4play.h + + 4 player digital joystick card for the Apple II by Lukazi + http://lukazi.blogspot.com/2016/05/apple-ii-4play-joystick-card-revb.html + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_4PLAY_H +#define MAME_BUS_A2BUS_4PLAY_H + +#include "a2bus.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_4play_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_4play_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + a2bus_4play_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t read_c0nx(uint8_t offset) override; + + required_ioport m_p1, m_p2, m_p3, m_p4; + +private: +}; + +// device type definition +DECLARE_DEVICE_TYPE(A2BUS_4PLAY, a2bus_4play_device) + +#endif // MAME_BUS_A2BUS_4PLAY_H diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index deea9b6e3ed..272590bbfc6 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -86,6 +86,7 @@ II Plus: RAM options reduced to 16/32/48 KB. #include "bus/a2bus/timemasterho.h" #include "bus/a2bus/ssprite.h" #include "bus/a2bus/ssbapple.h" +#include "bus/a2bus/4play.h" #include "bus/a2gameio/gameio.h" @@ -1264,6 +1265,7 @@ static void apple2_cards(device_slot_interface &device) device.option_add("ezcgi9958", A2BUS_EZCGI_9958); /* E-Z Color Graphics Interface (TMS9958) */ device.option_add("ssprite", A2BUS_SSPRITE); /* Synetix SuperSprite Board */ device.option_add("ssbapple", A2BUS_SSBAPPLE); /* SSB Apple speech board */ + device.option_add("4play", A2BUS_4PLAY); /* 4Play Joystick Card (Rev. B) */ // device.option_add("magicmusician", A2BUS_MAGICMUSICIAN); /* Magic Musician Card */ } diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 5affbbf58a1..589942c6e39 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -155,6 +155,7 @@ Address bus A0-A11 is Y0-Y11 #include "bus/a2bus/ssbapple.h" #include "bus/a2bus/transwarp.h" #include "bus/a2bus/a2vulcan.h" +#include "bus/a2bus/4play.h" #include "bus/a2gameio/gameio.h" @@ -4431,6 +4432,7 @@ static void apple2_cards(device_slot_interface &device) device.option_add("ssbapple", A2BUS_SSBAPPLE); /* SSB Apple speech board */ device.option_add("twarp", A2BUS_TRANSWARP); /* AE TransWarp accelerator */ device.option_add("vulcan", A2BUS_VULCANIIE); /* Applied Engineering Vulcan IDE drive */ + device.option_add("4play", A2BUS_4PLAY); /* 4Play Joystick Card (Rev. B) */ } static void apple2eaux_cards(device_slot_interface &device) diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 86cd4da5be5..39cbc84219d 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -87,6 +87,7 @@ #include "bus/a2bus/mouse.h" #include "bus/a2bus/ezcgi.h" #include "bus/a2bus/a2vulcan.h" +#include "bus/a2bus/4play.h" //#include "bus/a2bus/pc_xporter.h" #include "bus/a2gameio/gameio.h" @@ -4510,6 +4511,7 @@ static void apple2_cards(device_slot_interface &device) device.option_add("ezcgi9958", A2BUS_EZCGI_9958); /* E-Z Color Graphics Interface (TMS9958) */ device.option_add("vulcan", A2BUS_VULCAN); /* Applied Engineering Vulcan IDE drive */ device.option_add("vulcangold", A2BUS_VULCANGOLD); /* Applied Engineering Vulcan Gold IDE drive */ + device.option_add("4play", A2BUS_4PLAY); /* 4Play Joystick Card (Rev. B) */ // device.option_add("magicmusician", A2BUS_MAGICMUSICIAN); /* Magic Musician Card */ // device.option_add("pcxport", A2BUS_PCXPORTER); /* Applied Engineering PC Transporter */ } -- cgit v1.2.3