diff options
Diffstat (limited to 'src/devices/bus/electron/plus1.cpp')
-rw-r--r-- | src/devices/bus/electron/plus1.cpp | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp index 4b2c3ba9dad..349dcf9e5c7 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 ); @@ -135,10 +110,12 @@ void electron_plus1_device::device_add_mconfig(machine_config &config) /* adc */ 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); }); + + BBC_ANALOGUE_SLOT(config, m_analogue, bbc_analogue_devices, "acornjoy"); /* cartridges */ ELECTRON_CARTSLOT(config, m_cart_sk1, DERIVED_CLOCK(1, 1), electron_cart, nullptr); @@ -204,9 +181,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) @@ -223,7 +199,7 @@ electron_ap1_device::electron_ap1_device(const machine_config &mconfig, const ch { } -electron_ap6_device::electron_ap6_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) +electron_ap6_device::electron_ap6_device(const machine_config &mconfig, const char* tag, device_t* owner, uint32_t clock) : electron_plus1_device(mconfig, ELECTRON_AP6, tag, owner, clock) , m_rom(*this, "rom%u", 1) , m_links(*this, "LINKS") @@ -305,7 +281,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; @@ -428,7 +404,7 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data) break; case 0xfe: - if (offset == 0xfe05) + if ((offset == 0xfe05) && !(data & 0xf0)) { m_romsel = data & 0x0f; } @@ -515,23 +491,21 @@ void electron_ap6_device::expbus_w(offs_t offset, uint8_t data) // IMPLEMENTATION //************************************************************************** -image_init_result electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot) +std::pair<std::error_condition, std::string> electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot) { - uint32_t size = slot->common_get_size("rom"); + uint32_t const size = slot->common_get_size("rom"); // socket accepts 8K and 16K ROM only if (size != 0x2000 && size != 0x4000) - { - image.seterror(image_error::INVALIDIMAGE, "Invalid size: Only 8K/16K is supported"); - return image_init_result::FAIL; - } + return std::make_pair(image_error::INVALIDLENGTH, "Invalid size: Only 8K/16K is supported"); slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); slot->common_load_rom(slot->get_rom_base(), size, "rom"); // mirror 8K ROMs - uint8_t *crt = slot->get_rom_base(); - if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000); + uint8_t *const crt = slot->get_rom_base(); + if (size <= 0x2000) + memcpy(crt + 0x2000, crt, 0x2000); - return image_init_result::PASS; + return std::make_pair(std::error_condition(), std::string()); } |