From 17b9672b1fc15ac2c82e141a29d4357e16e4d7df Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 26 Nov 2022 18:49:19 +1100 Subject: bus/msx/ctrl: Added Micomsoft Libble Rabble Joypad. --- scripts/src/bus.lua | 2 + src/devices/bus/msx/ctrl/ctrl.cpp | 2 + src/devices/bus/msx/ctrl/libbler.cpp | 79 +++++++++++++++++++++++++++++++++++ src/devices/bus/msx/ctrl/libbler.h | 19 +++++++++ src/devices/bus/msx/ctrl/towns6b.cpp | 6 +-- src/devices/bus/msx/ctrl/towns6b.h | 2 +- src/devices/bus/msx/ctrl/townspad.cpp | 2 +- 7 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 src/devices/bus/msx/ctrl/libbler.cpp create mode 100644 src/devices/bus/msx/ctrl/libbler.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 543418be9ec..5aef3a467b2 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1805,6 +1805,8 @@ if (BUSES["MSX_CTRL"]~=null) then MAME_DIR .. "src/devices/bus/msx/ctrl/ctrl.h", MAME_DIR .. "src/devices/bus/msx/ctrl/joystick.cpp", MAME_DIR .. "src/devices/bus/msx/ctrl/joystick.h", + MAME_DIR .. "src/devices/bus/msx/ctrl/libbler.cpp", + MAME_DIR .. "src/devices/bus/msx/ctrl/libbler.h", MAME_DIR .. "src/devices/bus/msx/ctrl/mouse.cpp", MAME_DIR .. "src/devices/bus/msx/ctrl/mouse.h", MAME_DIR .. "src/devices/bus/msx/ctrl/towns6b.cpp", diff --git a/src/devices/bus/msx/ctrl/ctrl.cpp b/src/devices/bus/msx/ctrl/ctrl.cpp index 8f6ecd646b7..d698f759ece 100644 --- a/src/devices/bus/msx/ctrl/ctrl.cpp +++ b/src/devices/bus/msx/ctrl/ctrl.cpp @@ -10,6 +10,7 @@ #include "ctrl.h" #include "joystick.h" +#include "libbler.h" #include "mouse.h" #include "towns6b.h" #include "townspad.h" @@ -42,6 +43,7 @@ void msx_general_purpose_port_device::device_start() void msx_general_purpose_port_devices(device_slot_interface &device) { device.option_add("joystick", MSX_JOYSTICK); + device.option_add("libbler", MSX_LIBBLERPAD); device.option_add("mouse", MSX_MOUSE); device.option_add("towns6b", MSX_TOWNS6B); device.option_add("townspad", MSX_TOWNSPAD); diff --git a/src/devices/bus/msx/ctrl/libbler.cpp b/src/devices/bus/msx/ctrl/libbler.cpp new file mode 100644 index 00000000000..3e51b5024ca --- /dev/null +++ b/src/devices/bus/msx/ctrl/libbler.cpp @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Micomsoft Libble Rabble Joypad (XPD-1LR) emulation + + Bundled with the following games: + - Crazy Climber Video Game Anthology Vol.5 (Sharp X68000) + - Libble Rabble (Sharp X68000) + - Libble Rabble (Fujitsu FM Towns) + +**********************************************************************/ + +#include "emu.h" +#include "libbler.h" + + +namespace { + +INPUT_PORTS_START(xpd_1lr) + PORT_START("PAD1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT) PORT_8WAY + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("PAD2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP) PORT_8WAY + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN) PORT_8WAY + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT) PORT_8WAY + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT) PORT_8WAY + PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("BUTTONS") + PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("%p A") // used to add credits + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("%p B") // used to pause + PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + + +class xpd_1lr_device : public device_t, public device_msx_general_purpose_port_interface +{ +public: + xpd_1lr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual u8 read() override { return m_pad[m_pin8]->read() | m_buttons->read(); } + virtual void pin_8_w(int state) override { m_pin8 = state ? 1 : 0; } + +protected: + virtual void device_start() override; + virtual ioport_constructor device_input_ports() const override { return INPUT_PORTS_NAME(xpd_1lr); } + +private: + required_ioport_array<2> m_pad; + required_ioport m_buttons; + u8 m_pin8; +}; + + +xpd_1lr_device::xpd_1lr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, MSX_LIBBLERPAD, tag, owner, clock) + , device_msx_general_purpose_port_interface(mconfig, *this) + , m_pad(*this, "PAD%u", 1U) + , m_buttons(*this, "BUTTONS") + , m_pin8(0) +{ +} + +void xpd_1lr_device::device_start() +{ + save_item(NAME(m_pin8)); +} + +} // anonymous namespace + + +DEFINE_DEVICE_TYPE_PRIVATE(MSX_LIBBLERPAD, device_msx_general_purpose_port_interface, xpd_1lr_device, "msx_libblerpad", "Micomsoft Libble Rabble Joypad (XPD-1LR)") diff --git a/src/devices/bus/msx/ctrl/libbler.h b/src/devices/bus/msx/ctrl/libbler.h new file mode 100644 index 00000000000..b1d89a42abb --- /dev/null +++ b/src/devices/bus/msx/ctrl/libbler.h @@ -0,0 +1,19 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/********************************************************************** + + Micomsoft Libble Rabble Joypad (XPD-1LR) emulation + +**********************************************************************/ + +#ifndef MAME_BUS_MSX_CTRL_LIBBLER_H +#define MAME_BUS_MSX_CTRL_LIBBLER_H + +#pragma once + +#include "ctrl.h" + + +DECLARE_DEVICE_TYPE(MSX_LIBBLERPAD, device_msx_general_purpose_port_interface) + +#endif // MAME_BUS_MSX_CTRL_LIBBLER_H diff --git a/src/devices/bus/msx/ctrl/towns6b.cpp b/src/devices/bus/msx/ctrl/towns6b.cpp index 28341b5e6b1..cf03850bfc6 100644 --- a/src/devices/bus/msx/ctrl/towns6b.cpp +++ b/src/devices/bus/msx/ctrl/towns6b.cpp @@ -1,8 +1,8 @@ // license:BSD-3-Clause -// copyright-holders:Wilbert Pol +// copyright-holders:Vas Crabb /********************************************************************** - FM Towns 6-button Pad emulation + FM Towns 6-button Pad emulation **********************************************************************/ @@ -39,7 +39,7 @@ public: fm_towns_6b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); virtual u8 read() override; - void pin_8_w(int state) override { m_pin8 = state; } + virtual void pin_8_w(int state) override { m_pin8 = state; } protected: virtual void device_start() override; diff --git a/src/devices/bus/msx/ctrl/towns6b.h b/src/devices/bus/msx/ctrl/towns6b.h index 83a1fc5af13..df738978c4c 100644 --- a/src/devices/bus/msx/ctrl/towns6b.h +++ b/src/devices/bus/msx/ctrl/towns6b.h @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb /********************************************************************** - FM Towns Pad emulation + FM Towns 6-button Pad emulation **********************************************************************/ diff --git a/src/devices/bus/msx/ctrl/townspad.cpp b/src/devices/bus/msx/ctrl/townspad.cpp index ebdaf6853d1..c86d92f8687 100644 --- a/src/devices/bus/msx/ctrl/townspad.cpp +++ b/src/devices/bus/msx/ctrl/townspad.cpp @@ -2,7 +2,7 @@ // copyright-holders:Vas Crabb /********************************************************************** - FM Towns Pad emulation + FM Towns Pad emulation **********************************************************************/ -- cgit v1.2.3