diff options
Diffstat (limited to 'src/devices/bus/vcs_ctrl/ctrl.h')
-rw-r--r-- | src/devices/bus/vcs_ctrl/ctrl.h | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/devices/bus/vcs_ctrl/ctrl.h b/src/devices/bus/vcs_ctrl/ctrl.h index 574a7dc3ae8..b1ca5fde075 100644 --- a/src/devices/bus/vcs_ctrl/ctrl.h +++ b/src/devices/bus/vcs_ctrl/ctrl.h @@ -9,8 +9,8 @@ **********************************************************************/ -#ifndef MAME_BUS_CVS_CTRL_CTRL_H -#define MAME_BUS_CVS_CTRL_CTRL_H +#ifndef MAME_BUS_VCS_CTRL_CTRL_H +#define MAME_BUS_VCS_CTRL_CTRL_H #pragma once @@ -24,22 +24,25 @@ class vcs_control_port_device; // ======================> device_vcs_control_port_interface -class device_vcs_control_port_interface : public device_slot_card_interface +class device_vcs_control_port_interface : public device_interface { public: - // construction/destruction - device_vcs_control_port_interface(const machine_config &mconfig, device_t &device); virtual ~device_vcs_control_port_interface() { } - virtual uint8_t vcs_joy_r() { return 0xff; }; - virtual uint8_t vcs_pot_x_r() { return 0xff; }; - virtual uint8_t vcs_pot_y_r() { return 0xff; }; - virtual void vcs_joy_w(uint8_t data) { }; + virtual uint8_t vcs_joy_r() { return 0xff; } + virtual uint8_t vcs_pot_x_r() { return 0xff; } + virtual uint8_t vcs_pot_y_r() { return 0xff; } + virtual void vcs_joy_w(uint8_t data) { } virtual bool has_pot_x() { return false; } virtual bool has_pot_y() { return false; } + // FIXME: should be made protected when port definitions become member functions + inline void trigger_w(int state); + protected: + device_vcs_control_port_interface(const machine_config &mconfig, device_t &device); + vcs_control_port_device *m_port; }; @@ -72,18 +75,15 @@ public: // bit 1 - pin 2 - Down // bit 2 - pin 3 - Left // bit 3 - pin 4 - Right - // bit 4 - pin 5 - + // pin 5 - Pot X // bit 5 - pin 6 - Button // pin 7 - +5V // pin 8 - GND - // bit 6 - pin 9 - + // pin 9 - Pot Y // uint8_t read_joy() { return exists() ? m_device->vcs_joy_r() : 0xff; } - DECLARE_READ8_MEMBER( joy_r ) { return read_joy(); } uint8_t read_pot_x() { return exists() ? m_device->vcs_pot_x_r() : 0xff; } - DECLARE_READ8_MEMBER( pot_x_r ) { return read_pot_x(); } uint8_t read_pot_y() { return exists() ? m_device->vcs_pot_y_r() : 0xff; } - DECLARE_READ8_MEMBER( pot_y_r ) { return read_pot_y(); } void joy_w(uint8_t data) { if (exists()) m_device->vcs_joy_w(data); } @@ -95,7 +95,7 @@ public: protected: // device-level overrides - virtual void device_start() override; + virtual void device_start() override ATTR_COLD; device_vcs_control_port_interface *m_device; @@ -103,10 +103,16 @@ private: devcb_write_line m_write_trigger; }; +inline void device_vcs_control_port_interface::trigger_w(int state) +{ + m_port->trigger_w(state); +} + // device type definition DECLARE_DEVICE_TYPE(VCS_CONTROL_PORT, vcs_control_port_device) void vcs_control_port_devices(device_slot_interface &device); +void a800_control_port_devices(device_slot_interface &device); -#endif // MAME_BUS_CVS_CTRL_CTRL_H +#endif // MAME_BUS_VCS_CTRL_CTRL_H |