diff options
author | 2019-05-13 19:12:11 +0200 | |
---|---|---|
committer | 2019-05-13 19:12:23 +0200 | |
commit | 582b9e279f2314b2c247290b23a6fb4c640576b6 (patch) | |
tree | 8104ae9f80db5eeafd6c5e35840d875d3e7b5c7c /src | |
parent | 88190884b6dd60e5b339c9787f994a426b1e4c21 (diff) |
c64: added mouse controller (nw)
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/bus/c64/fcc.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/vcs_ctrl/ctrl.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/vcs_ctrl/mouse.cpp | 100 | ||||
-rw-r--r-- | src/devices/bus/vcs_ctrl/mouse.h | 56 |
4 files changed, 160 insertions, 0 deletions
diff --git a/src/devices/bus/c64/fcc.cpp b/src/devices/bus/c64/fcc.cpp index cd9848cb26f..f454b647129 100644 --- a/src/devices/bus/c64/fcc.cpp +++ b/src/devices/bus/c64/fcc.cpp @@ -4,6 +4,8 @@ Tasc Final ChessCard cartridge emulation +It expects a mouse in port 2, and/or joystick in port 1. + The cartridge includes its own CPU (G65SC02P-4 @ 5MHz), making a relatively strong chess program possible on C64. It was also released for IBM PC, with an ISA card. diff --git a/src/devices/bus/vcs_ctrl/ctrl.cpp b/src/devices/bus/vcs_ctrl/ctrl.cpp index c4f735aacb6..57cdad8f4ba 100644 --- a/src/devices/bus/vcs_ctrl/ctrl.cpp +++ b/src/devices/bus/vcs_ctrl/ctrl.cpp @@ -71,6 +71,7 @@ void vcs_control_port_device::device_start() #include "joystick.h" #include "keypad.h" #include "lightpen.h" +#include "mouse.h" #include "paddles.h" #include "wheel.h" @@ -78,6 +79,7 @@ void vcs_control_port_devices(device_slot_interface &device) { device.option_add("joy", VCS_JOYSTICK); device.option_add("pad", VCS_PADDLES); + device.option_add("mouse", VCS_MOUSE); device.option_add("lp", VCS_LIGHTPEN); device.option_add("joybstr", VCS_JOYSTICK_BOOSTER); device.option_add("wheel", VCS_WHEEL); diff --git a/src/devices/bus/vcs_ctrl/mouse.cpp b/src/devices/bus/vcs_ctrl/mouse.cpp new file mode 100644 index 00000000000..76e1a6a8b38 --- /dev/null +++ b/src/devices/bus/vcs_ctrl/mouse.cpp @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, hap +/********************************************************************** + + Mouse emulation (Commodore 1351 or compatible) + +**********************************************************************/ + +#include "emu.h" +#include "mouse.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +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( 0xde, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("POTX") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) + + PORT_START("POTY") + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor vcs_mouse_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( vcs_mouse ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vcs_mouse_device - constructor +//------------------------------------------------- + +vcs_mouse_device::vcs_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, VCS_MOUSE, tag, owner, clock), + device_vcs_control_port_interface(mconfig, *this), + m_joy(*this, "JOY"), + m_potx(*this, "POTX"), + m_poty(*this, "POTY") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vcs_mouse_device::device_start() +{ +} + + +//------------------------------------------------- +// vcs_joy_r - joystick read +//------------------------------------------------- + +uint8_t vcs_mouse_device::vcs_joy_r() +{ + return m_joy->read(); +} + + +//------------------------------------------------- +// vcs_pot_x_r - potentiometer X read +//------------------------------------------------- + +uint8_t vcs_mouse_device::vcs_pot_x_r() +{ + return m_potx->read(); +} + + +//------------------------------------------------- +// vcs_pot_y_r - potentiometer Y read +//------------------------------------------------- + +uint8_t vcs_mouse_device::vcs_pot_y_r() +{ + return m_poty->read(); +} diff --git a/src/devices/bus/vcs_ctrl/mouse.h b/src/devices/bus/vcs_ctrl/mouse.h new file mode 100644 index 00000000000..eab33d64aab --- /dev/null +++ b/src/devices/bus/vcs_ctrl/mouse.h @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder, hap +/********************************************************************** + + Mouse emulation (Commodore 1351 or compatible) + +**********************************************************************/ + +#ifndef MAME_BUS_VCS_CTRL_MOUSE_H +#define MAME_BUS_VCS_CTRL_MOUSE_H + +#pragma once + +#include "ctrl.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> vcs_mouse_device + +class vcs_mouse_device : public device_t, + public device_vcs_control_port_interface +{ +public: + // construction/destruction + vcs_mouse_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +protected: + // device-level overrides + virtual void device_start() override; + + // device_vcs_control_port_interface overrides + virtual uint8_t vcs_joy_r() override; + virtual uint8_t vcs_pot_x_r() override; + virtual uint8_t vcs_pot_y_r() override; + + virtual bool has_pot_x() override { return true; } + virtual bool has_pot_y() override { return true; } + +private: + required_ioport m_joy; + required_ioport m_potx; + required_ioport m_poty; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(VCS_MOUSE, vcs_mouse_device) + +#endif // MAME_BUS_VCS_CTRL_MOUSE_H |