bbc: moved joystick to analogue port slot device

- added Voltmace self-centering joysticks
This commit is contained in:
Nigel Barnes 2016-09-05 17:27:23 +01:00
parent 88da816a52
commit 7ae7811ca1
8 changed files with 240 additions and 42 deletions

View File

@ -247,6 +247,8 @@ if (BUSES["BBC_ANALOGUE"]~=null) then
files {
MAME_DIR .. "src/devices/bus/bbc/analogue/analogue.cpp",
MAME_DIR .. "src/devices/bus/bbc/analogue/analogue.h",
MAME_DIR .. "src/devices/bus/bbc/analogue/joystick.cpp",
MAME_DIR .. "src/devices/bus/bbc/analogue/joystick.h",
}
end

View File

@ -41,7 +41,6 @@ device_bbc_analogue_interface::~device_bbc_analogue_interface()
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@ -66,6 +65,21 @@ void bbc_analogue_slot_device::device_start()
m_card = dynamic_cast<device_bbc_analogue_interface *>(get_card_device());
}
UINT8 bbc_analogue_slot_device::ch_r(int channel)
{
if (m_card)
return m_card->ch_r(channel);
else
return 0x00;
}
UINT8 bbc_analogue_slot_device::pb_r()
{
if (m_card)
return m_card->pb_r();
else
return 0x30;
}
//-------------------------------------------------
// device_reset - device-specific reset
@ -86,11 +100,12 @@ void bbc_analogue_slot_device::device_reset()
// slot devices
//#include "joystick.h"
#include "joystick.h"
//#include "quinkey.h"
SLOT_INTERFACE_START( bbc_analogue_devices )
// SLOT_INTERFACE("joystick", BBC_JOYSTICKS) /* Acorn ANH01 BBC Micro Joysticks */
SLOT_INTERFACE("acornjoy", BBC_ACORNJOY) /* Acorn ANH01 Joysticks */
SLOT_INTERFACE("voltmace3b", BBC_VOLTMACE3B) /* Voltmace Delta 3b "Twin" Joysticks */
// SLOT_INTERFACE("quinkey", BBC_QUINKEY) /* Microwriter Quinkey */
SLOT_INTERFACE_END

View File

@ -57,14 +57,15 @@
class device_bbc_analogue_interface;
class bbc_analogue_slot_device : public device_t,
public device_slot_interface
class bbc_analogue_slot_device : public device_t, public device_slot_interface
{
public:
// construction/destruction
bbc_analogue_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~bbc_analogue_slot_device() {}
UINT8 ch_r(int channel);
UINT8 pb_r();
protected:
// device-level overrides
@ -84,6 +85,9 @@ public:
device_bbc_analogue_interface(const machine_config &mconfig, device_t &device);
virtual ~device_bbc_analogue_interface();
virtual UINT8 ch_r(int channel) { return 0x00; };
virtual UINT8 pb_r() { return 0x30; };
protected:
bbc_analogue_slot_device *m_slot;
};

View File

