summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/vcsctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mess/machine/vcsctrl.c')
-rw-r--r--src/mess/machine/vcsctrl.c16
1 files changed, 9 insertions, 7 deletions
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 )