mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
a2bus: Add support for Wico Trackball, Wico Command Control Joystick Adapter, and 4 paddles connected to the Sirius JoyPort to the Apple ][/][+ (#12666)
This commit is contained in:
parent
bf2e3484a4
commit
b989286652
@ -3027,6 +3027,8 @@ if (BUSES["A2BUS"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2videoterm.h",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2vulcan.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2vulcan.h",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2wico_trackball.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2wico_trackball.h",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2zipdrive.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/a2zipdrive.h",
|
||||
MAME_DIR .. "src/devices/bus/a2bus/ace2x00.cpp",
|
||||
@ -3129,10 +3131,14 @@ if (BUSES["A2GAMEIO"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/joystick.h",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/joyport.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/joyport.h",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/joyport_paddles.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/joyport_paddles.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",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/wico_joystick.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/wico_joystick.h",
|
||||
}
|
||||
end
|
||||
|
||||
|
248
src/devices/bus/a2bus/a2wico_trackball.cpp
Normal file
248
src/devices/bus/a2bus/a2wico_trackball.cpp
Normal file
@ -0,0 +1,248 @@
|
||||
// license:BSD-3-Clause
|
||||
/*********************************************************************
|
||||
|
||||
a2wicotrackball.cpp
|
||||
|
||||
Implemention of the Wico Trackball
|
||||
|
||||
Wico Trackball Interface PCB
|
||||
Wico 1983
|
||||
|
||||
This is a trackball interface for the Apple II
|
||||
|
||||
For API information, see:
|
||||
Track Balls, Bill Morgan, Apple Assembly Line, Vol. 3, Iss. 9, June 1983
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "a2wico_trackball.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class a2bus_wicotrackball_device:
|
||||
public device_t,
|
||||
public device_a2bus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a2bus_wicotrackball_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
protected:
|
||||
a2bus_wicotrackball_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// overrides of standard a2bus slot functions
|
||||
virtual uint8_t read_c0nx(uint8_t offset) override;
|
||||
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
|
||||
|
||||
required_ioport m_wicotrackballb;
|
||||
required_ioport_array<2> m_wicotrackballxy;
|
||||
|
||||
private:
|
||||
bool m_speed[2];
|
||||
uint8_t m_buttons;
|
||||
bool m_wraparound;
|
||||
uint8_t m_axis[2];
|
||||
uint32_t m_last_pos[2];
|
||||
uint8_t read_position(int axis);
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
#define WICOTRACKBALL_BUTTONS_TAG "a2wicotrackball_buttons"
|
||||
#define WICOTRACKBALL_XAXIS_TAG "a2wicotrackball_x"
|
||||
#define WICOTRACKBALL_YAXIS_TAG "a2wicotrackball_y"
|
||||
|
||||
#define WICOTRACKBALL_POS_UNINIT 0xffffffff /* default out-of-range position */
|
||||
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(A2BUS_WICOTRACKBALL, device_a2bus_card_interface, a2bus_wicotrackball_device, "a2wicotrackball", "Apple II Wico Trackball Card")
|
||||
|
||||
static INPUT_PORTS_START( wicotrackball )
|
||||
PORT_START(WICOTRACKBALL_BUTTONS_TAG) /* Trackball - buttons */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Trackball Button 1") PORT_CODE(MOUSECODE_BUTTON1)
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Trackball Button 2") PORT_CODE(MOUSECODE_BUTTON2)
|
||||
|
||||
PORT_START(WICOTRACKBALL_XAXIS_TAG) /* Trackball - X AXIS */
|
||||
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)
|
||||
|
||||
PORT_START(WICOTRACKBALL_YAXIS_TAG) /* Trackball - Y AXIS */
|
||||
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
input_ports - device-specific input ports
|
||||
-------------------------------------------------*/
|
||||
|
||||
ioport_constructor a2bus_wicotrackball_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(wicotrackball);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_add_mconfig - device-specific
|
||||
machine configurations
|
||||
-------------------------------------------------*/
|
||||
|
||||
void a2bus_wicotrackball_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
LIVE DEVICE
|
||||
***************************************************************************/
|
||||
|
||||
a2bus_wicotrackball_device::a2bus_wicotrackball_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_wicotrackballb(*this, WICOTRACKBALL_BUTTONS_TAG), m_wicotrackballxy(*this, { WICOTRACKBALL_XAXIS_TAG, WICOTRACKBALL_YAXIS_TAG }),
|
||||
m_speed{ false, false }, m_buttons{ 0 }, m_wraparound{false}, m_axis{ 0, 0 },
|
||||
m_last_pos{ WICOTRACKBALL_POS_UNINIT, WICOTRACKBALL_POS_UNINIT }
|
||||
{
|
||||
}
|
||||
|
||||
a2bus_wicotrackball_device::a2bus_wicotrackball_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
a2bus_wicotrackball_device(mconfig, A2BUS_WICOTRACKBALL, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_start - device-specific startup
|
||||
-------------------------------------------------*/
|
||||
|
||||
void a2bus_wicotrackball_device::device_start()
|
||||
{
|
||||
// register save state variables
|
||||
save_item(NAME(m_speed));
|
||||
save_item(NAME(m_wraparound));
|
||||
save_item(NAME(m_buttons));
|
||||
save_item(NAME(m_axis));
|
||||
save_item(NAME(m_last_pos));
|
||||
}
|
||||
|
||||
void a2bus_wicotrackball_device::device_reset()
|
||||
{
|
||||
m_speed[0] = m_speed[1] = false;
|
||||
m_wraparound = false;
|
||||
m_buttons = 0;
|
||||
m_axis[0] = m_axis[1] = 0;
|
||||
}
|
||||
|
||||
uint8_t a2bus_wicotrackball_device::read_position(int axis)
|
||||
{
|
||||
int speed_scale = (1 << m_speed[0]) << (m_speed[1] * 2);
|
||||
uint8_t temp_axis = 0;
|
||||
int diff_pos = 0;
|
||||
int cur_pos = m_wicotrackballxy[axis]->read();
|
||||
|
||||
if (m_last_pos[axis] == WICOTRACKBALL_POS_UNINIT) {
|
||||
m_last_pos[axis] = cur_pos;
|
||||
}
|
||||
diff_pos = cur_pos - m_last_pos[axis];
|
||||
// wrap-around the positoin
|
||||
if (diff_pos > 0x7f) {
|
||||
diff_pos -= 0x100;
|
||||
} else if (diff_pos < -0x80) {
|
||||
diff_pos += 0x100;
|
||||
}
|
||||
|
||||
if (m_wraparound) {
|
||||
temp_axis = m_axis[axis] + diff_pos / speed_scale;;
|
||||
} else {
|
||||
if ((m_axis[axis] + diff_pos / speed_scale) < 0) {
|
||||
temp_axis = 0;
|
||||
} else if ((m_axis[axis] + diff_pos / speed_scale) > 0xff) {
|
||||
temp_axis = 0xff;
|
||||
} else {
|
||||
temp_axis = m_axis[axis] + diff_pos / speed_scale;
|
||||
}
|
||||
}
|
||||
m_last_pos[axis] = cur_pos;
|
||||
m_axis[axis] = temp_axis;
|
||||
|
||||
return m_axis[axis];
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
read_c0nx - called for reads from this card's c0nx space
|
||||
-------------------------------------------------*/
|
||||
|
||||
uint8_t a2bus_wicotrackball_device::read_c0nx(uint8_t offset)
|
||||
{
|
||||
uint8_t data = 0;
|
||||
|
||||
switch (offset) {
|
||||
case 0x0: /* read X-position */
|
||||
data = read_position(0);
|
||||
break;
|
||||
case 0x1: /* read Y-position */
|
||||
data = read_position(1);
|
||||
break;
|
||||
case 0x2: /* set Bounded/Wraparound Soft Switch to Bounded */
|
||||
m_wraparound = false;
|
||||
break;
|
||||
case 0x3: /* set Bounded/Wraparound Soft Switch to Wraparound */
|
||||
m_wraparound = true;
|
||||
break;
|
||||
case 0x6: /* read buttons */
|
||||
data = m_buttons = m_wicotrackballb->read();
|
||||
break;
|
||||
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
write_c0nx - called for writes to this card's c0nx space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void a2bus_wicotrackball_device::write_c0nx(uint8_t offset, uint8_t data)
|
||||
{
|
||||
switch (offset) {
|
||||
case 0x0: /* set X-position */
|
||||
m_last_pos[0] = m_wicotrackballxy[0]->read();
|
||||
m_axis[0] = data;
|
||||
break;
|
||||
case 0x1: /* set Y-position */
|
||||
m_last_pos[1] = m_wicotrackballxy[1]->read();
|
||||
m_axis[1] = data;
|
||||
break;
|
||||
case 0x2: /* set Bounded/Wraparound Soft Switch to Bounded */
|
||||
m_wraparound = false;
|
||||
break;
|
||||
case 0x3: /* set Bounded/Wraparound Soft Switch to Wraparound */
|
||||
m_wraparound = true;
|
||||
break;
|
||||
case 0x4: /* set Speed 1/2 Soft Switch to Speed 1 */
|
||||
m_speed[0] = false;
|
||||
break;
|
||||
case 0x5: /* set Speed 1/2 Soft Switch to Speed 2 */
|
||||
m_speed[0] = true;
|
||||
break;
|
||||
case 0x6: /* set Speed 3/4 Soft Switch to Speed 3 */
|
||||
m_speed[1] = false;
|
||||
break;
|
||||
case 0x7: /* set Speed 3/4 Soft Switch to Speed 4 */
|
||||
m_speed[1] = true;
|
||||
break;
|
||||
}
|
||||
}
|
20
src/devices/bus/a2bus/a2wico_trackball.h
Normal file
20
src/devices/bus/a2bus/a2wico_trackball.h
Normal file
@ -0,0 +1,20 @@
|
||||
// license:BSD-3-Clause
|
||||
/*********************************************************************
|
||||
|
||||
a2wicotrackball.h
|
||||
|
||||
Implemention of the Wico Apple II Trackball
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef MAME_DEVICES_A2BUS_A2WICO_TRACKBALL_H
|
||||
#define MAME_DEVICES_A2BUS_A2WICO_TRACKBALL_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "a2bus.h"
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(A2BUS_WICOTRACKBALL, device_a2bus_card_interface)
|
||||
|
||||
#endif // MAME_DEVICES_A2BUS_A2WICO_TRACKBALL_H
|
@ -73,6 +73,7 @@
|
||||
#include "uniprint.h"
|
||||
#include "uthernet.h"
|
||||
#include "vistaa800.h"
|
||||
#include "a2wico_trackball.h"
|
||||
|
||||
|
||||
void apple2_slot0_cards(device_slot_interface &device)
|
||||
@ -153,6 +154,7 @@ void apple2_cards(device_slot_interface &device)
|
||||
device.option_add("grafex", A2BUS_GRAFEX); // Grafex card (uPD7220 graphics)
|
||||
device.option_add("excel9", A2BUS_EXCEL9); // Excel-9 (6809 coprocessor)
|
||||
device.option_add("vistaa800", A2BUS_VISTAA800); // Vista A800 8" Disk Controller Card
|
||||
device.option_add("wicotrackball", A2BUS_WICOTRACKBALL); // Wico Trackball
|
||||
}
|
||||
|
||||
void apple2e_cards(device_slot_interface &device)
|
||||
@ -234,6 +236,7 @@ void apple2e_cards(device_slot_interface &device)
|
||||
device.option_add("pdromdrive", A2BUS_PRODOSROMDRIVE); // ProDOS ROM Drive
|
||||
device.option_add("superdrive", A2BUS_SUPERDRIVE); // Apple II 3.5" Disk Controller
|
||||
device.option_add("vistaa800", A2BUS_VISTAA800); // Vista A800 8" Disk Controller Card
|
||||
device.option_add("wicotrackball", A2BUS_WICOTRACKBALL); // Wico Trackball
|
||||
}
|
||||
|
||||
void apple2gs_cards(device_slot_interface &device)
|
||||
@ -309,6 +312,7 @@ void apple2gs_cards(device_slot_interface &device)
|
||||
device.option_add("grafex", A2BUS_GRAFEX); // Grafex card (uPD7220 graphics)
|
||||
device.option_add("pdromdrive", A2BUS_PRODOSROMDRIVE); // ProDOS ROM Drive
|
||||
device.option_add("superdrive", A2BUS_SUPERDRIVE); // Apple II 3.5" Disk Controller
|
||||
device.option_add("wicotrackball", A2BUS_WICOTRACKBALL); // Wico Trackball
|
||||
}
|
||||
|
||||
void apple3_cards(device_slot_interface &device)
|
||||
|
@ -52,9 +52,11 @@
|
||||
#include "bus/a2gameio/gameio.h"
|
||||
#include "bus/a2gameio/joystick.h"
|
||||
#include "bus/a2gameio/joyport.h"
|
||||
#include "bus/a2gameio/joyport_paddles.h"
|
||||
#include "bus/a2gameio/computereyes.h"
|
||||
#include "bus/a2gameio/paddles.h"
|
||||
#include "bus/a2gameio/gizmo.h"
|
||||
#include "bus/a2gameio/wico_joystick.h"
|
||||
|
||||
//**************************************************************************
|
||||
// CONNECTOR DEVICE IMPLEMENTATION
|
||||
@ -76,8 +78,10 @@ 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("joyport_paddles", APPLE2_JOYPORT_PADDLES);
|
||||
slot.option_add("gizmo", APPLE2_GIZMO);
|
||||
slot.option_add("compeyes", APPLE2_COMPUTEREYES);
|
||||
slot.option_add("wicojoy", APPLE2_WICO_JOYSTICK);
|
||||
}
|
||||
|
||||
void apple2_gameio_device::default_options(device_slot_interface &slot)
|
||||
|
133
src/devices/bus/a2gameio/joyport_paddles.cpp
Normal file
133
src/devices/bus/a2gameio/joyport_paddles.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Sirius JoyPort with 4 Apple II paddles connected
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "bus/a2gameio/joyport_paddles.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// ======================> apple2_joyport_paddles_device
|
||||
|
||||
class apple2_joyport_paddles_device : public device_t, public device_a2gameio_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
apple2_joyport_paddles_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 u8 pdl0_r() override;
|
||||
virtual u8 pdl1_r() override;
|
||||
virtual u8 pdl2_r() override;
|
||||
virtual u8 pdl3_r() override;
|
||||
virtual int sw0_r() override;
|
||||
virtual int sw1_r() override;
|
||||
virtual void an0_w(int state) override;
|
||||
|
||||
private:
|
||||
// input ports
|
||||
required_ioport_array<4> m_pdl;
|
||||
required_ioport m_buttons;
|
||||
int m_an0;
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
// INPUT PORTS
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( apple2_joyport_paddles )
|
||||
PORT_START("paddle_1")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
|
||||
|
||||
PORT_START("paddle_2")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(2) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
|
||||
|
||||
PORT_START("paddle_3")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(3) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
|
||||
|
||||
PORT_START("paddle_4")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(4) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255)
|
||||
|
||||
PORT_START("paddle_buttons")
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4)
|
||||
INPUT_PORTS_END
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
apple2_joyport_paddles_device::apple2_joyport_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, APPLE2_JOYPORT_PADDLES, tag, owner, clock)
|
||||
, device_a2gameio_interface(mconfig, *this)
|
||||
, m_pdl(*this, "paddle_%u", 1U)
|
||||
, m_buttons(*this, "paddle_buttons")
|
||||
{
|
||||
}
|
||||
|
||||
ioport_constructor apple2_joyport_paddles_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(apple2_joyport_paddles);
|
||||
}
|
||||
|
||||
void apple2_joyport_paddles_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_an0));
|
||||
}
|
||||
|
||||
u8 apple2_joyport_paddles_device::pdl0_r()
|
||||
{
|
||||
return m_pdl[0]->read();
|
||||
}
|
||||
|
||||
u8 apple2_joyport_paddles_device::pdl1_r()
|
||||
{
|
||||
return m_pdl[1]->read();
|
||||
}
|
||||
|
||||
u8 apple2_joyport_paddles_device::pdl2_r()
|
||||
{
|
||||
return m_pdl[2]->read();
|
||||
}
|
||||
|
||||
u8 apple2_joyport_paddles_device::pdl3_r()
|
||||
{
|
||||
return m_pdl[3]->read();
|
||||
}
|
||||
|
||||
int apple2_joyport_paddles_device::sw0_r()
|
||||
{
|
||||
return m_an0 ? BIT(m_buttons->read(), 6) : BIT(m_buttons->read(), 4);
|
||||
}
|
||||
|
||||
int apple2_joyport_paddles_device::sw1_r()
|
||||
{
|
||||
return m_an0 ? BIT(m_buttons->read(), 7) : BIT(m_buttons->read(), 5);
|
||||
}
|
||||
|
||||
void apple2_joyport_paddles_device::an0_w(int state)
|
||||
{
|
||||
m_an0 = state;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(APPLE2_JOYPORT_PADDLES, device_a2gameio_interface, apple2_joyport_paddles_device, "a2joyprtpdls", "Sirius JoyPort with Apple II paddles")
|
19
src/devices/bus/a2gameio/joyport_paddles.h
Normal file
19
src/devices/bus/a2gameio/joyport_paddles.h
Normal file
@ -0,0 +1,19 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Sirius JoyPort with 4 Apple II paddles connected
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_A2GAMEIO_JOYPORT_PADDLES_H
|
||||
#define MAME_BUS_A2GAMEIO_JOYPORT_PADDLES_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/a2gameio/gameio.h"
|
||||
|
||||
// device type declaration
|
||||
DECLARE_DEVICE_TYPE(APPLE2_JOYPORT_PADDLES, device_a2gameio_interface)
|
||||
|
||||
#endif // MAME_BUS_A2GAMEIO_JOYPORT_PADDLES_H
|
128
src/devices/bus/a2gameio/wico_joystick.cpp
Normal file
128
src/devices/bus/a2gameio/wico_joystick.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Apple II Wico Command Control Joystick Adapter for Atari-style
|
||||
digital joysticks
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "bus/a2gameio/wico_joystick.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// ======================> apple2_wico_joystick_device
|
||||
|
||||
class apple2_wico_joystick_device : public device_t, public device_a2gameio_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
apple2_wico_joystick_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 u8 pdl0_r() override;
|
||||
virtual u8 pdl1_r() override;
|
||||
virtual u8 pdl2_r() override;
|
||||
virtual u8 pdl3_r() override;
|
||||
virtual int sw0_r() override;
|
||||
virtual int sw1_r() override;
|
||||
|
||||
private:
|
||||
// input ports
|
||||
required_ioport m_player1, m_player2;
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
// PARAMETERS
|
||||
//**************************************************************************
|
||||
|
||||
#define JOYSTICK_DELTA 80
|
||||
#define JOYSTICK_SENSITIVITY 50
|
||||
#define JOYSTICK_AUTOCENTER 80
|
||||
|
||||
//**************************************************************************
|
||||
// INPUT PORTS
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( apple2_wico_joystick )
|
||||
PORT_START("joystick_p1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
|
||||
|
||||
PORT_START("joystick_p2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
|
||||
INPUT_PORTS_END
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
apple2_wico_joystick_device::apple2_wico_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, APPLE2_WICO_JOYSTICK, tag, owner, clock)
|
||||
, device_a2gameio_interface(mconfig, *this)
|
||||
, m_player1(*this, "joystick_p1")
|
||||
, m_player2(*this, "joystick_p2")
|
||||
{
|
||||
}
|
||||
|
||||
ioport_constructor apple2_wico_joystick_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(apple2_wico_joystick);
|
||||
}
|
||||
|
||||
void apple2_wico_joystick_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
u8 apple2_wico_joystick_device::pdl0_r()
|
||||
{
|
||||
return !BIT(m_player1->read(), 3) ? 0x00 : !BIT(m_player1->read(), 1) ? 0xff : 0x80;
|
||||
}
|
||||
|
||||
u8 apple2_wico_joystick_device::pdl1_r()
|
||||
{
|
||||
return !BIT(m_player1->read(), 0) ? 0x00 : !BIT(m_player1->read(), 2) ? 0xff : 0x80;
|
||||
}
|
||||
|
||||
u8 apple2_wico_joystick_device::pdl2_r()
|
||||
{
|
||||
return !BIT(m_player2->read(), 3) ? 0x00 : !BIT(m_player2->read(), 1) ? 0xff : 0x80;
|
||||
}
|
||||
|
||||
u8 apple2_wico_joystick_device::pdl3_r()
|
||||
{
|
||||
return !BIT(m_player2->read(), 0) ? 0x00 : !BIT(m_player2->read(), 2) ? 0xff : 0x80;
|
||||
}
|
||||
|
||||
int apple2_wico_joystick_device::sw0_r()
|
||||
{
|
||||
return !BIT(m_player1->read(), 4);
|
||||
}
|
||||
|
||||
int apple2_wico_joystick_device::sw1_r()
|
||||
{
|
||||
return !BIT(m_player2->read(), 4);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(APPLE2_WICO_JOYSTICK, device_a2gameio_interface, apple2_wico_joystick_device, "a2wicojoy", "Wico Command Control Joystick Adapter")
|
20
src/devices/bus/a2gameio/wico_joystick.h
Normal file
20
src/devices/bus/a2gameio/wico_joystick.h
Normal file
@ -0,0 +1,20 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Apple II Wico Command Control Joystick Adapter for Atari-style
|
||||
digital joysticks
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_A2GAMEIO_WICO_JOYSTICK_H
|
||||
#define MAME_BUS_A2GAMEIO_WICO_JOYSTICK_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/a2gameio/gameio.h"
|
||||
|
||||
// device type declaration
|
||||
DECLARE_DEVICE_TYPE(APPLE2_WICO_JOYSTICK, device_a2gameio_interface)
|
||||
|
||||
#endif // MAME_BUS_A2GAMEIO_WICO_JOYSTICK_H
|
Loading…
Reference in New Issue
Block a user