@ -0,0 +1,133 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Joystick Controllers
ANH01 - Acorn Analogue Joystick Controllers
http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_ANH01_JoystickController.html
Voltmace Delta 3b "Twin" Joystick Controllers (self centering)
**********************************************************************/
#include "joystick.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type BBC_ACORNJOY = &device_creator<bbc_acornjoy_device>;
const device_type BBC_VOLTMACE3B = &device_creator<bbc_voltmace3b_device>;
static INPUT_PORTS_START( acornjoy )
PORT_START("JOY0")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1)
PORT_START("JOY1")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1)
PORT_START("JOY2")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2)
PORT_START("JOY3")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)
INPUT_PORTS_END
static INPUT_PORTS_START( voltmace3b )
PORT_START("JOY0")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1)
PORT_START("JOY1")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1)
PORT_START("JOY2")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2)
PORT_START("JOY3")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor bbc_acornjoy_device::device_input_ports() const
{
return INPUT_PORTS_NAME( acornjoy );
}
ioport_constructor bbc_voltmace3b_device::device_input_ports() const
{
return INPUT_PORTS_NAME( voltmace3b );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bbc_joystick_device - constructor
//-------------------------------------------------
bbc_joystick_device::bbc_joystick_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_bbc_analogue_interface(mconfig, *this),
m_joy(*this, "JOY%u", 0),
m_buttons(*this, "BUTTONS")
{
}
bbc_acornjoy_device::bbc_acornjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
bbc_joystick_device(mconfig, BBC_ACORNJOY, "Acorn Analogue Joysticks", tag, owner, clock, "bbc_acornjoy", __FILE__)
{
}
bbc_voltmace3b_device::bbc_voltmace3b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
bbc_joystick_device(mconfig, BBC_VOLTMACE3B, "Voltmace Delta 3b Twin Joysticks", tag, owner, clock, "bbc_voltmace3b", __FILE__)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void bbc_joystick_device::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void bbc_joystick_device::device_reset()
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
UINT8 bbc_joystick_device::ch_r(int channel)
{
return m_joy[channel]->read();
}
UINT8 bbc_joystick_device::pb_r()
{
return m_buttons->read();
}

View File

@ -0,0 +1,67 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Joystick Controllers
**********************************************************************/
#pragma once
#ifndef __BBC_JOYSTICK__
#define __BBC_JOYSTICK__
#include "emu.h"
#include "analogue.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> bbc_joystick_device
class bbc_joystick_device :
public device_t,
public device_bbc_analogue_interface
{
public:
// construction/destruction
bbc_joystick_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual UINT8 ch_r(int channel) override;
virtual UINT8 pb_r() override;
private:
required_ioport_array<4> m_joy;
required_ioport m_buttons;
};
class bbc_acornjoy_device : public bbc_joystick_device
{
public:
bbc_acornjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ioport_constructor device_input_ports() const override;
};
class bbc_voltmace3b_device : public bbc_joystick_device
{
public:
bbc_voltmace3b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ioport_constructor device_input_ports() const override;
};
// device type definition
extern const device_type BBC_ACORNJOY;
extern const device_type BBC_VOLTMACE3B;
#endif

View File

@ -407,10 +407,6 @@ static INPUT_PORTS_START(bbc_keyboard)
PORT_START("COL10")
PORT_START("COL11")
PORT_START("COL12")
PORT_START("IN0")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
INPUT_PORTS_END
@ -649,21 +645,6 @@ static INPUT_PORTS_START(bbcbp_links)
INPUT_PORTS_END
static INPUT_PORTS_START(bbc_joy)
PORT_START("JOY0")
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1)
PORT_START("JOY1")
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(1)
PORT_START("JOY2")
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2)
PORT_START("JOY3")
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_MINMAX(0x0,0xff ) PORT_PLAYER(2)
INPUT_PORTS_END
INPUT_CHANGED_MEMBER(bbc_state::monitor_changed)
{
m_monitortype = m_bbcconfig.read_safe(0) &0x03;
@ -727,7 +708,6 @@ static INPUT_PORTS_START(bbcb)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_dipswitch)
PORT_INCLUDE(bbcb_links)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(bbcbp)
@ -735,41 +715,35 @@ static INPUT_PORTS_START(bbcbp)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_dipswitch)
PORT_INCLUDE(bbcbp_links)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(torch)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(torch_keyboard)
PORT_INCLUDE(bbcb_links)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(abc)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_keypad)
PORT_INCLUDE(bbcbp_links)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(bbcm)
PORT_INCLUDE(bbc_config)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_keypad)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(ltmpbp)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_dipswitch)
PORT_INCLUDE(bbcbp_links)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
static INPUT_PORTS_START(ltmpm)
PORT_INCLUDE(bbc_keyboard)
PORT_INCLUDE(bbc_keypad)
PORT_INCLUDE(bbc_joy)
INPUT_PORTS_END
@ -999,7 +973,7 @@ static MACHINE_CONFIG_DERIVED( bbcb, bbca )
MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, nullptr)
/* expansion ports */
MCFG_BBC_ANALOGUE_SLOT_ADD("analogue", bbc_analogue_devices, nullptr)
MCFG_BBC_ANALOGUE_SLOT_ADD("analogue", bbc_analogue_devices, "acornjoy")
MCFG_BBC_1MHZBUS_SLOT_ADD("1mhzbus", bbc_1mhzbus_devices, nullptr)
MCFG_BBC_TUBE_SLOT_ADD("tube", bbc_tube_ext_devices, nullptr)
MCFG_BBC_USERPORT_SLOT_ADD("userport", bbc_userport_devices, nullptr)
@ -1031,8 +1005,8 @@ static MACHINE_CONFIG_DERIVED( bbcb_de, bbcb )
MCFG_FLOPPY_DRIVE_ADD("i8271:1", bbc_floppies_525, "525qd", bbc_state::floppy_formats_bbc)
MCFG_FLOPPY_DRIVE_SOUND(true)
/* software lists */
MCFG_SOFTWARE_LIST_ADD("flop_ls_b_de", "bbcb_cass_de")
/* software lists */
MCFG_SOFTWARE_LIST_ADD("flop_ls_b_de", "bbcb_cass_de")
MACHINE_CONFIG_END
@ -1422,7 +1396,7 @@ static MACHINE_CONFIG_START( bbcm, bbc_state )
MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, nullptr)
/* expansion ports */
MCFG_BBC_ANALOGUE_SLOT_ADD("analogue", bbc_analogue_devices, nullptr)
MCFG_BBC_ANALOGUE_SLOT_ADD("analogue", bbc_analogue_devices, "acornjoy")
MCFG_BBC_1MHZBUS_SLOT_ADD("1mhzbus", bbc_1mhzbus_devices, nullptr)
MCFG_BBC_TUBE_SLOT_ADD("tube_ext", bbc_tube_ext_devices, nullptr)
MCFG_BBC_TUBE_SLOT_ADD("tube_int", bbc_tube_int_devices, nullptr)
@ -1485,6 +1459,9 @@ static MACHINE_CONFIG_DERIVED( bbcmet, bbcm )
/* fdc */
MCFG_DEVICE_REMOVE("wd1770")
/* expansion ports */
MCFG_DEVICE_REMOVE("analogue")
MACHINE_CONFIG_END

