bus/electron/plus1: Use BBC Micro-type slot for analogue joystick inputs (#10460)

* bus/electron/plus1: Use BBC Micro-type slot for analogue joystick inputs

* bus/bbc/analogue: Reverse sense of all analogue inputs
This commit is contained in:
ajrhacker 2022-10-22 17:30:15 -04:00 committed by GitHub
parent 71d8eebfce
commit 14b00ce0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 32 additions and 58 deletions

View File

@ -425,7 +425,7 @@ u8 arc_io_aka_device::pa_r()
int arc_io_aka_device::get_analogue_input(int channel_number)
{
return (0xff - m_analog->ch_r(channel_number)) << 8;
return m_analog->ch_r(channel_number) << 8;
}
void arc_io_aka_device::upd7002_eoc(int state)

View File

@ -130,7 +130,7 @@ void arc_upa_hccs_device::device_start()
int arc_upa_hccs_device::get_analogue_input(int channel_number)
{
return (0xff - m_analog->ch_r(channel_number)) << 8;
return m_analog->ch_r(channel_number) << 8;
}
} // anonymous namespace

View File

@ -318,7 +318,7 @@ void arc_io_morley_device::device_reset()
int arc_io_morley_device::get_analogue_input(int channel_number)
{
return (0xff - m_analog->ch_r(channel_number)) << 8;
return m_analog->ch_r(channel_number) << 8;
}
void arc_io_morley_device::upd7002_eoc(int state)

View File

@ -169,7 +169,7 @@ void arc_bbcio_we_device::device_reset()
int arc_bbcio_we_device::get_analogue_input(int channel_number)
{
return (0xff - m_analog->ch_r(channel_number)) << 8;
return m_analog->ch_r(channel_number) << 8;
}
void arc_bbcio_we_device::upd7002_eoc(int state)

View File

@ -67,7 +67,7 @@ uint8_t bbc_analogue_slot_device::ch_r(int channel)
if (m_card)
return m_card->ch_r(channel);
else
return 0x00;
return 0xff;
}
uint8_t bbc_analogue_slot_device::pb_r()

View File

@ -42,16 +42,16 @@ ROM_END
static INPUT_PORTS_START(bitstik)
PORT_START("CHANNEL0")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_X) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick X") PORT_REVERSE
PORT_BIT(0xff, 0x00, IPT_AD_STICK_X) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick X")
PORT_START("CHANNEL1")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Y) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Y") PORT_REVERSE
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Y) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Y")
PORT_START("CHANNEL2")
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Z) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Z") PORT_REVERSE
PORT_BIT(0xff, 0x00, IPT_AD_STICK_Z) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(200) PORT_NAME("AD Stick Z")
PORT_START("CHANNEL3")
PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Right Button - Release")
PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("Right Button - Release")
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Top Button - Execute")

View File

@ -23,16 +23,16 @@ DEFINE_DEVICE_TYPE(CFA3000_ANLG, cfa3000_anlg_device, "cfa3000a", "Henson CFA 30
static INPUT_PORTS_START( cfa3000a )
PORT_START("CHANNEL0")
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_NAME("Background Intensity") PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_REVERSE
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_NAME("Background Intensity") PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_CENTERDELTA(0)
PORT_START("CHANNEL1")
PORT_BIT(0xff, 0x00, IPT_UNKNOWN)
PORT_BIT(0xff, 0xff, IPT_UNKNOWN)
PORT_START("CHANNEL2")
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_NAME("Age") PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_CENTERDELTA(0) PORT_REVERSE
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_NAME("Age") PORT_SENSITIVITY(25) PORT_KEYDELTA(5) PORT_CENTERDELTA(0)
PORT_START("CHANNEL3")
PORT_BIT(0xff, 0x00, IPT_UNKNOWN)
PORT_BIT(0xff, 0xff, IPT_UNKNOWN)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN)

View File

@ -24,16 +24,16 @@ DEFINE_DEVICE_TYPE(BBC_VOLTMACE3B, bbc_voltmace3b_device, "bbc_voltmace3b", "Vol
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_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(0) PORT_MINMAX(0x00, 0xff) PORT_REVERSE PORT_PLAYER(2)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)
@ -42,16 +42,16 @@ 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_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_REVERSE 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_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(2) PORT_CENTERDELTA(20) PORT_MINMAX(0x00, 0xff) PORT_REVERSE PORT_PLAYER(2)
PORT_START("BUTTONS")
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1)

View File

@ -106,7 +106,7 @@ void bbc_mertec_device::device_start()
int bbc_mertec_device::get_analogue_input(int channel_number)
{
return ((0xff - m_analog->ch_r(channel_number)) << 8);
return m_analog->ch_r(channel_number) << 8;
}
void bbc_mertec_device::upd7002_eoc(int data)

