mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
apple2: add support for paddles [R. Belmont]
This commit is contained in:
parent
cdac74dd3a
commit
24eb8d5d07
4 changed files with 155 additions and 0 deletions
|
@ -2285,6 +2285,8 @@ 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/paddles.cpp",
|
||||
MAME_DIR .. "src/devices/bus/a2gameio/paddles.h",
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "bus/a2gameio/joystick.h"
|
||||
#include "bus/a2gameio/joyport.h"
|
||||
#include "bus/a2gameio/computereyes.h"
|
||||
#include "bus/a2gameio/paddles.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -71,6 +72,7 @@ apple2_gameio_device::apple2_gameio_device(const machine_config &mconfig, const
|
|||
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("compeyes", APPLE2_COMPUTEREYES);
|
||||
}
|
||||
|
@ -78,6 +80,7 @@ void apple2_gameio_device::iiandplus_options(device_slot_interface &slot)
|
|||
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("compeyes", APPLE2_COMPUTEREYES);
|
||||
}
|
||||
|
||||
|
|
102
src/devices/bus/a2gameio/paddles.cpp
Executable file
102
src/devices/bus/a2gameio/paddles.cpp
Executable file
|
@ -0,0 +1,102 @@
|
|||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Apple II paddles
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "bus/a2gameio/paddles.h"
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE(APPLE2_PADDLES, apple2_paddles_device, "a2pdls", "Apple II paddles")
|
||||
|
||||
//**************************************************************************
|
||||
// INPUT PORTS
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( apple2_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_paddles_device::apple2_paddles_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, APPLE2_PADDLES, tag, owner, clock)
|
||||
, device_a2gameio_interface(mconfig, *this)
|
||||
, m_pdl(*this, "paddle_%u", 1U)
|
||||
, m_buttons(*this, "paddle_buttons")
|
||||
{
|
||||
}
|
||||
|
||||
ioport_constructor apple2_paddles_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(apple2_paddles);
|
||||
}
|
||||
|
||||
void apple2_paddles_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
u8 apple2_paddles_device::pdl0_r()
|
||||
{
|
||||
return m_pdl[0]->read();
|
||||
}
|
||||
|
||||
u8 apple2_paddles_device::pdl1_r()
|
||||
{
|
||||
return m_pdl[1]->read();
|
||||
}
|
||||
|
||||
u8 apple2_paddles_device::pdl2_r()
|
||||
{
|
||||
return m_pdl[2]->read();
|
||||
}
|
||||
|
||||
u8 apple2_paddles_device::pdl3_r()
|
||||
{
|
||||
return m_pdl[3]->read();
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(apple2_paddles_device::sw0_r)
|
||||
{
|
||||
return BIT(m_buttons->read(), 4);
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(apple2_paddles_device::sw1_r)
|
||||
{
|
||||
return BIT(m_buttons->read(), 5);
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(apple2_paddles_device::sw2_r)
|
||||
{
|
||||
return BIT(m_buttons->read(), 6);
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(apple2_paddles_device::sw3_r)
|
||||
{
|
||||
return BIT(m_buttons->read(), 7);
|
||||
}
|
48
src/devices/bus/a2gameio/paddles.h
Executable file
48
src/devices/bus/a2gameio/paddles.h
Executable file
|
@ -0,0 +1,48 @@
|
|||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/*********************************************************************
|
||||
|
||||
Apple II paddles
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_A2GAMEIO_PADDLES_H
|
||||
#define MAME_BUS_A2GAMEIO_PADDLES_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/a2gameio/gameio.h"
|
||||
|
||||
// ======================> apple2_paddles_device
|
||||
|
||||
class apple2_paddles_device : public device_t, public device_a2gameio_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
apple2_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 DECLARE_READ_LINE_MEMBER(sw0_r) override;
|
||||
virtual DECLARE_READ_LINE_MEMBER(sw1_r) override;
|
||||
virtual DECLARE_READ_LINE_MEMBER(sw2_r) override;
|
||||
virtual DECLARE_READ_LINE_MEMBER(sw3_r) override;
|
||||
|
||||
private:
|
||||
// input ports
|
||||
required_ioport_array<4> m_pdl;
|
||||
required_ioport m_buttons;
|
||||
};
|
||||
|
||||
// device type declaration
|
||||
DECLARE_DEVICE_TYPE(APPLE2_PADDLES, apple2_paddles_device)
|
||||
|
||||
#endif // MAME_BUS_A2GAMEIO_PADDLES_H
|
Loading…
Reference in a new issue