View File

@ -78,6 +78,7 @@ public:
m_via6522_0(*this, "via6522_0"),
m_via6522_1(*this, "via6522_1"),
m_upd7002(*this, "upd7002"),
m_analog(*this, "analogue"),
m_rtc(*this, "rtc"),
m_fdc(*this, "fdc"),
m_i8271(*this, "i8271"),
@ -87,7 +88,6 @@ public:
m_exp2(*this, "exp_rom2"),
m_exp3(*this, "exp_rom3"),
m_exp4(*this, "exp_rom4"),
m_joy(*this, "JOY%u", 0),
m_region_maincpu(*this, "maincpu"),
m_region_os(*this, "os"),
m_region_opt(*this, "option"),
@ -224,6 +224,7 @@ public: // HACK FOR MC6845
required_device<via6522_device> m_via6522_0;
optional_device<via6522_device> m_via6522_1;
optional_device<upd7002_device> m_upd7002;
optional_device<bbc_analogue_slot_device> m_analog;
optional_device<mc146818_device> m_rtc;
optional_device<bbc_fdc_slot_device> m_fdc;
optional_device<i8271_device> m_i8271;
@ -233,7 +234,6 @@ public: // HACK FOR MC6845
optional_device<generic_slot_device> m_exp2;
optional_device<generic_slot_device> m_exp3;
optional_device<generic_slot_device> m_exp4;
optional_ioport_array<4> m_joy;
required_memory_region m_region_maincpu;
required_memory_region m_region_os;

View File

@ -1064,11 +1064,11 @@ READ8_MEMBER(bbc_state::bbcb_via_system_read_portb)
// D5 of portb is joystick fire button 2
// D6 VSPINT
// D7 VSPRDY
int TMSint = m_tms ? m_tms->intq_r() : 0;
int TMSrdy = m_tms ? m_tms->readyq_r() : 0;
int vspint = m_tms ? m_tms->intq_r() : 0;
int vsprdy = m_tms ? m_tms->readyq_r() : 0;
//logerror("TMSint %d\n",TMSint);
//logerror("TMSrdy %d\n",TMSrdy);
return (0xf | ioport("IN0")->read() | (!TMSrdy << 7) | (!TMSint << 6));
return ((m_analog ? m_analog->pb_r() : 0x30) | (!vsprdy << 7) | (!vspint << 6));
}
@ -1099,7 +1099,7 @@ BBC Joystick Support
UPD7002_GET_ANALOGUE(bbc_state::BBC_get_analogue_input)
{
return ((0xff - m_joy[channel_number]->read()) << 8);
return ((0xff - m_analog->ch_r(channel_number)) << 8);
}
UPD7002_EOC(bbc_state::BBC_uPD7002_EOC)
@ -1375,7 +1375,7 @@ WRITE_LINE_MEMBER(bbc_state::write_acia_clock)
}
/**************************************
i8271 disc control function
i8271 disc control function
***************************************/