View File

@ -71,27 +71,7 @@ ROM_END
// INPUT_PORTS( plus1 )
//-------------------------------------------------
static INPUT_PORTS_START( plus1 )
PORT_START("JOY1")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_CENTERDELTA(100) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1) PORT_REVERSE
PORT_START("JOY2")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_CENTERDELTA(100) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(1) PORT_REVERSE
PORT_START("JOY3")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_CENTERDELTA(100) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2) PORT_REVERSE
PORT_START("JOY4")
PORT_BIT(0xff, 0x80, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_CENTERDELTA(100) PORT_MINMAX(0x00, 0xff) PORT_PLAYER(2) PORT_REVERSE
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( ap6 )
PORT_INCLUDE(plus1)
PORT_START("LINKS")
PORT_CONFNAME(0x01, 0x01, "J1 ROM 13")
PORT_CONFSETTING(0x00, "Disabled")
@ -108,11 +88,6 @@ INPUT_PORTS_END
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor electron_plus1_device::device_input_ports() const
{
return INPUT_PORTS_NAME( plus1 );
}
ioport_constructor electron_ap6_device::device_input_ports() const
{
return INPUT_PORTS_NAME( ap6 );
@ -133,12 +108,13 @@ void electron_plus1_device::device_add_mconfig(machine_config &config)
m_centronics->set_output_latch(latch);
/* adc */
BBC_ANALOGUE_SLOT(config, m_analogue, bbc_analogue_devices, "acornjoy");
ADC0844(config, m_adc);
m_adc->intr_callback().set([this](int state) { m_adc_ready = !state; });
m_adc->ch1_callback().set_ioport("JOY1");
m_adc->ch2_callback().set_ioport("JOY2");
m_adc->ch3_callback().set_ioport("JOY3");
m_adc->ch4_callback().set_ioport("JOY4");
m_adc->ch1_callback().set([this]() { return m_analogue->ch_r(0); });
m_adc->ch2_callback().set([this]() { return m_analogue->ch_r(1); });
m_adc->ch3_callback().set([this]() { return m_analogue->ch_r(2); });
m_adc->ch4_callback().set([this]() { return m_analogue->ch_r(3); });
/* cartridges */
ELECTRON_CARTSLOT(config, m_cart_sk1, DERIVED_CLOCK(1, 1), electron_cart, nullptr);
@ -204,9 +180,8 @@ electron_plus1_device::electron_plus1_device(const machine_config &mconfig, devi
, m_cart_sk2(*this, "cart_sk2")
, m_centronics(*this, "centronics")
, m_cent_data_out(*this, "cent_data_out")
, m_analogue(*this, "analogue")
, m_adc(*this, "adc")
, m_joy(*this, "JOY%u", 1)
, m_buttons(*this, "BUTTONS")
, m_romsel(0)
, m_centronics_busy(0)
, m_adc_ready(0)
@ -305,7 +280,7 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
// b6: ADC conversion end
// b5: Fire Button 1
// b4: Fire Button 2
data &= (m_centronics_busy << 7) | (m_adc_ready << 6) | m_buttons->read() | 0x0f;
data &= (m_centronics_busy << 7) | (m_adc_ready << 6) | m_analogue->pb_r() | 0x0f;
}
break;

View File

@ -13,6 +13,7 @@
#include "exp.h"
#include "machine/adc0844.h"
#include "machine/input_merger.h"
#include "bus/bbc/analogue/analogue.h"
#include "bus/centronics/ctronics.h"
#include "bus/electron/cart/slot.h"
#include "bus/generic/slot.h"
@ -39,7 +40,6 @@ protected:
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(offs_t offset) override;
virtual void expbus_w(offs_t offset, uint8_t data) override;
@ -50,9 +50,8 @@ protected:
required_device<electron_cartslot_device> m_cart_sk2;
required_device<centronics_device> m_centronics;
required_device<output_latch_device> m_cent_data_out;
required_device<bbc_analogue_slot_device> m_analogue;
required_device<adc0844_device> m_adc;
required_ioport_array<4> m_joy;
required_ioport m_buttons;
uint8_t m_romsel;
int m_centronics_busy;

View File

@ -967,7 +967,7 @@ WRITE_LINE_MEMBER(bbc_state::lpstb_w)
int bbc_state::get_analogue_input(int channel_number)
{
if (m_analog)
return ((0xff - m_analog->ch_r(channel_number)) << 8);
return m_analog->ch_r(channel_number) << 8;
else
return 0xff;
}