From 6c5326a0578f73e53e8875b3fb544b1ab4da8b87 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 18 Oct 2022 17:31:03 -0400 Subject: [PATCH] vcs_ctrl: Some fixes - Hook up trigger pin writes for currently unused callback - Invert analog ports for paddle controller --- src/devices/bus/vcs_ctrl/ctrl.h | 12 ++++++++++-- src/devices/bus/vcs_ctrl/joybooster.cpp | 2 +- src/devices/bus/vcs_ctrl/joystick.cpp | 2 +- src/devices/bus/vcs_ctrl/mouse.cpp | 2 +- src/devices/bus/vcs_ctrl/paddles.cpp | 8 ++++---- src/devices/bus/vcs_ctrl/wheel.cpp | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/devices/bus/vcs_ctrl/ctrl.h b/src/devices/bus/vcs_ctrl/ctrl.h index 25ac788e389..8047972fb68 100644 --- a/src/devices/bus/vcs_ctrl/ctrl.h +++ b/src/devices/bus/vcs_ctrl/ctrl.h @@ -37,6 +37,9 @@ public: 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); @@ -72,11 +75,11 @@ 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; } uint8_t read_pot_x() { return exists() ? m_device->vcs_pot_x_r() : 0xff; } @@ -100,6 +103,11 @@ 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) diff --git a/src/devices/bus/vcs_ctrl/joybooster.cpp b/src/devices/bus/vcs_ctrl/joybooster.cpp index 9ea3b813ac1..933928a0dd0 100644 --- a/src/devices/bus/vcs_ctrl/joybooster.cpp +++ b/src/devices/bus/vcs_ctrl/joybooster.cpp @@ -25,7 +25,7 @@ static INPUT_PORTS_START( vcs_joystick_booster ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY // Pin 2 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY // Pin 3 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY // Pin 4 - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // Pin 6 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_WRITE_LINE_MEMBER(vcs_joystick_booster_device, trigger_w) // Pin 6 PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED ) // Pin 5 diff --git a/src/devices/bus/vcs_ctrl/joystick.cpp b/src/devices/bus/vcs_ctrl/joystick.cpp index c911f435a0c..e68ec423d67 100644 --- a/src/devices/bus/vcs_ctrl/joystick.cpp +++ b/src/devices/bus/vcs_ctrl/joystick.cpp @@ -24,7 +24,7 @@ static INPUT_PORTS_START( vcs_joystick ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_WRITE_LINE_MEMBER(vcs_joystick_device, trigger_w) PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END diff --git a/src/devices/bus/vcs_ctrl/mouse.cpp b/src/devices/bus/vcs_ctrl/mouse.cpp index 611ae081da4..c1087bb32c1 100644 --- a/src/devices/bus/vcs_ctrl/mouse.cpp +++ b/src/devices/bus/vcs_ctrl/mouse.cpp @@ -28,7 +28,7 @@ DEFINE_DEVICE_TYPE(VCS_MOUSE, vcs_mouse_device, "vcs_mouse", "Atari / CBM Mouse" static INPUT_PORTS_START( vcs_mouse ) PORT_START("JOY") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_WRITE_LINE_MEMBER(vcs_mouse_device, trigger_w) PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("POTX") diff --git a/src/devices/bus/vcs_ctrl/paddles.cpp b/src/devices/bus/vcs_ctrl/paddles.cpp index 46084663356..aa60186b7df 100644 --- a/src/devices/bus/vcs_ctrl/paddles.cpp +++ b/src/devices/bus/vcs_ctrl/paddles.cpp @@ -20,15 +20,15 @@ DEFINE_DEVICE_TYPE(VCS_PADDLES, vcs_paddles_device, "vcs_paddles", "Atari / CBM static INPUT_PORTS_START( vcs_paddles ) PORT_START("JOY") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // pin 3 + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // pin 4 PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("POTX") - PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) + PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE // pin 5 PORT_START("POTY") - PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(2) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) + PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(2) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE // pin 9 INPUT_PORTS_END diff --git a/src/devices/bus/vcs_ctrl/wheel.cpp b/src/devices/bus/vcs_ctrl/wheel.cpp index 871835d89dd..57c5c9863ed 100644 --- a/src/devices/bus/vcs_ctrl/wheel.cpp +++ b/src/devices/bus/vcs_ctrl/wheel.cpp @@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(VCS_WHEEL, vcs_wheel_device, "vcs_wheel", "Atari / CBM Drivin static INPUT_PORTS_START( vcs_wheel ) PORT_START("JOY") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // Pin 6 + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_WRITE_LINE_MEMBER(vcs_wheel_device, trigger_w) // Pin 6 PORT_BIT( 0xdc, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("WHEEL")