summaryrefslogtreecommitdiffstats
path: root/src/devices/bus/astrocde/joy.cpp
blob: cbf75da0c5ccfaa675c532f85e66b6fc215bc362 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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 );
}