diff --git a/src/devices/bus/archimedes/podule/io.cpp b/src/devices/bus/archimedes/podule/io.cpp index 829ad1585de..698cf94114b 100644 --- a/src/devices/bus/archimedes/podule/io.cpp +++ b/src/devices/bus/archimedes/podule/io.cpp @@ -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) diff --git a/src/devices/bus/archimedes/podule/io_hccs.cpp b/src/devices/bus/archimedes/podule/io_hccs.cpp index 7daabf0f980..16c73b22b7d 100644 --- a/src/devices/bus/archimedes/podule/io_hccs.cpp +++ b/src/devices/bus/archimedes/podule/io_hccs.cpp @@ -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 diff --git a/src/devices/bus/archimedes/podule/io_morley.cpp b/src/devices/bus/archimedes/podule/io_morley.cpp index 284e26f5f9b..3e6bccc755b 100644 --- a/src/devices/bus/archimedes/podule/io_morley.cpp +++ b/src/devices/bus/archimedes/podule/io_morley.cpp @@ -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) diff --git a/src/devices/bus/archimedes/podule/io_we.cpp b/src/devices/bus/archimedes/podule/io_we.cpp index e7916c15b21..40d5092d824 100644 --- a/src/devices/bus/archimedes/podule/io_we.cpp +++ b/src/devices/bus/archimedes/podule/io_we.cpp @@ -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) diff --git a/src/devices/bus/bbc/analogue/analogue.cpp b/src/devices/bus/bbc/analogue/analogue.cpp index e1eb5e3419e..6dce6a36e99 100644 --- a/src/devices/bus/bbc/analogue/analogue.cpp +++ b/src/devices/bus/bbc/analogue/analogue.cpp @@ -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() diff --git a/src/devices/bus/bbc/analogue/bitstik.cpp b/src/devices/bus/bbc/analogue/bitstik.cpp index 1913c95c862..f904e20db9f 100644 --- a/src/devices/bus/bbc/analogue/bitstik.cpp +++ b/src/devices/bus/bbc/analogue/bitstik.cpp @@ -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") diff --git a/src/devices/bus/bbc/analogue/cfa3000a.cpp b/src/devices/bus/bbc/analogue/cfa3000a.cpp index 0dfd692df12..f48234e091b 100644 --- a/src/devices/bus/bbc/analogue/cfa3000a.cpp +++ b/src/devices/bus/bbc/analogue/cfa3000a.cpp @@ -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) diff --git a/src/devices/bus/bbc/analogue/joystick.cpp b/src/devices/bus/bbc/analogue/joystick.cpp index a6e37ebb3ba..434ea1060b2 100644 --- a/src/devices/bus/bbc/analogue/joystick.cpp +++ b/src/devices/bus/bbc/analogue/joystick.cpp @@ -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) diff --git a/src/devices/bus/bbc/exp/mertec.cpp b/src/devices/bus/bbc/exp/mertec.cpp index 11b3c9dccb9..c561f052460 100644 --- a/src/devices/bus/bbc/exp/mertec.cpp +++ b/src/devices/bus/bbc/exp/mertec.cpp @@ -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) diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp index 4b2c3ba9dad..e9aa67bb16b 100644 --- a/src/devices/bus/electron/plus1.cpp +++ b/src/devices/bus/electron/plus1.cpp @@ -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; diff --git a/src/devices/bus/electron/plus1.h b/src/devices/bus/electron/plus1.h index 36a403b960c..bdfd35808e7 100644 --- a/src/devices/bus/electron/plus1.h +++ b/src/devices/bus/electron/plus1.h @@ -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 m_cart_sk2; required_device m_centronics; required_device m_cent_data_out; + required_device m_analogue; required_device m_adc; - required_ioport_array<4> m_joy; - required_ioport m_buttons; uint8_t m_romsel; int m_centronics_busy; diff --git a/src/mame/acorn/bbc_m.cpp b/src/mame/acorn/bbc_m.cpp index 8873ed057e8..8188c3227bc 100644 --- a/src/mame/acorn/bbc_m.cpp +++ b/src/mame/acorn/bbc_m.cpp @@ -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; }