From 31ddd3a1aa4702cf83b387b597412d3261d4e4b9 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sat, 26 Jan 2013 18:53:13 +0000 Subject: (MESS) c64/c128: Implemented parallel joystick pot X/Y read. [Curt Coder] (MESS) vcsctrl: Removed runtime tag lookups. (nw) --- src/mess/machine/vcsctrl.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mess/machine/vcsctrl.c') diff --git a/src/mess/machine/vcsctrl.c b/src/mess/machine/vcsctrl.c index e550b6785d9..8b7158b0cde 100644 --- a/src/mess/machine/vcsctrl.c +++ b/src/mess/machine/vcsctrl.c @@ -53,8 +53,8 @@ device_vcs_control_port_interface::~device_vcs_control_port_interface() //------------------------------------------------- vcs_control_port_device::vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock), - device_slot_interface(mconfig, *this) + device_t(mconfig, VCS_CONTROL_PORT, "Atari VCS control port", tag, owner, clock), + device_slot_interface(mconfig, *this) { } @@ -78,15 +78,17 @@ void vcs_control_port_device::device_start() } -UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_joy_r(); return data; } +UINT8 vcs_control_port_device::joy_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_joy_r(); return data; } READ8_MEMBER( vcs_control_port_device::joy_r ) { return joy_r(); } -UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_x_r(); return data; } +UINT8 vcs_control_port_device::pot_x_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_x_r(); return data; } READ8_MEMBER( vcs_control_port_device::pot_x_r ) { return pot_x_r(); } -UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vcs_pot_y_r(); return data; } +UINT8 vcs_control_port_device::pot_y_r() { UINT8 data = 0xff; if (exists()) data = m_device->vcs_pot_y_r(); return data; } READ8_MEMBER( vcs_control_port_device::pot_y_r ) { return pot_y_r(); } -void vcs_control_port_device::joy_w( UINT8 data ) { if ( m_device != NULL ) m_device->vcs_joy_w( data ); } +void vcs_control_port_device::joy_w( UINT8 data ) { if ( exists() ) m_device->vcs_joy_w( data ); } WRITE8_MEMBER( vcs_control_port_device::joy_w ) { joy_w(data); } - +bool vcs_control_port_device::exists() { return m_device != NULL; } +bool vcs_control_port_device::has_pot_x() { return exists() && m_device->has_pot_x(); } +bool vcs_control_port_device::has_pot_y() { return exists() && m_device->has_pot_y(); } //------------------------------------------------- // SLOT_INTERFACE( vcs_control_port_devices ) -- cgit v1.2.3-70-g09d2