1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 /**********************************************************************
4
5 Atari Video Computer System digital joystick emulation
6
7 **********************************************************************/
8
9 #include "emu.h"
10 #include "joystick.h"
11
12
13
14 //**************************************************************************
15 // DEVICE DEFINITIONS
16 //**************************************************************************
17
18 DEFINE_DEVICE_TYPE(VCS_JOYSTICK, vcs_joystick_device, "vcs_joystick", "Atari / CBM Digital joystick")
19
20
INPUT_PORTS_START(vcs_joystick)21 static INPUT_PORTS_START( vcs_joystick )
22 PORT_START("JOY")
23 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
27 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
28 PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED )
29 INPUT_PORTS_END
30
31
32 //-------------------------------------------------
33 // input_ports - device-specific input ports
34 //-------------------------------------------------
35
36 ioport_constructor vcs_joystick_device::device_input_ports() const
37 {
38 return INPUT_PORTS_NAME( vcs_joystick );
39 }
40
41
42
43 //**************************************************************************
44 // LIVE DEVICE
45 //**************************************************************************
46
47 //-------------------------------------------------
48 // vcs_joystick_device - constructor
49 //-------------------------------------------------
50
vcs_joystick_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)51 vcs_joystick_device::vcs_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
52 device_t(mconfig, VCS_JOYSTICK, tag, owner, clock),
53 device_vcs_control_port_interface(mconfig, *this),
54 m_joy(*this, "JOY")
55 {
56 }
57
58
59 //-------------------------------------------------
60 // device_start - device-specific startup
61 //-------------------------------------------------
62
device_start()63 void vcs_joystick_device::device_start()
64 {
65 }
66
67
68 //-------------------------------------------------
69 // vcs_joy_r - joystick read
70 //-------------------------------------------------
71
vcs_joy_r()72 uint8_t vcs_joystick_device::vcs_joy_r()
73 {
74 return m_joy->read();
75 }
76