diff options
Diffstat (limited to 'src/devices')
836 files changed, 35937 insertions, 8234 deletions
diff --git a/src/devices/bus/a1bus/a1bus.cpp b/src/devices/bus/a1bus/a1bus.cpp index cafc399b00f..43a05b892ab 100644 --- a/src/devices/bus/a1bus/a1bus.cpp +++ b/src/devices/bus/a1bus/a1bus.cpp @@ -129,11 +129,10 @@ void a1bus_device::install_device(offs_t start, offs_t end, read8sm_delegate rha m_space->install_readwrite_handler(start, end, rhandler, whandler); } -void a1bus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void a1bus_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_space->install_readwrite_bank(start, end, tag); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + m_space->install_ram(start, end, data); } // interrupt request from a1bus card @@ -195,7 +194,7 @@ void device_a1bus_card_interface::install_device(offs_t start, offs_t end, read8 m_a1bus->install_device(start, end, rhandler, whandler); } -void device_a1bus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_a1bus_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_a1bus->install_bank(start, end, tag, data); + m_a1bus->install_bank(start, end, data); } diff --git a/src/devices/bus/a1bus/a1bus.h b/src/devices/bus/a1bus/a1bus.h index 8c354b89f43..d1d4860113d 100644 --- a/src/devices/bus/a1bus/a1bus.h +++ b/src/devices/bus/a1bus/a1bus.h @@ -69,7 +69,7 @@ public: void set_nmi_line(int state); void install_device(offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); DECLARE_WRITE_LINE_MEMBER( irq_w ); DECLARE_WRITE_LINE_MEMBER( nmi_w ); @@ -118,7 +118,7 @@ protected: void lower_slot_nmi() { m_a1bus->set_nmi_line(CLEAR_LINE); } void install_device(offs_t start, offs_t end, read8sm_delegate rhandler, write8sm_delegate whandler); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); device_a1bus_card_interface(const machine_config &mconfig, device_t &device); diff --git a/src/devices/bus/a1bus/a1cassette.cpp b/src/devices/bus/a1bus/a1cassette.cpp index 9ab13fb755d..f486105c6e5 100644 --- a/src/devices/bus/a1bus/a1cassette.cpp +++ b/src/devices/bus/a1bus/a1cassette.cpp @@ -76,7 +76,7 @@ a1bus_cassette_device::a1bus_cassette_device(const machine_config &mconfig, devi void a1bus_cassette_device::device_start() { install_device(0xc000, 0xc0ff, read8sm_delegate(*this, FUNC(a1bus_cassette_device::cassette_r)), write8sm_delegate(*this, FUNC(a1bus_cassette_device::cassette_w))); - install_bank(0xc100, 0xc1ff, "bank_a1cas", &m_rom[0]); + install_bank(0xc100, 0xc1ff, &m_rom[0]); save_item(NAME(m_cassette_output_flipflop)); } diff --git a/src/devices/bus/a1bus/a1cffa.cpp b/src/devices/bus/a1bus/a1cffa.cpp index 4d7f020c030..5656509a62d 100644 --- a/src/devices/bus/a1bus/a1cffa.cpp +++ b/src/devices/bus/a1bus/a1cffa.cpp @@ -69,7 +69,7 @@ a1bus_cffa_device::a1bus_cffa_device(const machine_config &mconfig, device_type void a1bus_cffa_device::device_start() { install_device(0xafe0, 0xafff, read8sm_delegate(*this, FUNC(a1bus_cffa_device::cffa_r)), write8sm_delegate(*this, FUNC(a1bus_cffa_device::cffa_w))); - install_bank(0x9000, 0xafdf, "bank_cffa1", &m_rom[0]); + install_bank(0x9000, 0xafdf, &m_rom[0]); save_item(NAME(m_lastdata)); save_item(NAME(m_writeprotect)); diff --git a/src/devices/bus/a2bus/a2diskiing.cpp b/src/devices/bus/a2bus/a2diskiing.cpp index 9ce3a0df64c..45d792c761c 100644 --- a/src/devices/bus/a2bus/a2diskiing.cpp +++ b/src/devices/bus/a2bus/a2diskiing.cpp @@ -64,14 +64,14 @@ void diskiing_device::device_add_mconfig(machine_config &config) { DISKII_FDC(config, m_wozfdc, 1021800*2); for (auto &floppy : m_floppy) - FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", diskiing_device::floppy_formats); + FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", diskiing_device::floppy_formats).enable_sound(true); } void a2bus_diskiing13_device::device_add_mconfig(machine_config &config) { DISKII_FDC(config, m_wozfdc, 1021800*2); for (auto &floppy : m_floppy) - FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", a2bus_diskiing13_device::floppy_formats); + FLOPPY_CONNECTOR(config, floppy, a2_floppies, "525", a2bus_diskiing13_device::floppy_formats).enable_sound(true); } //------------------------------------------------- diff --git a/src/devices/bus/a2bus/a2mockingboard.cpp b/src/devices/bus/a2bus/a2mockingboard.cpp index c7f5fda534d..c81614a8ec0 100644 --- a/src/devices/bus/a2bus/a2mockingboard.cpp +++ b/src/devices/bus/a2bus/a2mockingboard.cpp @@ -40,12 +40,12 @@ DEFINE_DEVICE_TYPE(A2BUS_ECHOPLUS, a2bus_echoplus_device, "a2echop", "S void a2bus_ayboard_device::add_common_devices(machine_config &config) { - VIA6522(config, m_via1, 1022727); + MOS6522(config, m_via1, 1022727); m_via1->writepa_handler().set(FUNC(a2bus_ayboard_device::via1_out_a)); m_via1->writepb_handler().set(FUNC(a2bus_ayboard_device::via1_out_b)); m_via1->irq_handler().set(FUNC(a2bus_ayboard_device::via1_irq_w)); - VIA6522(config, m_via2, 1022727); + MOS6522(config, m_via2, 1022727); m_via2->writepa_handler().set(FUNC(a2bus_ayboard_device::via2_out_a)); m_via2->writepb_handler().set(FUNC(a2bus_ayboard_device::via2_out_b)); m_via2->irq_handler().set(FUNC(a2bus_ayboard_device::via2_irq_w)); diff --git a/src/devices/bus/a2bus/a2parprn.cpp b/src/devices/bus/a2bus/a2parprn.cpp new file mode 100644 index 00000000000..c1ec975d1fb --- /dev/null +++ b/src/devices/bus/a2bus/a2parprn.cpp @@ -0,0 +1,233 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +#include "emu.h" +#include "a2parprn.h" + +//#define VERBOSE 1 +//#define LOG_OUTPUT_FUNC osd_printf_info +#include "logmacro.h" + +namespace { + +// FIXME: get proper PROM dumps. +/* + There are most likely multiple revisions. + 6309 and 74471 PROMs were used. + + Example silkscreen: + + SINGAPORE + 341-0005-00 + cAPPLE 78-02 + SN74S471N + + Example label: + + APPLE + ©1978 + + PROM image here is from entering a listing and zero-filling unused areas. + + ******************************** + * * + * PRINTER CARD I FIRMWARE * + * * + * WOZ 11/1/77 * + * APPLE COMPUTER INC. * + * ALL RIGHTS RESERVED * + * * + ******************************** +*/ +ROM_START(parprn) + ROM_REGION(0x100, "prom", 0) + ROM_LOAD( "prom.b4", 0x0000, 0x0100, BAD_DUMP CRC(00b742ca) SHA1(c67888354aa013f9cb882eeeed924e292734e717) ) +ROM_END + + +INPUT_PORTS_START(parprn) + PORT_START("CFG") + PORT_CONFNAME(0x01, 0x00, "Acknowledge latching edge") + PORT_CONFSETTING( 0x00, "Falling (/Y-B)") + PORT_CONFSETTING( 0x01, "Rising (Y-B)") + PORT_CONFNAME(0x06, 0x02, "Printer ready") + PORT_CONFSETTING( 0x00, "Always (S5-C-D)") + PORT_CONFSETTING( 0x02, "Acknowledge latch (Z-C-D)") + PORT_CONFSETTING( 0x04, "ACK (Y-C-D)") + PORT_CONFSETTING( 0x06, "/ACK (/Y-C-D)") + PORT_CONFNAME(0x08, 0x00, "Strobe polarity") + PORT_CONFSETTING( 0x00, "Negative (S5-A-/X, GND-X)") + PORT_CONFSETTING( 0x08, "Positive (S5-X, GND-A-/X)") + PORT_CONFNAME(0x10, 0x10, "Character width") + PORT_CONFSETTING( 0x00, "7-bit") + PORT_CONFSETTING( 0x10, "8-bit") +INPUT_PORTS_END + +} // anonymous namespace + + + +DEFINE_DEVICE_TYPE(A2BUS_PARPRN, a2bus_parprn_device, "a2parprn", "Apple II Parallel Printer Interface Card") + + + +a2bus_parprn_device::a2bus_parprn_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : + device_t(mconfig, A2BUS_PARPRN, tag, owner, clock), + device_a2bus_card_interface(mconfig, *this), + m_printer_conn(*this, "prn"), + m_printer_out(*this, "prn_out"), + m_input_config(*this, "CFG"), + m_prom(*this, "prom"), + m_strobe_timer(nullptr), + m_next_strobe(0U), + m_ack_latch(0U), + m_ack_in(1U) +{ +} + + + +//---------------------------------------------- +// device_a2bus_card_interface implementation +//---------------------------------------------- + +u8 a2bus_parprn_device::read_c0nx(u8 offset) +{ + if (!machine().side_effects_disabled()) + { + LOG("Read C0n%01X (effective open-bus write)\n", offset); + + // R/W is ignored, so it has the same effect as a write + // the bus is open, but 74LS logic has low-impedance inputs so it's likely to latch 0xff + write_c0nx(offset, 0xffU); + } + + return 0x00U; +} + + +void a2bus_parprn_device::write_c0nx(u8 offset, u8 data) +{ + LOG("Write C0n%01X=%02X\n", offset, data); + if (m_ack_latch) + LOG("Clearing acknowledge latch\n"); + else + LOG("Previous data not acknowledged\n"); + + ioport_value const cfg(m_input_config->read()); + + m_printer_out->write(data & (BIT(cfg, 8) ? 0xffU : 0x7fU)); + m_printer_conn->write_strobe(BIT(~cfg, 3)); + m_next_strobe = BIT(cfg, 3); + m_ack_latch = 0U; + m_strobe_timer->adjust(attotime::from_ticks(1, clock())); +} + + +u8 a2bus_parprn_device::read_cnxx(u8 offset) +{ + ioport_value const cfg(m_input_config->read()); + + if (BIT(cfg, 2)) + { + if (!BIT(offset, 6) || (BIT(offset, 7) && (BIT(cfg, 1) != m_ack_in))) + offset |= 0x40U; + else + offset &= 0xbfU; + } + else if (BIT(cfg, 1)) + { + if (!BIT(offset, 6) || (BIT(offset, 7) && !m_ack_latch)) + offset |= 0x40U; + else + offset &= 0xbfU; + } + else + { + offset ^= 0x40U; + } + + return m_prom[offset]; +} + + + +//---------------------------------------------- +// device_t implementation +//---------------------------------------------- + +tiny_rom_entry const *a2bus_parprn_device::device_rom_region() const +{ + return ROM_NAME(parprn); +} + + +void a2bus_parprn_device::device_add_mconfig(machine_config &config) +{ + CENTRONICS(config, m_printer_conn, centronics_devices, "printer"); + m_printer_conn->ack_handler().set(FUNC(a2bus_parprn_device::ack_w)); + + OUTPUT_LATCH(config, m_printer_out); + m_printer_conn->set_output_latch(*m_printer_out); +} + + +ioport_constructor a2bus_parprn_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(parprn); +} + + +void a2bus_parprn_device::device_start() +{ + m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_parprn_device::update_strobe), this)); + + save_item(NAME(m_next_strobe)); + save_item(NAME(m_ack_latch)); + save_item(NAME(m_ack_in)); +} + + +void a2bus_parprn_device::device_reset() +{ + m_ack_latch = 1U; +} + + + +//---------------------------------------------- +// printer status inputs +//---------------------------------------------- + +WRITE_LINE_MEMBER(a2bus_parprn_device::ack_w) +{ + if (bool(state) != bool(m_ack_in)) + { + m_ack_in = state ? 1U : 0U; + LOG("ACK=%u\n", m_ack_in); + if (started() && (m_ack_in == BIT(m_input_config->read(), 0))) + { + LOG("Active ACK edge\n"); + m_ack_latch = 1U; + } + } +} + + + +//---------------------------------------------- +// timer handlers +//---------------------------------------------- + +TIMER_CALLBACK_MEMBER(a2bus_parprn_device::update_strobe) +{ + ioport_value const cfg(m_input_config->read()); + + LOG("Output /STROBE=%u\n", m_next_strobe); + m_printer_conn->write_strobe(m_next_strobe); + if (m_next_strobe == BIT(cfg, 3)) + { + LOG("Start strobe timer\n"); + m_next_strobe = BIT(~cfg, 3); + m_strobe_timer->adjust(attotime::from_ticks(1, clock())); + } +} diff --git a/src/devices/bus/a2bus/a2parprn.h b/src/devices/bus/a2bus/a2parprn.h new file mode 100644 index 00000000000..87a9c808c30 --- /dev/null +++ b/src/devices/bus/a2bus/a2parprn.h @@ -0,0 +1,97 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb +/*********************************************************************** + + Apple II Parallel Printer Interface Card + + 20-pin header: + + GND 1 2 ACK + SP1* 3 4 F + SP2* 5 6 SP3* + SP4* 7 8 STR + SP5* 9 10 DP0 + DP1 11 12 DP2 + DP3 13 14 DP4 + DP5 15 16 DP6 + DP7 17 18 SP6* + SP7* 19 20 GND + + *spare, SP1-SP5 brought out to pads for wire mods + + DIP jumper B1: + + no connection NC 1 16 B acknowledge latch clock + no connection NC 2 15 D printer ready 1 + synchronised ACK Y 3 14 C printer ready 2 + synchronised /ACK /Y 4 13 A idle strobe + acknowledge latch Q /Z 5 12 /X strobe on access + acknowlwdge latch /Q Z 6 11 S5 +5V via 12kΩ resistor + signal ground GND 7 10 X strobe after one cycle + header pin 4 F 8 9 NC no connection + + In real life, the card only samples the ACK input on rising + edges of the phase 1 clock. Acknowledge pulses shorter than one + microsecond may be ignored. This limitation is not emulated. + + The card completely ignores the R/W line. The PROM driver uses + an indexed write to access the C0nX region. This produces a + spurious read, causing data to be latched and triggering a + delayed strobe pulse. This is why the delay is important – the + write needs to happen on the cycle immediately following the + spurious read to prevent the open bus data from being printed. + + The card was designed to allow user modifications. There are + locations at 5A (16-pin) and 5B (20-pin) for additional DIP + packages. Common modifications included stretching strobe + and/or acknowledge pulses to improve reliability. + +***********************************************************************/ +#ifndef MAME_BUS_A2BUS_A2PARPRN_H +#define MAME_BUS_A2BUS_A2PARPRN_H + +#pragma once + +#include "a2bus.h" +#include "bus/centronics/ctronics.h" + +class a2bus_parprn_device : public device_t, public device_a2bus_card_interface +{ +public: + a2bus_parprn_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + // device_a2bus_card_interface implementation + virtual u8 read_c0nx(u8 offset) override; + virtual void write_c0nx(u8 offset, u8 data) override; + virtual u8 read_cnxx(u8 offset) override; + +protected: + // device_t implementation + virtual tiny_rom_entry const *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_start() override; + virtual void device_reset() override; + +private: + // printer status inputs + DECLARE_WRITE_LINE_MEMBER(ack_w); + + // timer handlers + TIMER_CALLBACK_MEMBER(update_strobe); + + required_device<centronics_device> m_printer_conn; + required_device<output_latch_device> m_printer_out; + required_ioport m_input_config; + required_region_ptr<u8> m_prom; + emu_timer * m_strobe_timer; + + u8 m_next_strobe; // B3 pin 13 + u8 m_ack_latch; // B2 pin 6 + u8 m_ack_in; // pin 2 +}; + + +DECLARE_DEVICE_TYPE(A2BUS_PARPRN, a2bus_parprn_device) + +#endif // MAME_BUS_A2BUS_A2PARPRN_H diff --git a/src/devices/bus/a2bus/a2pic.h b/src/devices/bus/a2bus/a2pic.h index 283dd537e7c..027c18611f0 100644 --- a/src/devices/bus/a2bus/a2pic.h +++ b/src/devices/bus/a2bus/a2pic.h @@ -1,6 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Vas Crabb -/********************************************************************* +/*********************************************************************** Apple II Parallel Interface Card (670-0021) @@ -34,7 +34,18 @@ *wired to 500ns strobe but connector hole is blocked -*********************************************************************/ + This card has significant flaws: + * The strobe pulse begins on the same rising edge of the phase 1 + clock as the data is latched. The parallel load enable input + to the strobe time counter (6A) is delayed slightly, but the + load happens on the rising phase 1 clock edge. This could + glitch on a real printer. MAME always sets the data outputs + before starting the strobe pulse. + * Acknowledge is ignored while the strobe output is active. If + the printer acknowledges the data before the end of the strobe + pulse, the card will miss it and wait forever. + +***********************************************************************/ #ifndef MAME_BUS_A2BUS_A2PIC_H #define MAME_BUS_A2BUS_A2PIC_H diff --git a/src/devices/bus/a2bus/a2scsi.cpp b/src/devices/bus/a2bus/a2scsi.cpp index 0673aa13938..58b065a4fca 100644 --- a/src/devices/bus/a2bus/a2scsi.cpp +++ b/src/devices/bus/a2bus/a2scsi.cpp @@ -151,9 +151,6 @@ uint8_t a2bus_scsi_device::read_c0nx(uint8_t offset) case 9: // our SCSI ID (normally 0x80 = 7) return (1<<7); - case 0xa: // RAM/ROM bank - return m_bank; - case 0xe: // DRQ status in bit 7 return m_drq; diff --git a/src/devices/bus/a2bus/a2ssc.cpp b/src/devices/bus/a2bus/a2ssc.cpp index 773f4db246f..b9e531696b6 100644 --- a/src/devices/bus/a2bus/a2ssc.cpp +++ b/src/devices/bus/a2bus/a2ssc.cpp @@ -6,6 +6,11 @@ Apple II Super Serial Card + The Apricorn Super Serial Imager has separate "Modem" and + "Printer" pin headers, which carry different arrangements of the + same RS232 signals. Its GPI mode also features Videx VideoTerm + support when that card is installed in slot 3. + *********************************************************************/ #include "emu.h" @@ -22,19 +27,21 @@ //************************************************************************** DEFINE_DEVICE_TYPE(A2BUS_SSC, a2bus_ssc_device, "a2ssc", "Apple Super Serial Card") - -#define SSC_ROM_REGION "ssc_rom" -#define SSC_ACIA_TAG "ssc_acia" -#define SSC_RS232_TAG "ssc_rs232" +DEFINE_DEVICE_TYPE(APRICORN_SSI, apricorn_ssi_device, "aprissi", "Apricorn Super Serial Imager") ROM_START( ssc ) - ROM_REGION(0x000800, SSC_ROM_REGION, 0) + ROM_REGION(0x800, "program", 0) ROM_LOAD( "341-0065-a.bin", 0x000000, 0x000800, CRC(b7539d4c) SHA1(6dab633470c6bc4cb3e81d09fda46597caf8ee57) ) ROM_END +ROM_START( ssi ) + ROM_REGION(0x2000, "program", 0) // "SSI Version 1.1" + ROM_LOAD( "apricorn super serial imager - rom.bin", 0x0000, 0x2000, CRC(d251f7f1) SHA1(19f2bc1e60c3fd5e179c4a38f7ca4e3221553562) ) +ROM_END + static INPUT_PORTS_START( ssc ) PORT_START("DSW1") - PORT_DIPNAME( 0xf0, 0xf0, "Baud rate" ) + PORT_DIPNAME( 0xf0, 0xe0, "Baud Rate" ) PORT_DIPLOCATION("SW1:4,3,2,1") PORT_DIPSETTING( 0x00, "Undefined/115200" ) PORT_DIPSETTING( 0x10, "50" ) PORT_DIPSETTING( 0x20, "75" ) @@ -51,36 +58,141 @@ static INPUT_PORTS_START( ssc ) PORT_DIPSETTING( 0xd0, "7200" ) PORT_DIPSETTING( 0xe0, "9600" ) PORT_DIPSETTING( 0xf0, "19200" ) - - PORT_DIPNAME( 0x0c, 0x00, "Mode" ) + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x03, 0x00, "Mode" ) PORT_DIPLOCATION("SW1:6,5") PORT_DIPSETTING( 0x00, "Communications Mode" ) - PORT_DIPSETTING( 0x04, "SIC P8 Emulation Mode" ) - PORT_DIPSETTING( 0x08, "Printer Mode" ) - PORT_DIPSETTING( 0x0c, "SIC P8A Emulation Mode" ) - - PORT_DIPNAME( 0x01, 0x00, "Clear To Send" ) - PORT_DIPSETTING( 0x00, "Normal Clear To Send" ) - PORT_DIPSETTING( 0x01, "Secondary Clear To Send" ) + PORT_DIPSETTING( 0x01, "SIC P8 Emulation Mode" ) + PORT_DIPSETTING( 0x02, "Printer Mode" ) + PORT_DIPSETTING( 0x03, "SIC P8A Emulation Mode" ) PORT_START("DSW2") - PORT_DIPNAME( 0xc0, 0x00, "Format" ) - PORT_DIPSETTING( 0x00, "8 data, 1 stop") - PORT_DIPSETTING( 0x40, "7 data, 1 stop") - PORT_DIPSETTING( 0x80, "8 data, 2 stop") - PORT_DIPSETTING( 0xc0, "7 data, 2 stop") - - PORT_DIPNAME( 0x30, 0x00, "Parity" ) - PORT_DIPSETTING( 0x00, "None") - PORT_DIPSETTING( 0x10, "Odd") - PORT_DIPSETTING( 0x30, "Even") - - PORT_DIPNAME( 0x08, 0x08, "End of Line" ) + PORT_DIPNAME( 0x80, 0x00, "Stop Bits" ) PORT_DIPLOCATION("SW2:1") + PORT_DIPSETTING( 0x00, "1") + PORT_DIPSETTING( 0x80, "2") + PORT_DIPNAME( 0x20, 0x00, "Data Bits" ) PORT_DIPLOCATION("SW2:2") PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x02) + PORT_DIPSETTING( 0x20, "7") + PORT_DIPSETTING( 0x00, "8") + PORT_DIPNAME( 0x20, 0x00, "Delay After CR" ) PORT_DIPLOCATION("SW2:2") PORT_CONDITION("DSW1", 0x03, EQUALS, 0x02) + PORT_DIPSETTING( 0x20, DEF_STR(None)) + PORT_DIPSETTING( 0x00, "1/4 sec") + PORT_BIT( 0x50, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x0c, 0x00, "Parity" ) PORT_DIPLOCATION("SW2:4,3") PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x02) + PORT_DIPSETTING( 0x00, DEF_STR(None)) + PORT_DIPSETTING( 0x08, "None (2)") + PORT_DIPSETTING( 0x04, "Odd") + PORT_DIPSETTING( 0x0c, "Even") + PORT_DIPNAME( 0x0c, 0x00, "Line Width" ) PORT_DIPLOCATION("SW2:4,3") PORT_CONDITION("DSW1", 0x03, EQUALS, 0x02) + PORT_DIPSETTING( 0x00, "40 Characters") + PORT_DIPSETTING( 0x04, "72 Characters") + PORT_DIPSETTING( 0x08, "80 Characters") + PORT_DIPSETTING( 0x0c, "132 Characters") + PORT_DIPNAME( 0x02, 0x02, "End of Line" ) PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x00, "Add LF after CR") - PORT_DIPSETTING( 0x08, "Don't add LF after CR") + PORT_DIPSETTING( 0x02, "Don't add LF after CR") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("rs232", rs232_port_device, cts_r) + + PORT_START("DSWX") // Non-memory-mapped DIP switches + PORT_DIPNAME( 0x04, 0x04, "Interrupts" ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x00, "DCD Connected" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x01, 0x01, "Secondary CTS Connected" ) PORT_DIPLOCATION("SW2:7") + PORT_DIPSETTING( 0x01, DEF_STR(Off)) +INPUT_PORTS_END + +static INPUT_PORTS_START( ssi ) + PORT_START("DSW1") + PORT_DIPNAME( 0x100, 0x100, "Emulation Mode" ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x100, "Off (GPI)" ) + PORT_DIPSETTING( 0x000, "On (SSC)" ) + PORT_DIPNAME( 0xf0, 0xe0, "Baud Rate" ) PORT_DIPLOCATION("SW1:4,3,2,1") + PORT_DIPSETTING( 0x00, "Undefined" ) + PORT_DIPSETTING( 0x10, "50" ) + PORT_DIPSETTING( 0x20, "75" ) + PORT_DIPSETTING( 0x30, "110" ) + PORT_DIPSETTING( 0x40, "135" ) + PORT_DIPSETTING( 0x50, "150" ) + PORT_DIPSETTING( 0x60, "300" ) + PORT_DIPSETTING( 0x70, "600" ) + PORT_DIPSETTING( 0x80, "1200" ) + PORT_DIPSETTING( 0x90, "1800" ) + PORT_DIPSETTING( 0xa0, "2400" ) + PORT_DIPSETTING( 0xb0, "3600" ) + PORT_DIPSETTING( 0xc0, "4800" ) + PORT_DIPSETTING( 0xd0, "7200" ) + PORT_DIPSETTING( 0xe0, "9600" ) + PORT_DIPSETTING( 0xf0, "19200" ) + PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x03, 0x02, "SSC Mode" ) PORT_DIPLOCATION("SW1:6,5") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x000) + PORT_DIPSETTING( 0x00, "Communications" ) + PORT_DIPSETTING( 0x02, "Printer" ) + PORT_DIPNAME( 0x02, 0x02, "XON/XOFF Handshaking" ) PORT_DIPLOCATION("SW1:5") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x01, 0x00, "LF After CR" ) PORT_DIPLOCATION("SW1:6") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x01, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) - PORT_DIPNAME( 0x04, 0x04, "Interrupts" ) - PORT_DIPSETTING( 0x00, "On") - PORT_DIPSETTING( 0x04, "Off") + PORT_START("DSW2") + PORT_DIPNAME( 0x80, 0x80, "Stop Bits" ) PORT_DIPLOCATION("SW2:1") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x000) + PORT_DIPSETTING( 0x00, "1") + PORT_DIPSETTING( 0x80, "2") + PORT_DIPNAME( 0x40, 0x40, DEF_STR(Unused)) PORT_DIPLOCATION("SW2:7") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x000) + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x20, 0x00, "Data Bits" ) PORT_DIPLOCATION("SW2:2") PORT_CONDITION("DSW1", 0x103, EQUALS, 0x000) + PORT_DIPSETTING( 0x20, "7") + PORT_DIPSETTING( 0x00, "8") + PORT_DIPNAME( 0x20, 0x00, "CR Delay" ) PORT_DIPLOCATION("SW2:2") PORT_CONDITION("DSW1", 0x103, EQUALS, 0x002) + PORT_DIPSETTING( 0x20, DEF_STR(None)) + PORT_DIPSETTING( 0x00, "32 ms") + PORT_DIPNAME( 0x10, 0x10, DEF_STR(Unused)) PORT_DIPLOCATION("SW2:8") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x000) + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x0c, 0x08, "Parity" ) PORT_DIPLOCATION("SW2:4,3") PORT_CONDITION("DSW1", 0x103, EQUALS, 0x000) + PORT_DIPSETTING( 0x00, DEF_STR(None)) + PORT_DIPSETTING( 0x08, "None (2)") + PORT_DIPSETTING( 0x04, "Odd") + PORT_DIPSETTING( 0x0c, "Even") + PORT_DIPNAME( 0x0c, 0x00, "Line Width" ) PORT_DIPLOCATION("SW2:4,3") PORT_CONDITION("DSW1", 0x103, EQUALS, 0x002) + PORT_DIPSETTING( 0x00, "40 Characters (Echo On)") + PORT_DIPSETTING( 0x04, "72 Characters (Echo Off)") + PORT_DIPSETTING( 0x08, "80 Characters (Echo Off)") + PORT_DIPSETTING( 0x0c, "132 Characters (Echo Off)") + PORT_DIPNAME( 0x02, 0x00, "LF After CR" ) PORT_DIPLOCATION("SW2:5") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x000) + PORT_DIPSETTING( 0x02, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0xa8, 0x88, "Printer Type" ) PORT_DIPLOCATION("SW2:3,2,1") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x08, "ImageWriter" ) + PORT_DIPSETTING( 0x88, "Epson" ) + PORT_DIPSETTING( 0x80, "Star Micronics" ) + PORT_DIPSETTING( 0x20, "Okidata" ) + PORT_DIPSETTING( 0x00, "C. Itoh" ) + PORT_DIPSETTING( 0x28, "Unknown (1)" ) + PORT_DIPSETTING( 0xa0, "Unknown (2)" ) + PORT_DIPSETTING( 0xa8, "Unknown (3)" ) + PORT_DIPNAME( 0x40, 0x40, "Video Echo" ) PORT_DIPLOCATION("SW2:7") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x40, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x10, 0x10, "Transparent Mode" ) PORT_DIPLOCATION("SW2:8") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x10, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x04, 0x04, DEF_STR(Unused)) PORT_DIPLOCATION("SW2:4") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x00, "MSB Output" ) PORT_DIPLOCATION("SW2:5") PORT_CONDITION("DSW1", 0x100, EQUALS, 0x100) + PORT_DIPSETTING( 0x02, "Clear 8th Bit" ) + PORT_DIPSETTING( 0x00, "Pass 8th Bit" ) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("rs232", rs232_port_device, cts_r) // TBD: implemented on SSI or not? + + PORT_START("DSWX") + PORT_DIPNAME( 0x04, 0x04, "Interrupts" ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x04, DEF_STR(Off)) + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_DIPNAME( 0x02, 0x00, "DCD Connected" ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x00, DEF_STR(On)) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END //------------------------------------------------- @@ -92,6 +204,11 @@ ioport_constructor a2bus_ssc_device::device_input_ports() const return INPUT_PORTS_NAME( ssc ); } +ioport_constructor apricorn_ssi_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ssi ); +} + //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- @@ -101,9 +218,11 @@ void a2bus_ssc_device::device_add_mconfig(machine_config &config) MOS6551(config, m_acia, 0); m_acia->set_xtal(1.8432_MHz_XTAL); m_acia->irq_handler().set(FUNC(a2bus_ssc_device::acia_irq_w)); - m_acia->txd_handler().set(SSC_RS232_TAG, FUNC(rs232_port_device::write_txd)); + m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_acia->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + m_acia->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); - rs232_port_device &rs232(RS232_PORT(config, SSC_RS232_TAG, default_rs232_devices, nullptr)); + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); rs232.rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); rs232.dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); rs232.dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); @@ -119,6 +238,11 @@ const tiny_rom_entry *a2bus_ssc_device::device_rom_region() const return ROM_NAME( ssc ); } +const tiny_rom_entry *apricorn_ssi_device::device_rom_region() const +{ + return ROM_NAME( ssi ); +} + //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -133,8 +257,15 @@ a2bus_ssc_device::a2bus_ssc_device(const machine_config &mconfig, device_type ty device_a2bus_card_interface(mconfig, *this), m_dsw1(*this, "DSW1"), m_dsw2(*this, "DSW2"), - m_acia(*this, SSC_ACIA_TAG), m_rom(nullptr), - m_started(false) + m_dswx(*this, "DSWX"), + m_acia(*this, "acia"), + m_rom(*this, "program") +{ +} + +apricorn_ssi_device::apricorn_ssi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_ssc_device(mconfig, APRICORN_SSI, tag, owner, clock), + m_alt_bank(false) { } @@ -144,12 +275,15 @@ a2bus_ssc_device::a2bus_ssc_device(const machine_config &mconfig, device_type ty void a2bus_ssc_device::device_start() { - m_rom = machine().root_device().memregion(this->subtag(SSC_ROM_REGION).c_str())->base(); +} + +void apricorn_ssi_device::device_start() +{ + save_item(NAME(m_alt_bank)); } void a2bus_ssc_device::device_reset() { - m_started = true; } /*------------------------------------------------- @@ -161,6 +295,19 @@ uint8_t a2bus_ssc_device::read_cnxx(uint8_t offset) return m_rom[(offset&0xff)+0x700]; } +uint8_t apricorn_ssi_device::read_cnxx(uint8_t offset) +{ + if (!machine().side_effects_disabled()) + m_alt_bank = false; + return m_rom[offset | (BIT(m_dsw1->read(), 8) ? 0x1700 : 0x0700)]; +} + +void apricorn_ssi_device::write_cnxx(uint8_t offset, uint8_t data) +{ + // TBD: behavior guessed + m_alt_bank = false; +} + /*------------------------------------------------- read_c800 - called for reads from this card's c800 space -------------------------------------------------*/ @@ -170,6 +317,15 @@ uint8_t a2bus_ssc_device::read_c800(uint16_t offset) return m_rom[offset]; } +uint8_t apricorn_ssi_device::read_c800(uint16_t offset) +{ + if (BIT(m_dsw1->read(), 8)) + offset |= 0x1000; + if (m_alt_bank) + offset |= 0x800; + return m_rom[offset]; +} + /*------------------------------------------------- read_c0nx - called for reads from this card's c0nx space -------------------------------------------------*/ @@ -178,22 +334,17 @@ uint8_t a2bus_ssc_device::read_c0nx(uint8_t offset) { // dips at C0n1/C0n2, ACIA at C0n8/9/A/B - switch (offset) + if (BIT(offset, 3)) + return m_acia->read(offset & 3); + else { - case 1: - return m_dsw1->read(); - case 2: - return m_dsw2->read(); - - case 8: - case 9: - case 0xa: - case 0xb: - return m_acia->read(offset-8); - + uint8_t buffer = 0xff; + if (!BIT(offset, 1)) + buffer &= m_dsw1->read(); + if (!BIT(offset, 0)) + buffer &= m_dsw2->read(); + return buffer; } - - return 0; } /*------------------------------------------------- @@ -202,22 +353,23 @@ uint8_t a2bus_ssc_device::read_c0nx(uint8_t offset) void a2bus_ssc_device::write_c0nx(uint8_t offset, uint8_t data) { - switch (offset) - { - case 8: - case 9: - case 0xa: - case 0xb: - m_acia->write(offset-8, data); - break; - } + if (BIT(offset, 3)) + m_acia->write(offset & 3, data); +} + +void apricorn_ssi_device::write_c0nx(uint8_t offset, uint8_t data) +{ + if (BIT(offset, 3)) + m_acia->write(offset & 3, data); + else + m_alt_bank = true; } WRITE_LINE_MEMBER( a2bus_ssc_device::acia_irq_w ) { - if (m_started) + if (machine().ioport().safe_to_read()) { - if (!(m_dsw2->read() & 4)) + if (!(m_dswx->read() & 4)) { if (state) { diff --git a/src/devices/bus/a2bus/a2ssc.h b/src/devices/bus/a2bus/a2ssc.h index 0e298bc7d96..2e2bc8edc16 100644 --- a/src/devices/bus/a2bus/a2ssc.h +++ b/src/devices/bus/a2bus/a2ssc.h @@ -41,17 +41,38 @@ protected: virtual uint8_t read_c800(uint16_t offset) override; required_ioport m_dsw1, m_dsw2; + required_ioport m_dswx; required_device<mos6551_device> m_acia; + required_region_ptr<uint8_t> m_rom; + private: DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); +}; + +class apricorn_ssi_device : public a2bus_ssc_device +{ +public: + // construction/destruction + apricorn_ssi_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_start() override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; + + virtual void write_c0nx(uint8_t offset, uint8_t data) override; + virtual uint8_t read_cnxx(uint8_t offset) override; + virtual void write_cnxx(uint8_t offset, uint8_t data) override; + virtual uint8_t read_c800(uint16_t offset) override; - uint8_t *m_rom; - bool m_started; +private: + bool m_alt_bank; }; -// device type definition +// device type declarations DECLARE_DEVICE_TYPE(A2BUS_SSC, a2bus_ssc_device) +DECLARE_DEVICE_TYPE(APRICORN_SSI, apricorn_ssi_device) #endif // MAME_BUS_A2BUS_A2SSC_H diff --git a/src/devices/bus/a2bus/agat840k_hle.cpp b/src/devices/bus/a2bus/agat840k_hle.cpp index f46d9ae7251..6d8cbc97d0a 100644 --- a/src/devices/bus/a2bus/agat840k_hle.cpp +++ b/src/devices/bus/a2bus/agat840k_hle.cpp @@ -150,12 +150,9 @@ void a2bus_agat840k_hle_device::device_reset() for (auto &img : m_floppy_image) { - if (img.found()) - { - img->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0); - img->floppy_drive_set_rpm(300.); - img->floppy_drive_seek(-img->floppy_drive_get_current_track()); - } + img->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0); + img->floppy_drive_set_rpm(300.); + img->floppy_drive_seek(-img->floppy_drive_get_current_track()); } m_floppy = m_floppy_image[0].target(); diff --git a/src/devices/bus/a2bus/agat_fdc.cpp b/src/devices/bus/a2bus/agat_fdc.cpp index bc995dde0bb..33b4ff87339 100644 --- a/src/devices/bus/a2bus/agat_fdc.cpp +++ b/src/devices/bus/a2bus/agat_fdc.cpp @@ -384,7 +384,7 @@ uint8_t a2bus_agat_fdc_device::read_cnxx(uint8_t offset) */ uint8_t a2bus_agat_fdc_device::d14_i_b() { - u8 data = 0x3; + u8 data = 0x0; // all signals active low if (floppy) @@ -421,6 +421,16 @@ void a2bus_agat_fdc_device::d14_o_c(uint8_t data) { m_unit = BIT(data, 3); + switch (m_unit) + { + case 0: + floppy = floppy0 ? floppy0->get_device() : nullptr; + break; + case 1: + floppy = floppy1 ? floppy1->get_device() : nullptr; + break; + } + if (floppy) { floppy->dir_w(!BIT(data, 2)); diff --git a/src/devices/bus/a2bus/ccs7710.cpp b/src/devices/bus/a2bus/ccs7710.cpp new file mode 100644 index 00000000000..17f8cdfe80e --- /dev/null +++ b/src/devices/bus/a2bus/ccs7710.cpp @@ -0,0 +1,155 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/********************************************************************* + + California Computer Systems, Inc. Model 7710 + Asynchronous Serial Interface (ASI-1) + + One unusual feature of this small RS-232-C communications card + which is not relevant for emulation is that the DP8304B bus + buffer and program ROMs are powered down when they are not being + accessed. Another unemulated feature is a suggested modification + to replace the two 256×4 program ROMs with like-sized 2112 RAMs + (the R/W bus signal is enabled to these with a jumper connection) + so that custom firmware can be uploaded instead. + + The 7710-02 terminal firmware is incompatible with the Apple IIe + due to the use of a II+-specific monitor location. One recommended + way to work around this problem was to load the II+ monitor into + the IIe's language card. The incompatibility was corrected in + 7710-03, and the 7710-03 ROMs were the only ones delivered after + July 1983. + +**********************************************************************/ + +#include "emu.h" +#include "ccs7710.h" + +#include "bus/rs232/rs232.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +DEFINE_DEVICE_TYPE(A2BUS_CCS7710, ccs7710_device, "ccs7710", "CCS Model 7710 Asynchronous Serial Interface") + +//************************************************************************** +// DEVICE IMPLEMENTATION +//************************************************************************** + +ccs7710_device::ccs7710_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, A2BUS_CCS7710, tag, owner, clock) + , device_a2bus_card_interface(mconfig, *this) + , m_acia(*this, "acia") + , m_brg(*this, "brg") + , m_firmware(*this, "firmware") + , m_baud_select(*this, "BAUD") + , m_external_clock(false) +{ +} + +void ccs7710_device::device_start() +{ + save_item(NAME(m_external_clock)); +} + +u8 ccs7710_device::read_c0nx(u8 offset) +{ + return m_acia->read(offset & 1); +} + +void ccs7710_device::write_c0nx(u8 offset, u8 data) +{ + m_acia->write(offset & 1, data); +} + +u8 ccs7710_device::read_cnxx(u8 offset) +{ + return m_firmware[offset]; +} + +WRITE_LINE_MEMBER(ccs7710_device::acia_irq_w) +{ + if (state == ASSERT_LINE) + raise_slot_irq(); + else + lower_slot_irq(); +} + +WRITE_LINE_MEMBER(ccs7710_device::external_clock_w) +{ + m_external_clock = state; + if (!BIT(m_baud_select->read(), 0)) + m_brg->im_w(state); +} + +u8 ccs7710_device::baud_select_r(offs_t offset) +{ + u8 baud = m_baud_select->read(); + m_brg->im_w(BIT(baud, 0) ? !BIT(offset, 2) : m_external_clock); + return baud; +} + +static INPUT_PORTS_START(ccs7710) + PORT_START("BAUD") + PORT_DIPNAME(0xf, 0x8, "Baud Rate") PORT_DIPLOCATION("S1:1,2,3,4") + PORT_DIPSETTING(0x0, "External") + PORT_DIPSETTING(0x2, "50") + PORT_DIPSETTING(0x3, "75") + PORT_DIPSETTING(0xf, "110") + PORT_DIPSETTING(0x4, "134.5") + PORT_DIPSETTING(0xe, "150") + PORT_DIPSETTING(0x5, "200") + PORT_DIPSETTING(0xd, "300") + PORT_DIPSETTING(0x6, "600") + PORT_DIPSETTING(0xb, "1200") + PORT_DIPSETTING(0xa, "1800") + PORT_DIPSETTING(0x7, "2400") + PORT_DIPSETTING(0x9, "4800") + PORT_DIPSETTING(0x8, "9600") + PORT_DIPSETTING(0x1, "19200") +INPUT_PORTS_END + +ioport_constructor ccs7710_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(ccs7710); +} + +void ccs7710_device::device_add_mconfig(machine_config &config) +{ + ACIA6850(config, m_acia); + m_acia->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_acia->irq_handler().set(FUNC(ccs7710_device::acia_irq_w)); + + F4702(config, m_brg, 2.4576_MHz_XTAL); + m_brg->s_callback().set(FUNC(ccs7710_device::baud_select_r)); + m_brg->z_callback().set(m_acia, FUNC(acia6850_device::write_rxc)); + m_brg->z_callback().append(m_acia, FUNC(acia6850_device::write_txc)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd)); + rs232.cts_handler().set(m_acia, FUNC(acia6850_device::write_cts)); + rs232.dcd_handler().set(m_acia, FUNC(acia6850_device::write_dcd)); + rs232.txc_handler().set(FUNC(ccs7710_device::external_clock_w)); +} + +ROM_START(ccs7710) + ROM_REGION(0x100, "firmware", 0) + ROM_DEFAULT_BIOS("7710-03") + ROM_SYSTEM_BIOS(0, "7710-01", "CCS 7710-01") + ROMX_LOAD("7710-01h.u5", 0x000, 0x100, CRC(4f4b1023) SHA1(4f96f9cbbad383c259d4a3f8762263d01532c735), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) + ROMX_LOAD("7710-01l.u6", 0x000, 0x100, CRC(1dab7113) SHA1(c9c7b8b73db90fa008c8779b1d75ac265ec6ca2f), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) + ROM_SYSTEM_BIOS(1, "7710-02", "CCS 7710-02") + ROMX_LOAD("7710-02h.u5", 0x000, 0x100, CRC(46ded0cc) SHA1(62a087e3a1790a9910561d84001acaa9ec804194), ROM_BIOS(1) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) + ROMX_LOAD("7710-02l.u6", 0x000, 0x100, CRC(d4922d69) SHA1(a651dbd3faba9476aff382952266188f3cb05f16), ROM_BIOS(1) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) + ROM_SYSTEM_BIOS(2, "7710-03", "CCS 7710-03") + ROMX_LOAD("7710-03h.u5", 0x000, 0x100, CRC(a2cdb6bd) SHA1(6ecfb6b145256d4787a943da8ef267303df562d6), ROM_BIOS(2) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) + ROMX_LOAD("7710-03l.u6", 0x000, 0x100, CRC(18e3983f) SHA1(d0df2aaf0134f8c1b929a4de0036fedc7e7164e2), ROM_BIOS(2) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) +ROM_END + +const tiny_rom_entry *ccs7710_device::device_rom_region() const +{ + return ROM_NAME(ccs7710); +} diff --git a/src/devices/bus/a2bus/ccs7710.h b/src/devices/bus/a2bus/ccs7710.h new file mode 100644 index 00000000000..3c65b9b783f --- /dev/null +++ b/src/devices/bus/a2bus/ccs7710.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/********************************************************************* + + CCS Model 7710 Asynchronous Serial Interface + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_CCS7710_H +#define MAME_BUS_A2BUS_CCS7710_H + +#pragma once + +#include "a2bus.h" +#include "machine/6850acia.h" +#include "machine/f4702.h" + +class ccs7710_device : public device_t, public device_a2bus_card_interface +{ +public: + // device type constructor + ccs7710_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // device_a2bus_card_interface overrides + virtual u8 read_c0nx(u8 offset) override; + virtual void write_c0nx(u8 offset, u8 data) override; + virtual u8 read_cnxx(u8 offset) override; + +private: + // miscellaneous handlers + DECLARE_WRITE_LINE_MEMBER(acia_irq_w); + DECLARE_WRITE_LINE_MEMBER(external_clock_w); + u8 baud_select_r(offs_t offset); + + // object finders + required_device<acia6850_device> m_acia; + required_device<f4702_device> m_brg; + required_region_ptr<u8> m_firmware; + required_ioport m_baud_select; + + // internal state + bool m_external_clock; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(A2BUS_CCS7710, ccs7710_device) + +#endif // MAME_BUS_A2BUS_CCS7710_H diff --git a/src/devices/bus/a2bus/mouse.cpp b/src/devices/bus/a2bus/mouse.cpp index e5c2e7fcf84..414338bf8ad 100644 --- a/src/devices/bus/a2bus/mouse.cpp +++ b/src/devices/bus/a2bus/mouse.cpp @@ -40,8 +40,8 @@ Hookup notes: - PIA port A connects to 68705 port A in its entirety (bi-directional) - PIA PB4-PB7 connects to 68705 PC0-3 (bi-directional) + PIA port A connects to 68705 port A in its entirety (bi-directional with internal pullups) + PIA PB4-PB7 connects to 68705 PC0-3 (bi-directional but should not be pulled up) PIA PB0 is 'sync latch' PIA PB1 is A8 on the EPROM PIA PB2 is A9 on the EPROM @@ -139,6 +139,7 @@ void a2bus_mouse_device::device_add_mconfig(machine_config &config) PIA6821(config, m_pia, 1021800); m_pia->writepa_handler().set(FUNC(a2bus_mouse_device::pia_out_a)); m_pia->writepb_handler().set(FUNC(a2bus_mouse_device::pia_out_b)); + m_pia->tspb_handler().set_constant(0x00); m_pia->irqa_handler().set(FUNC(a2bus_mouse_device::pia_irqa_w)); m_pia->irqb_handler().set(FUNC(a2bus_mouse_device::pia_irqb_w)); } @@ -186,15 +187,11 @@ void a2bus_mouse_device::device_start() save_item(NAME(m_port_b_in)); save_item(NAME(m_last)); save_item(NAME(m_count)); - - m_port_b_in = 0x00; } void a2bus_mouse_device::device_reset() { - m_rom_bank = 0; m_last[0] = m_last[1] = m_count[0] = m_count[1] = 0; - m_port_a_in = 0x00; } /*------------------------------------------------- @@ -231,7 +228,7 @@ void a2bus_mouse_device::pia_out_a(uint8_t data) void a2bus_mouse_device::pia_out_b(uint8_t data) { - m_mcu->pc_w(0xf0 | ((data >> 4) & 0x0f)); + m_mcu->pc_w(data >> 4); m_rom_bank = (data & 0xe) << 7; } diff --git a/src/devices/bus/a2bus/pc_xporter.cpp b/src/devices/bus/a2bus/pc_xporter.cpp index 34be42c7557..1cfa36797d6 100644 --- a/src/devices/bus/a2bus/pc_xporter.cpp +++ b/src/devices/bus/a2bus/pc_xporter.cpp @@ -164,10 +164,9 @@ void a2bus_pcxporter_device::device_add_mconfig(machine_config &config) m_isabus->drq2_callback().set(m_dma8237, FUNC(am9517a_device::dreq2_w)); m_isabus->drq3_callback().set(m_dma8237, FUNC(am9517a_device::dreq3_w)); - PC_KBDC(config, m_pc_kbdc, 0); + PC_KBDC(config, m_pc_kbdc, pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270); m_pc_kbdc->out_clock_cb().set(FUNC(a2bus_pcxporter_device::keyboard_clock_w)); m_pc_kbdc->out_data_cb().set(FUNC(a2bus_pcxporter_device::keyboard_data_w)); - PC_KBDC_SLOT(config, "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270).set_pc_kbdc_slot(m_pc_kbdc); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -190,7 +189,7 @@ a2bus_pcxporter_device::a2bus_pcxporter_device(const machine_config &mconfig, de m_pit8253(*this, "pit8253"), m_speaker(*this, "speaker"), m_isabus(*this, "isa"), - m_pc_kbdc(*this, "pc_kbdc") + m_pc_kbdc(*this, "kbd") { } diff --git a/src/devices/bus/a2bus/suprterminal.cpp b/src/devices/bus/a2bus/suprterminal.cpp new file mode 100644 index 00000000000..aa3d31d96d8 --- /dev/null +++ b/src/devices/bus/a2bus/suprterminal.cpp @@ -0,0 +1,215 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + suprterminal.cpp + M&R Enterprises SUP'R'TERMINAL 80-column card. + + This card only works in Slot 3. The firmware will crash in any other slot. + Emulation tested and works with DOS 3.3, ProDOS, and CP/M. + + $C0B2: Select VRAM at $C800 and disable ROM at $C800 + $C0B4: Select font RAM at $C800 and disable ROM at $C800 + $C0B6: Select bank 2 of (VRAM? font RAM?). This is unused on this card, + and there are not enough DRAMs (or places for them!) to make it work. + $C0B8: 6845 address + $C0B9: 6845 data + + The $C800 handling on this card is unusual. + Disabling the card's $C800 space by accessing $CFFF resets the card to ROM + at $C800. Enabling either VRAM or font RAM at $C800 disables ROM until + $CFFF is accessed. + +*********************************************************************/ + +#include "emu.h" +#include "suprterminal.h" +#include "screen.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(A2BUS_SUPRTERMINAL, a2bus_suprterminal_device, "a2suprterm", "M&R Enterprises SUP'R'TERMINAL") + +ROM_START(a2suprterm) + ROM_REGION(0x800, "s3firmware", ROMREGION_ERASEFF) + ROM_LOAD("suprterminal.bin", 0x000000, 0x000800, CRC(4c49b0f5) SHA1(66a7411c46c04a8089a7ddfb5ffd9809dd08a21f)) +ROM_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void a2bus_suprterminal_device::device_add_mconfig(machine_config &config) +{ + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(17.43_MHz_XTAL, 1116, 0, 720, 260, 0, 216); + screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update)); + + HD6845S(config, m_crtc, 17.43_MHz_XTAL / 9); + m_crtc->set_screen("screen"); + m_crtc->set_show_border_area(false); + m_crtc->set_char_width(9); + m_crtc->set_update_row_callback(FUNC(a2bus_suprterminal_device::crtc_update_row)); +} + +const tiny_rom_entry *a2bus_suprterminal_device::device_rom_region() const +{ + return ROM_NAME(a2suprterm); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_suprterminal_device::a2bus_suprterminal_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + a2bus_suprterminal_device(mconfig, A2BUS_SUPRTERMINAL, tag, owner, clock) +{ +} + +a2bus_suprterminal_device::a2bus_suprterminal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, type, tag, owner, clock), + device_a2bus_card_interface(mconfig, *this), + m_crtc(*this, "crtc"), + m_rom(*this, "s3firmware") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_suprterminal_device::device_start() +{ + m_vram = std::make_unique<u8[]>(0x800); // 4 2114 DRAMs + m_fontram = std::make_unique<u8[]>(0x400); // 2 2114 DRAMs + + m_bRasterRAM = true; + m_bCharBank1 = false; + + save_item(NAME(m_bRasterRAM)); + save_item(NAME(m_bCharBank1)); + save_item(NAME(m_bC800IsRAM)); + save_pointer(NAME(m_vram), 0x800); + save_pointer(NAME(m_fontram), 0x400); +} + +void a2bus_suprterminal_device::device_reset() +{ +} + +u8 a2bus_suprterminal_device::read_cnxx(u8 offset) +{ + return m_rom[offset+0x300]; +} + +u8 a2bus_suprterminal_device::read_c0nx(u8 offset) +{ + switch (offset) + { + case 9: + return m_crtc->register_r(); + } + + return 0xff; +} + +void a2bus_suprterminal_device::write_c0nx(u8 offset, u8 data) +{ + switch (offset) + { + case 2: + m_bRasterRAM = true; + m_bC800IsRAM = true; + break; + + case 4: + m_bRasterRAM = false; + m_bC800IsRAM = true; + break; + + case 6: + m_bCharBank1 ^= 1; + break; + + case 8: + m_crtc->address_w(data); + break; + + case 9: + m_crtc->register_w(data); + break; + } +} + +u8 a2bus_suprterminal_device::read_c800(u16 offset) +{ + if (!machine().side_effects_disabled()) + { + if (offset == 0x7ff) + { + m_bC800IsRAM = false; + } + } + + if (m_bC800IsRAM) + { + if (!m_bRasterRAM) + { + return m_vram[offset]; + } + else + { + return m_fontram[offset&0x3ff]; + } + } + + return m_rom[offset]; +} + +/*------------------------------------------------- + write_c800 - called for writes to this card's c800 space +-------------------------------------------------*/ +void a2bus_suprterminal_device::write_c800(u16 offset, u8 data) +{ + if (offset == 0x7ff) + { + m_bC800IsRAM = false; + } + + if (!m_bRasterRAM) + { + m_vram[offset] = data; + } + else + { + m_fontram[offset&0x3ff] = data; + } +} + +MC6845_UPDATE_ROW(a2bus_suprterminal_device::crtc_update_row) +{ + u32 *p = &bitmap.pix(y); + u16 chr_base = ra; + + for (int i = 0; i < x_count; i++) + { + u16 offset = (ma + i) & 0x7ff; + u8 chr = m_vram[offset] & 0x7f; + u8 data = m_fontram[chr_base + chr * 8]; + rgb_t fg = rgb_t::white(); + rgb_t bg = rgb_t::black(); + + if (i == cursor_x) + { + std::swap(fg, bg); + } + + for (int j = 9; j > 0; j--) + { + *p++ = BIT(data, 7) ? fg : bg; + data <<= 1; + } + } +} diff --git a/src/devices/bus/a2bus/suprterminal.h b/src/devices/bus/a2bus/suprterminal.h new file mode 100644 index 00000000000..f1aa9c2b4f0 --- /dev/null +++ b/src/devices/bus/a2bus/suprterminal.h @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + suprterminal.h + + M&R Enterprises SUP'R'TERMINAL 80-column card + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_SUPRTERMINAL_H +#define MAME_BUS_A2BUS_SUPRTERMINAL_H + +#pragma once + +#include "a2bus.h" +#include "video/mc6845.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_suprterminal_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_suprterminal_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + a2bus_suprterminal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // overrides of standard a2bus slot functions + virtual u8 read_cnxx(u8 offset) override; + virtual u8 read_c0nx(u8 offset) override; + virtual void write_c0nx(u8 offset, u8 data) override; + virtual u8 read_c800(u16 offset) override; + virtual void write_c800(u16 offset, u8 data) override; + virtual bool take_c800() override { return true; } + +private: + required_device<mc6845_device> m_crtc; + required_region_ptr<u8> m_rom; + + MC6845_UPDATE_ROW(crtc_update_row); + + std::unique_ptr<u8[]> m_vram; + std::unique_ptr<u8[]> m_fontram; +// u8 m_fontram[0x400]; + bool m_bRasterRAM, m_bCharBank1, m_bC800IsRAM; +}; + +// device type definition +DECLARE_DEVICE_TYPE(A2BUS_SUPRTERMINAL, a2bus_suprterminal_device) + +#endif // MAME_BUS_A2BUS_SUPRTERMINAL_H diff --git a/src/devices/bus/a2bus/uniprint.cpp b/src/devices/bus/a2bus/uniprint.cpp new file mode 100644 index 00000000000..f98e2a44a45 --- /dev/null +++ b/src/devices/bus/a2bus/uniprint.cpp @@ -0,0 +1,219 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, R. Belmont +#include "emu.h" +#include "uniprint.h" + +//#define VERBOSE 1 +//#define LOG_OUTPUT_FUNC osd_printf_info +#include "logmacro.h" + +namespace { + +ROM_START(uniprint) + ROM_REGION(0x1000, "rom", 0) + ROM_LOAD("videx_uniprint_2732a.bin", 0x000000, 0x001000, CRC(e8423ef6) SHA1(0a2789ec2cb28f10a2836a91feabc24ceca8f142)) +ROM_END + +INPUT_PORTS_START(uniprint) + PORT_START("S1") + PORT_DIPNAME(0x70, 0x00, "Printer Type") PORT_DIPLOCATION("S1:1,2,3") + PORT_DIPSETTING( 0x00, "Apple DMP/C. Itoh 8510/NEC 8023A/Leading Edge Prowriter") + PORT_DIPSETTING( 0x10, "Epson MX, FX, RX/Mannesman Tally 160L, Sprit-80") + PORT_DIPSETTING( 0x20, "Star Gemini 10, 15") + PORT_DIPSETTING( 0x30, "Data Products (IDS) 440, 460, Prism, uPrism/Okidata 82A, 83A, 93A") + PORT_DIPSETTING( 0x40, "Anadex 9000, 9000A, 9001, 9001A, 9500A, 9501, 9501A") + PORT_DIPSETTING( 0x50, "Leading Edge Gorilla Banana/Commodore VIC Printer/Radio Shack DMP-100/Sekiosha GP-100A") + PORT_DIPSETTING( 0x60, "Centronics 739-1") + PORT_DIPSETTING( 0x70, "Reserved") + PORT_DIPNAME(0x0c, 0x00, "Default Page Width") PORT_DIPLOCATION("S1:4,5") + PORT_DIPSETTING( 0x00, "No Width") + PORT_DIPSETTING( 0x04, "80 Columns") + PORT_DIPSETTING( 0x08, "96 Columns") + PORT_DIPSETTING( 0x0c, "132 Columns") + PORT_DIPNAME(0x03, 0x00, "Default Page Length") PORT_DIPLOCATION("S1:6,7") + PORT_DIPSETTING( 0x00, "No Length") + PORT_DIPSETTING( 0x01, "54 Lines") + PORT_DIPSETTING( 0x02, "57 Lines") + PORT_DIPSETTING( 0x03, "60 Lines") + + PORT_START("S2") + PORT_DIPNAME(0x01, 0x01, "Strobe Polarity") PORT_DIPLOCATION("S1:8") + PORT_DIPSETTING( 0x00, "Positive") + PORT_DIPSETTING( 0x01, "Negative") + PORT_DIPNAME(0x02, 0x02, "Acknowledge Polarity") PORT_DIPLOCATION("S1:9") + PORT_DIPSETTING( 0x00, "Positive") + PORT_DIPSETTING( 0x02, "Negative") +INPUT_PORTS_END + +} // anonymous namespace + + + +DEFINE_DEVICE_TYPE(A2BUS_UNIPRINT, a2bus_uniprint_device, "a2uniprint", "Videx Uniprint Printer Interface") + +a2bus_uniprint_device::a2bus_uniprint_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : + device_t(mconfig, A2BUS_UNIPRINT, tag, owner, clock), + device_a2bus_card_interface(mconfig, *this), + m_printer_conn(*this, "prn"), + m_printer_out(*this, "prn_out"), + m_s1(*this, "S1"), + m_s2(*this, "S2"), + m_rom(*this, "rom"), + m_strobe_timer(nullptr), + m_data_latch(0xffU), + m_ack_latch(0x01U), + m_next_strobe(1U), + m_ack_in(1U) +{ +} + + + +//---------------------------------------------- +// DIP switch handlers +//---------------------------------------------- + +INPUT_CHANGED_MEMBER(a2bus_uniprint_device::sw_msb) +{ + if (BIT(m_data_latch, 7)) + m_printer_out->write(m_data_latch & (BIT(m_s1->read(), 3) ? 0xffU : 0x7fU)); +} + + + +//---------------------------------------------- +// device_a2bus_card_interface implementation +//---------------------------------------------- + +// address lines are connected only to the EPROM, so all C0NX accesses are the same +u8 a2bus_uniprint_device::read_c0nx(u8 offset) +{ + // inverted /ACK? + if (m_s2->read() & 0x02U) + { + return (m_s1->read() & 0x07FU) | ((m_ack_latch ^ 1) << 7); + } + + return (m_s1->read() & 0x07FU) | (m_ack_latch << 7); +} + +void a2bus_uniprint_device::write_c0nx(u8 offset, u8 data) +{ + m_data_latch = data; + m_printer_out->write(data); + + // clearing the ACK latch will acknowledge an interrupt + if (m_ack_in) + { + m_ack_latch = 0x00U; + } + else + { + LOG("/ACK asserted, not clearing acknowledge latch\n"); + } + + // generate strobe pulse after one clock cycle + m_next_strobe = 0U; + if (!m_strobe_timer->enabled()) + { + LOG("Start strobe timer\n"); + m_strobe_timer->adjust(attotime::from_ticks(1, clock())); + } +} + +u8 a2bus_uniprint_device::read_cnxx(u8 offset) +{ + return m_rom[offset + (slotno() * 0x100)]; +} + +u8 a2bus_uniprint_device::read_c800(u16 offset) +{ + return m_rom[offset + 0x800]; +} + + +//---------------------------------------------- +// device_t implementation +//---------------------------------------------- + +tiny_rom_entry const *a2bus_uniprint_device::device_rom_region() const +{ + return ROM_NAME(uniprint); +} + + +void a2bus_uniprint_device::device_add_mconfig(machine_config &config) +{ + CENTRONICS(config, m_printer_conn, centronics_devices, "printer"); + m_printer_conn->ack_handler().set(FUNC(a2bus_uniprint_device::ack_w)); + + OUTPUT_LATCH(config, m_printer_out); + m_printer_conn->set_output_latch(*m_printer_out); +} + + +ioport_constructor a2bus_uniprint_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(uniprint); +} + + +void a2bus_uniprint_device::device_start() +{ + m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_uniprint_device::update_strobe), this)); + + m_next_strobe = 1U; + + save_item(NAME(m_data_latch)); + save_item(NAME(m_ack_latch)); + save_item(NAME(m_next_strobe)); + save_item(NAME(m_ack_in)); + + m_strobe_timer->adjust(attotime::from_ticks(1, clock())); +} + + +void a2bus_uniprint_device::device_reset() +{ + m_ack_latch = 0x01U; +} + + + +//---------------------------------------------- +// printer status inputs +//---------------------------------------------- + +WRITE_LINE_MEMBER(a2bus_uniprint_device::ack_w) +{ + if (bool(state) != bool(m_ack_in)) + { + LOG("/ACK=%d\n", state); + m_ack_in = state ? 1U : 0U; + if (!state) + { + if (!m_ack_latch) + LOG("Set acknowledge latch\n"); + else + LOG("No data written since previous acknowledge\n"); + m_ack_latch = 0x01U; + } + } +} + +//---------------------------------------------- +// timer handlers +//---------------------------------------------- + +TIMER_CALLBACK_MEMBER(a2bus_uniprint_device::update_strobe) +{ + LOG("Output /STROBE=%u\n", m_next_strobe); + // invert strobe if DIP set to positive polarity + m_printer_conn->write_strobe(m_next_strobe ^ (m_s2->read() & 0x01) ? 0 : 1); + if (!m_next_strobe) + { + LOG("Start strobe timer\n"); + m_next_strobe = 1U; + m_strobe_timer->adjust(attotime::from_ticks(1, clock())); + } +} diff --git a/src/devices/bus/a2bus/uniprint.h b/src/devices/bus/a2bus/uniprint.h new file mode 100644 index 00000000000..416ad6e8f54 --- /dev/null +++ b/src/devices/bus/a2bus/uniprint.h @@ -0,0 +1,75 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, R. Belmont +/*********************************************************************** + + Videx Uniprint Parallel Interface Card + + Manual, including schematic and theory of operation: + https://www.apple.asimov.net/documentation/hardware/io/Videx%20UniPrint%20Manual.pdf + + Connector P2 pinout (pins 1 and 11 are at the top of the card): + STB 1 11 GND + D0 2 12 GND + D1 3 13 GND + D2 4 14 GND + D3 5 15 GND + D4 6 16 GND + D5 7 17 GND + D6 8 18 GND + D7 9 19 GND + ACK 10 20 GND + +***********************************************************************/ +#ifndef MAME_BUS_A2BUS_UNIPRINT_H +#define MAME_BUS_A2BUS_UNIPRINT_H + +#pragma once + +#include "a2bus.h" +#include "bus/centronics/ctronics.h" + +class a2bus_uniprint_device : public device_t, public device_a2bus_card_interface +{ +public: + a2bus_uniprint_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); + + // DIP switch handlers + DECLARE_INPUT_CHANGED_MEMBER(sw_msb); + + // device_a2bus_card_interface implementation + virtual u8 read_c0nx(u8 offset) override; + virtual void write_c0nx(u8 offset, u8 data) override; + virtual u8 read_cnxx(u8 offset) override; + virtual u8 read_c800(u16 offset) override; + +protected: + // device_t implementation + virtual tiny_rom_entry const *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_start() override; + virtual void device_reset() override; + + // timer handlers + TIMER_CALLBACK_MEMBER(update_strobe); + +private: + // printer status inputs + DECLARE_WRITE_LINE_MEMBER(ack_w); + + required_device<centronics_device> m_printer_conn; + required_device<output_latch_device> m_printer_out; + required_ioport m_s1, m_s2; + required_region_ptr<u8> m_rom; + emu_timer * m_strobe_timer; + + u8 m_data_latch; // U6 + u8 m_ack_latch; // U2 (pin 9) + u8 m_next_strobe; // U4 (pin 5) + u8 m_ack_in; // printer connector pin 10 +}; + + +DECLARE_DEVICE_TYPE(A2BUS_UNIPRINT, a2bus_uniprint_device) + +#endif // MAME_BUS_A2BUS_UNIPRINT_H diff --git a/src/devices/bus/a7800/a78_slot.cpp b/src/devices/bus/a7800/a78_slot.cpp index 1103c177822..035fc258561 100644 --- a/src/devices/bus/a7800/a78_slot.cpp +++ b/src/devices/bus/a7800/a78_slot.cpp @@ -25,7 +25,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "a78_slot.h" @@ -315,7 +314,7 @@ static int a78_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/a800/a800_slot.cpp b/src/devices/bus/a800/a800_slot.cpp index a6a2867f874..9ccbb170e1f 100644 --- a/src/devices/bus/a800/a800_slot.cpp +++ b/src/devices/bus/a800/a800_slot.cpp @@ -20,7 +20,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "a800_slot.h" @@ -207,7 +206,7 @@ static int a800_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/abcbus/abc890.cpp b/src/devices/bus/abcbus/abc890.cpp index 27530439929..9374096f38b 100644 --- a/src/devices/bus/abcbus/abc890.cpp +++ b/src/devices/bus/abcbus/abc890.cpp @@ -192,7 +192,7 @@ void abc890_device::device_reset() void abc890_device::abcbus_cs(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_cs(data); } @@ -205,7 +205,7 @@ uint8_t abc890_device::abcbus_inp() { uint8_t data = 0xff; - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) data &= slot.read_inp(); return data; @@ -218,7 +218,7 @@ uint8_t abc890_device::abcbus_inp() void abc890_device::abcbus_out(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_out(data); } @@ -231,7 +231,7 @@ uint8_t abc890_device::abcbus_stat() { uint8_t data = 0xff; - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) data &= slot.read_stat(); return data; @@ -244,7 +244,7 @@ uint8_t abc890_device::abcbus_stat() void abc890_device::abcbus_c1(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_c1(data); } @@ -255,7 +255,7 @@ void abc890_device::abcbus_c1(uint8_t data) void abc890_device::abcbus_c2(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_c2(data); } @@ -266,7 +266,7 @@ void abc890_device::abcbus_c2(uint8_t data) void abc890_device::abcbus_c3(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_c3(data); } @@ -277,7 +277,7 @@ void abc890_device::abcbus_c3(uint8_t data) void abc890_device::abcbus_c4(uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) slot.write_c4(data); } @@ -290,7 +290,7 @@ uint8_t abc890_device::abcbus_xmemfl(offs_t offset) { uint8_t data = 0xff; - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) { data &= slot.xmemfl_r(offset); } @@ -305,7 +305,7 @@ uint8_t abc890_device::abcbus_xmemfl(offs_t offset) void abc890_device::abcbus_xmemw(offs_t offset, uint8_t data) { - for (abcbus_slot_device &slot : abcbus_slot_device_iterator(*this)) + for (abcbus_slot_device &slot : abcbus_slot_device_enumerator(*this)) { slot.xmemw_w(offset, data); } diff --git a/src/devices/bus/abcbus/abcbus.cpp b/src/devices/bus/abcbus/abcbus.cpp index 714c4608975..9b24210bd3b 100644 --- a/src/devices/bus/abcbus/abcbus.cpp +++ b/src/devices/bus/abcbus/abcbus.cpp @@ -89,9 +89,10 @@ void abcbus_slot_device::device_start() // slot devices #include "abc890.h" #include "cadmouse.h" -#include "db411223.h" +#include "db4106.h" +#include "db4107.h" +#include "db4112.h" #include "fd2.h" -#include "hdc.h" #include "lux10828.h" #include "lux21046.h" #include "lux21056.h" @@ -116,7 +117,9 @@ void abc80_cards(device_slot_interface &device) device.option_add("abc830", ABC830); device.option_add("abcexp", ABC_EXPANSION_UNIT); device.option_add("cadabc", ABC_CADMOUSE); - device.option_add("db411223", DATABOARD_4112_23); + device.option_add("db4106", DATABOARD_4106); + device.option_add("db4107", DATABOARD_4107); + device.option_add("db4112", DATABOARD_4112); device.option_add("fd2", ABC_FD2); device.option_add("memcard", ABC_MEMORY_CARD); device.option_add("slow", LUXOR_55_10828); @@ -141,8 +144,9 @@ void abcbus_cards(device_slot_interface &device) device.option_add("abc856", ABC856); device.option_add("abc890", ABC890); device.option_add("abc894", ABC894); - device.option_add("db411223", DATABOARD_4112_23); - device.option_add("hdc", ABC_HDC); + device.option_add("db4106", DATABOARD_4106); + device.option_add("db4107", DATABOARD_4107); + device.option_add("db4112", DATABOARD_4112); device.option_add("sio", ABC_SIO); device.option_add("slow", LUXOR_55_10828); device.option_add("slutprov", ABC_SLUTPROV); diff --git a/src/devices/bus/abcbus/abcbus.h b/src/devices/bus/abcbus/abcbus.h index 1c5721650e4..c25cc8b51f2 100644 --- a/src/devices/bus/abcbus/abcbus.h +++ b/src/devices/bus/abcbus/abcbus.h @@ -271,7 +271,7 @@ void abcbus_cards(device_slot_interface &device); void abc1600bus_cards(device_slot_interface &device); -typedef device_type_iterator<abcbus_slot_device> abcbus_slot_device_iterator; +typedef device_type_enumerator<abcbus_slot_device> abcbus_slot_device_enumerator; #endif // MAME_DEVICES_ABCBUS_ABCBUS_H diff --git a/src/devices/bus/abcbus/db411223.cpp b/src/devices/bus/abcbus/db4106.cpp index f07e4bfcb70..edd604f610c 100644 --- a/src/devices/bus/abcbus/db411223.cpp +++ b/src/devices/bus/abcbus/db4106.cpp @@ -2,12 +2,12 @@ // copyright-holders:Curt Coder /********************************************************************** - Databoard 4112-23 floppy disk controller emulation + DataBoard 4106 Minifloppy interface emulation *********************************************************************/ #include "emu.h" -#include "db411223.h" +#include "db4106.h" @@ -22,16 +22,16 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(DATABOARD_4112_23, abc_databoard_4112_23_device, "abc_db411223", "Databoard 4112-23") +DEFINE_DEVICE_TYPE(DATABOARD_4106, databoard_4106_device, "abc_db4106", "DataBoard 4106 Minifloppy interface") //------------------------------------------------- -// ROM( databoard_4112_23 ) +// ROM( databoard_4106 ) //------------------------------------------------- -ROM_START( databoard_4112_23 ) - ROM_REGION( 0x2000, Z80_TAG, 0 ) - ROM_LOAD("fpy_int_4112-23_teac_fd55.bin", 0x0000, 0x2000, CRC(9175ceb8) SHA1(95c150d3152df318abd9267915d5669d2ec33895)) +ROM_START( databoard_4106 ) + ROM_REGION( 0x800, Z80_TAG, 0 ) + ROM_LOAD("databoard-4106-a5.12-floppy-cont.bin", 0x000, 0x800, CRC(708f2a2f) SHA1(3f99ea2ef301d9e3415db152dad79171dc62cc2d) ) // single track controller ROM_END @@ -39,27 +39,27 @@ ROM_END // rom_region - device-specific ROM region //------------------------------------------------- -const tiny_rom_entry *abc_databoard_4112_23_device::device_rom_region() const +const tiny_rom_entry *databoard_4106_device::device_rom_region() const { - return ROM_NAME( databoard_4112_23 ); + return ROM_NAME( databoard_4106 ); } //------------------------------------------------- -// ADDRESS_MAP( databoard_4112_23_mem ) +// ADDRESS_MAP( databoard_4106_mem ) //------------------------------------------------- -void abc_databoard_4112_23_device::databoard_4112_23_mem(address_map &map) +void databoard_4106_device::databoard_4106_mem(address_map &map) { - map(0x0000, 0x1fff).rom().region(Z80_TAG, 0); + map(0x0000, 0x07ff).rom().region(Z80_TAG, 0); } //------------------------------------------------- -// ADDRESS_MAP( databoard_4112_23_io ) +// ADDRESS_MAP( databoard_4106_io ) //------------------------------------------------- -void abc_databoard_4112_23_device::databoard_4112_23_io(address_map &map) +void databoard_4106_device::databoard_4106_io(address_map &map) { } @@ -68,19 +68,19 @@ void abc_databoard_4112_23_device::databoard_4112_23_io(address_map &map) // device_add_mconfig - add device configuration //------------------------------------------------- -void abc_databoard_4112_23_device::device_add_mconfig(machine_config &config) +void databoard_4106_device::device_add_mconfig(machine_config &config) { Z80(config, m_maincpu, 4000000); - m_maincpu->set_addrmap(AS_PROGRAM, &abc_databoard_4112_23_device::databoard_4112_23_mem); - m_maincpu->set_addrmap(AS_IO, &abc_databoard_4112_23_device::databoard_4112_23_io); + m_maincpu->set_memory_map(&databoard_4106_device::databoard_4106_mem); + m_maincpu->set_io_map(&databoard_4106_device::databoard_4106_io); } //------------------------------------------------- -// INPUT_PORTS( databoard_4112_23 ) +// INPUT_PORTS( databoard_4106 ) //------------------------------------------------- -INPUT_PORTS_START( databoard_4112_23 ) +INPUT_PORTS_START( databoard_4106 ) INPUT_PORTS_END @@ -88,9 +88,9 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor abc_databoard_4112_23_device::device_input_ports() const +ioport_constructor databoard_4106_device::device_input_ports() const { - return INPUT_PORTS_NAME( databoard_4112_23 ); + return INPUT_PORTS_NAME( databoard_4106 ); } @@ -100,11 +100,11 @@ ioport_constructor abc_databoard_4112_23_device::device_input_ports() const //************************************************************************** //------------------------------------------------- -// abc_databoard_4112_23_device - constructor +// databoard_4106_device - constructor //------------------------------------------------- -abc_databoard_4112_23_device::abc_databoard_4112_23_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, DATABOARD_4112_23, tag, owner, clock), +databoard_4106_device::databoard_4106_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, DATABOARD_4106, tag, owner, clock), device_abcbus_card_interface(mconfig, *this), m_maincpu(*this, Z80_TAG) { @@ -115,7 +115,7 @@ abc_databoard_4112_23_device::abc_databoard_4112_23_device(const machine_config // device_start - device-specific startup //------------------------------------------------- -void abc_databoard_4112_23_device::device_start() +void databoard_4106_device::device_start() { } @@ -124,7 +124,7 @@ void abc_databoard_4112_23_device::device_start() // device_reset - device-specific reset //------------------------------------------------- -void abc_databoard_4112_23_device::device_reset() +void databoard_4106_device::device_reset() { m_cs = false; } @@ -139,7 +139,7 @@ void abc_databoard_4112_23_device::device_reset() // abcbus_cs - //------------------------------------------------- -void abc_databoard_4112_23_device::abcbus_cs(uint8_t data) +void databoard_4106_device::abcbus_cs(uint8_t data) { } @@ -148,7 +148,7 @@ void abc_databoard_4112_23_device::abcbus_cs(uint8_t data) // abcbus_stat - //------------------------------------------------- -uint8_t abc_databoard_4112_23_device::abcbus_stat() +uint8_t databoard_4106_device::abcbus_stat() { uint8_t data = 0xff; @@ -164,7 +164,7 @@ uint8_t abc_databoard_4112_23_device::abcbus_stat() // abcbus_inp - //------------------------------------------------- -uint8_t abc_databoard_4112_23_device::abcbus_inp() +uint8_t databoard_4106_device::abcbus_inp() { uint8_t data = 0xff; @@ -180,7 +180,7 @@ uint8_t abc_databoard_4112_23_device::abcbus_inp() // abcbus_out - //------------------------------------------------- -void abc_databoard_4112_23_device::abcbus_out(uint8_t data) +void databoard_4106_device::abcbus_out(uint8_t data) { if (!m_cs) return; } @@ -190,7 +190,7 @@ void abc_databoard_4112_23_device::abcbus_out(uint8_t data) // abcbus_c1 - //------------------------------------------------- -void abc_databoard_4112_23_device::abcbus_c1(uint8_t data) +void databoard_4106_device::abcbus_c1(uint8_t data) { if (m_cs) { @@ -202,7 +202,7 @@ void abc_databoard_4112_23_device::abcbus_c1(uint8_t data) // abcbus_c3 - //------------------------------------------------- -void abc_databoard_4112_23_device::abcbus_c3(uint8_t data) +void databoard_4106_device::abcbus_c3(uint8_t data) { if (m_cs) { diff --git a/src/devices/bus/abcbus/db411223.h b/src/devices/bus/abcbus/db4106.h index 4618aaf6cd6..3c2e5f0c6b7 100644 --- a/src/devices/bus/abcbus/db411223.h +++ b/src/devices/bus/abcbus/db4106.h @@ -2,12 +2,12 @@ // copyright-holders:Curt Coder /********************************************************************** - Databoard 4112-23 floppy disk controller emulation + DataBoard 4106 Minifloppy interface emulation *********************************************************************/ -#ifndef MAME_BUS_ABCBUS_DATABOARD_4112_23_H -#define MAME_BUS_ABCBUS_DATABOARD_4112_23_H +#ifndef MAME_BUS_ABCBUS_DATABOARD_4106_H +#define MAME_BUS_ABCBUS_DATABOARD_4106_H #pragma once @@ -20,14 +20,14 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> abc_databoard_4112_23_device +// ======================> databoard_4106_device -class abc_databoard_4112_23_device : public device_t, - public device_abcbus_card_interface +class databoard_4106_device : public device_t, + public device_abcbus_card_interface { public: // construction/destruction - abc_databoard_4112_23_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + databoard_4106_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -48,16 +48,16 @@ protected: virtual void abcbus_c3(uint8_t data) override; private: - required_device<cpu_device> m_maincpu; + required_device<z80_device> m_maincpu; bool m_cs; - void databoard_4112_23_io(address_map &map); - void databoard_4112_23_mem(address_map &map); + void databoard_4106_io(address_map &map); + void databoard_4106_mem(address_map &map); }; // device type definition -DECLARE_DEVICE_TYPE(DATABOARD_4112_23, abc_databoard_4112_23_device) +DECLARE_DEVICE_TYPE(DATABOARD_4106, databoard_4106_device) -#endif // MAME_BUS_ABCBUS_DATABOARD_4112_23_H +#endif // MAME_BUS_ABCBUS_DATABOARD_4106_H diff --git a/src/devices/bus/abcbus/db4107.cpp b/src/devices/bus/abcbus/db4107.cpp new file mode 100644 index 00000000000..0b9ab0ed062 --- /dev/null +++ b/src/devices/bus/abcbus/db4107.cpp @@ -0,0 +1,240 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + DataBoard 4107 Winchester interface emulation + +*********************************************************************/ + +#include "emu.h" +#include "db4107.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define Z80_TAG "maincpu" +#define Z80DMA_TAG "dma" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(DATABOARD_4107, databoard_4107_device, "abc_db4107", "DataBoard 4107 Winchester interface") + + +//------------------------------------------------- +// ROM( databoard_4107 ) +//------------------------------------------------- + +ROM_START( databoard_4107 ) + ROM_REGION( 0x2000, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "w511", "Micropolis W511" ) + ROMX_LOAD("micr.w511_6490398-2.bin", 0x000, 0x1000, CRC(cd8f16ff) SHA1(52966142bbed07459f6eb272213b677ec49864d3), ROM_BIOS(0) ) + ROM_SYSTEM_BIOS( 1, "nec5126", "NEC 5126)" ) + ROMX_LOAD("nec_1.2_6490396-1.bin", 0x000, 0x1000, CRC(88fa6ed2) SHA1(9faa144591c620c5d7dcc15feada350f6a14f02a), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 2, "nec6490", "NEC 6490" ) + ROMX_LOAD("nec_6490.bin", 0x000, 0x1000, CRC(17c247e7) SHA1(7339738b87751655cb4d6414422593272fe72f5d), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 3, "ro202", "Rodime RO-202" ) + ROMX_LOAD("ro202_1.00_6490320-01.bin", 0x000, 0x800, CRC(337b4dcf) SHA1(791ebeb4521ddc11fb9742114018e161e1849bdf), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 4, "st4038", "Seagate ST4038 (CHS: 733,5,17,512)" ) + ROMX_LOAD("st4038.bin", 0x000, 0x800, CRC(4c803b87) SHA1(1141bb51ad9200fc32d92a749460843dc6af8953), ROM_BIOS(4) ) + ROM_SYSTEM_BIOS( 5, "st406", "Seagate ST406" ) + ROMX_LOAD("st406.bin", 0x000, 0x800, CRC(3cdd154f) SHA1(b1464163370e9037a8ce1d535935ee55fbf68ee1), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS( 6, "st514", "Seagate ST514" ) + ROMX_LOAD("st514_15_5.bin", 0x000, 0x800, CRC(6e25c645) SHA1(8b3ca02decef5aafdb46dbfdf84371057d06799e), ROM_BIOS(6) ) + ROM_SYSTEM_BIOS( 7, "w504", "W504" ) + ROMX_LOAD("w504_10m.bin", 0x000, 0x800, CRC(277ee4a5) SHA1(a3bf6f2b9f75ef46fd3b1aca6e4a42191d702b82), ROM_BIOS(7) ) + ROM_SYSTEM_BIOS( 8, "st412", "Seagate ST412" ) + ROMX_LOAD("w507_st412.bin", 0x000, 0x800, CRC(0d3c92d2) SHA1(345c5f8154f0ec9d66ef19ce9793176aa257707d), ROM_BIOS(8) ) + ROM_SYSTEM_BIOS( 9, "w514", "W514" ) + ROMX_LOAD("w514.bin", 0x000, 0x800, CRC(8ec3f70e) SHA1(ca60a48d591e42526fcc301ce94e861bf8368aa4), ROM_BIOS(9) ) + ROM_SYSTEM_BIOS( 10, "b6185b", "BASF 6185B" ) + ROMX_LOAD("basf_6185b.bin", 0x000, 0x800, CRC(06f8fe2e) SHA1(e81f2a47c854e0dbb096bee3428d79e63591059d), ROM_BIOS(10) ) + ROM_SYSTEM_BIOS( 11, "m1325", "Micropolis 1325" ) + ROMX_LOAD("micr1325.bin", 0x000, 0x800, CRC(084af409) SHA1(342b8e214a8c4c2b014604e53c45ef1bd1c69ea3), ROM_BIOS(11) ) + ROM_SYSTEM_BIOS( 12, "st225", "W515 (CHS: 615,4,17,512)" ) + ROMX_LOAD("w515_st225.bin", 0x000, 0x800, CRC(c9f68f81) SHA1(7ff8b2a19f71fe0279ab3e5a0a5fffcb6030360c), ROM_BIOS(12) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *databoard_4107_device::device_rom_region() const +{ + return ROM_NAME( databoard_4107 ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( databoard_4107_mem ) +//------------------------------------------------- + +void databoard_4107_device::databoard_4107_mem(address_map &map) +{ + map(0x0000, 0x1fff).rom().region(Z80_TAG, 0); +} + + +//------------------------------------------------- +// ADDRESS_MAP( databoard_4107_io ) +//------------------------------------------------- + +void databoard_4107_device::databoard_4107_io(address_map &map) +{ +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void databoard_4107_device::device_add_mconfig(machine_config &config) +{ + Z80(config, m_maincpu, 4000000); + m_maincpu->set_memory_map(&databoard_4107_device::databoard_4107_mem); + m_maincpu->set_io_map(&databoard_4107_device::databoard_4107_io); + + Z80DMA(config, m_dma, 4000000); +} + + +//------------------------------------------------- +// INPUT_PORTS( databoard_4107 ) +//------------------------------------------------- + +INPUT_PORTS_START( databoard_4107 ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor databoard_4107_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( databoard_4107 ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// databoard_4107_device - constructor +//------------------------------------------------- + +databoard_4107_device::databoard_4107_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, DATABOARD_4107, tag, owner, clock), + device_abcbus_card_interface(mconfig, *this), + m_maincpu(*this, Z80_TAG), + m_dma(*this, Z80DMA_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void databoard_4107_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void databoard_4107_device::device_reset() +{ + m_cs = false; +} + + + +//************************************************************************** +// ABC BUS INTERFACE +//************************************************************************** + +//------------------------------------------------- +// abcbus_cs - +//------------------------------------------------- + +void databoard_4107_device::abcbus_cs(uint8_t data) +{ +} + + +//------------------------------------------------- +// abcbus_stat - +//------------------------------------------------- + +uint8_t databoard_4107_device::abcbus_stat() +{ + uint8_t data = 0xff; + + if (m_cs) + { + } + + return data; +} + + +//------------------------------------------------- +// abcbus_inp - +//------------------------------------------------- + +uint8_t databoard_4107_device::abcbus_inp() +{ + uint8_t data = 0xff; + + if (m_cs) + { + } + + return data; +} + + +//------------------------------------------------- +// abcbus_out - +//------------------------------------------------- + +void databoard_4107_device::abcbus_out(uint8_t data) +{ + if (!m_cs) return; +} + + +//------------------------------------------------- +// abcbus_c1 - +//------------------------------------------------- + +void databoard_4107_device::abcbus_c1(uint8_t data) +{ + if (m_cs) + { + } +} + + +//------------------------------------------------- +// abcbus_c3 - +//------------------------------------------------- + +void databoard_4107_device::abcbus_c3(uint8_t data) +{ + if (m_cs) + { + m_maincpu->reset(); + } +} diff --git a/src/devices/bus/abcbus/db4107.h b/src/devices/bus/abcbus/db4107.h new file mode 100644 index 00000000000..0a69a6c95a9 --- /dev/null +++ b/src/devices/bus/abcbus/db4107.h @@ -0,0 +1,65 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + DataBoard 4107 Winchester interface emulation + +*********************************************************************/ + +#ifndef MAME_BUS_ABCBUS_DATABOARD_4107_H +#define MAME_BUS_ABCBUS_DATABOARD_4107_H + +#pragma once + +#include "abcbus.h" +#include "cpu/z80/z80.h" +#include "machine/z80dma.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> databoard_4107_device + +class databoard_4107_device : public device_t, + public device_abcbus_card_interface +{ +public: + // construction/destruction + databoard_4107_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_abcbus_interface overrides + virtual void abcbus_cs(uint8_t data) override; + virtual uint8_t abcbus_inp() override; + virtual void abcbus_out(uint8_t data) override; + virtual uint8_t abcbus_stat() override; + virtual void abcbus_c1(uint8_t data) override; + virtual void abcbus_c3(uint8_t data) override; + +private: + required_device<z80_device> m_maincpu; + required_device<z80dma_device> m_dma; + + bool m_cs; + + void databoard_4107_io(address_map &map); + void databoard_4107_mem(address_map &map); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(DATABOARD_4107, databoard_4107_device) + +#endif // MAME_BUS_ABCBUS_DATABOARD_4107_H diff --git a/src/devices/bus/abcbus/db4112.cpp b/src/devices/bus/abcbus/db4112.cpp new file mode 100644 index 00000000000..a2631f0b244 --- /dev/null +++ b/src/devices/bus/abcbus/db4112.cpp @@ -0,0 +1,215 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + DataBoard 4112-23 floppy disk controller emulation + +*********************************************************************/ + +#include "emu.h" +#include "db4112.h" + + + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define Z80_TAG "maincpu" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(DATABOARD_4112, abc_databoard_4112_device, "abc_db4112", "DataBoard 4112") + + +//------------------------------------------------- +// ROM( databoard_4112 ) +//------------------------------------------------- + +ROM_START( databoard_4112 ) + ROM_DEFAULT_BIOS( "fd55" ) + ROM_REGION( 0x2000, Z80_TAG, 0 ) + ROM_SYSTEM_BIOS( 0, "119", "CONT 4112 Ver 1.19 85-07-04" ) + ROMX_LOAD("fpy_int_4112-23_4112_ver1.19.bin", 0x0000, 0x2000, CRC(74c355e5) SHA1(cc434af31897cf326cb2bb2a630f74a8d8174c3c), ROM_BIOS(0) ) + ROM_SYSTEM_BIOS( 1, "fd55", "TEAC FD55 (860702)" ) + ROMX_LOAD("fpy_int_4112-23_teac_fd55.bin", 0x0000, 0x2000, CRC(9175ceb8) SHA1(95c150d3152df318abd9267915d5669d2ec33895), ROM_BIOS(1) ) +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *abc_databoard_4112_device::device_rom_region() const +{ + return ROM_NAME( databoard_4112 ); +} + + +//------------------------------------------------- +// ADDRESS_MAP( databoard_4112_mem ) +//------------------------------------------------- + +void abc_databoard_4112_device::databoard_4112_mem(address_map &map) +{ + map(0x0000, 0x1fff).rom().region(Z80_TAG, 0); +} + + +//------------------------------------------------- +// ADDRESS_MAP( databoard_4112_io ) +//------------------------------------------------- + +void abc_databoard_4112_device::databoard_4112_io(address_map &map) +{ +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void abc_databoard_4112_device::device_add_mconfig(machine_config &config) +{ + Z80(config, m_maincpu, 4000000); + m_maincpu->set_memory_map(&abc_databoard_4112_device::databoard_4112_mem); + m_maincpu->set_io_map(&abc_databoard_4112_device::databoard_4112_io); +} + + +//------------------------------------------------- +// INPUT_PORTS( databoard_4112 ) +//------------------------------------------------- + +INPUT_PORTS_START( databoard_4112 ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor abc_databoard_4112_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( databoard_4112 ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// abc_databoard_4112_device - constructor +//------------------------------------------------- + +abc_databoard_4112_device::abc_databoard_4112_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, DATABOARD_4112, tag, owner, clock), + device_abcbus_card_interface(mconfig, *this), + m_maincpu(*this, Z80_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void abc_databoard_4112_device::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void abc_databoard_4112_device::device_reset() +{ + m_cs = false; +} + + + +//************************************************************************** +// ABC BUS INTERFACE +//************************************************************************** + +//------------------------------------------------- +// abcbus_cs - +//------------------------------------------------- + +void abc_databoard_4112_device::abcbus_cs(uint8_t data) +{ +} + + +//------------------------------------------------- +// abcbus_stat - +//------------------------------------------------- + +uint8_t abc_databoard_4112_device::abcbus_stat() +{ + uint8_t data = 0xff; + + if (m_cs) + { + } + + return data; +} + + +//------------------------------------------------- +// abcbus_inp - +//------------------------------------------------- + +uint8_t abc_databoard_4112_device::abcbus_inp() +{ + uint8_t data = 0xff; + + if (m_cs) + { + } + + return data; +} + + +//------------------------------------------------- +// abcbus_out - +//------------------------------------------------- + +void abc_databoard_4112_device::abcbus_out(uint8_t data) +{ + if (!m_cs) return; +} + + +//------------------------------------------------- +// abcbus_c1 - +//------------------------------------------------- + +void abc_databoard_4112_device::abcbus_c1(uint8_t data) +{ + if (m_cs) + { + } +} + + +//------------------------------------------------- +// abcbus_c3 - +//------------------------------------------------- + +void abc_databoard_4112_device::abcbus_c3(uint8_t data) +{ + if (m_cs) + { + m_maincpu->reset(); + } +} diff --git a/src/devices/bus/abcbus/hdc.h b/src/devices/bus/abcbus/db4112.h index 075caad3778..f98e125e790 100644 --- a/src/devices/bus/abcbus/hdc.h +++ b/src/devices/bus/abcbus/db4112.h @@ -2,19 +2,17 @@ // copyright-holders:Curt Coder /********************************************************************** - Luxor XEBEC Winchester controller card emulation + DataBoard 4112-23 floppy disk controller emulation *********************************************************************/ -#ifndef MAME_BUS_ABCBUS_HDC_H -#define MAME_BUS_ABCBUS_HDC_H +#ifndef MAME_BUS_ABCBUS_DATABOARD_4112_H +#define MAME_BUS_ABCBUS_DATABOARD_4112_H #pragma once #include "abcbus.h" #include "cpu/z80/z80.h" -#include "machine/z80daisy.h" -#include "bus/scsi/scsihd.h" @@ -22,14 +20,14 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> abc_hdc_device +// ======================> abc_databoard_4112_device -class abc_hdc_device : public device_t, - public device_abcbus_card_interface +class abc_databoard_4112_device : public device_t, + public device_abcbus_card_interface { public: // construction/destruction - abc_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + abc_databoard_4112_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -39,19 +37,27 @@ protected: // optional information overrides virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; // device_abcbus_interface overrides virtual void abcbus_cs(uint8_t data) override; + virtual uint8_t abcbus_inp() override; + virtual void abcbus_out(uint8_t data) override; + virtual uint8_t abcbus_stat() override; + virtual void abcbus_c1(uint8_t data) override; + virtual void abcbus_c3(uint8_t data) override; private: required_device<z80_device> m_maincpu; - void abc_hdc_io(address_map &map); - void abc_hdc_mem(address_map &map); + bool m_cs; + + void databoard_4112_io(address_map &map); + void databoard_4112_mem(address_map &map); }; // device type definition -DECLARE_DEVICE_TYPE(ABC_HDC, abc_hdc_device) +DECLARE_DEVICE_TYPE(DATABOARD_4112, abc_databoard_4112_device) -#endif // MAME_BUS_ABCBUS_HDC_H +#endif // MAME_BUS_ABCBUS_DATABOARD_4112_H diff --git a/src/devices/bus/abcbus/hdc.cpp b/src/devices/bus/abcbus/hdc.cpp deleted file mode 100644 index 2febc491d79..00000000000 --- a/src/devices/bus/abcbus/hdc.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Luxor XEBEC Winchester controller card emulation - -*********************************************************************/ - -#include "emu.h" -#include "hdc.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define Z80_TAG "z80" -#define SASIBUS_TAG "sasi" - - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -DEFINE_DEVICE_TYPE(ABC_HDC, abc_hdc_device, "abc_hdc", "ABC HDC") - - -//------------------------------------------------- -// ROM( abc_hdc ) -//------------------------------------------------- - -ROM_START( abc_hdc ) - ROM_REGION( 0x800, Z80_TAG, 0 ) - ROM_SYSTEM_BIOS( 0, "st4038", "Seagate ST4038 (CHS: 733,5,17,512)" ) - ROMX_LOAD( "st4038.6c", 0x000, 0x800, CRC(4c803b87) SHA1(1141bb51ad9200fc32d92a749460843dc6af8953), ROM_BIOS(0) ) // Seagate ST4038 (http://stason.org/TULARC/pc/hard-drives-hdd/seagate/ST4038-1987-31MB-5-25-FH-MFM-ST412.html) - ROM_SYSTEM_BIOS( 1, "st225", "Seagate ST225 (CHS: 615,4,17,512)" ) - ROMX_LOAD( "st225.6c", 0x000, 0x800, CRC(c9f68f81) SHA1(7ff8b2a19f71fe0279ab3e5a0a5fffcb6030360c), ROM_BIOS(1) ) // Seagate ST225 (http://stason.org/TULARC/pc/hard-drives-hdd/seagate/ST225-21MB-5-25-HH-MFM-ST412.html) -ROM_END - - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const tiny_rom_entry *abc_hdc_device::device_rom_region() const -{ - return ROM_NAME( abc_hdc ); -} - - -//------------------------------------------------- -// ADDRESS_MAP( abc_hdc_mem ) -//------------------------------------------------- - -void abc_hdc_device::abc_hdc_mem(address_map &map) -{ - map(0x0000, 0x0ff).rom().region(Z80_TAG, 0); -} - - -//------------------------------------------------- -// ADDRESS_MAP( abc_hdc_io ) -//------------------------------------------------- - -void abc_hdc_device::abc_hdc_io(address_map &map) -{ -} - - -//------------------------------------------------- -// z80_daisy_config daisy_chain -//------------------------------------------------- - -static const z80_daisy_config daisy_chain[] = -{ - { nullptr } -}; - - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -void abc_hdc_device::device_add_mconfig(machine_config &config) -{ - Z80(config, m_maincpu, 4000000); - m_maincpu->set_memory_map(&abc_hdc_device::abc_hdc_mem); - m_maincpu->set_io_map(&abc_hdc_device::abc_hdc_io); - m_maincpu->set_daisy_config(daisy_chain); - - scsi_port_device &scsi(SCSI_PORT(config, SASIBUS_TAG)); - scsi.set_slot_device(1, "harddisk", SCSIHD, DEVICE_INPUT_DEFAULTS_NAME(SCSI_ID_0)); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -//------------------------------------------------- -// abc_hdc_device - constructor -//------------------------------------------------- - -abc_hdc_device::abc_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ABC_HDC, tag, owner, clock) - , device_abcbus_card_interface(mconfig, *this) - , m_maincpu(*this, Z80_TAG) -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void abc_hdc_device::device_start() -{ -} - - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void abc_hdc_device::device_reset() -{ -} - - - -//************************************************************************** -// ABC BUS INTERFACE -//************************************************************************** - -//------------------------------------------------- -// abcbus_cs - -//------------------------------------------------- - -void abc_hdc_device::abcbus_cs(uint8_t data) -{ -} diff --git a/src/devices/bus/abcbus/lux21046.cpp b/src/devices/bus/abcbus/lux21046.cpp index c305f2bfc63..c6101d5d403 100644 --- a/src/devices/bus/abcbus/lux21046.cpp +++ b/src/devices/bus/abcbus/lux21046.cpp @@ -111,12 +111,14 @@ ROM_START( luxor_55_21046 ) ROM_DEFAULT_BIOS( "v207" ) ROM_SYSTEM_BIOS( 0, "v105", "Luxor v1.05 (1984-10-04)" ) ROMX_LOAD( "cntr 105.6cd", 0x2000, 0x2000, CRC(44043025) SHA1(17487ca35b399bb49d4015bbeede0809db8e772f), ROM_BIOS(0) ) - ROM_SYSTEM_BIOS( 1, "v107", "Luxor v1.07 (1985-07-03)" ) - ROMX_LOAD( "cntr 1.07 6490318-07.6cd", 0x0000, 0x4000, CRC(db8c1c0e) SHA1(8bccd5bc72124984de529ee058df779f06d2c1d5), ROM_BIOS(1) ) - ROM_SYSTEM_BIOS( 2, "v108", "Luxor v1.08 (1986-03-12)" ) - ROMX_LOAD( "cntr 108.6cd", 0x2000, 0x2000, CRC(229764cb) SHA1(a2e2f6f49c31b827efc62f894de9a770b65d109d), ROM_BIOS(2) ) - ROM_SYSTEM_BIOS( 3, "v207", "DiAB v2.07 (1987-06-24)" ) - ROMX_LOAD( "diab 207.6cd", 0x2000, 0x2000, CRC(86622f52) SHA1(61ad271de53152c1640c0b364fce46d1b0b4c7e2), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 1, "v106", "Luxor v1.06 (1984-12-13)" ) + ROMX_LOAD( "6490318-06.6cd", 0x2000, 0x2000, CRC(7f4726c9) SHA1(cf576456f135877537c5ee56b00a7259160d2c56), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 2, "v107", "Luxor v1.07 (1985-07-03)" ) + ROMX_LOAD( "cntr 1.07 6490318-07.6cd", 0x0000, 0x4000, CRC(db8c1c0e) SHA1(8bccd5bc72124984de529ee058df779f06d2c1d5), ROM_BIOS(2) ) + ROM_SYSTEM_BIOS( 3, "v108", "Luxor v1.08 (1986-03-12)" ) + ROMX_LOAD( "cntr 108.6cd", 0x2000, 0x2000, CRC(229764cb) SHA1(a2e2f6f49c31b827efc62f894de9a770b65d109d), ROM_BIOS(3) ) + ROM_SYSTEM_BIOS( 4, "v207", "DiAB v2.07 (1987-06-24)" ) + ROMX_LOAD( "diab 207.6cd", 0x2000, 0x2000, CRC(86622f52) SHA1(61ad271de53152c1640c0b364fce46d1b0b4c7e2), ROM_BIOS(4) ) ROM_REGION( 0x104, "plds", 0 ) ROM_LOAD( "pal16r4.2a", 0x000, 0x104, NO_DUMP) diff --git a/src/devices/bus/abcbus/lux4105.cpp b/src/devices/bus/abcbus/lux4105.cpp index 1bb72560855..f803eec26db 100644 --- a/src/devices/bus/abcbus/lux4105.cpp +++ b/src/devices/bus/abcbus/lux4105.cpp @@ -41,7 +41,14 @@ Notes: TODO - - sector length error in read check after format + - sector length error in read check after format (breakpoint @ 97ba) + + 0C xx INITIALIZE DRIVE CHARACTERISTICS + 01 00 00 00 00 02 RECALIBRATE + 04 00 00 00 05 02 FORMAT UNIT + 08 00 00 00 11 02 READ + ...transfer 8704 (17*512) bytes... + error */ diff --git a/src/devices/bus/abcbus/ram.cpp b/src/devices/bus/abcbus/ram.cpp index 4886f46defa..563964041c5 100644 --- a/src/devices/bus/abcbus/ram.cpp +++ b/src/devices/bus/abcbus/ram.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(ABC80_16KB_RAM_CARD, abc80_16kb_ram_card_device, "abc80_16kb" abc80_16kb_ram_card_device::abc80_16kb_ram_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ABC80_16KB_RAM_CARD, tag, owner, clock), device_abcbus_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x4000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ abc80_16kb_ram_card_device::abc80_16kb_ram_card_device(const machine_config &mco void abc80_16kb_ram_card_device::device_start() { - m_ram.allocate(0x4000); } diff --git a/src/devices/bus/abcbus/ram.h b/src/devices/bus/abcbus/ram.h index cddb07182c7..ddb191cd5cf 100644 --- a/src/devices/bus/abcbus/ram.h +++ b/src/devices/bus/abcbus/ram.h @@ -37,7 +37,7 @@ protected: virtual void abcbus_xmemw(offs_t offset, uint8_t data) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/abcbus/ssa.cpp b/src/devices/bus/abcbus/ssa.cpp index 3de6119a3d9..c17c2e2a826 100644 --- a/src/devices/bus/abcbus/ssa.cpp +++ b/src/devices/bus/abcbus/ssa.cpp @@ -121,7 +121,7 @@ abc_super_smartaid_device::abc_super_smartaid_device(const machine_config &mconf m_rom_1(*this, "ssa1"), m_rom_2(*this, "ssa2"), m_prom(*this, "ssa3"), - m_nvram(*this, "nvram"), + m_nvram(*this, "nvram", 0x800, ENDIANNESS_LITTLE), m_rom_bank(0), m_prom_bank(0) { @@ -144,9 +144,6 @@ void abc_super_smartaid_device::device_start() m_rom_2->base()[i] = bitswap<8>(m_rom_2->base()[i], 2, 6, 1, 4, 3, 5, 7, 0); } - // allocate memory - m_nvram.allocate(0x800); - // state saving save_item(NAME(m_rom_bank)); save_item(NAME(m_prom_bank)); @@ -181,7 +178,7 @@ uint8_t abc_super_smartaid_device::abcbus_xmemfl(offs_t offset) { case 0x08: m_prom_bank = 1; - // fallthru + [[fallthrough]]; case 0x0c: case 0x0f: data = m_rom_2->base()[(m_rom_bank << 12) | (offset & 0xfff)]; break; diff --git a/src/devices/bus/abcbus/ssa.h b/src/devices/bus/abcbus/ssa.h index 7de5ade5950..2be5046b24a 100644 --- a/src/devices/bus/abcbus/ssa.h +++ b/src/devices/bus/abcbus/ssa.h @@ -61,7 +61,7 @@ private: required_memory_region m_rom_1; required_memory_region m_rom_2; required_memory_region m_prom; - optional_shared_ptr<uint8_t> m_nvram; + memory_share_creator<uint8_t> m_nvram; uint8_t m_rom_bank; uint8_t m_prom_bank; }; diff --git a/src/devices/bus/acorn/atom/discpack.cpp b/src/devices/bus/acorn/atom/discpack.cpp index dd8d3021301..c7010454e78 100644 --- a/src/devices/bus/acorn/atom/discpack.cpp +++ b/src/devices/bus/acorn/atom/discpack.cpp @@ -85,10 +85,11 @@ void atom_discpack_device::device_start() space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map); space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8smo_delegate(*m_fdc, FUNC(i8271_device::data_r)), write8smo_delegate(*m_fdc, FUNC(i8271_device::data_w))); - space.install_ram(0x2000, 0x23ff); - space.install_ram(0x2400, 0x27ff); - space.install_ram(0x3c00, 0x3fff); + space.install_ram(0x2000, 0x27ff, m_ram); + space.install_ram(0x3c00, 0x3fff, m_ram+0x800); space.install_rom(0xe000, 0xefff, m_dos_rom->base()); + + save_item(NAME(m_ram)); } diff --git a/src/devices/bus/acorn/atom/discpack.h b/src/devices/bus/acorn/atom/discpack.h index 3f06870f87c..a55abce3278 100644 --- a/src/devices/bus/acorn/atom/discpack.h +++ b/src/devices/bus/acorn/atom/discpack.h @@ -47,6 +47,8 @@ private: required_memory_region m_dos_rom; required_device<i8271_device> m_fdc; required_device_array<floppy_connector, 2> m_floppy; + + u8 m_ram[0x800 + 0x400]; }; diff --git a/src/devices/bus/acorn/cms/4080term.cpp b/src/devices/bus/acorn/cms/4080term.cpp index 27f69d3a3c1..3313545a618 100644 --- a/src/devices/bus/acorn/cms/4080term.cpp +++ b/src/devices/bus/acorn/cms/4080term.cpp @@ -86,7 +86,7 @@ void cms_4080term_device::device_add_mconfig(machine_config &config) TIMER(config, "scantimer").configure_scanline(FUNC(cms_4080term_device::update_scanline), "screen", 0, 10); - VIA6522(config, m_via, 1_MHz_XTAL); + MOS6522(config, m_via, 1_MHz_XTAL); m_via->writepa_handler().set("cent_data_out", FUNC(output_latch_device::write)); m_via->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)); m_via->irq_handler().set(FUNC(cms_4080term_device::bus_irq_w)); diff --git a/src/devices/bus/acorn/system/32k.cpp b/src/devices/bus/acorn/system/32k.cpp index c74d60cc863..00eb80050e9 100644 --- a/src/devices/bus/acorn/system/32k.cpp +++ b/src/devices/bus/acorn/system/32k.cpp @@ -73,6 +73,7 @@ acorn_32k_device::acorn_32k_device(const machine_config &mconfig, const char *ta void acorn_32k_device::device_start() { + save_item(NAME(m_ram)); } //------------------------------------------------- @@ -85,11 +86,11 @@ void acorn_32k_device::device_reset() if (m_links->read()) { - space.install_ram(0x8000, 0xbfff); + space.install_ram(0x8000, 0xbfff, m_ram); } else { - space.install_ram(0x2000, 0x7fff); - space.install_ram(0xc000, 0xdfff); + space.install_ram(0x2000, 0x7fff, m_ram); + space.install_ram(0xc000, 0xdfff, m_ram + 0x6000); } } diff --git a/src/devices/bus/acorn/system/32k.h b/src/devices/bus/acorn/system/32k.h index 0ef4c10f3c3..f3d3b76be5c 100644 --- a/src/devices/bus/acorn/system/32k.h +++ b/src/devices/bus/acorn/system/32k.h @@ -38,6 +38,7 @@ protected: private: required_ioport m_links; + u8 m_ram[32768]; }; diff --git a/src/devices/bus/acorn/system/8k.cpp b/src/devices/bus/acorn/system/8k.cpp index 97939b7362f..ecbd69c930f 100644 --- a/src/devices/bus/acorn/system/8k.cpp +++ b/src/devices/bus/acorn/system/8k.cpp @@ -98,6 +98,7 @@ acorn_8k_device::acorn_8k_device(const machine_config &mconfig, const char *tag, void acorn_8k_device::device_start() { + save_item(NAME(m_ram)); } //------------------------------------------------- @@ -112,11 +113,11 @@ void acorn_8k_device::device_reset() if (ram_addr == 0x0000) // BLK0 { - space.install_ram(0x1000, 0x1fff); + space.install_ram(0x1000, 0x1fff, m_ram); } else { - space.install_ram(ram_addr, ram_addr + 0x1fff); + space.install_ram(ram_addr, ram_addr + 0x1fff, m_ram); } uint16_t rom_addr = (m_links->read() & 0xf0) << 9; diff --git a/src/devices/bus/acorn/system/8k.h b/src/devices/bus/acorn/system/8k.h index 125b636cd5b..09f089c1563 100644 --- a/src/devices/bus/acorn/system/8k.h +++ b/src/devices/bus/acorn/system/8k.h @@ -47,6 +47,7 @@ private: required_device_array<generic_slot_device, 2> m_rom; required_ioport m_links; + u8 m_ram[8192]; }; diff --git a/src/devices/bus/acorn/system/vib.cpp b/src/devices/bus/acorn/system/vib.cpp index cd6cffc61d4..bf685daac95 100644 --- a/src/devices/bus/acorn/system/vib.cpp +++ b/src/devices/bus/acorn/system/vib.cpp @@ -149,7 +149,7 @@ void acorn_vib_device::device_add_mconfig(machine_config &config) { INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(FUNC(acorn_vib_device::irq_w)); - VIA6522(config, m_via6522, 1'000'000); // TODO: derive clock from bus (pin 29 = ϕ2) + MOS6522(config, m_via6522, 1'000'000); // TODO: derive clock from bus (pin 29 = ϕ2) m_via6522->writepa_handler().set("cent_data_out", FUNC(output_latch_device::write)); m_via6522->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)); m_via6522->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); diff --git a/src/devices/bus/adam/exp.cpp b/src/devices/bus/adam/exp.cpp index a6c8b777402..59c677144f3 100644 --- a/src/devices/bus/adam/exp.cpp +++ b/src/devices/bus/adam/exp.cpp @@ -36,8 +36,7 @@ DEFINE_DEVICE_TYPE(ADAM_EXPANSION_SLOT, adam_expansion_slot_device, "adam_expans //------------------------------------------------- device_adam_expansion_slot_card_interface::device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "adamexp"), - m_rom(*this, "rom") + device_interface(device, "adamexp") { m_slot = dynamic_cast<adam_expansion_slot_device *>(device.owner()); } diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h index 69ed921d5d5..ee74bf0396a 100644 --- a/src/devices/bus/adam/exp.h +++ b/src/devices/bus/adam/exp.h @@ -100,7 +100,7 @@ protected: adam_expansion_slot_device *m_slot; - optional_shared_ptr<uint8_t> m_rom; + std::unique_ptr<uint8_t[]> m_rom; }; diff --git a/src/devices/bus/adam/ram.cpp b/src/devices/bus/adam/ram.cpp index a7e79719867..65dc13f2246 100644 --- a/src/devices/bus/adam/ram.cpp +++ b/src/devices/bus/adam/ram.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(ADAM_RAM, adam_ram_expansion_device, "adam_ram", "Adam 64KB R adam_ram_expansion_device::adam_ram_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ADAM_RAM, tag, owner, clock), device_adam_expansion_slot_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x10000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ adam_ram_expansion_device::adam_ram_expansion_device(const machine_config &mconf void adam_ram_expansion_device::device_start() { - m_ram.allocate(0x10000); } diff --git a/src/devices/bus/adam/ram.h b/src/devices/bus/adam/ram.h index 780d51be726..c1997bf77c4 100644 --- a/src/devices/bus/adam/ram.h +++ b/src/devices/bus/adam/ram.h @@ -37,7 +37,7 @@ protected: virtual void adam_bd_w(offs_t offset, uint8_t data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/amiga/keyboard/a1200.cpp b/src/devices/bus/amiga/keyboard/a1200.cpp index 74d0f98518d..e9107fbe5be 100644 --- a/src/devices/bus/amiga/keyboard/a1200.cpp +++ b/src/devices/bus/amiga/keyboard/a1200.cpp @@ -61,7 +61,7 @@ DEFINE_DEVICE_TYPE_NS(A1200_KBD, bus::amiga::keyboard, a1200_kbd_device, "a1200k -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { namespace { @@ -211,4 +211,4 @@ void a1200_kbd_device::device_reset_after_children() m_mpu->set_input_line(M68HC05_IRQ_LINE, BIT(ioport("IRQ")->read(), 0) ? CLEAR_LINE : ASSERT_LINE); } -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/a1200.h b/src/devices/bus/amiga/keyboard/a1200.h index edb946699f2..4cbba0616db 100644 --- a/src/devices/bus/amiga/keyboard/a1200.h +++ b/src/devices/bus/amiga/keyboard/a1200.h @@ -14,7 +14,7 @@ #include "keyboard.h" -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { //************************************************************************** // TYPE DECLARATIONS @@ -55,7 +55,7 @@ private: bool m_host_kdat, m_mpu_kdat; }; -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard //************************************************************************** diff --git a/src/devices/bus/amiga/keyboard/a2000.cpp b/src/devices/bus/amiga/keyboard/a2000.cpp index 656881eefe2..b9728ca7f26 100644 --- a/src/devices/bus/amiga/keyboard/a2000.cpp +++ b/src/devices/bus/amiga/keyboard/a2000.cpp @@ -82,7 +82,7 @@ DEFINE_DEVICE_TYPE_NS(A2000_KBD_G80_GB, bus::amiga::keyboard, a2000_kbd_g80_gb_d -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { namespace { @@ -669,4 +669,4 @@ ioport_constructor a2000_kbd_g80_gb_device::device_input_ports() const return INPUT_PORTS_NAME(a2000_gb_keyboard); } -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/a2000.h b/src/devices/bus/amiga/keyboard/a2000.h index bcc7016ed8b..7a710f6ad37 100644 --- a/src/devices/bus/amiga/keyboard/a2000.h +++ b/src/devices/bus/amiga/keyboard/a2000.h @@ -14,7 +14,7 @@ #include "keyboard.h" -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { //************************************************************************** // TYPE DECLARATIONS @@ -110,7 +110,7 @@ protected: virtual ioport_constructor device_input_ports() const override; }; -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard //************************************************************************** diff --git a/src/devices/bus/amiga/keyboard/matrix.cpp b/src/devices/bus/amiga/keyboard/matrix.cpp index fa588052cd7..530d243f4b0 100644 --- a/src/devices/bus/amiga/keyboard/matrix.cpp +++ b/src/devices/bus/amiga/keyboard/matrix.cpp @@ -9,7 +9,7 @@ #include "emu.h" #include "matrix.h" -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { namespace { @@ -852,4 +852,4 @@ INPUT_PORTS_START(remove_keypad) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard diff --git a/src/devices/bus/amiga/keyboard/matrix.h b/src/devices/bus/amiga/keyboard/matrix.h index 01ab81b1dec..50060d01f22 100644 --- a/src/devices/bus/amiga/keyboard/matrix.h +++ b/src/devices/bus/amiga/keyboard/matrix.h @@ -11,7 +11,7 @@ #pragma once -namespace bus { namespace amiga { namespace keyboard { +namespace bus::amiga::keyboard { INPUT_PORTS_EXTERN(matrix_us); INPUT_PORTS_EXTERN(matrix_de); @@ -27,6 +27,6 @@ INPUT_PORTS_EXTERN(matrix_gb); INPUT_PORTS_EXTERN(a1000_keypad); INPUT_PORTS_EXTERN(remove_keypad); -} } } // namespace bus::amiga::keyboard +} // namespace bus::amiga::keyboard #endif // MAME_BUS_AMIGA_KEYBOARD_MATRIX_H diff --git a/src/devices/bus/amiga/zorro/a2052.cpp b/src/devices/bus/amiga/zorro/a2052.cpp index 877d0f9c1d3..69b5f324d18 100644 --- a/src/devices/bus/amiga/zorro/a2052.cpp +++ b/src/devices/bus/amiga/zorro/a2052.cpp @@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_A2052, bus::amiga::zorro, a2052_device, "zorro_a2052", "CBM A2052 Fast Memory") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // input_ports - device-specific input ports @@ -128,4 +128,4 @@ WRITE_LINE_MEMBER( a2052_device::cfgin_w ) } } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a2052.h b/src/devices/bus/amiga/zorro/a2052.h index fbbac14f4cb..f64bf06196d 100644 --- a/src/devices/bus/amiga/zorro/a2052.h +++ b/src/devices/bus/amiga/zorro/a2052.h @@ -17,7 +17,7 @@ #include "machine/autoconfig.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -46,7 +46,7 @@ private: std::vector<uint16_t> m_ram; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_A2052, bus::amiga::zorro, a2052_device) diff --git a/src/devices/bus/amiga/zorro/a2058.cpp b/src/devices/bus/amiga/zorro/a2058.cpp index cb30212620f..34a587454d8 100644 --- a/src/devices/bus/amiga/zorro/a2058.cpp +++ b/src/devices/bus/amiga/zorro/a2058.cpp @@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_A2058, bus::amiga::zorro, a2058_device, "zorro_a2058", "CBM A2058 Fast Memory") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // input_ports - device-specific input ports @@ -139,4 +139,4 @@ WRITE_LINE_MEMBER( a2058_device::cfgin_w ) } } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a2058.h b/src/devices/bus/amiga/zorro/a2058.h index e46a6774a3e..9b361b403e4 100644 --- a/src/devices/bus/amiga/zorro/a2058.h +++ b/src/devices/bus/amiga/zorro/a2058.h @@ -17,7 +17,7 @@ #include "machine/autoconfig.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -47,7 +47,7 @@ private: int m_ram_size; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_A2058, bus::amiga::zorro, a2058_device) diff --git a/src/devices/bus/amiga/zorro/a2065.cpp b/src/devices/bus/amiga/zorro/a2065.cpp index 50c92753eae..b99eb51ebfb 100644 --- a/src/devices/bus/amiga/zorro/a2065.cpp +++ b/src/devices/bus/amiga/zorro/a2065.cpp @@ -27,7 +27,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_A2065, bus::amiga::zorro, a2065_device, "zorro_a2065", "CBM A2065 Ethernet Card") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // device_add_mconfig - add device configuration @@ -164,4 +164,4 @@ WRITE_LINE_MEMBER( a2065_device::lance_irq_w ) m_slot->int2_w(!state); } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a2065.h b/src/devices/bus/amiga/zorro/a2065.h index f305309fe48..43e66c29678 100644 --- a/src/devices/bus/amiga/zorro/a2065.h +++ b/src/devices/bus/amiga/zorro/a2065.h @@ -18,7 +18,7 @@ #include "machine/autoconfig.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -56,7 +56,7 @@ private: std::unique_ptr<uint16_t[]> m_ram; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_A2065, bus::amiga::zorro, a2065_device) diff --git a/src/devices/bus/amiga/zorro/a2232.cpp b/src/devices/bus/amiga/zorro/a2232.cpp index af2e6db7461..938b60ffb63 100644 --- a/src/devices/bus/amiga/zorro/a2232.cpp +++ b/src/devices/bus/amiga/zorro/a2232.cpp @@ -24,7 +24,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_A2232, bus::amiga::zorro, a2232_device, "zorro_a2232", "CBM A2232 Serial Card") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // device_add_mconfig - add device configuration @@ -488,4 +488,4 @@ void a2232_device::iocpu_map(address_map &map) map(0xc000, 0xffff).ram().share("shared"); } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a2232.h b/src/devices/bus/amiga/zorro/a2232.h index c6c836aec80..e8a5da3258c 100644 --- a/src/devices/bus/amiga/zorro/a2232.h +++ b/src/devices/bus/amiga/zorro/a2232.h @@ -24,7 +24,7 @@ #include "bus/rs232/rs232.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -106,7 +106,7 @@ private: uint8_t m_cia_port_b; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_A2232, bus::amiga::zorro, a2232_device) diff --git a/src/devices/bus/amiga/zorro/a590.cpp b/src/devices/bus/amiga/zorro/a590.cpp index c183ed93c3b..a956e845b90 100644 --- a/src/devices/bus/amiga/zorro/a590.cpp +++ b/src/devices/bus/amiga/zorro/a590.cpp @@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_A590, bus::amiga::zorro, a590_device, "zorro_a590" DEFINE_DEVICE_TYPE_NS(ZORRO_A2091, bus::amiga::zorro, a2091_device, "zorro_a2091", "CBM A2091 HD Controller") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // input_ports - device-specific input ports @@ -377,4 +377,4 @@ WRITE_LINE_MEMBER( dmac_hdc_device_base::scsi_drq_w ) m_dmac->xdreq_w(state); } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/a590.h b/src/devices/bus/amiga/zorro/a590.h index bdf9ad1ec0c..ab2a71bb0ce 100644 --- a/src/devices/bus/amiga/zorro/a590.h +++ b/src/devices/bus/amiga/zorro/a590.h @@ -18,7 +18,7 @@ #include "machine/wd33c9x.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -132,7 +132,7 @@ private: required_ioport m_jp201; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_A590, bus::amiga::zorro, a590_device) diff --git a/src/devices/bus/amiga/zorro/action_replay.cpp b/src/devices/bus/amiga/zorro/action_replay.cpp index d8aea30153a..6fe65413709 100644 --- a/src/devices/bus/amiga/zorro/action_replay.cpp +++ b/src/devices/bus/amiga/zorro/action_replay.cpp @@ -27,7 +27,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK2, bus::amiga::zorro, action_replay_ DEFINE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK3, bus::amiga::zorro, action_replay_mk3_device, "zorro_ar3", "Datel Action Replay MK-III") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // input_ports - device-specific input ports @@ -150,4 +150,4 @@ INPUT_CHANGED_MEMBER( action_replay_device_base::freeze ) m_slot->ipl_w(newval == 1 ? 7 : 0); } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/action_replay.h b/src/devices/bus/amiga/zorro/action_replay.h index 4c0d6f3c93d..18a3c6c6456 100644 --- a/src/devices/bus/amiga/zorro/action_replay.h +++ b/src/devices/bus/amiga/zorro/action_replay.h @@ -16,7 +16,7 @@ #include "zorro.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -77,7 +77,7 @@ protected: virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_ACTION_REPLAY_MK1, bus::amiga::zorro, action_replay_mk1_device) diff --git a/src/devices/bus/amiga/zorro/buddha.cpp b/src/devices/bus/amiga/zorro/buddha.cpp index 842a32f7f2d..08e7df229ec 100644 --- a/src/devices/bus/amiga/zorro/buddha.cpp +++ b/src/devices/bus/amiga/zorro/buddha.cpp @@ -36,7 +36,7 @@ DEFINE_DEVICE_TYPE_NS(ZORRO_BUDDHA, bus::amiga::zorro, buddha_device, "zorro_buddha", "Buddha IDE controller") -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //------------------------------------------------- // mmio_map - device-specific memory mapped I/O @@ -326,4 +326,4 @@ void buddha_device::ide_1_cs1_w(offs_t offset, uint16_t data, uint16_t mem_mask) m_ata_1->cs1_w((offset >> 1) & 0x07, data, mem_mask); } -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro diff --git a/src/devices/bus/amiga/zorro/buddha.h b/src/devices/bus/amiga/zorro/buddha.h index f79382f6013..80fce2682c5 100644 --- a/src/devices/bus/amiga/zorro/buddha.h +++ b/src/devices/bus/amiga/zorro/buddha.h @@ -18,7 +18,7 @@ #include "bus/ata/ataintf.h" -namespace bus { namespace amiga { namespace zorro { +namespace bus::amiga::zorro { //************************************************************************** // TYPE DEFINITIONS @@ -78,7 +78,7 @@ private: int m_ide_1_interrupt; }; -} } } // namespace bus::amiga::zorro +} // namespace bus::amiga::zorro // device type definition DECLARE_DEVICE_TYPE_NS(ZORRO_BUDDHA, bus::amiga::zorro, buddha_device) diff --git a/src/devices/bus/apf/slot.cpp b/src/devices/bus/apf/slot.cpp index 2e62030e54f..0d44530a8b6 100644 --- a/src/devices/bus/apf/slot.cpp +++ b/src/devices/bus/apf/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -122,7 +121,7 @@ static int apf_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/aquarius/c1541.cpp b/src/devices/bus/aquarius/c1541.cpp new file mode 100644 index 00000000000..40ac2679422 --- /dev/null +++ b/src/devices/bus/aquarius/c1541.cpp @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius C1541 DOS Interface by Ron Koenig + +**********************************************************************/ + + +#include "emu.h" +#include "c1541.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_C1541, aquarius_c1541_device, "aquarius_c1541", "Aquarius C1541 DOS Interface") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_c1541_device::device_add_mconfig(machine_config &config) +{ + cbm_iec_slot_device::add(config, m_iec, "c1541"); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_c1541_device - constructor +//------------------------------------------------- + +aquarius_c1541_device::aquarius_c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_C1541, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_iec(*this, "iec_bus") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_c1541_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_c1541_device::mreq_ce_r(offs_t offset) +{ + return get_rom_base()[offset & 0x3fff]; +} + + +uint8_t aquarius_c1541_device::iorq_r(offs_t offset) +{ + uint8_t data = 0xff; + + if (offset == 0x60) + { + // TODO: unknown connections + data = 0x00; + data |= m_iec->clk_r() << 7; + data |= m_iec->data_r() << 3; + logerror("iorq_r: %02x = %02x\n", offset, data); + } + + return data; +} + +void aquarius_c1541_device::iorq_w(offs_t offset, uint8_t data) +{ + if (offset == 0x60) + { + logerror("iorq_w: %02x = %02x\n", offset, data); + // TODO: unknown connections + m_iec->host_atn_w(BIT(data, 6)); + m_iec->host_clk_w(BIT(data, 5)); + m_iec->host_data_w(BIT(data, 4)); + } +} diff --git a/src/devices/bus/aquarius/c1541.h b/src/devices/bus/aquarius/c1541.h new file mode 100644 index 00000000000..3a9e16e290c --- /dev/null +++ b/src/devices/bus/aquarius/c1541.h @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius C1541 DOS Interface by Ron Koenig + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_C1541_H +#define MAME_BUS_AQUARIUS_C1541_H + +#pragma once + +#include "slot.h" +#include "bus/cbmiec/cbmiec.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_c1541_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_c1541_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::DISK; } + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device<cbm_iec_device> m_iec; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_C1541, aquarius_c1541_device) + + +#endif // MAME_BUS_AQUARIUS_C1541_H diff --git a/src/devices/bus/aquarius/mini.cpp b/src/devices/bus/aquarius/mini.cpp new file mode 100644 index 00000000000..dee7c4cd294 --- /dev/null +++ b/src/devices/bus/aquarius/mini.cpp @@ -0,0 +1,221 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Mini Expander + +**********************************************************************/ + + +#include "emu.h" +#include "mini.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_MINI, aquarius_mini_device, "aquarius_mini", "Aquarius Mini Expander") + + +//------------------------------------------------- +// INPUT_PORTS( mini ) +//------------------------------------------------- + +static INPUT_PORTS_START(mini) + PORT_START("RIGHT") + PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fb) + PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1eb) + PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e9) + PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f9) + PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fd) + PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ed) + PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ec) + PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fc) + PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fe) + PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ee) + PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e6) + PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f6) + PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f7) + PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e7) + PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e3) + PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f3) + PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1bf) + PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17b) + PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x15f) + PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1df) + PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17d) + PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17e) + + PORT_START("LEFT") + PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fb) + PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0eb) + PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e9) + PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f9) + PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fd) + PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ed) + PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ec) + PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fc) + PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fe) + PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ee) + PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e6) + PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f6) + PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f7) + PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e7) + PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e3) + PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f3) + PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0bf) + PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07b) + PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x05f) + PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0df) + PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07d) + PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07e) +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor aquarius_mini_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(mini); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_mini_device::device_add_mconfig(machine_config &config) +{ + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::irq_w)); + + /* sound hardware */ + SPEAKER(config, "mono").front_center(); + + AY8910(config, m_ay, DERIVED_CLOCK(1, 2)); + m_ay->port_a_read_callback().set([this] () { return m_ctrl_input[0]; }); + m_ay->port_b_read_callback().set([this] () { return m_ctrl_input[1]; }); + m_ay->add_route(ALL_OUTPUTS, "mono", 0.25); + + /* cartridge */ + AQUARIUS_CARTRIDGE_SLOT(config, m_exp[0], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp[0]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); + m_exp[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); + + AQUARIUS_CARTRIDGE_SLOT(config, m_exp[1], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp[1]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); + m_exp[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_mini_device - constructor +//------------------------------------------------- + +aquarius_mini_device::aquarius_mini_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_MINI, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_irqs(*this, "irqs") + , m_exp(*this, "exp%u", 1U) + , m_ay(*this, "ay8910") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_mini_device::device_start() +{ + m_ctrl_input[0] = 0xff; + m_ctrl_input[1] = 0xff; + + save_item(NAME(m_ctrl_input)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER(aquarius_mini_device::input_changed) +{ + if (newval) + m_ctrl_input[BIT(param, 8)] &= param; + else + m_ctrl_input[BIT(param, 8)] |= ~param; +} + +uint8_t aquarius_mini_device::mreq_r(offs_t offset) +{ + uint8_t data = 0xff; + + data &= m_exp[0]->mreq_r(offset); + data &= m_exp[1]->mreq_r(offset); + + return data; +} + +void aquarius_mini_device::mreq_w(offs_t offset, uint8_t data) +{ + m_exp[0]->mreq_w(offset, data); + m_exp[1]->mreq_w(offset, data); +} + + +uint8_t aquarius_mini_device::mreq_ce_r(offs_t offset) +{ + uint8_t data = 0xff; + + data &= m_exp[0]->mreq_ce_r(offset); + data &= m_exp[1]->mreq_ce_r(offset); + + return data; +} + +void aquarius_mini_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_exp[0]->mreq_ce_w(offset, data); + m_exp[1]->mreq_ce_w(offset, data); +} + + +uint8_t aquarius_mini_device::iorq_r(offs_t offset) +{ + uint8_t data = 0xff; + + switch (offset & 0xff) + { + case 0xf6: + data &= m_ay->data_r(); + break; + case 0xf7: + break; + } + + data &= m_exp[0]->iorq_r(offset); + data &= m_exp[1]->iorq_r(offset); + + return data; +} + +void aquarius_mini_device::iorq_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xff) + { + case 0xf6: + m_ay->data_w(data); + break; + case 0xf7: + m_ay->address_w(data); + break; + } + + m_exp[0]->iorq_w(offset, data); + m_exp[1]->iorq_w(offset, data); +} diff --git a/src/devices/bus/aquarius/mini.h b/src/devices/bus/aquarius/mini.h new file mode 100644 index 00000000000..ed9cc1af641 --- /dev/null +++ b/src/devices/bus/aquarius/mini.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Mini Expander + +**********************************************************************/ + + +#ifndef MAME_BUS_AQUARIUS_MINI_H +#define MAME_BUS_AQUARIUS_MINI_H + +#include "slot.h" +#include "machine/input_merger.h" +#include "sound/ay8910.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_mini_device: + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_mini_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_INPUT_CHANGED_MEMBER(input_changed); + +protected: + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device<input_merger_device> m_irqs; + required_device_array<aquarius_cartridge_slot_device, 2> m_exp; + required_device<ay8910_device> m_ay; + + uint8_t m_ctrl_input[2]; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_MINI, aquarius_mini_device) + + +#endif /* MAME_BUS_AQUARIUS_MINI_H */ diff --git a/src/devices/bus/aquarius/qdisk.cpp b/src/devices/bus/aquarius/qdisk.cpp new file mode 100644 index 00000000000..ba06201f554 --- /dev/null +++ b/src/devices/bus/aquarius/qdisk.cpp @@ -0,0 +1,164 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Radofin Aquarius Quick Disk + + Specifications: + Capacity 64K byte per side + Read/Write time 64K/8sec + Transmitting speed 101K [BPS] + Recording density 4410 [BPI] + Track density 59 [TPI] + Number of track 1 (spiral) + Recoding system MFM + Rotation speed 423 [RPM] + Disk 2.8" + Number of heads 1 + + TODO: + + - floppy support (I/O 0xe6-0xe7 = drive 1, 0xea-0xeb = drive 2) + +**********************************************************************/ + + +#include "emu.h" +#include "qdisk.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_QDISK, aquarius_qdisk_device, "aquarius_qdisk", "Aquarius Quick Disk") + + +//------------------------------------------------- +// INPUT_PORTS( qdisk ) +//------------------------------------------------- + +static INPUT_PORTS_START(qdisk) + PORT_START("SW1") + PORT_DIPNAME(0x01, 0x00, "Drive Selection") + PORT_DIPSETTING(0x00, "1") + PORT_DIPSETTING(0x01, "2") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor aquarius_qdisk_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(qdisk); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void aquarius_qdisk_device::device_add_mconfig(machine_config &config) +{ + MC6852(config, m_ssda, 6.5_MHz_XTAL); + + AQUARIUS_CARTRIDGE_SLOT(config, m_exp, DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr); + m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::irq_w)); + m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_qdisk_device - constructor +//------------------------------------------------- + +aquarius_qdisk_device::aquarius_qdisk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_QDISK, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_ssda(*this, "mc6852") + , m_exp(*this, "exp") + , m_sw1(*this, "SW1") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_qdisk_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_qdisk_device::mreq_r(offs_t offset) +{ + return m_exp->mreq_r(offset); +} + +void aquarius_qdisk_device::mreq_w(offs_t offset, uint8_t data) +{ + m_exp->mreq_w(offset, data); +} + + +uint8_t aquarius_qdisk_device::mreq_ce_r(offs_t offset) +{ + uint8_t data = get_rom_base()[offset & 0x1fff]; + + data &= m_exp->mreq_ce_r(offset); + + return data; +} + +void aquarius_qdisk_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_exp->mreq_ce_w(offset, data); +} + + +uint8_t aquarius_qdisk_device::iorq_r(offs_t offset) +{ + uint8_t data = m_exp->iorq_r(offset); + + switch (offset & 0xfe) + { + case 0xe6: case 0xea: + if (BIT(offset, 3) == m_sw1->read()) + { + data = m_ssda->read(offset & 0x01); + } + logerror("iorq_r: %02x = %02x\n", offset, data); + break; + } + + data &= m_exp->iorq_r(offset); + + return data; +} + +void aquarius_qdisk_device::iorq_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xfe) + { + case 0xe6: case 0xea: + if (BIT(offset, 3) == m_sw1->read()) + { + m_ssda->write(offset & 0x01, data); + } + logerror("iorq_w: %02x = %02x\n", offset, data); + break; + } + + m_exp->iorq_w(offset, data); +} diff --git a/src/devices/bus/aquarius/qdisk.h b/src/devices/bus/aquarius/qdisk.h new file mode 100644 index 00000000000..303ed90affa --- /dev/null +++ b/src/devices/bus/aquarius/qdisk.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Radofin Aquarius Quick Disk + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_QDISK_H +#define MAME_BUS_AQUARIUS_QDISK_H + +#pragma once + +#include "slot.h" +#include "machine/mc6852.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class aquarius_qdisk_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_qdisk_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::DISK; } + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + virtual uint8_t iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, uint8_t data) override; + +private: + required_device<mc6852_device> m_ssda; + required_device<aquarius_cartridge_slot_device> m_exp; + required_ioport m_sw1; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_QDISK, aquarius_qdisk_device) + + +#endif // MAME_BUS_AQUARIUS_QDISK_H diff --git a/src/devices/bus/aquarius/ram.cpp b/src/devices/bus/aquarius/ram.cpp new file mode 100644 index 00000000000..753a1fbf3a3 --- /dev/null +++ b/src/devices/bus/aquarius/ram.cpp @@ -0,0 +1,110 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Memory Cartridges + +**********************************************************************/ + +#include "emu.h" +#include "ram.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_RAM4, aquarius_ram4_device, "aquarius_ram4", "Aquarius 4K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM16, aquarius_ram16_device, "aquarius_ram16", "Aquarius 16K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM32, aquarius_ram32_device, "aquarius_ram32", "Aquarius 32K Memory Cartridge") +DEFINE_DEVICE_TYPE(AQUARIUS_RAM16P, aquarius_ram16p_device, "aquarius_ram16p", "Aquarius 16K+ Memory Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_ram_device - constructor +//------------------------------------------------- + +aquarius_ram_device::aquarius_ram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint16_t size) + : device_t(mconfig, type, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_ram_size(size) +{ +} + +aquarius_ram4_device::aquarius_ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM4, tag, owner, clock, 0x1000) +{ +} + +aquarius_ram16_device::aquarius_ram16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM16, tag, owner, clock, 0x4000) +{ +} + +aquarius_ram32_device::aquarius_ram32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : aquarius_ram_device(mconfig, AQUARIUS_RAM32, tag, owner, clock, 0x8000) +{ +} + +aquarius_ram16p_device::aquarius_ram16p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_RAM16P, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_ram_device::device_start() +{ + m_ram = make_unique_clear<uint8_t[]>(m_ram_size); + + save_pointer(NAME(m_ram), m_ram_size); +} + +void aquarius_ram16p_device::device_start() +{ + m_ram = make_unique_clear<uint8_t[]>(0x4000); + + save_pointer(NAME(m_ram), 0x4000); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_ram_device::mreq_r(offs_t offset) +{ + if (offset < m_ram_size) + { + return m_ram[offset]; + } + + return 0xff; +} + +void aquarius_ram_device::mreq_w(offs_t offset, uint8_t data) +{ + if (offset < m_ram_size) + { + m_ram[offset] = data; + } +} + + +uint8_t aquarius_ram16p_device::mreq_ce_r(offs_t offset) +{ + return m_ram[offset]; +} + +void aquarius_ram16p_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + m_ram[offset] = data; +} diff --git a/src/devices/bus/aquarius/ram.h b/src/devices/bus/aquarius/ram.h new file mode 100644 index 00000000000..3721314bb0f --- /dev/null +++ b/src/devices/bus/aquarius/ram.h @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Memory Cartridges + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_RAM_H +#define MAME_BUS_AQUARIUS_RAM_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_ram_device + +class aquarius_ram_device : + public device_t, + public device_aquarius_cartridge_interface +{ +protected: + // construction/destruction + aquarius_ram_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, uint16_t size); + + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_r(offs_t offset) override; + virtual void mreq_w(offs_t offset, uint8_t data) override; + +private: + uint16_t m_ram_size; + + std::unique_ptr<uint8_t[]> m_ram; +}; + +// ======================> aquarius_ram4_device + +class aquarius_ram4_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +// ======================> aquarius_ram16_device + +class aquarius_ram16_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +// ======================> aquarius_ram32_device + +class aquarius_ram32_device : public aquarius_ram_device +{ +public: + // construction/destruction + aquarius_ram32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// ======================> aquarius_ram16p_device + +class aquarius_ram16p_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_ram16p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + +private: + std::unique_ptr<uint8_t[]> m_ram; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_RAM4, aquarius_ram4_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM16, aquarius_ram16_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM32, aquarius_ram32_device) +DECLARE_DEVICE_TYPE(AQUARIUS_RAM16P, aquarius_ram16p_device) + + +#endif // MAME_BUS_AQUARIUS_RAM_H diff --git a/src/devices/bus/aquarius/rom.cpp b/src/devices/bus/aquarius/rom.cpp new file mode 100644 index 00000000000..87f7df97079 --- /dev/null +++ b/src/devices/bus/aquarius/rom.cpp @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius Software Cartridges + +***************************************************************************/ + +#include "emu.h" +#include "rom.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_ROM, aquarius_rom_device, "aquarius_rom", "Aquarius ROM Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_rom_device - constructor +//------------------------------------------------- + +aquarius_rom_device::aquarius_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_ROM, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_rom_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_rom_device::mreq_ce_r(offs_t offset) +{ + return get_rom_base()[offset & (get_rom_size() - 1)]; +} diff --git a/src/devices/bus/aquarius/rom.h b/src/devices/bus/aquarius/rom.h new file mode 100644 index 00000000000..9e25f9e9ab0 --- /dev/null +++ b/src/devices/bus/aquarius/rom.h @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius Software Cartridges + +***************************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_ROM_H +#define MAME_BUS_AQUARIUS_ROM_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_rom_device + +class aquarius_rom_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_ROM, aquarius_rom_device) + + +#endif // MAME_BUS_AQUARIUS_ROM_H diff --git a/src/devices/bus/aquarius/slot.cpp b/src/devices/bus/aquarius/slot.cpp new file mode 100644 index 00000000000..825e03f39d5 --- /dev/null +++ b/src/devices/bus/aquarius/slot.cpp @@ -0,0 +1,225 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Cartridge Port emulation + +**********************************************************************/ + +#include "emu.h" +#include "slot.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_CARTRIDGE_SLOT, aquarius_cartridge_slot_device, "aquarius_cartridge_slot", "Aquarius Cartridge port") + + +//************************************************************************** +// DEVICE AQUARIUS_CARTRIDGE CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_aquarius_cartridge_interface - constructor +//------------------------------------------------- + +device_aquarius_cartridge_interface::device_aquarius_cartridge_interface(const machine_config &mconfig, device_t &device) + : device_interface(device, "aquariuscart") + , m_rom(nullptr) + , m_rom_size(0) +{ + m_slot = dynamic_cast<aquarius_cartridge_slot_device *>(device.owner()); +} + + +//------------------------------------------------- +// rom_alloc - alloc the space for the ROM +//------------------------------------------------- + +void device_aquarius_cartridge_interface::rom_alloc(uint32_t size, const char *tag) +{ + if (m_rom == nullptr) + { + m_rom = device().machine().memory().region_alloc(std::string(tag).append(AQUARIUS_CART_ROM_REGION_TAG).c_str(), size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_cartridge_slot_device - constructor +//------------------------------------------------- + +aquarius_cartridge_slot_device::aquarius_cartridge_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_CARTRIDGE_SLOT, tag, owner, clock) + , device_image_interface(mconfig, *this) + , device_single_card_slot_interface<device_aquarius_cartridge_interface>(mconfig, *this) + , m_cart(nullptr) + , m_irq_handler(*this) + , m_nmi_handler(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_cartridge_slot_device::device_start() +{ + m_cart = get_card_device(); + + // resolve callbacks + m_irq_handler.resolve_safe(); + m_nmi_handler.resolve_safe(); +} + +//------------------------------------------------- +// call_load +//------------------------------------------------- + +image_init_result aquarius_cartridge_slot_device::call_load() +{ + if (m_cart) + { + uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom"); + + if (size % 0x1000) + { + seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid ROM size"); + return image_init_result::FAIL; + } + + m_cart->rom_alloc(size, tag()); + + if (!loaded_through_softlist()) + fread(m_cart->get_rom_base(), size); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + } + + return image_init_result::PASS; +} + +//------------------------------------------------- +// get_default_card_software +//------------------------------------------------- + +std::string aquarius_cartridge_slot_device::get_default_card_software(get_default_card_software_hook &hook) const +{ + static const unsigned char SC08_HEADER[16] = { 0x53, 0x43, 0x30, 0x38, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x06, 0x70 }; + static const unsigned char SC16_HEADER[16] = { 0x53, 0x43, 0x31, 0x36, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x08, 0x70 }; + + if (hook.image_file()) + { + const char *slot_string = "rom"; + uint32_t len = hook.image_file()->size(); + + if (len >= 0x10000) + { + std::vector<uint8_t> header(16); + + hook.image_file()->seek(len - 0x2000, SEEK_SET); + hook.image_file()->read(&header[0], 16); + + // detect SuperCart header + if (!memcmp(&header[0], SC08_HEADER, 16) || !memcmp(&header[0], SC16_HEADER, 16)) + slot_string = "sc1"; + } + + return std::string(slot_string); + } + else + return software_get_default_slot("rom"); +} + +//------------------------------------------------- +// iorq_r +//------------------------------------------------- + +uint8_t aquarius_cartridge_slot_device::iorq_r(offs_t offset) +{ + if (m_cart) + return m_cart->iorq_r(offset); + else + return 0xff; +} + +//------------------------------------------------- +// iorq_w +//------------------------------------------------- + +void aquarius_cartridge_slot_device::iorq_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->iorq_w(offset, data); +} + +//------------------------------------------------- +// mreq_r +//------------------------------------------------- + +uint8_t aquarius_cartridge_slot_device::mreq_r(offs_t offset) +{ + if (m_cart) + return m_cart->mreq_r(offset); + else + return 0xff; +} + +uint8_t aquarius_cartridge_slot_device::mreq_ce_r(offs_t offset) +{ + if (m_cart) + return m_cart->mreq_ce_r(offset); + else + return 0xff; +} + +//------------------------------------------------- +// mreq_w +//------------------------------------------------- + +void aquarius_cartridge_slot_device::mreq_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->mreq_w(offset, data); +} + +void aquarius_cartridge_slot_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + if (m_cart) + m_cart->mreq_ce_w(offset, data); +} + + +//------------------------------------------------- +// SLOT_INTERFACE( aquarius_cartridge_devices ) +//------------------------------------------------- + + +// slot devices +#include "c1541.h" +#include "mini.h" +#include "qdisk.h" +#include "ram.h" +#include "rom.h" +#include "supercart.h" + + +void aquarius_cartridge_devices(device_slot_interface &device) +{ + device.option_add("mini", AQUARIUS_MINI); + device.option_add("ram4", AQUARIUS_RAM4); + device.option_add("ram16", AQUARIUS_RAM16); + device.option_add("ram16p", AQUARIUS_RAM16P); + device.option_add("ram32", AQUARIUS_RAM32); + device.option_add_internal("c1541", AQUARIUS_C1541); + device.option_add_internal("qdisk", AQUARIUS_QDISK); + device.option_add_internal("rom", AQUARIUS_ROM); + device.option_add_internal("sc1", AQUARIUS_SC1); +} diff --git a/src/devices/bus/aquarius/slot.h b/src/devices/bus/aquarius/slot.h new file mode 100644 index 00000000000..3c836803ab1 --- /dev/null +++ b/src/devices/bus/aquarius/slot.h @@ -0,0 +1,126 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Aquarius Cartridge Port emulation + +**********************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_SLOT_H +#define MAME_BUS_AQUARIUS_SLOT_H + +#pragma once + +#include "softlist_dev.h" + + +#define AQUARIUS_CART_ROM_REGION_TAG ":cart:rom" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_cartridge_slot_device + +class device_aquarius_cartridge_interface; + +class aquarius_cartridge_slot_device : public device_t, + public device_image_interface, + public device_single_card_slot_interface<device_aquarius_cartridge_interface> +{ +public: + // construction/destruction + template <typename T> + aquarius_cartridge_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&slot_options, const char *default_option) + : aquarius_cartridge_slot_device(mconfig, tag, owner, clock) + { + option_reset(); + slot_options(*this); + set_default_option(default_option); + set_fixed(false); + } + + aquarius_cartridge_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock); + + // callbacks + auto irq_handler() { return m_irq_handler.bind(); } + auto nmi_handler() { return m_nmi_handler.bind(); } + + // image-level overrides + virtual image_init_result call_load() override; + + virtual iodevice_t image_type() const noexcept override { return IO_CARTSLOT; } + virtual bool is_readable() const noexcept override { return true; } + virtual bool is_writeable() const noexcept override { return true; } + virtual bool is_creatable() const noexcept override { return false; } + virtual bool must_be_loaded() const noexcept override { return false; } + virtual bool is_reset_on_load() const noexcept override { return true; } + virtual const char *image_interface() const noexcept override { return "aquarius_cart"; } + virtual const char *file_extensions() const noexcept override { return "rom,bin"; } + + // slot interface overrides + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + + // reading and writing + uint8_t mreq_r(offs_t offset); + void mreq_w(offs_t offset, uint8_t data); + uint8_t mreq_ce_r(offs_t offset); + void mreq_ce_w(offs_t offset, uint8_t data); + uint8_t iorq_r(offs_t offset); + void iorq_w(offs_t offset, uint8_t data); + + DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); } + DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); } + +protected: + // device-level overrides + virtual void device_start() override; + + // device_image_interface implementation + virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); } + + device_aquarius_cartridge_interface *m_cart; + +private: + devcb_write_line m_irq_handler; + devcb_write_line m_nmi_handler; +}; + + +// ======================> device_aquarius_cartridge_interface + +class device_aquarius_cartridge_interface : public device_interface +{ +public: + // reading and writing + virtual uint8_t mreq_r(offs_t offset) { return 0xff; } + virtual void mreq_w(offs_t offset, uint8_t data) { } + virtual uint8_t mreq_ce_r(offs_t offset) { return 0xff; } + virtual void mreq_ce_w(offs_t offset, uint8_t data) { } + virtual uint8_t iorq_r(offs_t offset) { return 0xff; } + virtual void iorq_w(offs_t offset, uint8_t data) { } + + void rom_alloc(uint32_t size, const char *tag); + uint8_t* get_rom_base() { return m_rom; } + uint32_t get_rom_size() { return m_rom_size; } + +protected: + // construction/destruction + device_aquarius_cartridge_interface(const machine_config &mconfig, device_t &device); + + aquarius_cartridge_slot_device *m_slot; + +private: + // internal state + uint8_t *m_rom; + uint32_t m_rom_size; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_CARTRIDGE_SLOT, aquarius_cartridge_slot_device) + +void aquarius_cartridge_devices(device_slot_interface &device); + + +#endif // MAME_BUS_AQUARIUS_SLOT_H diff --git a/src/devices/bus/aquarius/supercart.cpp b/src/devices/bus/aquarius/supercart.cpp new file mode 100644 index 00000000000..2bc2ad82fd8 --- /dev/null +++ b/src/devices/bus/aquarius/supercart.cpp @@ -0,0 +1,101 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius SuperCart Cartridge + +***************************************************************************/ + +#include "emu.h" +#include "supercart.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(AQUARIUS_SC1, aquarius_sc1_device, "aquarius_sc1", "Aquarius SuperCart I Cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// aquarius_sc1_device - constructor +//------------------------------------------------- + +aquarius_sc1_device::aquarius_sc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AQUARIUS_SC1, tag, owner, clock) + , device_aquarius_cartridge_interface(mconfig, *this) + , m_bank(0) + , m_mode(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aquarius_sc1_device::device_start() +{ + save_item(NAME(m_bank)); + save_item(NAME(m_mode)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void aquarius_sc1_device::device_reset() +{ + static const unsigned char SC08_HEADER[16] = { 0x53, 0x43, 0x30, 0x38, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x06, 0x70 }; + static const unsigned char SC16_HEADER[16] = { 0x53, 0x43, 0x31, 0x36, 0x4b, 0x9c, 0xb5, 0xb0, 0xa8, 0x6c, 0xac, 0x64, 0xcc, 0xa8, 0x08, 0x70 }; + + uint8_t* header = get_rom_base() + get_rom_size() - 0x2000; + + // select bank switching mode + if (!memcmp(header, SC08_HEADER, 16)) + m_mode = 0; + else if (!memcmp(header, SC16_HEADER, 16)) + m_mode = 1; + else + fatalerror("Invalid SuperCart mode header\n"); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t aquarius_sc1_device::mreq_ce_r(offs_t offset) +{ + switch (m_mode) + { + case 0: // 8K Mode + if (offset & 0x2000) + { + offset |= get_rom_size() - 0x2000; + } + else + { + offset |= m_bank << 13; + } + break; + + case 1: // 16K Mode + offset |= (m_bank & 0x7e) << 13; + break; + } + + return get_rom_base()[offset & (get_rom_size() - 1)]; +} + +void aquarius_sc1_device::mreq_ce_w(offs_t offset, uint8_t data) +{ + if (offset & 0x2000) + { + m_bank = data & 0x7f; + } +} diff --git a/src/devices/bus/aquarius/supercart.h b/src/devices/bus/aquarius/supercart.h new file mode 100644 index 00000000000..9242c1dc667 --- /dev/null +++ b/src/devices/bus/aquarius/supercart.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Aquarius SuperCart Cartridge + +***************************************************************************/ + +#ifndef MAME_BUS_AQUARIUS_SUPERCART_H +#define MAME_BUS_AQUARIUS_SUPERCART_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> aquarius_sc1_device + +class aquarius_sc1_device : + public device_t, + public device_aquarius_cartridge_interface +{ +public: + // construction/destruction + aquarius_sc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_aquarius_cartridge_interface overrides + virtual uint8_t mreq_ce_r(offs_t offset) override; + virtual void mreq_ce_w(offs_t offset, uint8_t data) override; + +private: + uint8_t m_bank; + int m_mode; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(AQUARIUS_SC1, aquarius_sc1_device) + + +#endif // MAME_BUS_AQUARIUS_SUPERCART_H diff --git a/src/devices/bus/arcadia/slot.cpp b/src/devices/bus/arcadia/slot.cpp index 7d4e7547d9a..bf9329dc880 100644 --- a/src/devices/bus/arcadia/slot.cpp +++ b/src/devices/bus/arcadia/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -110,7 +109,7 @@ static int arcadia_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 7e7dc8cf059..0e72d9b57b9 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -112,7 +111,7 @@ static int astrocade_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/ata/atapicdr.cpp b/src/devices/bus/ata/atapicdr.cpp index 33cb0cb154e..2099763468c 100644 --- a/src/devices/bus/ata/atapicdr.cpp +++ b/src/devices/bus/ata/atapicdr.cpp @@ -130,6 +130,7 @@ void atapi_cdrom_device::ExecCommand() m_transfer_length = 0; return; } + [[fallthrough]]; default: if(m_media_change) { diff --git a/src/devices/bus/bbc/1mhzbus/cc500.cpp b/src/devices/bus/bbc/1mhzbus/cc500.cpp index 8de7f36b884..c04fc06429e 100644 --- a/src/devices/bus/bbc/1mhzbus/cc500.cpp +++ b/src/devices/bus/bbc/1mhzbus/cc500.cpp @@ -61,7 +61,7 @@ ROM_END void bbc_cc500_device::device_add_mconfig(machine_config &config) { - VIA6522(config, m_via, DERIVED_CLOCK(1, 1)); + MOS6522(config, m_via, DERIVED_CLOCK(1, 1)); m_via->readpa_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepa_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); diff --git a/src/devices/bus/bbc/fdc/opus.cpp b/src/devices/bus/bbc/fdc/opus.cpp index 43425182fba..5f1727f8251 100644 --- a/src/devices/bus/bbc/fdc/opus.cpp +++ b/src/devices/bus/bbc/fdc/opus.cpp @@ -230,6 +230,7 @@ uint8_t bbc_opus8272_device::read(offs_t offset) case 0x06: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(1); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(1); + [[fallthrough]]; case 0x04: data = m_fdc->msr_r(); break; @@ -237,6 +238,7 @@ uint8_t bbc_opus8272_device::read(offs_t offset) case 0x05: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); + [[fallthrough]]; case 0x07: data = m_fdc->fifo_r(); break; @@ -262,6 +264,7 @@ void bbc_opus8272_device::write(offs_t offset, uint8_t data) case 0x05: if (m_floppy0->get_device()) m_floppy0->get_device()->mon_w(0); if (m_floppy1->get_device()) m_floppy1->get_device()->mon_w(0); + [[fallthrough]]; case 0x07: m_fdc->fifo_w(data); break; diff --git a/src/devices/bus/bbc/tube/tube_arm.cpp b/src/devices/bus/bbc/tube/tube_arm.cpp index 2648f6234cf..fb557357310 100644 --- a/src/devices/bus/bbc/tube/tube_arm.cpp +++ b/src/devices/bus/bbc/tube/tube_arm.cpp @@ -26,9 +26,9 @@ DEFINE_DEVICE_TYPE(BBC_TUBE_ARM, bbc_tube_arm_device, "bbc_tube_arm", "ARM Evalu void bbc_tube_arm_device::tube_arm_mem(address_map &map) { map.unmap_value_high(); - map(0x0000000, 0x03fffff).rw(FUNC(bbc_tube_arm_device::ram_r), FUNC(bbc_tube_arm_device::ram_w)); + map(0x0000000, 0x03fffff).ram().share(RAM_TAG); map(0x0400000, 0x0ffffff).noprw(); - map(0x1000000, 0x100001f).rw("ula", FUNC(tube_device::parasite_r), FUNC(tube_device::parasite_w)).umask32(0x000000ff); + map(0x1000000, 0x100001f).rw(m_ula, FUNC(tube_device::parasite_r), FUNC(tube_device::parasite_w)).umask32(0x000000ff); map(0x3000000, 0x3003fff).rom().region("bootstrap", 0).mirror(0xc000); } @@ -53,12 +53,12 @@ ROM_END void bbc_tube_arm_device::device_add_mconfig(machine_config &config) { - ARM(config, m_arm, 20_MHz_XTAL / 3); - m_arm->set_addrmap(AS_PROGRAM, &bbc_tube_arm_device::tube_arm_mem); + ARM(config, m_maincpu, 20_MHz_XTAL / 3); + m_maincpu->set_addrmap(AS_PROGRAM, &bbc_tube_arm_device::tube_arm_mem); TUBE(config, m_ula); - m_ula->pnmi_handler().set_inputline(m_arm, ARM_FIRQ_LINE); - m_ula->pirq_handler().set_inputline(m_arm, ARM_IRQ_LINE); + m_ula->pnmi_handler().set_inputline(m_maincpu, ARM_FIRQ_LINE); + m_ula->pirq_handler().set_inputline(m_maincpu, ARM_IRQ_LINE); /* internal ram */ RAM(config, m_ram).set_default_size("4M").set_default_value(0); @@ -87,11 +87,10 @@ const tiny_rom_entry *bbc_tube_arm_device::device_rom_region() const bbc_tube_arm_device::bbc_tube_arm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, BBC_TUBE_ARM, tag, owner, clock) , device_bbc_tube_interface(mconfig, *this) - , m_arm(*this, "arm") + , m_maincpu(*this, "maincpu") , m_ula(*this, "ula") , m_ram(*this, "ram") , m_bootstrap(*this, "bootstrap") - , m_rom_select(true) { } @@ -109,8 +108,19 @@ void bbc_tube_arm_device::device_start() void bbc_tube_arm_device::device_reset() { + address_space &program = m_maincpu->space(AS_PROGRAM); + /* enable the reset vector to be fetched from ROM */ - m_rom_select = true; + m_maincpu->space(AS_PROGRAM).install_rom(0x000000, 0x003fff, 0x3fc000, m_bootstrap->base()); + + m_rom_shadow_tap = program.install_write_tap(0x0000000, 0x03fffff, "rom_shadow_w",[this](offs_t offset, u32 &data, u32 mem_mask) + { + /* delete this tap */ + m_rom_shadow_tap->remove(); + + /* install ram */ + m_maincpu->space(AS_PROGRAM).install_ram(0x0000000, 0x03fffff, m_ram->pointer()); + }); } @@ -127,24 +137,3 @@ void bbc_tube_arm_device::host_w(offs_t offset, uint8_t data) { m_ula->host_w(offset, data); } - - -uint8_t bbc_tube_arm_device::ram_r(offs_t offset) -{ - uint8_t data; - - if (m_rom_select) - data = m_bootstrap->base()[offset & 0x3fff]; - else - data = m_ram->pointer()[offset]; - - return data; -} - -void bbc_tube_arm_device::ram_w(offs_t offset, uint8_t data) -{ - /* clear ROM select on first write */ - if (!machine().side_effects_disabled()) m_rom_select = false; - - m_ram->pointer()[offset] = data; -} diff --git a/src/devices/bus/bbc/tube/tube_arm.h b/src/devices/bus/bbc/tube/tube_arm.h index 8470fec84ef..a8388885840 100644 --- a/src/devices/bus/bbc/tube/tube_arm.h +++ b/src/devices/bus/bbc/tube/tube_arm.h @@ -42,15 +42,12 @@ protected: virtual void host_w(offs_t offset, uint8_t data) override; private: - required_device<arm_cpu_device> m_arm; + required_device<arm_cpu_device> m_maincpu; required_device<tube_device> m_ula; required_device<ram_device> m_ram; required_memory_region m_bootstrap; - bool m_rom_select; - - uint8_t ram_r(offs_t offset); - void ram_w(offs_t offset, uint8_t data); + memory_passthrough_handler *m_rom_shadow_tap; void tube_arm_mem(address_map &map); }; diff --git a/src/devices/bus/bbc/tube/tube_casper.cpp b/src/devices/bus/bbc/tube/tube_casper.cpp index b75142d1383..301f0d4df32 100644 --- a/src/devices/bus/bbc/tube/tube_casper.cpp +++ b/src/devices/bus/bbc/tube/tube_casper.cpp @@ -53,13 +53,13 @@ void bbc_tube_casper_device::device_add_mconfig(machine_config &config) M68000(config, m_m68000, 4_MHz_XTAL); m_m68000->set_addrmap(AS_PROGRAM, &bbc_tube_casper_device::tube_casper_mem); - VIA6522(config, m_via6522_0, 4_MHz_XTAL / 2); + MOS6522(config, m_via6522_0, 4_MHz_XTAL / 2); m_via6522_0->writepb_handler().set(m_via6522_1, FUNC(via6522_device::write_pa)); m_via6522_0->ca2_handler().set(m_via6522_1, FUNC(via6522_device::write_cb1)); m_via6522_0->cb2_handler().set(m_via6522_1, FUNC(via6522_device::write_ca1)); m_via6522_0->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_tube_slot_device::irq_w)); - VIA6522(config, m_via6522_1, 4_MHz_XTAL / 2); + MOS6522(config, m_via6522_1, 4_MHz_XTAL / 2); m_via6522_1->writepb_handler().set(m_via6522_0, FUNC(via6522_device::write_pa)); m_via6522_1->ca2_handler().set(m_via6522_0, FUNC(via6522_device::write_cb1)); m_via6522_1->cb2_handler().set(m_via6522_0, FUNC(via6522_device::write_ca1)); diff --git a/src/devices/bus/bbc/tube/tube_rc6502.cpp b/src/devices/bus/bbc/tube/tube_rc6502.cpp index 666c5fbece7..1c05d6c3b89 100644 --- a/src/devices/bus/bbc/tube/tube_rc6502.cpp +++ b/src/devices/bus/bbc/tube/tube_rc6502.cpp @@ -61,13 +61,13 @@ ioport_constructor bbc_tube_rc6502_device::device_input_ports() const void bbc_tube_rc6502_device::tube_rc6502_bank(address_map &map) { // Bank 0: ROM disabled with banked RAM (65C02) - map(0x000000, 0x00ffff).ram().share("ram"); + map(0x000000, 0x07ffff).ram().share("ram"); map(0x004000, 0x007fff).bankrw(m_bank1); map(0x008000, 0x00bfff).bankrw(m_bank2); // Bank 1: ROM disabled with linear RAM (65C816) map(0x100000, 0x17ffff).ram().share("ram"); // Bank 2: ROM enabled with banked RAM (65C02) - map(0x200000, 0x20ffff).ram().share("ram"); + map(0x200000, 0x27ffff).ram().share("ram"); map(0x204000, 0x207fff).bankrw(m_bank1); map(0x208000, 0x20bfff).bankrw(m_bank2); map(0x208000, 0x20ffff).rom().region("maincpu", 0); diff --git a/src/devices/bus/bbc/tube/tube_zep100.cpp b/src/devices/bus/bbc/tube/tube_zep100.cpp index 261f6357926..0d5b0d18948 100644 --- a/src/devices/bus/bbc/tube/tube_zep100.cpp +++ b/src/devices/bus/bbc/tube/tube_zep100.cpp @@ -105,7 +105,7 @@ void bbc_tube_zep100_device::device_add_mconfig(machine_config &config) m_z80->set_addrmap(AS_PROGRAM, &bbc_tube_zep100_device::tube_zep100_mem); m_z80->set_addrmap(AS_IO, &bbc_tube_zep100_device::tube_zep100_io); - VIA6522(config, m_via, 4_MHz_XTAL / 2); + MOS6522(config, m_via, 4_MHz_XTAL / 2); m_via->writepb_handler().set(FUNC(bbc_tube_zep100_device::via_pb_w)); m_via->cb2_handler().set(m_ppi, FUNC(i8255_device::pc2_w)); m_via->ca2_handler().set(m_ppi, FUNC(i8255_device::pc6_w)); diff --git a/src/devices/bus/bw2/ramcard.cpp b/src/devices/bus/bw2/ramcard.cpp index b1e0bfe5bcf..33d1fc147d9 100644 --- a/src/devices/bus/bw2/ramcard.cpp +++ b/src/devices/bus/bw2/ramcard.cpp @@ -51,7 +51,7 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char : device_t(mconfig, BW2_RAMCARD, tag, owner, clock), device_bw2_expansion_slot_interface(mconfig, *this), m_rom(*this, "ramcard"), - m_ram(*this, "ram"), + m_ram(*this, "ram", 512*1024, ENDIANNESS_LITTLE), m_en(0), m_bank(0) { @@ -64,9 +64,6 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char void bw2_ramcard_device::device_start() { - // allocate memory - m_ram.allocate(512 * 1024); - // state saving save_item(NAME(m_en)); save_item(NAME(m_bank)); diff --git a/src/devices/bus/bw2/ramcard.h b/src/devices/bus/bw2/ramcard.h index 029d9b91feb..f3cd95f38d4 100644 --- a/src/devices/bus/bw2/ramcard.h +++ b/src/devices/bus/bw2/ramcard.h @@ -43,7 +43,7 @@ protected: private: required_memory_region m_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_en; uint8_t m_bank; diff --git a/src/devices/bus/c64/bn1541.cpp b/src/devices/bus/c64/bn1541.cpp index dbb5fc4bb1a..ffdf84b77d1 100644 --- a/src/devices/bus/c64/bn1541.cpp +++ b/src/devices/bus/c64/bn1541.cpp @@ -75,9 +75,9 @@ c64_bn1541_device::c64_bn1541_device(const machine_config &mconfig, const char * void c64_bn1541_device::device_start() { - for (device_t &device : device_iterator(machine().root_device())) + for (device_t &device : device_enumerator(machine().root_device())) { - for (device_t &subdevice : device_iterator(device)) + for (device_t &subdevice : device_enumerator(device)) { if (subdevice.interface(m_other) && &subdevice != this) { diff --git a/src/devices/bus/c64/c128_partner.cpp b/src/devices/bus/c64/c128_partner.cpp index 91b7cf751ab..808926d8583 100644 --- a/src/devices/bus/c64/c128_partner.cpp +++ b/src/devices/bus/c64/c128_partner.cpp @@ -80,7 +80,8 @@ ioport_constructor c128_partner_cartridge_device::device_input_ports() const c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C128_PARTNER, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), t_joyb2(nullptr), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), + t_joyb2(nullptr), m_ram_a12_a7(0), m_ls74_cd(0), m_ls74_q1(0), @@ -96,9 +97,6 @@ c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_confi void c128_partner_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); - // simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle t_joyb2 = timer_alloc(); t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16)); diff --git a/src/devices/bus/c64/c128_partner.h b/src/devices/bus/c64/c128_partner.h index 1f4402d5b22..da906531122 100644 --- a/src/devices/bus/c64/c128_partner.h +++ b/src/devices/bus/c64/c128_partner.h @@ -49,7 +49,7 @@ protected: virtual void vcs_joy_w(uint8_t data); private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; emu_timer *t_joyb2; int m_ram_a12_a7; diff --git a/src/devices/bus/c64/dela_ep256.cpp b/src/devices/bus/c64/dela_ep256.cpp index 8642d7c5f55..d5052f914b2 100644 --- a/src/devices/bus/c64/dela_ep256.cpp +++ b/src/devices/bus/c64/dela_ep256.cpp @@ -24,14 +24,8 @@ DEFINE_DEVICE_TYPE(C64_DELA_EP256, c64_dela_ep256_cartridge_device, "c64_dela_ep void c64_dela_ep256_cartridge_device::device_add_mconfig(machine_config &config) { - GENERIC_SOCKET(config, "rom1", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom2", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom3", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom4", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom5", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom6", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom7", generic_linear_slot, nullptr, "bin,rom"); - GENERIC_SOCKET(config, "rom8", generic_linear_slot, nullptr, "bin,rom"); + for (auto &rom : m_eproms) + GENERIC_SOCKET(config, rom, generic_linear_slot, nullptr, "bin,rom"); } @@ -46,14 +40,9 @@ void c64_dela_ep256_cartridge_device::device_add_mconfig(machine_config &config) c64_dela_ep256_cartridge_device::c64_dela_ep256_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_DELA_EP256, tag, owner, clock), - device_c64_expansion_card_interface(mconfig, *this) + device_c64_expansion_card_interface(mconfig, *this), + m_eproms(*this, "rom%u", 1U) { - for (int i = 0; i < 8; i++) - { - char str[6]; - sprintf(str, "rom%i", i + 1); - m_eproms[i] = subdevice<generic_slot_device>(str); - } } diff --git a/src/devices/bus/c64/dela_ep256.h b/src/devices/bus/c64/dela_ep256.h index 61501df0790..bb6806f4d8e 100644 --- a/src/devices/bus/c64/dela_ep256.h +++ b/src/devices/bus/c64/dela_ep256.h @@ -44,7 +44,7 @@ protected: virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; private: - generic_slot_device *m_eproms[8]; + required_device_array<generic_slot_device, 8> m_eproms; uint8_t m_bank, m_socket; int m_reset; diff --git a/src/devices/bus/c64/dqbb.cpp b/src/devices/bus/c64/dqbb.cpp index 20adedd9057..e08bfbd05b5 100644 --- a/src/devices/bus/c64/dqbb.cpp +++ b/src/devices/bus/c64/dqbb.cpp @@ -53,7 +53,8 @@ c64_dqbb_cartridge_device::c64_dqbb_cartridge_device(const machine_config &mconf void c64_dqbb_cartridge_device::device_start() { // allocate memory - m_nvram.allocate(0x4000); + m_nvram = std::make_unique<uint8_t[]>(0x4000); + save_pointer(NAME(m_nvram), 0x4000); // state saving save_item(NAME(m_cs)); diff --git a/src/devices/bus/c64/dqbb.h b/src/devices/bus/c64/dqbb.h index aaa8c0e1bf4..af9460a5bbe 100644 --- a/src/devices/bus/c64/dqbb.h +++ b/src/devices/bus/c64/dqbb.h @@ -38,8 +38,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x4000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x4000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; diff --git a/src/devices/bus/c64/easyflash.cpp b/src/devices/bus/c64/easyflash.cpp index 38cdf9739c6..eab9ff7930a 100644 --- a/src/devices/bus/c64/easyflash.cpp +++ b/src/devices/bus/c64/easyflash.cpp @@ -77,7 +77,7 @@ c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_con m_flash_roml(*this, AM29F040_0_TAG), m_flash_romh(*this, AM29F040_1_TAG), m_jp1(*this, "JP1"), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x100, ENDIANNESS_LITTLE), m_bank(0), m_mode(0) { @@ -90,9 +90,6 @@ c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_con void c64_easyflash_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x100); - // state saving save_item(NAME(m_bank)); save_item(NAME(m_mode)); diff --git a/src/devices/bus/c64/easyflash.h b/src/devices/bus/c64/easyflash.h index 377de25d50d..6c73a14838a 100644 --- a/src/devices/bus/c64/easyflash.h +++ b/src/devices/bus/c64/easyflash.h @@ -49,7 +49,7 @@ private: required_device<amd_29f040_device> m_flash_roml; required_device<amd_29f040_device> m_flash_romh; required_ioport m_jp1; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; uint8_t m_mode; diff --git a/src/devices/bus/c64/exp.cpp b/src/devices/bus/c64/exp.cpp index 3c5663db036..8304a7be6b7 100644 --- a/src/devices/bus/c64/exp.cpp +++ b/src/devices/bus/c64/exp.cpp @@ -29,10 +29,6 @@ DEFINE_DEVICE_TYPE(C64_EXPANSION_SLOT, c64_expansion_slot_device, "c64_expansion device_c64_expansion_card_interface::device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "c64exp"), - m_roml(*this, "roml"), - m_romh(*this, "romh"), - m_romx(*this, "romx"), - m_nvram(*this, "nvram"), m_game(1), m_exrom(1) { @@ -148,11 +144,11 @@ image_init_result c64_expansion_slot_device::call_load() uint8_t *roml = nullptr; uint8_t *romh = nullptr; - m_card->m_roml.allocate(roml_size); - m_card->m_romh.allocate(romh_size); + m_card->m_roml = std::make_unique<uint8_t[]>(roml_size); + m_card->m_romh = std::make_unique<uint8_t[]>(romh_size); - if (roml_size) roml = m_card->m_roml; - if (romh_size) romh = m_card->m_roml; + if (roml_size) roml = m_card->m_roml.get(); + if (romh_size) romh = m_card->m_romh.get(); cbm_crt_read_data(image_core_file(), roml, romh); } diff --git a/src/devices/bus/c64/exp.h b/src/devices/bus/c64/exp.h index 2507227d724..29e79fb1ff8 100644 --- a/src/devices/bus/c64/exp.h +++ b/src/devices/bus/c64/exp.h @@ -148,10 +148,10 @@ public: protected: device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_roml; - optional_shared_ptr<uint8_t> m_romh; - optional_shared_ptr<uint8_t> m_romx; - optional_shared_ptr<uint8_t> m_nvram; + std::unique_ptr<uint8_t[]> m_roml; + std::unique_ptr<uint8_t[]> m_romh; + std::unique_ptr<uint8_t[]> m_romx; + std::unique_ptr<uint8_t[]> m_nvram; int m_game; int m_exrom; diff --git a/src/devices/bus/c64/fcc.cpp b/src/devices/bus/c64/fcc.cpp index 405c1761a2e..07ff8840e3a 100644 --- a/src/devices/bus/c64/fcc.cpp +++ b/src/devices/bus/c64/fcc.cpp @@ -97,7 +97,10 @@ c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mco void c64_final_chesscard_device::device_start() { + m_nvram = std::make_unique<uint8_t[]>(0x2000); + // state saving + save_pointer(NAME(m_nvram), 0x2000); save_item(NAME(m_bank)); save_item(NAME(m_hidden)); } diff --git a/src/devices/bus/c64/fcc.h b/src/devices/bus/c64/fcc.h index 03eac948a73..15a096f5cf5 100644 --- a/src/devices/bus/c64/fcc.h +++ b/src/devices/bus/c64/fcc.h @@ -42,8 +42,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x2000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x2000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; @@ -59,8 +59,8 @@ private: DECLARE_WRITE_LINE_MEMBER(mainlatch_int) { m_slot->nmi_w(state); } uint8_t rom_r(offs_t offset) { return m_romx[offset]; } // cartridge cpu rom - uint8_t nvram_r(offs_t offset) { return m_nvram[offset & m_nvram.mask()]; } - void nvram_w(offs_t offset, uint8_t data) { m_nvram[offset & m_nvram.mask()] = data; } + uint8_t nvram_r(offs_t offset) { return m_nvram[offset & 0x1fff]; } + void nvram_w(offs_t offset, uint8_t data) { m_nvram[offset & 0x1fff] = data; } void c64_fcc_map(address_map &map); }; diff --git a/src/devices/bus/c64/georam.cpp b/src/devices/bus/c64/georam.cpp index 6bf8a16a1d8..377bc10a391 100644 --- a/src/devices/bus/c64/georam.cpp +++ b/src/devices/bus/c64/georam.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(C64_GEORAM, c64_georam_cartridge_device, "c64_georam", "C64 G c64_georam_cartridge_device::c64_georam_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_GEORAM, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x80000, ENDIANNESS_LITTLE), m_bank(0) { } @@ -42,9 +42,6 @@ c64_georam_cartridge_device::c64_georam_cartridge_device(const machine_config &m void c64_georam_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x80000); - // state saving save_item(NAME(m_bank)); } diff --git a/src/devices/bus/c64/georam.h b/src/devices/bus/c64/georam.h index 03967625c23..41b7fd82379 100644 --- a/src/devices/bus/c64/georam.h +++ b/src/devices/bus/c64/georam.h @@ -39,7 +39,7 @@ protected: virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint16_t m_bank; }; diff --git a/src/devices/bus/c64/ide64.cpp b/src/devices/bus/c64/ide64.cpp index 73e14ea6b99..830f38c3993 100644 --- a/src/devices/bus/c64/ide64.cpp +++ b/src/devices/bus/c64/ide64.cpp @@ -93,7 +93,8 @@ c64_ide64_cartridge_device::c64_ide64_cartridge_device(const machine_config &mco m_rtc(*this, DS1302_TAG), m_ata(*this, ATA_TAG), m_jp1(*this, "JP1"), - m_ram(*this, "ram"), m_bank(0), m_ata_data(0), m_wp(0), m_enable(0) + m_ram(*this, "ram", 0x8000, ENDIANNESS_LITTLE), + m_bank(0), m_ata_data(0), m_wp(0), m_enable(0) { } @@ -104,9 +105,6 @@ c64_ide64_cartridge_device::c64_ide64_cartridge_device(const machine_config &mco void c64_ide64_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x8000); - // state saving save_item(NAME(m_bank)); save_item(NAME(m_ata_data)); diff --git a/src/devices/bus/c64/ide64.h b/src/devices/bus/c64/ide64.h index 366357868b9..9438e3a1ed0 100644 --- a/src/devices/bus/c64/ide64.h +++ b/src/devices/bus/c64/ide64.h @@ -53,7 +53,7 @@ private: required_device<ds1302_device> m_rtc; required_device<ata_interface_device> m_ata; required_ioport m_jp1; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; uint16_t m_ata_data; diff --git a/src/devices/bus/c64/magic_formel.cpp b/src/devices/bus/c64/magic_formel.cpp index 8d43fd05810..1e6c38d1685 100644 --- a/src/devices/bus/c64/magic_formel.cpp +++ b/src/devices/bus/c64/magic_formel.cpp @@ -157,7 +157,7 @@ c64_magic_formel_cartridge_device::c64_magic_formel_cartridge_device(const machi device_t(mconfig, C64_MAGIC_FORMEL, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), m_pia(*this, MC6821_TAG), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), m_rom_bank(0), m_ram_bank(0), m_ram_oe(0), @@ -174,9 +174,6 @@ c64_magic_formel_cartridge_device::c64_magic_formel_cartridge_device(const machi void c64_magic_formel_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); - // state saving save_item(NAME(m_rom_bank)); save_item(NAME(m_ram_bank)); diff --git a/src/devices/bus/c64/magic_formel.h b/src/devices/bus/c64/magic_formel.h index 43fb7c69fe5..ab16d4a0e34 100644 --- a/src/devices/bus/c64/magic_formel.h +++ b/src/devices/bus/c64/magic_formel.h @@ -51,7 +51,7 @@ private: DECLARE_WRITE_LINE_MEMBER( pia_cb2_w ); required_device<pia6821_device> m_pia; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_rom_bank; uint8_t m_ram_bank; diff --git a/src/devices/bus/c64/neoram.cpp b/src/devices/bus/c64/neoram.cpp index 4cb34cbbb57..c0f292da161 100644 --- a/src/devices/bus/c64/neoram.cpp +++ b/src/devices/bus/c64/neoram.cpp @@ -43,7 +43,7 @@ c64_neoram_cartridge_device::c64_neoram_cartridge_device(const machine_config &m void c64_neoram_cartridge_device::device_start() { // allocate memory - m_nvram.allocate(0x200000); + m_nvram = std::make_unique<uint8_t[]>(0x200000); // state saving save_item(NAME(m_bank)); diff --git a/src/devices/bus/c64/neoram.h b/src/devices/bus/c64/neoram.h index d5058b878b7..b6729ec08d4 100644 --- a/src/devices/bus/c64/neoram.h +++ b/src/devices/bus/c64/neoram.h @@ -37,8 +37,8 @@ protected: // device_nvram_interface overrides virtual void nvram_default() override { } - virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram, m_nvram.bytes()); } } - virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram, m_nvram.bytes()); } } + virtual void nvram_read(emu_file &file) override { if (m_nvram != nullptr) { file.read(m_nvram.get(), 0x200000); } } + virtual void nvram_write(emu_file &file) override { if (m_nvram != nullptr) { file.write(m_nvram.get(), 0x200000); } } // device_c64_expansion_card_interface overrides virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; diff --git a/src/devices/bus/c64/ocean.cpp b/src/devices/bus/c64/ocean.cpp index 92b18de6a51..d267a9912fa 100644 --- a/src/devices/bus/c64/ocean.cpp +++ b/src/devices/bus/c64/ocean.cpp @@ -84,15 +84,15 @@ void c64_ocean_cartridge_device::device_reset() uint8_t c64_ocean_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { - if (!roml && m_roml.bytes()) + if (!roml && m_roml) { offs_t addr = (m_bank << 13) | (offset & 0x1fff); - data = m_roml[addr & m_roml.mask()]; + data = m_roml[addr]; } - else if (!romh && m_romh.bytes()) + else if (!romh && m_romh) { offs_t addr = (m_bank << 13) | (offset & 0x1fff); - data = m_romh[addr & m_romh.mask()]; + data = m_romh[addr]; } else if (!io1) { diff --git a/src/devices/bus/c64/pagefox.cpp b/src/devices/bus/c64/pagefox.cpp index 80264aab13b..e33bb4d3d7b 100644 --- a/src/devices/bus/c64/pagefox.cpp +++ b/src/devices/bus/c64/pagefox.cpp @@ -52,7 +52,8 @@ DEFINE_DEVICE_TYPE(C64_PAGEFOX, c64_pagefox_cartridge_device, "c64_pagefox", "C6 c64_pagefox_cartridge_device::c64_pagefox_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_PAGEFOX, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), m_bank(0) + m_ram(*this, "ram", 0x8000, ENDIANNESS_LITTLE), + m_bank(0) { } @@ -63,9 +64,6 @@ c64_pagefox_cartridge_device::c64_pagefox_cartridge_device(const machine_config void c64_pagefox_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x8000); - // state saving save_item(NAME(m_bank)); } diff --git a/src/devices/bus/c64/pagefox.h b/src/devices/bus/c64/pagefox.h index 74ed5a4edf0..b0295eb9d0d 100644 --- a/src/devices/bus/c64/pagefox.h +++ b/src/devices/bus/c64/pagefox.h @@ -39,7 +39,7 @@ protected: virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; uint8_t m_bank; }; diff --git a/src/devices/bus/c64/partner.cpp b/src/devices/bus/c64/partner.cpp index 55e4d07f3e1..b77cf610d17 100644 --- a/src/devices/bus/c64/partner.cpp +++ b/src/devices/bus/c64/partner.cpp @@ -80,7 +80,7 @@ ioport_constructor c64_partner_cartridge_device::device_input_ports() const c64_partner_cartridge_device::c64_partner_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, C64_PARTNER, tag, owner, clock), device_c64_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", 0x2000, ENDIANNESS_LITTLE), m_a0(1), m_a6(1), m_nmi(0) @@ -94,8 +94,6 @@ c64_partner_cartridge_device::c64_partner_cartridge_device(const machine_config void c64_partner_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(0x2000); } diff --git a/src/devices/bus/c64/partner.h b/src/devices/bus/c64/partner.h index 6ecf4503a91..4dd71542571 100644 --- a/src/devices/bus/c64/partner.h +++ b/src/devices/bus/c64/partner.h @@ -44,7 +44,7 @@ protected: virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_a0; int m_a6; diff --git a/src/devices/bus/c64/reu.cpp b/src/devices/bus/c64/reu.cpp index cc51b99e096..0d24a1967fa 100644 --- a/src/devices/bus/c64/reu.cpp +++ b/src/devices/bus/c64/reu.cpp @@ -53,7 +53,7 @@ c64_reu_cartridge_device::c64_reu_cartridge_device(const machine_config &mconfig device_c64_expansion_card_interface(mconfig, *this), m_dmac(*this, MOS8726R1_TAG), m_eprom(*this, "rom"), - m_ram(*this, "ram"), + m_ram(*this, "ram", ram_size, ENDIANNESS_LITTLE), m_variant(variant), m_jp1(jp1), m_ram_size(ram_size) @@ -76,9 +76,6 @@ c64_reu1764_cartridge_device::c64_reu1764_cartridge_device(const machine_config void c64_reu_cartridge_device::device_start() { - // allocate memory - m_ram.allocate(m_ram_size); - // setup DMA controller m_dmac->set_unscaled_clock(m_slot->phi2()); m_dmac->bs_w(m_jp1); diff --git a/src/devices/bus/c64/reu.h b/src/devices/bus/c64/reu.h index 0cbb67d9576..eaa662f38a1 100644 --- a/src/devices/bus/c64/reu.h +++ b/src/devices/bus/c64/reu.h @@ -52,7 +52,7 @@ protected: required_device<mos8726_device> m_dmac; required_device<generic_slot_device> m_eprom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_variant; int m_jp1; diff --git a/src/devices/bus/c64/ross.cpp b/src/devices/bus/c64/ross.cpp index 25c1a996df8..e8703a33bcc 100644 --- a/src/devices/bus/c64/ross.cpp +++ b/src/devices/bus/c64/ross.cpp @@ -68,7 +68,7 @@ uint8_t c64_ross_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sph { offs_t addr = (m_bank << 14) | (offset & 0x3fff); - data = m_roml[addr & m_roml.mask()]; + data = m_roml[addr]; } return data; diff --git a/src/devices/bus/c64/std.cpp b/src/devices/bus/c64/std.cpp index 08f4c1d65e0..95d472bfbfd 100644 --- a/src/devices/bus/c64/std.cpp +++ b/src/devices/bus/c64/std.cpp @@ -49,19 +49,19 @@ void c64_standard_cartridge_device::device_start() uint8_t c64_standard_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) { - if (!roml && m_roml.bytes()) + if (!roml && m_roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } else if (!romh) { - if (m_romh.bytes()) + if (m_romh) { - data = m_romh[offset & m_romh.mask()]; + data = m_romh[offset]; } - else if (m_roml.mask() == 0x3fff) + else if (m_roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } } diff --git a/src/devices/bus/c64/westermann.cpp b/src/devices/bus/c64/westermann.cpp index ac254733f01..33b22c06942 100644 --- a/src/devices/bus/c64/westermann.cpp +++ b/src/devices/bus/c64/westermann.cpp @@ -61,17 +61,17 @@ uint8_t c64_westermann_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, i { if (!roml) { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } else if (!romh) { - if (m_romh.bytes()) + if (m_romh) { - data = m_romh[offset & m_romh.mask()]; + data = m_romh[offset]; } else { - data = m_roml[offset & m_roml.mask()]; + data = m_roml[offset]; } } else if (!io2) diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp index 6bfa6e9d8cd..346fb7c0947 100644 --- a/src/devices/bus/c64/xl80.cpp +++ b/src/devices/bus/c64/xl80.cpp @@ -157,7 +157,7 @@ c64_xl80_device::c64_xl80_device(const machine_config &mconfig, const char *tag, m_crtc(*this, HD46505SP_TAG), m_palette(*this, "palette"), m_char_rom(*this, HD46505SP_TAG), - m_ram(*this, "ram") + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE) { } @@ -168,8 +168,6 @@ c64_xl80_device::c64_xl80_device(const machine_config &mconfig, const char *tag, void c64_xl80_device::device_start() { - // allocate memory - m_ram.allocate(RAM_SIZE); } diff --git a/src/devices/bus/c64/xl80.h b/src/devices/bus/c64/xl80.h index 70a9b1cba9d..762b8ed39eb 100644 --- a/src/devices/bus/c64/xl80.h +++ b/src/devices/bus/c64/xl80.h @@ -52,7 +52,7 @@ private: required_device<hd6845s_device> m_crtc; required_device<palette_device> m_palette; required_memory_region m_char_rom; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/cbm2/24k.cpp b/src/devices/bus/cbm2/24k.cpp index c212b2fef83..c56474c7be9 100644 --- a/src/devices/bus/cbm2/24k.cpp +++ b/src/devices/bus/cbm2/24k.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(CBM2_24K, cbm2_24k_cartridge_device, "cbm2_24k", "CBM-II 24K cbm2_24k_cartridge_device::cbm2_24k_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CBM2_24K, tag, owner, clock), device_cbm2_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram") + m_ram(*this, "ram", 0x6000, ENDIANNESS_LITTLE) { } @@ -41,7 +41,6 @@ cbm2_24k_cartridge_device::cbm2_24k_cartridge_device(const machine_config &mconf void cbm2_24k_cartridge_device::device_start() { - m_ram.allocate(0x6000); } diff --git a/src/devices/bus/cbm2/24k.h b/src/devices/bus/cbm2/24k.h index b1c029c5254..554ba721444 100644 --- a/src/devices/bus/cbm2/24k.h +++ b/src/devices/bus/cbm2/24k.h @@ -36,7 +36,7 @@ protected: virtual uint8_t cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override; virtual void cbm2_bd_w(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) override; - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; }; diff --git a/src/devices/bus/cbm2/exp.cpp b/src/devices/bus/cbm2/exp.cpp index 92c865006f7..7bc35f33120 100644 --- a/src/devices/bus/cbm2/exp.cpp +++ b/src/devices/bus/cbm2/exp.cpp @@ -36,10 +36,7 @@ DEFINE_DEVICE_TYPE(CBM2_EXPANSION_SLOT, cbm2_expansion_slot_device, "cbm2_expans //------------------------------------------------- device_cbm2_expansion_card_interface::device_cbm2_expansion_card_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "cbm2exp"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3") + device_interface(device, "cbm2exp") { m_slot = dynamic_cast<cbm2_expansion_slot_device *>(device.owner()); } @@ -107,17 +104,17 @@ image_init_result cbm2_expansion_slot_device::call_load() if (is_filetype("20")) { - m_card->m_bank1.allocate(size); + m_card->m_bank1 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank1, size); } else if (is_filetype("40")) { - m_card->m_bank2.allocate(size); + m_card->m_bank2 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank2, size); } else if (is_filetype("60")) { - m_card->m_bank3.allocate(size); + m_card->m_bank3 = std::make_unique<uint8_t[]>(size); fread(m_card->m_bank3, size); } } diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h index d07035614a8..9781e4ac05a 100644 --- a/src/devices/bus/cbm2/exp.h +++ b/src/devices/bus/cbm2/exp.h @@ -113,9 +113,9 @@ public: protected: device_cbm2_expansion_card_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_bank1; - optional_shared_ptr<uint8_t> m_bank2; - optional_shared_ptr<uint8_t> m_bank3; + std::unique_ptr<uint8_t[]> m_bank1; + std::unique_ptr<uint8_t[]> m_bank2; + std::unique_ptr<uint8_t[]> m_bank3; cbm2_expansion_slot_device *m_slot; }; diff --git a/src/devices/bus/cbm2/std.cpp b/src/devices/bus/cbm2/std.cpp index f56226028ee..51653c72755 100644 --- a/src/devices/bus/cbm2/std.cpp +++ b/src/devices/bus/cbm2/std.cpp @@ -49,17 +49,17 @@ void cbm2_standard_cartridge_device::device_start() uint8_t cbm2_standard_cartridge_device::cbm2_bd_r(offs_t offset, uint8_t data, int csbank1, int csbank2, int csbank3) { - if (!csbank1 && m_bank1.bytes()) + if (!csbank1 && m_bank1) { - data = m_bank1[offset & m_bank1.mask()]; + data = m_bank1[offset]; } - else if (!csbank2 && m_bank2.bytes()) + else if (!csbank2 && m_bank2) { - data = m_bank2[offset & m_bank2.mask()]; + data = m_bank2[offset]; } - else if (!csbank3 && m_bank3.bytes()) + else if (!csbank3 && m_bank3) { - data = m_bank3[offset & m_bank3.mask()]; + data = m_bank3[offset]; } return data; diff --git a/src/devices/bus/cbmiec/c1541.cpp b/src/devices/bus/cbmiec/c1541.cpp index aae2baddc09..62d29d71115 100644 --- a/src/devices/bus/cbmiec/c1541.cpp +++ b/src/devices/bus/cbmiec/c1541.cpp @@ -964,7 +964,7 @@ void c1541_device_base::device_add_mconfig(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &c1541_device_base::c1541_mem); //config.set_perfect_quantum(m_maincpu); FIXME: not safe in a slot device - add barriers - VIA6522(config, m_via0, XTAL(16'000'000)/16); + MOS6522(config, m_via0, XTAL(16'000'000)/16); m_via0->readpa_handler().set(FUNC(c1541_device_base::via0_pa_r)); m_via0->readpb_handler().set(FUNC(c1541_device_base::via0_pb_r)); m_via0->writepa_handler().set(FUNC(c1541_device_base::via0_pa_w)); @@ -972,7 +972,7 @@ void c1541_device_base::device_add_mconfig(machine_config &config) m_via0->cb2_handler().set(FUNC(c1541_device_base::via0_ca2_w)); m_via0->irq_handler().set(FUNC(c1541_device_base::via0_irq_w)); - VIA6522(config, m_via1, XTAL(16'000'000)/16); + MOS6522(config, m_via1, XTAL(16'000'000)/16); m_via1->readpa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_r)); m_via1->readpb_handler().set(FUNC(c1541_device_base::via1_pb_r)); m_via1->writepa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_w)); diff --git a/src/devices/bus/cbmiec/c1571.cpp b/src/devices/bus/cbmiec/c1571.cpp index d08d92c8d7a..e711ce062ce 100644 --- a/src/devices/bus/cbmiec/c1571.cpp +++ b/src/devices/bus/cbmiec/c1571.cpp @@ -600,14 +600,14 @@ void c1571_device::add_base_mconfig(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &c1571_device::c1571_mem); //config.set_perfect_quantum(m_maincpu); FIXME: not safe in a slot device - add barriers - VIA6522(config, m_via0, 16_MHz_XTAL / 16); + MOS6522(config, m_via0, 16_MHz_XTAL / 16); m_via0->readpa_handler().set(FUNC(c1571_device::via0_pa_r)); m_via0->readpb_handler().set(FUNC(c1571_device::via0_pb_r)); m_via0->writepa_handler().set(FUNC(c1571_device::via0_pa_w)); m_via0->writepb_handler().set(FUNC(c1571_device::via0_pb_w)); m_via0->irq_handler().set(FUNC(c1571_device::via0_irq_w)); - VIA6522(config, m_via1, 16_MHz_XTAL / 16); + MOS6522(config, m_via1, 16_MHz_XTAL / 16); m_via1->readpa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_r)); m_via1->readpb_handler().set(FUNC(c1571_device::via1_pb_r)); m_via1->writepa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_w)); diff --git a/src/devices/bus/cbmiec/cmdhd.cpp b/src/devices/bus/cbmiec/cmdhd.cpp index 096f68a9641..104b0eb456e 100644 --- a/src/devices/bus/cbmiec/cmdhd.cpp +++ b/src/devices/bus/cbmiec/cmdhd.cpp @@ -78,8 +78,8 @@ void cmd_hd_device::device_add_mconfig(machine_config &config) M6502(config, m_maincpu, 2000000); m_maincpu->set_addrmap(AS_PROGRAM, &cmd_hd_device::mem_map); - VIA6522(config, M6522_1_TAG, 2000000); - VIA6522(config, M6522_2_TAG, 2000000); + MOS6522(config, M6522_1_TAG, 2000000); + MOS6522(config, M6522_2_TAG, 2000000); I8255A(config, I8255A_TAG, 0); RTC72421(config, RTC72421A_TAG, XTAL(32'768)); diff --git a/src/devices/bus/cbmiec/fd2000.cpp b/src/devices/bus/cbmiec/fd2000.cpp index 0ac6321c359..057c77c7db9 100644 --- a/src/devices/bus/cbmiec/fd2000.cpp +++ b/src/devices/bus/cbmiec/fd2000.cpp @@ -219,7 +219,7 @@ void fd2000_device::add_common_devices(machine_config &config) { M65C02(config, m_maincpu, 24_MHz_XTAL / 12); - via6522_device &via(VIA6522(config, G65SC22P2_TAG, 24_MHz_XTAL / 12)); + via6522_device &via(R65C22(config, G65SC22P2_TAG, 24_MHz_XTAL / 12)); via.readpa_handler().set(FUNC(fd2000_device::via_pa_r)); via.readpb_handler().set(FUNC(fd2000_device::via_pb_r)); via.writepa_handler().set(FUNC(fd2000_device::via_pa_w)); diff --git a/src/devices/bus/cbmiec/interpod.cpp b/src/devices/bus/cbmiec/interpod.cpp index 27d418a749d..c5479a30b18 100644 --- a/src/devices/bus/cbmiec/interpod.cpp +++ b/src/devices/bus/cbmiec/interpod.cpp @@ -128,7 +128,7 @@ void cbm_interpod_device::device_add_mconfig(machine_config &config) M6502(config, m_maincpu, 1000000); m_maincpu->set_addrmap(AS_PROGRAM, &cbm_interpod_device::interpod_mem); - VIA6522(config, m_via, 1000000); + MOS6522(config, m_via, 1000000); MOS6532_NEW(config, m_riot, 1000000); diff --git a/src/devices/bus/chanf/slot.cpp b/src/devices/bus/chanf/slot.cpp index 62de4ba67c0..f17e52653d0 100644 --- a/src/devices/bus/chanf/slot.cpp +++ b/src/devices/bus/chanf/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -124,7 +123,7 @@ static int chanf_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/coco/coco_dwsock.cpp b/src/devices/bus/coco/coco_dwsock.cpp index 96cfd234f8c..b970458c91c 100644 --- a/src/devices/bus/coco/coco_dwsock.cpp +++ b/src/devices/bus/coco/coco_dwsock.cpp @@ -80,7 +80,7 @@ beckerport_device::~beckerport_device() device_start -------------------------------------------------*/ -void beckerport_device::device_start(void) +void beckerport_device::device_start() { char chAddress[64]; @@ -104,7 +104,7 @@ void beckerport_device::device_start(void) device_stop -------------------------------------------------*/ -void beckerport_device::device_stop(void) +void beckerport_device::device_stop() { if (m_pSocket) { @@ -117,7 +117,7 @@ void beckerport_device::device_stop(void) device_config_complete -------------------------------------------------*/ -void beckerport_device::device_config_complete(void) +void beckerport_device::device_config_complete() { m_hostname = "127.0.0.1"; m_dwtcpport = 65504; @@ -198,9 +198,9 @@ void beckerport_device::write(offs_t offset, u8 data) update_port -------------------------------------------------*/ -void beckerport_device::update_port(void) +void beckerport_device::update_port() { device_stop(); - m_dwtcpport = m_dwconfigport.read_safe(65504); + m_dwtcpport = m_dwconfigport->read(); device_start(); } diff --git a/src/devices/bus/coco/coco_dwsock.h b/src/devices/bus/coco/coco_dwsock.h index add3186a126..56e82e01f81 100644 --- a/src/devices/bus/coco/coco_dwsock.h +++ b/src/devices/bus/coco/coco_dwsock.h @@ -67,6 +67,6 @@ private: DECLARE_DEVICE_TYPE(COCO_DWSOCK, beckerport_device) // device iterator -typedef device_type_iterator<beckerport_device> beckerport_device_iterator; +typedef device_type_enumerator<beckerport_device> beckerport_device_enumerator; #endif // MAME_BUS_COCO_COCO_DWSOCKH_H diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp index cf68799357b..9cbb6fe549f 100644 --- a/src/devices/bus/coco/coco_fdc.cpp +++ b/src/devices/bus/coco/coco_fdc.cpp @@ -82,9 +82,14 @@ #include "formats/sdf_dsk.h" #include "formats/os9_dsk.h" -// #define VERBOSE (LOG_GENERAL ) +//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already +#define LOG_WDFDC (1U << 1) // Shows register setup + +//#define VERBOSE (LOG_GENERAL ) #include "logmacro.h" +#define LOGWDFDC(...) LOGMASKED(LOG_WDFDC, __VA_ARGS__) + /*************************************************************************** PARAMETERS ***************************************************************************/ @@ -514,19 +519,19 @@ u8 coco_fdc_device_base::scs_read(offs_t offset) { case 8: result = m_wd17xx->status_r(); - LOG("m_wd17xx->status_r: %2.2x\n", result ); + LOGWDFDC("m_wd17xx->status_r: %2.2x\n", result ); break; case 9: result = m_wd17xx->track_r(); - LOG("m_wd17xx->track_r: %2.2x\n", result ); + LOGWDFDC("m_wd17xx->track_r: %2.2x\n", result ); break; case 10: result = m_wd17xx->sector_r(); - LOG("m_wd17xx->sector_r: %2.2x\n", result ); + LOGWDFDC("m_wd17xx->sector_r: %2.2x\n", result ); break; case 11: result = m_wd17xx->data_r(); - LOG("m_wd17xx->data_r: %2.2x\n", result ); + LOGWDFDC("m_wd17xx->data_r: %2.2x\n", result ); break; } @@ -571,19 +576,19 @@ void coco_fdc_device_base::scs_write(offs_t offset, u8 data) dskreg_w(data); break; case 8: - LOG("m_wd17xx->cmd_w: %2.2x\n", data ); + LOGWDFDC("m_wd17xx->cmd_w: %2.2x\n", data ); m_wd17xx->cmd_w(data); break; case 9: - LOG("m_wd17xx->track_w: %2.2x\n", data ); + LOGWDFDC("m_wd17xx->track_w: %2.2x\n", data ); m_wd17xx->track_w(data); break; case 10: - LOG("m_wd17xx->sector_w: %2.2x\n", data ); + LOGWDFDC("m_wd17xx->sector_w: %2.2x\n", data ); m_wd17xx->sector_w(data); break; case 11: - LOG("m_wd17xx->data_w: %2.2x\n", data ); + LOGWDFDC("m_wd17xx->data_w: %2.2x\n", data ); m_wd17xx->data_w(data); break; }; diff --git a/src/devices/bus/coco/coco_midi.cpp b/src/devices/bus/coco/coco_midi.cpp new file mode 100644 index 00000000000..0e6e38b839b --- /dev/null +++ b/src/devices/bus/coco/coco_midi.cpp @@ -0,0 +1,116 @@ +// license:BSD-3-Clause +// copyright-holders:tim lindner +/*************************************************************************** + + coco_midi.cpp + + Emulation of Rutherford Research's Midi Pak and also compatible with + Go4Retro's MIDI Maestro. + +***************************************************************************/ + +#include "emu.h" +#include "coco_midi.h" + +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "bus/midi/midi.h" + +namespace { + +// ======================> coco_midi_device + +class coco_midi_device : + public device_t, + public device_cococart_interface +{ + public: + // construction/destruction + coco_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + protected: + coco_midi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + required_device<acia6850_device> m_acia; + DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); + + private: + required_device<midi_port_device> m_mdthru; +}; + +class dragon_midi_device : public coco_midi_device +{ + public: + // construction/destruction + dragon_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + protected: + dragon_midi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + virtual void device_start() override; +}; + +coco_midi_device::coco_midi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, type, tag, owner, clock) + , device_cococart_interface(mconfig, *this ) + , m_acia(*this, "mc6850") + , m_mdthru(*this, "mdthru") +{ +} + +coco_midi_device::coco_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : coco_midi_device(mconfig, COCO_MIDI, tag, owner, clock) +{ +} + +void coco_midi_device::device_add_mconfig(machine_config &config) +{ + ACIA6850(config, m_acia).txd_handler().set("mdout", FUNC(midi_port_device::write_txd)); + m_acia->irq_handler().set(FUNC(coco_midi_device::acia_irq_w)); + + midi_port_device &mdin(MIDI_PORT(config, "mdin", midiin_slot, "midiin")); + mdin.rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd)); + mdin.rxd_handler().append(m_mdthru, FUNC(midi_port_device::write_txd)); + MIDI_PORT(config, m_mdthru, midiout_slot, "midiout"); + MIDI_PORT(config, "mdout", midiout_slot, "midiout"); + + clock_device &acia_clock(CLOCK(config, "acia_clock", 31250*16)); + acia_clock.signal_handler().set(m_acia, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)); +} + +void coco_midi_device::device_start() +{ + install_readwrite_handler(0xff6e, 0xff6f, + read8sm_delegate(m_acia, FUNC(acia6850_device::read)), + write8sm_delegate(m_acia, FUNC(acia6850_device::write))); +} + +WRITE_LINE_MEMBER(coco_midi_device::acia_irq_w) +{ + set_line_value(line::CART, state == 0); +} + +dragon_midi_device::dragon_midi_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : coco_midi_device(mconfig, type, tag, owner, clock) +{ +} + +dragon_midi_device::dragon_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : dragon_midi_device(mconfig, DRAGON_MIDI, tag, owner, clock) +{ +} + +void dragon_midi_device::device_start() +{ + install_readwrite_handler(0xff74, 0xff75, + read8sm_delegate(m_acia, FUNC(acia6850_device::read)), + write8sm_delegate(m_acia, FUNC(acia6850_device::write))); +} + +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(COCO_MIDI, device_cococart_interface, coco_midi_device, "coco_midi", "CoCo MIDI PAK") +DEFINE_DEVICE_TYPE_PRIVATE(DRAGON_MIDI, device_cococart_interface, dragon_midi_device, "dragon_midi", "Dragon MIDI PAK") diff --git a/src/devices/bus/coco/coco_midi.h b/src/devices/bus/coco/coco_midi.h new file mode 100644 index 00000000000..77b0756ff20 --- /dev/null +++ b/src/devices/bus/coco/coco_midi.h @@ -0,0 +1,14 @@ +// license:BSD-3-Clause +// copyright-holders:tim lindner +#ifndef MAME_BUS_COCO_COCO_MIDI_H +#define MAME_BUS_COCO_COCO_MIDI_H + +#pragma once + +#include "cococart.h" + +// device type definition +DECLARE_DEVICE_TYPE(COCO_MIDI, device_cococart_interface) +DECLARE_DEVICE_TYPE(DRAGON_MIDI, device_cococart_interface) + +#endif // MAME_BUS_COCO_COCO_MIDI_H diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp index ee7cbfb41c1..7006281286f 100644 --- a/src/devices/bus/coco/coco_multi.cpp +++ b/src/devices/bus/coco/coco_multi.cpp @@ -57,15 +57,6 @@ #include "coco_multi.h" #include "cococart.h" -#include "coco_dcmodem.h" -#include "coco_fdc.h" -#include "coco_gmc.h" -#include "coco_orch90.h" -#include "coco_pak.h" -#include "coco_ram.h" -#include "coco_rs232.h" -#include "coco_ssc.h" -#include "coco_stecomp.h" #define SLOT1_TAG "slot1" #define SLOT2_TAG "slot2" @@ -74,6 +65,15 @@ #define SWITCH_CONFIG_TAG "switch" +//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already +#define LOG_CART (1U << 1) // shows cart line changes +#define LOG_SWITCH (1U << 2) // shows switch changes +//#define VERBOSE (LOG_CART|LOG_SWITCH) + +#include "logmacro.h" + +#define LOGCART(...) LOGMASKED(LOG_CART, __VA_ARGS__) +#define LOGSWITCH(...) LOGMASKED(LOG_SWITCH, __VA_ARGS__) //************************************************************************** // MACROS / CONSTANTS @@ -162,30 +162,13 @@ namespace static void coco_cart_slot1_3(device_slot_interface &device) { - device.option_add("banked_16k", COCO_PAK_BANKED); - device.option_add("dcmodem", COCO_DCMODEM); - device.option_add("games_master", COCO_PAK_GMC); - device.option_add("orch90", COCO_ORCH90); - device.option_add("pak", COCO_PAK); - device.option_add("ram", COCO_PAK_RAM); - device.option_add("rs232", COCO_RS232); - device.option_add("ssc", COCO_SSC); - device.option_add("stecomp", COCO_STEREO_COMPOSER); + coco_cart_add_basic_devices(device); } + static void coco_cart_slot4(device_slot_interface &device) { - device.option_add("banked_16k", COCO_PAK_BANKED); - device.option_add("cc2hdb1", COCO2_HDB1); - device.option_add("cc3hdb1", COCO3_HDB1); - device.option_add("dcmodem", COCO_DCMODEM); - device.option_add("fdcv11", COCO_FDC_V11); - device.option_add("games_master", COCO_PAK_GMC); - device.option_add("orch90", COCO_ORCH90); - device.option_add("pak", COCO_PAK); - device.option_add("ram", COCO_PAK_RAM); - device.option_add("rs232", COCO_RS232); - device.option_add("ssc", COCO_SSC); - device.option_add("stecomp", COCO_STEREO_COMPOSER); + coco_cart_add_basic_devices(device); + coco_cart_add_fdcs(device); } @@ -359,6 +342,8 @@ cococart_slot_device &coco_multipak_device::active_cts_slot() void coco_multipak_device::set_select(u8 new_select) { + LOGSWITCH( "set_select: 0x%02X\n", new_select); + // identify old value for CART, in case this needs to change cococart_slot_device::line_value old_cart = active_cts_slot().get_line_value(line::CART); @@ -408,6 +393,7 @@ void coco_multipak_device::update_line(int slot_number, line ln) case line::CART: // only propagate if this is coming from the slot specified propagate = slot_number == active_cts_slot_number(); + LOGCART( "update_line: slot: %d, line: CART, value: %s, propogate: %s\n", slot_number, owning_slot().line_value_string(slot(slot_number).get_line_value(ln)), propagate ? "yes" : "no" ); break; case line::NMI: diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp index 3677010648f..d7836927ead 100644 --- a/src/devices/bus/coco/coco_ssc.cpp +++ b/src/devices/bus/coco/coco_ssc.cpp @@ -34,15 +34,23 @@ #include "coco_ssc.h" #include "cpu/tms7000/tms7000.h" -#include "machine/netlist.h" #include "machine/ram.h" -#include "netlist/devices/net_lib.h" #include "sound/ay8910.h" #include "sound/sp0256.h" #include "speaker.h" -#define LOG_SSC 0 +#define LOG_INTERFACE (1U << 1) +#define LOG_INTERNAL (1U << 2) +#define VERBOSE (0) +// #define VERBOSE (LOG_INTERFACE) +// #define VERBOSE (LOG_INTERFACE | LOG_INTERNAL) + +#include "logmacro.h" + +#define LOGINTERFACE(...) LOGMASKED(LOG_INTERFACE, __VA_ARGS__) +#define LOGINTERNAL(...) LOGMASKED(LOG_INTERNAL, __VA_ARGS__) + #define PIC_TAG "pic7040" #define AY_TAG "cocossc_ay" #define SP0256_TAG "sp0256" @@ -94,11 +102,9 @@ namespace protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; u8 ff7d_read(offs_t offset); void ff7d_write(offs_t offset, u8 data); virtual void set_sound_enable(bool sound_enable) override; - static constexpr device_timer_id BUSY_TIMER_ID = 0; private: u8 m_reset_line; @@ -107,7 +113,6 @@ namespace u8 m_tms7000_portb; u8 m_tms7000_portc; u8 m_tms7000_portd; - emu_timer *m_tms7000_busy_timer; required_device<tms7040_device> m_tms7040; required_device<ram_device> m_staticram; required_device<ay8910_device> m_ay; @@ -132,9 +137,11 @@ namespace // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + // Power of 2 + static constexpr int BUFFER_SIZE = 4; private: sound_stream* m_stream; - double m_rms[16]; + double m_rms[BUFFER_SIZE]; int m_index; }; }; @@ -210,8 +217,8 @@ coco_ssc_device::coco_ssc_device(const machine_config &mconfig, const char *tag, void coco_ssc_device::device_start() { - // install $FF7D-E handler - install_readwrite_handler(0xFF7D, 0xFF7E, + // install $ff7d-e handler + install_readwrite_handler(0xff7d, 0xff7e, read8sm_delegate(*this, FUNC(coco_ssc_device::ff7d_read)), write8sm_delegate(*this, FUNC(coco_ssc_device::ff7d_write))); @@ -221,9 +228,6 @@ void coco_ssc_device::device_start() save_item(NAME(m_tms7000_portb)); save_item(NAME(m_tms7000_portc)); save_item(NAME(m_tms7000_portd)); - - m_tms7000_busy_timer = timer_alloc(BUSY_TIMER_ID); - } @@ -239,26 +243,6 @@ void coco_ssc_device::device_reset() //------------------------------------------------- -// device_timer - handle timer callbacks -//------------------------------------------------- - -void coco_ssc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch(id) - { - case BUSY_TIMER_ID: - m_tms7000_busy = false; - m_tms7000_busy_timer->adjust(attotime::never); - break; - - default: - break; - - } -} - - -//------------------------------------------------- // rom_region - device-specific ROM region //------------------------------------------------- @@ -298,11 +282,7 @@ u8 coco_ssc_device::ff7d_read(offs_t offset) { case 0x00: data = 0xff; - - if (LOG_SSC) - { - logerror( "[%s] ff7d read: %02x\n", machine().describe_context(), data ); - } + LOGINTERFACE( "[%s] ff7d read: %02x\n", machine().describe_context(), data ); break; case 0x01: @@ -318,25 +298,23 @@ u8 coco_ssc_device::ff7d_read(offs_t offset) data |= 0x40; } - if( ! m_sac->sound_activity_circuit_output() ) + if( m_sac->sound_activity_circuit_output() ) { data |= 0x20; } - if (LOG_SSC) - { - logerror( "[%s] ff7e read: %c%c%c%c %c%c%c%c (%02x)\n", + LOGINTERFACE( "[%s] ff7e read: %c%c%c%c %c%c%c%c (%02x)\n", machine().describe_context(), - data & 0x80 ? '.' : 'B', - data & 0x40 ? '.' : 'S', - data & 0x20 ? '.' : 'P', - data & 0x10 ? '.' : '1', - data & 0x08 ? '.' : '1', - data & 0x04 ? '.' : '1', - data & 0x02 ? '.' : '1', - data & 0x01 ? '.' : '1', + data & 0x80 ? 'b' : 'B', + data & 0x40 ? 's' : 'S', + data & 0x20 ? 'p' : 'P', + data & 0x10 ? '1' : '0', + data & 0x08 ? '1' : '0', + data & 0x04 ? '1' : '0', + data & 0x02 ? '1' : '0', + data & 0x01 ? '1' : '0', data ); - } + break; } @@ -353,9 +331,11 @@ void coco_ssc_device::ff7d_write(offs_t offset, u8 data) switch(offset) { case 0x00: - if (LOG_SSC) + LOGINTERFACE( "[%s] ff7d write: %02x\n", machine().describe_context(), data ); + + if( (data & 1) == 1 ) { - logerror( "[%s] ff7d write: %02x\n", machine().describe_context(), data ); + m_spo->reset(); } if( (m_reset_line & 1) == 1 ) @@ -364,7 +344,6 @@ void coco_ssc_device::ff7d_write(offs_t offset, u8 data) { m_tms7040->reset(); m_ay->reset(); - m_spo->reset(); m_tms7000_busy = false; } } @@ -373,12 +352,7 @@ void coco_ssc_device::ff7d_write(offs_t offset, u8 data) break; case 0x01: - - if (LOG_SSC) - { - logerror( "[%s] ff7e write: %02x\n", machine().describe_context(), data ); - } - + LOGINTERFACE( "[%s] ff7e write: %02x\n", machine().describe_context(), data ); m_tms7000_porta = data; m_tms7000_busy = true; m_tms7040->set_input_line(TMS7000_INT3_LINE, ASSERT_LINE); @@ -393,32 +367,26 @@ void coco_ssc_device::ff7d_write(offs_t offset, u8 data) u8 coco_ssc_device::ssc_port_a_r() { - if (LOG_SSC) + LOGINTERNAL( "[%s] port a read: %02x\n", machine().describe_context(), m_tms7000_porta ); + + if (!machine().side_effects_disabled()) { - logerror( "[%s] port a read: %02x\n", machine().describe_context(), m_tms7000_porta ); + m_tms7040->set_input_line(TMS7000_INT3_LINE, CLEAR_LINE); } - m_tms7040->set_input_line(TMS7000_INT3_LINE, CLEAR_LINE); - return m_tms7000_porta; } void coco_ssc_device::ssc_port_b_w(u8 data) { - if (LOG_SSC) - { - logerror( "[%s] port b write: %02x\n", machine().describe_context(), data ); - } + LOGINTERNAL( "[%s] port b write: %02x\n", machine().describe_context(), data ); m_tms7000_portb = data; } u8 coco_ssc_device::ssc_port_c_r() { - if (LOG_SSC) - { - logerror( "[%s] port c read: %02x\n", machine().describe_context(), m_tms7000_portc ); - } + LOGINTERNAL( "[%s] port c read: %02x\n", machine().describe_context(), m_tms7000_portc ); return m_tms7000_portc; } @@ -454,12 +422,10 @@ void coco_ssc_device::ssc_port_c_w(u8 data) if( ((m_tms7000_portc & C_BSY) == 0) && ((data & C_BSY) == C_BSY) ) { - m_tms7000_busy_timer->adjust(attotime::from_usec(1800)); + m_tms7000_busy = false; } - if (LOG_SSC) - { - logerror( "[%s] port c write: %c%c%c%c %c%c%c%c (%02x)\n", + LOGINTERNAL( "[%s] port c write: %c%c%c%c %c%c%c%c (%02x)\n", machine().describe_context(), data & 0x80 ? '.' : 'B', data & 0x40 ? '.' : 'P', @@ -470,7 +436,6 @@ void coco_ssc_device::ssc_port_c_w(u8 data) data & 0x02 ? '1' : '0', data & 0x40 ? (data & 0x01 ? '1' : '0') : (data & 0x01 ? 'C' : '.'), data ); - } m_tms7000_portc = data; } @@ -497,20 +462,14 @@ u8 coco_ssc_device::ssc_port_d_r() } } - if (LOG_SSC) - { - logerror( "[%s] port d read: %02x\n", machine().describe_context(), m_tms7000_portd ); - } + LOGINTERNAL( "[%s] port d read: %02x\n", machine().describe_context(), m_tms7000_portd ); return m_tms7000_portd; } void coco_ssc_device::ssc_port_d_w(u8 data) { - if (LOG_SSC) - { - logerror( "[%s] port d write: %02x\n", machine().describe_context(), data ); - } + LOGINTERNAL( "[%s] port d write: %02x\n", machine().describe_context(), data ); m_tms7000_portd = data; } @@ -526,6 +485,7 @@ cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char m_stream(nullptr), m_index(0) { + std::fill(std::begin(m_rms), std::end(m_rms), 0); } @@ -548,19 +508,25 @@ void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<r auto &src = inputs[0]; auto &dst = outputs[0]; - double n = dst.samples(); + int count = dst.samples(); + m_rms[m_index] = 0; - for (int sampindex = 0; sampindex < n; sampindex++) + if( count > 0 ) { - m_rms[m_index] += src.get(sampindex) * src.get(sampindex); - dst.put(sampindex, src.get(sampindex)); - } + for (int sampindex = 0; sampindex < count; sampindex++) + { + // sum the squares + m_rms[m_index] += src.get(sampindex) * src.get(sampindex); + // copy from source to destination + dst.put(sampindex, src.get(sampindex)); + } - m_rms[m_index] = m_rms[m_index] / n; - m_rms[m_index] = sqrt(m_rms[m_index]); + m_rms[m_index] = m_rms[m_index] / count; + m_rms[m_index] = sqrt(m_rms[m_index]); + } m_index++; - m_index &= 0x0f; + m_index &= BUFFER_SIZE; } @@ -570,14 +536,8 @@ void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<r bool cocossc_sac_device::sound_activity_circuit_output() { - double average = m_rms[0] + m_rms[1] + m_rms[2] + m_rms[3] + m_rms[4] + - m_rms[5] + m_rms[6] + m_rms[7] + m_rms[8] + m_rms[9] + m_rms[10] + - m_rms[11] + m_rms[12] + m_rms[13] + m_rms[14] + m_rms[15]; - - average /= 16.0; - - if( average > 0.317 ) - return true; + double sum = std::accumulate(std::begin(m_rms), std::end(m_rms), 0.0); + double average = (sum / BUFFER_SIZE); - return false; + return average < 0.08; } diff --git a/src/devices/bus/coco/coco_ssc.h b/src/devices/bus/coco/coco_ssc.h index de672cd7771..4f4f9bce0a8 100644 --- a/src/devices/bus/coco/coco_ssc.h +++ b/src/devices/bus/coco/coco_ssc.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nathan Woods +// copyright-holders:tim lindner #ifndef MAME_BUS_COCO_COCO_SSC_H #define MAME_BUS_COCO_COCO_SSC_H diff --git a/src/devices/bus/coco/coco_stecomp.cpp b/src/devices/bus/coco/coco_stecomp.cpp index bf9804a1211..60b5c1a9443 100644 --- a/src/devices/bus/coco/coco_stecomp.cpp +++ b/src/devices/bus/coco/coco_stecomp.cpp @@ -5,10 +5,10 @@ coco_stecomp.cpp - Code for emulating The Stereo Composer by Speech Systems + Code for emulating The Stereo Composer by Speech Systems - This cartridge is a simple sound cartridge. It had two 8-bit DACs - connected thru a PIA. It contained no ROM. + This cartridge is a simple sound cartridge. It had two 8-bit DACs + connected thru a PIA. It contained no ROM. ***************************************************************************/ @@ -52,7 +52,7 @@ namespace virtual void device_start() override { // install handlers - install_readwrite_handler( 0xFF70, 0xFF73, read8sm_delegate(*m_pia, FUNC(pia6821_device::read)), write8sm_delegate(*m_pia, FUNC(pia6821_device::write))); + install_readwrite_handler( 0xFF70, 0xFF73, read8sm_delegate(*m_pia, FUNC(pia6821_device::read)), write8sm_delegate(*m_pia, FUNC(pia6821_device::write))); } private: diff --git a/src/devices/bus/coco/coco_sym12.cpp b/src/devices/bus/coco/coco_sym12.cpp new file mode 100644 index 00000000000..c65678837de --- /dev/null +++ b/src/devices/bus/coco/coco_sym12.cpp @@ -0,0 +1,179 @@ +// license:BSD-3-Clause +// copyright-holders:tim lindner +/*************************************************************************** + + coco_sym12.cpp + + + Code for emulating The Symphony 12 + + Made by Speech Systems, 1982. + + This cartridge is a complex sound cartridge. It had 4 AY-3-8910 PSG + connected thru a PIA. It contained no ROM. + +***************************************************************************/ + +#include "emu.h" +#include "coco_sym12.h" +#include "cococart.h" + +#include "speaker.h" +#include "machine/6821pia.h" +#include "sound/ay8910.h" + +//************************************************************************** +// SYMPHONY_TWELVE DEVICE CLASS +//************************************************************************** + +namespace +{ + // ======================> coco_symphony_twelve_device + + class coco_symphony_twelve_device : + public device_t, + public device_cococart_interface + { + public: + // construction/destruction + coco_symphony_twelve_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, COCO_SYM12, tag, owner, clock) + , device_cococart_interface(mconfig, *this) + , m_pia(*this, "s12_pia") + , m_ay8910(*this, "s12_ay8910-%u", 1) + { + } + + protected: + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + // device-level overrides + virtual void device_start() override + { + // install handlers + install_readwrite_handler( 0xff60, 0xff63, read8sm_delegate(*m_pia, FUNC(pia6821_device::read)), write8sm_delegate(*m_pia, FUNC(pia6821_device::write))); + } + + u8 read_porta(); + void write_porta(u8 data); + void write_portb(u8 data); + void write_psg(u8 bus, u8 data); + + private: + // internal state + required_device<pia6821_device> m_pia; + required_device_array<ay8910_device, 4> m_ay8910; + }; + + //************************************************************************** + // SYMPHONY_TWELVE MACHINE DECLARATIONS + //************************************************************************** + + void coco_symphony_twelve_device::device_add_mconfig(machine_config &config) + { + pia6821_device &pia(PIA6821(config, "s12_pia", 0)); + pia.writepa_handler().set(*this, FUNC(coco_symphony_twelve_device::write_porta)); + pia.readpa_handler().set(*this, FUNC(coco_symphony_twelve_device::read_porta)); + pia.writepb_handler().set(*this, FUNC(coco_symphony_twelve_device::write_portb)); + + SPEAKER(config, "s12_l").front_left(); + SPEAKER(config, "s12_r").front_right(); + AY8910(config, m_ay8910[0], DERIVED_CLOCK(1, 1)); + m_ay8910[0]->set_flags(AY8910_SINGLE_OUTPUT); + m_ay8910[0]->add_route(ALL_OUTPUTS, "s12_l", 0.50); + + AY8910(config, m_ay8910[1], DERIVED_CLOCK(1, 1)); + m_ay8910[1]->set_flags(AY8910_SINGLE_OUTPUT); + m_ay8910[1]->add_route(ALL_OUTPUTS, "s12_l", 0.50); + + AY8910(config, m_ay8910[2], DERIVED_CLOCK(1, 1)); + m_ay8910[2]->set_flags(AY8910_SINGLE_OUTPUT); + m_ay8910[2]->add_route(ALL_OUTPUTS, "s12_r", 0.50); + + AY8910(config, m_ay8910[3], DERIVED_CLOCK(1, 1)); + m_ay8910[3]->set_flags(AY8910_SINGLE_OUTPUT); + m_ay8910[3]->add_route(ALL_OUTPUTS, "s12_r", 0.50); + + } + + //************************************************************************** + // SYMPHONY_TWELVE PSG I/O + //************************************************************************** + + u8 coco_symphony_twelve_device::read_porta() + { + uint8_t b_output = m_pia->b_output(); + u8 result = 0; + + if ((b_output & 0x03) == 0x01) { + result |= m_ay8910[0]->data_r(); + } + + if ((b_output & 0x0c) == 0x04) { + result |= m_ay8910[1]->data_r(); + } + + if ((b_output & 0x30) == 0x10) { + result |= m_ay8910[2]->data_r(); + } + + if ((b_output & 0xc0) == 0x40) { + result |= m_ay8910[3]->data_r(); + } + + return result; + } + + void coco_symphony_twelve_device::write_porta(u8 data) + { + write_psg(m_pia->b_output(), data); + } + + void coco_symphony_twelve_device::write_portb(u8 data) + { + write_psg(data, m_pia->a_output()); + } + + void coco_symphony_twelve_device::write_psg(u8 bus, u8 data) + { + if ((bus & 0x03) == 0x03) { + m_ay8910[0]->address_w(data); + } + + if ((bus & 0x03) == 0x02) { + m_ay8910[0]->data_w(data); + } + + if ((bus & 0x0c) == 0x0c) { + m_ay8910[1]->address_w(data); + } + + if ((bus & 0x0c) == 0x08) { + m_ay8910[1]->data_w(data); + } + + if ((bus & 0x30) == 0x30) { + m_ay8910[2]->address_w(data); + } + + if ((bus & 0x30) == 0x20) { + m_ay8910[2]->data_w(data); + } + + if ((bus & 0xc0) == 0xc0) { + m_ay8910[3]->address_w(data); + } + + if ((bus & 0xc0) == 0x80) { + m_ay8910[3]->data_w(data); + } + } +} + + +//************************************************************************** +// DEVICE DECLARATION +//************************************************************************** + +DEFINE_DEVICE_TYPE_PRIVATE(COCO_SYM12, device_cococart_interface, coco_symphony_twelve_device, "coco_symphony_twelve", "Speech Systems Symphony Twelve") diff --git a/src/devices/bus/coco/coco_sym12.h b/src/devices/bus/coco/coco_sym12.h new file mode 100644 index 00000000000..6c3dabc7517 --- /dev/null +++ b/src/devices/bus/coco/coco_sym12.h @@ -0,0 +1,13 @@ +// license:BSD-3-Clause +// copyright-holders:tim lindner +#ifndef MAME_BUS_COCO_COCO_SYM12_H +#define MAME_BUS_COCO_COCO_SYM12_H + +#pragma once + +#include "cococart.h" + +// device type definition +DECLARE_DEVICE_TYPE(COCO_SYM12, device_cococart_interface) + +#endif // MAME_BUS_COCO_COCO_SYM12_H diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index 220b0d1cab3..78f78288753 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -40,12 +40,36 @@ #include "emu.h" #include "cococart.h" +#include "coco_dcmodem.h" +#include "coco_fdc.h" +#include "coco_gmc.h" +#include "coco_midi.h" +#include "coco_multi.h" +#include "coco_orch90.h" +#include "coco_pak.h" +#include "coco_psg.h" +#include "coco_ram.h" +#include "coco_rs232.h" +#include "coco_ssc.h" +#include "coco_stecomp.h" +#include "coco_sym12.h" + /*************************************************************************** PARAMETERS ***************************************************************************/ -#define LOG_LINE 0 +//#define LOG_GENERAL (1U << 0) //defined in logmacro.h already +#define LOG_CART (1U << 1) // shows cart line changes +#define LOG_NMI (1U << 2) // shows switch changes +#define LOG_HALT (1U << 3) // shows switch changes +// #define VERBOSE (LOG_CART) + +#include "logmacro.h" + +#define LOGCART(...) LOGMASKED(LOG_CART, __VA_ARGS__) +#define LOGNMI(...) LOGMASKED(LOG_NMI, __VA_ARGS__) +#define LOGHALT(...) LOGMASKED(LOG_HALT, __VA_ARGS__) /*************************************************************************** @@ -137,15 +161,15 @@ void cococart_slot_device::device_timer(emu_timer &timer, device_timer_id id, in switch(id) { case TIMER_CART: - set_line("CART", m_cart_line, (line_value) param); + set_line(line::CART, m_cart_line, (line_value) param); break; case TIMER_NMI: - set_line("NMI", m_nmi_line, (line_value) param); + set_line(line::NMI, m_nmi_line, (line_value) param); break; case TIMER_HALT: - set_line("HALT", m_halt_line, (line_value) param); + set_line(line::HALT, m_halt_line, (line_value) param); break; } } @@ -229,14 +253,26 @@ const char *cococart_slot_device::line_value_string(line_value value) // set_line //------------------------------------------------- -void cococart_slot_device::set_line(const char *line_name, coco_cartridge_line &line, cococart_slot_device::line_value value) +void cococart_slot_device::set_line(line ln, coco_cartridge_line &line, cococart_slot_device::line_value value) { if ((line.value != value) || (value == line_value::Q)) { line.value = value; - if (LOG_LINE) - logerror("[%s]: set_line(): %s <= %s\n", machine().describe_context(), line_name, line_value_string(value)); + switch (ln) + { + case line::CART: + LOGCART( "set_line: CART, value: %s\n", line_value_string(value)); + break; + case line::NMI: + LOGNMI( "set_line: NMI, value: %s\n", line_value_string(value)); + break; + case line::HALT: + LOGHALT( "set_line: HALT, value: %s\n", line_value_string(value)); + break; + case line::SOUND_ENABLE: + break; + } // engage in a bit of gymnastics for this odious 'Q' value switch(line.value) @@ -649,3 +685,53 @@ void device_cococart_interface::set_line_value(cococart_slot_device::line line, { owning_slot().set_line_value(line, value); } + + +//------------------------------------------------- +// coco_cart_add_basic_devices +//------------------------------------------------- + +void coco_cart_add_basic_devices(device_slot_interface &device) +{ + // basic devices, on both the main slot and the Multi-Pak interface + device.option_add_internal("banked_16k", COCO_PAK_BANKED); + device.option_add_internal("pak", COCO_PAK); + device.option_add("ccpsg", COCO_PSG); + device.option_add("dcmodem", COCO_DCMODEM); + device.option_add("games_master", COCO_PAK_GMC); + device.option_add("midi", COCO_MIDI); + device.option_add("orch90", COCO_ORCH90); + device.option_add("ram", COCO_PAK_RAM); + device.option_add("rs232", COCO_RS232); + device.option_add("ssc", COCO_SSC); + device.option_add("stecomp", COCO_STEREO_COMPOSER); + device.option_add("sym12", COCO_SYM12); +} + + +//------------------------------------------------- +// coco_cart_add_fdcs +//------------------------------------------------- + +void coco_cart_add_fdcs(device_slot_interface &device) +{ + // FDCs are optional because if they are on a Multi-Pak interface, they must + // be on Slot 4 + device.option_add("cc2hdb1", COCO2_HDB1); + device.option_add("cc3hdb1", COCO3_HDB1); + device.option_add("cd6809_fdc", CD6809_FDC); + device.option_add("cp450_fdc", CP450_FDC); + device.option_add("fdc", COCO_FDC); + device.option_add("fdcv11", COCO_FDC_V11); +} + + +//------------------------------------------------- +// coco_cart_add_multi_pak +//------------------------------------------------- + +void coco_cart_add_multi_pak(device_slot_interface &device) +{ + // and the Multi-Pak itself is optional because they cannot be daisy chained + device.option_add("multi", COCO_MULTIPAK); +} diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h index d2a573202f0..78176588969 100644 --- a/src/devices/bus/coco/cococart.h +++ b/src/devices/bus/coco/cococart.h @@ -137,9 +137,10 @@ private: device_cococart_interface *m_cart; // methods - void set_line(const char *line_name, coco_cartridge_line &line, line_value value); + void set_line(line ln, coco_cartridge_line &line, line_value value); void set_line_timer(coco_cartridge_line &line, line_value value); void twiddle_line_if_q(coco_cartridge_line &line); +public: static const char *line_value_string(line_value value); }; @@ -225,4 +226,10 @@ private: device_cococart_host_interface * m_host; }; +// methods for configuring CoCo slot devices (the expansion cart +// itself, as well as slots on the Multi-Pak) +void coco_cart_add_basic_devices(device_slot_interface &device); +void coco_cart_add_fdcs(device_slot_interface &device); +void coco_cart_add_multi_pak(device_slot_interface &device); + #endif // MAME_BUS_COCO_COCOCART_H diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp index 192e5989a36..d32b4a694f8 100644 --- a/src/devices/bus/comx35/clm.cpp +++ b/src/devices/bus/comx35/clm.cpp @@ -173,7 +173,7 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, m_palette(*this, "palette"), m_rom(*this, "c000"), m_char_rom(*this, MC6845_TAG), - m_video_ram(*this, "video_ram") + m_video_ram(*this, "video_ram", VIDEORAM_SIZE, ENDIANNESS_LITTLE) { } @@ -184,9 +184,6 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, void comx_clm_device::device_start() { - // allocate memory - m_video_ram.allocate(VIDEORAM_SIZE); - // state saving save_item(NAME(m_ds)); } diff --git a/src/devices/bus/comx35/clm.h b/src/devices/bus/comx35/clm.h index 9c4845cbbe0..de86ff28b7f 100644 --- a/src/devices/bus/comx35/clm.h +++ b/src/devices/bus/comx35/clm.h @@ -52,7 +52,7 @@ private: required_device<palette_device> m_palette; required_memory_region m_rom; required_memory_region m_char_rom; - optional_shared_ptr<uint8_t> m_video_ram; + memory_share_creator<uint8_t> m_video_ram; }; diff --git a/src/devices/bus/comx35/ram.cpp b/src/devices/bus/comx35/ram.cpp index b468b6366ff..0f11dfdb194 100644 --- a/src/devices/bus/comx35/ram.cpp +++ b/src/devices/bus/comx35/ram.cpp @@ -37,7 +37,7 @@ DEFINE_DEVICE_TYPE(COMX_RAM, comx_ram_device, "comx_ram", "COMX-35 RAM Card") comx_ram_device::comx_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, COMX_RAM, tag, owner, clock), device_comx_expansion_card_interface(mconfig, *this), - m_ram(*this, "ram"), + m_ram(*this, "ram", RAM_SIZE, ENDIANNESS_LITTLE), m_bank(0) { } @@ -49,7 +49,6 @@ comx_ram_device::comx_ram_device(const machine_config &mconfig, const char *tag, void comx_ram_device::device_start() { - m_ram.allocate(RAM_SIZE); } diff --git a/src/devices/bus/comx35/ram.h b/src/devices/bus/comx35/ram.h index 3a75e208eb6..8ab8703d195 100644 --- a/src/devices/bus/comx35/ram.h +++ b/src/devices/bus/comx35/ram.h @@ -39,7 +39,7 @@ protected: virtual void comx_io_w(offs_t offset, uint8_t data) override; private: - optional_shared_ptr<uint8_t> m_ram; + memory_share_creator<uint8_t> m_ram; int m_bank; }; diff --git a/src/devices/bus/cpc/cpc_rom.cpp b/src/devices/bus/cpc/cpc_rom.cpp index 69bd7f80035..ff60f024f39 100644 --- a/src/devices/bus/cpc/cpc_rom.cpp +++ b/src/devices/bus/cpc/cpc_rom.cpp @@ -109,12 +109,12 @@ image_init_result cpc_rom_image_device::call_load() m_base = std::make_unique<uint8_t[]>(16384); if(size <= 16384) { - image->fread(m_base.get(),size); + image->fread(m_base,size); } else { image->fseek(size-16384,SEEK_SET); - image->fread(m_base.get(),16384); + image->fread(m_base,16384); } return image_init_result::PASS; diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp index 1df2292c982..ecab87796e4 100644 --- a/src/devices/bus/crvision/slot.cpp +++ b/src/devices/bus/crvision/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -115,7 +114,7 @@ static int crvision_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp index 659bab524ad..b4a09f78523 100644 --- a/src/devices/bus/ecbbus/grip.cpp +++ b/src/devices/bus/ecbbus/grip.cpp @@ -567,7 +567,7 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char * m_centronics(*this, CENTRONICS_TAG), m_palette(*this, "palette"), m_speaker(*this, "speaker"), - m_video_ram(*this, "video_ram"), + m_video_ram(*this, "video_ram", VIDEORAM_SIZE, ENDIANNESS_LITTLE), m_j3a(*this, "J3A"), m_j3b(*this, "J3B"), m_j7(*this, "J7"), @@ -581,9 +581,6 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char * void ecb_grip21_device::device_start() { - // allocate video RAM - m_video_ram.allocate(VIDEORAM_SIZE); - // setup GRIP memory banking membank("videoram")->configure_entries(0, 2, m_video_ram, 0x8000); membank("videoram")->set_entry(0); diff --git a/src/devices/bus/ecbbus/grip.h b/src/devices/bus/ecbbus/grip.h index 076a61880d9..a0914f28137 100644 --- a/src/devices/bus/ecbbus/grip.h +++ b/src/devices/bus/ecbbus/grip.h @@ -72,7 +72,7 @@ private: required_device<centronics_device> m_centronics; required_device<palette_device> m_palette; required_device<speaker_sound_device> m_speaker; - optional_shared_ptr<uint8_t> m_video_ram; + memory_share_creator<uint8_t> m_video_ram; required_ioport m_j3a; required_ioport m_j3b; required_ioport m_j7; diff --git a/src/devices/bus/econet/e01.cpp b/src/devices/bus/econet/e01.cpp index ede1c58dafa..3326607b60c 100644 --- a/src/devices/bus/econet/e01.cpp +++ b/src/devices/bus/econet/e01.cpp @@ -30,7 +30,7 @@ 2 x TMM27256D-20 white labelled EPROMs, TMSE01 MOS on left and E01 FS on the right IC20 WD2793-APL-02 floppy disc controller 2 x NEC D41464C-12 64k x 4bit NMOS RAM ICs giving 64K memory - IC21 Rockwell RC6522AP VIA behind to the right + IC21 Rockwell R65C22AP or CMD G65SC22P-2 VIA behind to the right */ @@ -248,7 +248,7 @@ void econet_e01_device::device_add_mconfig(machine_config &config) m_rtc->irq().set(FUNC(econet_e01_device::rtc_irq_w)); // devices - via6522_device &via(VIA6522(config, R6522_TAG, 8_MHz_XTAL / 4)); + via6522_device &via(R65C22(config, R6522_TAG, 8_MHz_XTAL / 4)); via.writepa_handler().set("cent_data_out", FUNC(output_latch_device::write)); via.irq_handler().set(FUNC(econet_e01_device::via_irq_w)); diff --git a/src/devices/bus/ekara/slot.cpp b/src/devices/bus/ekara/slot.cpp index b8eafff441b..badba2b0ec1 100644 --- a/src/devices/bus/ekara/slot.cpp +++ b/src/devices/bus/ekara/slot.cpp @@ -104,7 +104,7 @@ static int ekara_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/electron/cart/ap5.cpp b/src/devices/bus/electron/cart/ap5.cpp index 3deacaa655b..cc4c951a154 100644 --- a/src/devices/bus/electron/cart/ap5.cpp +++ b/src/devices/bus/electron/cart/ap5.cpp @@ -33,7 +33,7 @@ void electron_ap5_device::device_add_mconfig(machine_config &config) m_romslot[1]->set_device_load(FUNC(electron_ap5_device::rom2_load)); /* via */ - VIA6522(config, m_via, DERIVED_CLOCK(1, 16)); + MOS6522(config, m_via, DERIVED_CLOCK(1, 16)); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp index e0215ae6de9..d7058943a92 100644 --- a/src/devices/bus/electron/m2105.cpp +++ b/src/devices/bus/electron/m2105.cpp @@ -65,7 +65,7 @@ void electron_m2105_device::device_add_mconfig(machine_config &config) RAM(config, m_ram).set_default_size("64K"); /* system via */ - VIA6522(config, m_via6522_0, DERIVED_CLOCK(1, 16)); + MOS6522(config, m_via6522_0, DERIVED_CLOCK(1, 16)); //m_via6522_0->readpa_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_porta)); m_via6522_0->readpb_handler().set(m_tms, FUNC(tms5220_device::status_r)); //m_via6522_0->writepa_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_porta)); @@ -73,7 +73,7 @@ void electron_m2105_device::device_add_mconfig(machine_config &config) m_via6522_0->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); /* user via */ - VIA6522(config, m_via6522_1, DERIVED_CLOCK(1, 16)); + MOS6522(config, m_via6522_1, DERIVED_CLOCK(1, 16)); m_via6522_1->writepb_handler().set("cent_data_out", FUNC(output_latch_device::write)); m_via6522_1->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)); m_via6522_1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); diff --git a/src/devices/bus/electron/plus2.cpp b/src/devices/bus/electron/plus2.cpp index 1e9d9d6591b..d379f053047 100644 --- a/src/devices/bus/electron/plus2.cpp +++ b/src/devices/bus/electron/plus2.cpp @@ -50,7 +50,7 @@ void electron_plus2_device::device_add_mconfig(machine_config &config) m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); /* via */ - VIA6522(config, m_via, DERIVED_CLOCK(1, 16)); + MOS6522(config, m_via, DERIVED_CLOCK(1, 16)); m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r)); m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w)); m_via->cb1_handler().set(m_userport, FUNC(bbc_userport_slot_device::write_cb1)); @@ -126,6 +126,7 @@ uint8_t electron_plus2_device::expbus_r(offs_t offset) case 13: data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: data &= m_rom[m_romsel - 13]->read_rom(offset & 0x3fff); diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp index 9408ce1cc74..e6cfd472989 100644 --- a/src/devices/bus/electron/romboxp.cpp +++ b/src/devices/bus/electron/romboxp.cpp @@ -201,6 +201,7 @@ uint8_t electron_romboxp_device::expbus_r(offs_t offset) case 13: data &= m_cart[0]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); data &= m_cart[1]->read(offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: if (m_rom_base == 12) @@ -274,6 +275,7 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data) case 13: m_cart[0]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); m_cart[1]->write(offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 0, 1); + [[fallthrough]]; case 14: case 15: if (m_rom_base == 12) diff --git a/src/devices/bus/gamate/slot.cpp b/src/devices/bus/gamate/slot.cpp index 67814aa096e..625e4103482 100644 --- a/src/devices/bus/gamate/slot.cpp +++ b/src/devices/bus/gamate/slot.cpp @@ -102,7 +102,7 @@ static int gamate_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/gameboy/gb_slot.cpp b/src/devices/bus/gameboy/gb_slot.cpp index 31d11e59dcf..f09a993aa90 100644 --- a/src/devices/bus/gameboy/gb_slot.cpp +++ b/src/devices/bus/gameboy/gb_slot.cpp @@ -17,7 +17,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "gb_slot.h" @@ -222,7 +221,7 @@ static int gb_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } @@ -314,13 +313,13 @@ image_init_result gb_cart_slot_device_base::call_load() if (get_feature("rumble")) { - if (!core_stricmp(get_feature("rumble"), "yes")) + if (!strcmp(get_feature("rumble"), "yes")) m_cart->set_has_rumble(true); } if (get_feature("rtc")) { - if (!core_stricmp(get_feature("rtc"), "yes")) + if (!strcmp(get_feature("rtc"), "yes")) m_cart->set_has_timer(true); } } diff --git a/src/devices/bus/gameboy/rom.cpp b/src/devices/bus/gameboy/rom.cpp index d3e90d73f51..b635a828b8c 100644 --- a/src/devices/bus/gameboy/rom.cpp +++ b/src/devices/bus/gameboy/rom.cpp @@ -220,6 +220,7 @@ void gb_rom_tama5_device::write_ram(offs_t offset, uint8_t data) case 0x40: /* Unknown, some kind of read */ if ((m_tama5_addr & 0x1f) == 0x12) m_tama5_data = 0xff; + [[fallthrough]]; case 0x80: /* Unknown, some kind of read (when 07=01)/write (when 07=00/02) */ default: logerror( "%s Unknown addressing mode\n", machine().describe_context() ); diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index 629557768ed..06ec379cf77 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -594,7 +594,7 @@ static int gba_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } @@ -659,13 +659,13 @@ image_init_result gba_cart_slot_device::call_load() { case 2 * 1024 * 1024: memcpy(ROM + 0x200000, ROM, 0x200000); - // intentional fall-through + [[fallthrough]]; case 4 * 1024 * 1024: memcpy(ROM + 0x400000, ROM, 0x400000); - // intentional fall-through + [[fallthrough]]; case 8 * 1024 * 1024: memcpy(ROM + 0x800000, ROM, 0x800000); - // intentional fall-through + [[fallthrough]]; case 16 * 1024 * 1024: memcpy(ROM + 0x1000000, ROM, 0x1000000); break; @@ -719,7 +719,11 @@ static inline std::string gba_chip_string( uint32_t chip ) if (chip & GBA_CHIP_FLASH_512) str += "FLASH_512 "; if (chip & GBA_CHIP_SRAM) str += "SRAM "; if (chip & GBA_CHIP_RTC) str += "RTC "; - strtrimspace(str); + if (!str.empty()) + { + assert(str.back() == ' '); + str = str.substr(0, str.length() - 1); + } return str; } diff --git a/src/devices/bus/gba/rom.cpp b/src/devices/bus/gba/rom.cpp index 378ed1d03cf..643432b8433 100644 --- a/src/devices/bus/gba/rom.cpp +++ b/src/devices/bus/gba/rom.cpp @@ -301,6 +301,7 @@ uint32_t gba_rom_device::read_gpio(offs_t offset, uint32_t mem_mask) } if (ACCESSING_BITS_16_31) return m_gpio_regs[1] << 16; + [[fallthrough]]; case 1: if (ACCESSING_BITS_0_15) return m_gpio_regs[2]; diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index 53e8a40e7c0..b9dcfd29ef8 100644 --- a/src/devices/bus/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -160,7 +160,7 @@ // Hexbus instance DEFINE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device, "hexbus", "Hexbus connector") -namespace bus { namespace hexbus { +namespace bus::hexbus { device_hexbus_interface::device_hexbus_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "hexbus") @@ -428,7 +428,7 @@ int hexbus_chained_device::data_bit(int n) // ------------------------------------------------------------------------ -} } // end namespace bus::hexbus +} // end namespace bus::hexbus void hexbus_options(device_slot_interface &device) { diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index 7f39400974b..1d225c55749 100644 --- a/src/devices/bus/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -15,7 +15,7 @@ #pragma once -namespace bus { namespace hexbus { +namespace bus::hexbus { enum { @@ -171,7 +171,7 @@ private: hexbus_chained_device* m_chain_element; }; -} } // end namespace bus::hexbus +} // end namespace bus::hexbus DECLARE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device) diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp index 65f59e0a18a..64fb31d57b0 100644 --- a/src/devices/bus/hexbus/hx5102.cpp +++ b/src/devices/bus/hexbus/hx5102.cpp @@ -109,7 +109,7 @@ DEFINE_DEVICE_TYPE_NS(HX5102, bus::hexbus, hx5102_device, "ti_hx5102", "TI Hexbus Floppy Drive") -namespace bus { namespace hexbus { +namespace bus::hexbus { void hx5102_device::memmap(address_map &map) { @@ -744,5 +744,5 @@ ioport_constructor hx5102_device::device_input_ports() const return INPUT_PORTS_NAME( hx5102 ); } -} } // end namespace bus::hexbus +} // end namespace bus::hexbus diff --git a/src/devices/bus/hexbus/hx5102.h b/src/devices/bus/hexbus/hx5102.h index 573c999ce3b..ac7b9e6a88b 100644 --- a/src/devices/bus/hexbus/hx5102.h +++ b/src/devices/bus/hexbus/hx5102.h @@ -28,7 +28,7 @@ #include "imagedev/floppy.h" #include "tp0370.h" -namespace bus { namespace hexbus { +namespace bus::hexbus { class hx5102_device : public hexbus_chained_device { @@ -121,7 +121,7 @@ private: uint8_t* m_rom2; }; -} } // end namespace bus::hexbus +} // end namespace bus::hexbus DECLARE_DEVICE_TYPE_NS(HX5102, bus::hexbus, hx5102_device) diff --git a/src/devices/bus/hexbus/tp0370.cpp b/src/devices/bus/hexbus/tp0370.cpp index 6b8b416383b..739d7c4a685 100644 --- a/src/devices/bus/hexbus/tp0370.cpp +++ b/src/devices/bus/hexbus/tp0370.cpp @@ -130,7 +130,7 @@ enum // Hexbus instance DEFINE_DEVICE_TYPE_NS(IBC, bus::hexbus, ibc_device, "ibc", "Intelligent Peripheral Bus Controller") -namespace bus { namespace hexbus { +namespace bus::hexbus { ibc_device::ibc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, IBC, tag, owner, clock), @@ -358,5 +358,5 @@ void ibc_device::device_reset() m_disable = true; } -} } +} // namespace bus::hexbus diff --git a/src/devices/bus/hexbus/tp0370.h b/src/devices/bus/hexbus/tp0370.h index eb8b37dfd60..9aafc27804a 100644 --- a/src/devices/bus/hexbus/tp0370.h +++ b/src/devices/bus/hexbus/tp0370.h @@ -16,7 +16,7 @@ #pragma once -namespace bus { namespace hexbus { +namespace bus::hexbus { class ibc_device : public device_t { @@ -69,7 +69,7 @@ private: void set_lines(bool bav, bool hsk); }; -} } +} // namespace bus::hexbus DECLARE_DEVICE_TYPE_NS(IBC, bus::hexbus, ibc_device) #endif diff --git a/src/devices/bus/hp_dio/hp98265a.cpp b/src/devices/bus/hp_dio/hp98265a.cpp index f02a4b9fcb2..97f6b9bc945 100644 --- a/src/devices/bus/hp_dio/hp98265a.cpp +++ b/src/devices/bus/hp_dio/hp98265a.cpp @@ -19,7 +19,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface") -namespace bus { namespace hp_dio { +namespace bus::hp_dio { void dio16_98265a_device::mb87030_scsi_adapter(device_t *device) { @@ -295,4 +295,4 @@ WRITE_LINE_MEMBER(dio16_98265a_device::dmar0_w) } -} } // namespace bus::hp_dio +} // namespace bus::hp_dio diff --git a/src/devices/bus/hp_dio/hp98265a.h b/src/devices/bus/hp_dio/hp98265a.h index c2bd58726b5..8246f9bb743 100644 --- a/src/devices/bus/hp_dio/hp98265a.h +++ b/src/devices/bus/hp_dio/hp98265a.h @@ -11,8 +11,7 @@ #include "bus/scsi/scsi.h" #include "bus/scsi/scsicd.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98265a_device : public device_t, @@ -65,7 +64,7 @@ private: bool m_dmar0; }; -} } // namespace bus::hp_dio +} // namespace bus::hp_dio DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device) diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp index d219dbd77c8..6df0757f04f 100644 --- a/src/devices/bus/hp_dio/hp98543.cpp +++ b/src/devices/bus/hp_dio/hp98543.cpp @@ -23,8 +23,7 @@ ROM_END DEFINE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, dio16_98543_device, "dio98543", "HP98543 medium-res color DIO video card") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { void dio16_98543_device::device_add_mconfig(machine_config &config) { @@ -253,4 +252,3 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 & } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98543.h b/src/devices/bus/hp_dio/hp98543.h index 567f2215c1b..c1e86126880 100644 --- a/src/devices/bus/hp_dio/hp98543.h +++ b/src/devices/bus/hp_dio/hp98543.h @@ -11,8 +11,8 @@ #include "video/nereid.h" #include "machine/ram.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { + class dio16_98543_device : public device_t, public device_dio16_card_interface, @@ -67,7 +67,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, dio16_98543_device) diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp index 4c211e8778d..040e36637aa 100644 --- a/src/devices/bus/hp_dio/hp98544.cpp +++ b/src/devices/bus/hp_dio/hp98544.cpp @@ -21,8 +21,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98544, bus::hp_dio, dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { ROM_START( hp98544 ) ROM_REGION( 0x2000, HP98544_ROM_REGION, 0 ) @@ -186,4 +185,3 @@ uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 & } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98544.h b/src/devices/bus/hp_dio/hp98544.h index 7e718180ea6..a490f765c84 100644 --- a/src/devices/bus/hp_dio/hp98544.h +++ b/src/devices/bus/hp_dio/hp98544.h @@ -14,8 +14,7 @@ // ======================> dio16_98544_device -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98544_device : public device_t, @@ -59,7 +58,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_98544, bus::hp_dio, dio16_98544_device) diff --git a/src/devices/bus/hp_dio/hp98550.cpp b/src/devices/bus/hp_dio/hp98550.cpp index 878c5193a37..b4a9af05a73 100644 --- a/src/devices/bus/hp_dio/hp98550.cpp +++ b/src/devices/bus/hp_dio/hp98550.cpp @@ -25,7 +25,7 @@ ROM_END DEFINE_DEVICE_TYPE_NS(HPDIO_98550, bus::hp_dio, dio32_98550_device, "dio98550", "HP98550A high-res color DIO video card") -namespace bus { namespace hp_dio { +namespace bus::hp_dio { void dio32_98550_device::device_add_mconfig(machine_config &config) { @@ -233,4 +233,3 @@ uint32_t dio32_98550_device::screen_update(screen_device &screen, bitmap_rgb32 & } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98550.h b/src/devices/bus/hp_dio/hp98550.h index 155a7213c09..eca4da5bed6 100644 --- a/src/devices/bus/hp_dio/hp98550.h +++ b/src/devices/bus/hp_dio/hp98550.h @@ -11,8 +11,8 @@ #include "video/nereid.h" #include "machine/ram.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { + class dio32_98550_device : public device_t, public device_dio16_card_interface, @@ -68,7 +68,6 @@ protected: }; } // namespace bus::hp_dio -} // namespace bus // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_98550, bus::hp_dio, dio32_98550_device) diff --git a/src/devices/bus/hp_dio/hp98603a.cpp b/src/devices/bus/hp_dio/hp98603a.cpp index caf83b3373f..791366d7639 100644 --- a/src/devices/bus/hp_dio/hp98603a.cpp +++ b/src/devices/bus/hp_dio/hp98603a.cpp @@ -13,8 +13,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98603A, bus::hp_dio, dio16_98603a_device, "dio98603a #define HP98603A_ROM_REGION "98603a_rom" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { ROM_START(hp98603a) ROM_REGION(0x80000, HP98603A_ROM_REGION, 0) @@ -81,4 +80,3 @@ void dio16_98603a_device::rom_w(offs_t offset, uint16_t data) } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98603a.h b/src/devices/bus/hp_dio/hp98603a.h index ff369071bab..15cccb7ab3d 100644 --- a/src/devices/bus/hp_dio/hp98603a.h +++ b/src/devices/bus/hp_dio/hp98603a.h @@ -8,8 +8,7 @@ #include "hp_dio.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98603a_device : public device_t, @@ -37,7 +36,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus DECLARE_DEVICE_TYPE_NS(HPDIO_98603A, bus::hp_dio, dio16_98603a_device) diff --git a/src/devices/bus/hp_dio/hp98603b.cpp b/src/devices/bus/hp_dio/hp98603b.cpp index 16bb4831bd0..e9ab716f30f 100644 --- a/src/devices/bus/hp_dio/hp98603b.cpp +++ b/src/devices/bus/hp_dio/hp98603b.cpp @@ -13,8 +13,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98603B, bus::hp_dio, dio16_98603b_device, "dio98603b #define HP98603B_ROM_REGION "98603b_rom" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { ROM_START(hp98603b) ROM_REGION(0x100000, HP98603B_ROM_REGION, 0) @@ -76,4 +75,3 @@ void dio16_98603b_device::rom_w(offs_t offset, uint16_t data) } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98603b.h b/src/devices/bus/hp_dio/hp98603b.h index 615815edc51..4f910781dba 100644 --- a/src/devices/bus/hp_dio/hp98603b.h +++ b/src/devices/bus/hp_dio/hp98603b.h @@ -8,8 +8,7 @@ #include "hp_dio.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98603b_device : public device_t, @@ -37,7 +36,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus DECLARE_DEVICE_TYPE_NS(HPDIO_98603B, bus::hp_dio, dio16_98603b_device) diff --git a/src/devices/bus/hp_dio/hp98620.cpp b/src/devices/bus/hp_dio/hp98620.cpp index 2a872dae77f..6a58ef2af78 100644 --- a/src/devices/bus/hp_dio/hp98620.cpp +++ b/src/devices/bus/hp_dio/hp98620.cpp @@ -15,8 +15,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, dio16_98620_device, "hp98620", "HP98620 DMA Controller") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { dio16_98620_device::dio16_98620_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : dio16_98620_device(mconfig, HPDIO_98620, tag, owner, clock) @@ -377,5 +376,3 @@ WRITE_LINE_MEMBER(dio16_98620_device::dmar1_in) } } // namespace bus::hp_dio -} // namespace bus - diff --git a/src/devices/bus/hp_dio/hp98620.h b/src/devices/bus/hp_dio/hp98620.h index ca6d2ae9da2..d8779f0e852 100644 --- a/src/devices/bus/hp_dio/hp98620.h +++ b/src/devices/bus/hp_dio/hp98620.h @@ -9,8 +9,7 @@ #include "hp_dio.h" -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98620_device : public device_t, @@ -125,7 +124,7 @@ private: bool m_dmar[2]; }; -} } // namespace bus::hp_dio +} // namespace bus::hp_dio DECLARE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, dio16_98620_device) diff --git a/src/devices/bus/hp_dio/hp98643.cpp b/src/devices/bus/hp_dio/hp98643.cpp index 7d5cc557e71..bba7cefebb5 100644 --- a/src/devices/bus/hp_dio/hp98643.cpp +++ b/src/devices/bus/hp_dio/hp98643.cpp @@ -15,7 +15,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98643, bus::hp_dio, dio16_98643_device, "dio98643", "HP98643A LANIC Ethernet card") -namespace bus { namespace hp_dio { +namespace bus::hp_dio { void dio16_98643_device::device_add_mconfig(machine_config &config) { @@ -213,4 +213,3 @@ void dio16_98643_device::addrmap(address_map &map) } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98643.h b/src/devices/bus/hp_dio/hp98643.h index 665528ad3f6..c1944bb1b8f 100644 --- a/src/devices/bus/hp_dio/hp98643.h +++ b/src/devices/bus/hp_dio/hp98643.h @@ -9,7 +9,7 @@ #include "hp_dio.h" #include "machine/am79c90.h" -namespace bus { namespace hp_dio { +namespace bus::hp_dio { static constexpr int REG_SWITCHES_REMOTE = 0x80; @@ -84,7 +84,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_98643, bus::hp_dio, dio16_98643_device) diff --git a/src/devices/bus/hp_dio/hp98644.cpp b/src/devices/bus/hp_dio/hp98644.cpp index 7badd2d2f15..2896076d01f 100644 --- a/src/devices/bus/hp_dio/hp98644.cpp +++ b/src/devices/bus/hp_dio/hp98644.cpp @@ -17,8 +17,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_98644, bus::hp_dio, dio16_98644_device, "dio98644", "HP98644A Asynchronous Serial Interface") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { //------------------------------------------------- // device_add_mconfig - add device configuration @@ -242,4 +241,3 @@ void dio16_98644_device::io_w(offs_t offset, uint16_t data) } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/hp98644.h b/src/devices/bus/hp_dio/hp98644.h index f34ff193588..6cd99123b92 100644 --- a/src/devices/bus/hp_dio/hp98644.h +++ b/src/devices/bus/hp_dio/hp98644.h @@ -15,8 +15,7 @@ // ======================> dio16_98644_device -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { class dio16_98644_device : public device_t, @@ -53,7 +52,6 @@ private: }; } // namespace bus::hp_dio -} // namespace bus // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_98644, bus::hp_dio, dio16_98644_device) diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp index aa777e3e5dd..75102828b01 100644 --- a/src/devices/bus/hp_dio/hp_dio.cpp +++ b/src/devices/bus/hp_dio/hp_dio.cpp @@ -28,8 +28,7 @@ DEFINE_DEVICE_TYPE_NS(DIO32_SLOT, bus::hp_dio, dio32_slot_device, "dio32_slot", DEFINE_DEVICE_TYPE_NS(DIO16, bus::hp_dio, dio16_device, "dio16", "16-bit DIO bus") DEFINE_DEVICE_TYPE_NS(DIO32, bus::hp_dio, dio32_device, "dio32", "32-bit DIO-II bus") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { //************************************************************************** // LIVE DEVICE @@ -273,10 +272,9 @@ template void dio16_device::install_memory<read16_delegate, write16_delegate template void dio16_device::install_memory<read16s_delegate, write16s_delegate >(offs_t start, offs_t end, read16s_delegate rhandler, write16s_delegate whandler); template void dio16_device::install_memory<read16sm_delegate, write16sm_delegate >(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler); -void dio16_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void dio16_device::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_prgspace->install_readwrite_bank(start, end, 0, tag); - machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data); + m_prgspace->install_ram(start, end, data); } void dio16_device::unmap_bank(offs_t start, offs_t end) @@ -284,10 +282,9 @@ void dio16_device::unmap_bank(offs_t start, offs_t end) m_prgspace->unmap_readwrite(start, end); } -void dio16_device::install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data) +void dio16_device::install_rom(offs_t start, offs_t end, uint8_t *data) { - m_prgspace->install_read_bank(start, end, 0, tag); - machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data); + m_prgspace->install_rom(start, end, data); } void dio16_device::unmap_rom(offs_t start, offs_t end) @@ -356,7 +353,6 @@ void device_dio32_card_interface::interface_pre_start() } } // namespace bus::hp_dio -} // namespace bus void dio16_cards(device_slot_interface & device) { diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h index 11738a5fc26..744c4940dc5 100644 --- a/src/devices/bus/hp_dio/hp_dio.h +++ b/src/devices/bus/hp_dio/hp_dio.h @@ -17,7 +17,7 @@ #pragma once -namespace bus { namespace hp_dio { +namespace bus::hp_dio { //************************************************************************** // TYPE DEFINITIONS @@ -83,8 +83,8 @@ public: // due to the varying bus widths. Using all install_memory() shields you from this problem. // Either know what you're doing (m_prgwidth is available to cards for this purpose) or // only use these for 32-bit DIO-II cards. - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); - void install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); + void install_rom(offs_t start, offs_t end, uint8_t *data); void unmap_bank(offs_t start, offs_t end); void unmap_rom(offs_t start, offs_t end); @@ -280,7 +280,7 @@ protected: dio32_device &dio() { assert(m_dio_dev); return downcast<dio32_device &>(*m_dio_dev); } }; -} } // namespace bus::hp_dio +} // namespace bus::hp_dio // device type definition DECLARE_DEVICE_TYPE_NS(DIO16_SLOT, bus::hp_dio, dio16_slot_device) diff --git a/src/devices/bus/hp_dio/human_interface.cpp b/src/devices/bus/hp_dio/human_interface.cpp index 9f160380a51..b084ac47e24 100644 --- a/src/devices/bus/hp_dio/human_interface.cpp +++ b/src/devices/bus/hp_dio/human_interface.cpp @@ -21,8 +21,7 @@ DEFINE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device, "human_interface", "HP human interface card") -namespace bus { - namespace hp_dio { +namespace bus::hp_dio { void human_interface_device::device_add_mconfig(machine_config &config) { @@ -389,4 +388,3 @@ uint8_t human_interface_device::dmack_r_in(int channel) } } // namespace bus::hp_dio -} // namespace bus diff --git a/src/devices/bus/hp_dio/human_interface.h b/src/devices/bus/hp_dio/human_interface.h index 26f3548b731..2e1d1376211 100644 --- a/src/devices/bus/hp_dio/human_interface.h +++ b/src/devices/bus/hp_dio/human_interface.h @@ -14,8 +14,9 @@ #include "bus/hp_hil/hp_hil.h" #include "bus/hp_hil/hil_devices.h" #include "bus/ieee488/ieee488.h" -namespace bus { - namespace hp_dio { + +namespace bus::hp_dio { + class human_interface_device : public device_t, public device_dio16_card_interface @@ -96,7 +97,7 @@ private: uint8_t m_ppoll_mask; }; -} } // namespace bus::hp_dio +} // namespace bus::hp_dio // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device) diff --git a/src/devices/bus/hp_hil/hlebase.cpp b/src/devices/bus/hp_hil/hlebase.cpp index f122919dc1c..b43271f705a 100644 --- a/src/devices/bus/hp_hil/hlebase.cpp +++ b/src/devices/bus/hp_hil/hlebase.cpp @@ -6,8 +6,7 @@ //#define VERBOSE 1 #include "logmacro.h" -namespace bus { - namespace hp_hil { +namespace bus::hp_hil { /*************************************************************************** BASE HLE KEYBOARD DEVICE @@ -160,4 +159,3 @@ out: } } // namespace bus::hp_hil -} // namespace bus diff --git a/src/devices/bus/hp_hil/hlebase.h b/src/devices/bus/hp_hil/hlebase.h index ebffc3455b2..2ea81239560 100644 --- a/src/devices/bus/hp_hil/hlebase.h +++ b/src/devices/bus/hp_hil/hlebase.h @@ -9,8 +9,7 @@ #include "machine/keyboard.h" -namespace bus { - namespace hp_hil { +namespace bus::hp_hil { class hle_device_base : public device_t @@ -41,6 +40,5 @@ private: }; } // namespace bus::hp_hil -} // namespace bus #endif // MAME_DEVICES_HP_HIL_HLEBASE_H diff --git a/src/devices/bus/hp_hil/hlekbd.cpp b/src/devices/bus/hp_hil/hlekbd.cpp index b3709676d30..2a07bc083df 100644 --- a/src/devices/bus/hp_hil/hlekbd.cpp +++ b/src/devices/bus/hp_hil/hlekbd.cpp @@ -14,7 +14,7 @@ DEFINE_DEVICE_TYPE_NS(HP_IPC_HLE_KEYBOARD, bus::hp_hil, hle_hp_ipc_device, "hp_ipc_hle_kbd", "HP Integral Keyboard (HLE)") DEFINE_DEVICE_TYPE_NS(HP_ITF_HLE_KEYBOARD, bus::hp_hil, hle_hp_itf_device, "hp_itf_hle_kbd", "HP ITF Keyboard") -namespace bus { namespace hp_hil { +namespace bus::hp_hil { namespace { @@ -610,4 +610,4 @@ void hle_hp_itf_device::hil_idd() m_hp_hil_mlc->hil_write(m_device_id16 | 0x04); } -} } // namespace bus::hp_hil +} // namespace bus::hp_hil diff --git a/src/devices/bus/hp_hil/hlekbd.h b/src/devices/bus/hp_hil/hlekbd.h index c9bb59faaad..e1b5c08fd5a 100644 --- a/src/devices/bus/hp_hil/hlekbd.h +++ b/src/devices/bus/hp_hil/hlekbd.h @@ -10,7 +10,7 @@ #include "machine/keyboard.h" -namespace bus { namespace hp_hil { +namespace bus::hp_hil { class hle_hp_ipc_device : public hle_device_base @@ -64,7 +64,7 @@ private: void transmit_byte(uint8_t byte); }; -} } // namespace bus::hp_hil +} // namespace bus::hp_hil DECLARE_DEVICE_TYPE_NS(HP_IPC_HLE_KEYBOARD, bus::hp_hil, hle_hp_ipc_device); diff --git a/src/devices/bus/hp_hil/hlemouse.cpp b/src/devices/bus/hp_hil/hlemouse.cpp index fe4fd311733..76a1cbf7ef5 100644 --- a/src/devices/bus/hp_hil/hlemouse.cpp +++ b/src/devices/bus/hp_hil/hlemouse.cpp @@ -12,8 +12,7 @@ DEFINE_DEVICE_TYPE_NS(HP_46060B_MOUSE, bus::hp_hil, hle_hp_46060b_device, "hp_46060b", "HP 46060B Mouse") -namespace bus { - namespace hp_hil { +namespace bus::hp_hil { namespace { @@ -127,5 +126,4 @@ INPUT_CHANGED_MEMBER(hle_hp_46060b_device::mouse_button) mouse_buttons = data; } -} // namesapce bus::hp_hil -} // namespace bus +} // namespace bus::hp_hil diff --git a/src/devices/bus/hp_hil/hlemouse.h b/src/devices/bus/hp_hil/hlemouse.h index 7abfc1d5192..830ffd20bfe 100644 --- a/src/devices/bus/hp_hil/hlemouse.h +++ b/src/devices/bus/hp_hil/hlemouse.h @@ -10,8 +10,7 @@ #include "machine/keyboard.h" -namespace bus { - namespace hp_hil { +namespace bus::hp_hil { class hle_hp_46060b_device : public hle_device_base @@ -45,7 +44,6 @@ public: }; } // namespace bus::hp_hil -} // namespace bus DECLARE_DEVICE_TYPE_NS(HP_46060B_MOUSE, bus::hp_hil, hle_hp_46060b_device); diff --git a/src/devices/bus/ieee488/c2031.cpp b/src/devices/bus/ieee488/c2031.cpp index 10b21fcff4d..a01e42ec113 100644 --- a/src/devices/bus/ieee488/c2031.cpp +++ b/src/devices/bus/ieee488/c2031.cpp @@ -300,14 +300,14 @@ void c2031_device::device_add_mconfig(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &c2031_device::c2031_mem); //config.set_perfect_quantum(m_maincpu); FIXME: not safe in a slot device - add barriers - VIA6522(config, m_via0, XTAL(16'000'000)/16); + MOS6522(config, m_via0, XTAL(16'000'000)/16); m_via0->readpa_handler().set(FUNC(c2031_device::via0_pa_r)); m_via0->readpb_handler().set(FUNC(c2031_device::via0_pb_r)); m_via0->writepa_handler().set(FUNC(c2031_device::via0_pa_w)); m_via0->writepb_handler().set(FUNC(c2031_device::via0_pb_w)); m_via0->irq_handler().set(FUNC(c2031_device::via0_irq_w)); - VIA6522(config, m_via1, XTAL(16'000'000)/16); + MOS6522(config, m_via1, XTAL(16'000'000)/16); m_via1->readpa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_r)); m_via1->readpb_handler().set(FUNC(c2031_device::via1_pb_r)); m_via1->writepa_handler().set(C64H156_TAG, FUNC(c64h156_device::yb_w)); diff --git a/src/devices/bus/ieee488/c2040.cpp b/src/devices/bus/ieee488/c2040.cpp index a42dc1a2099..cc8ff042235 100644 --- a/src/devices/bus/ieee488/c2040.cpp +++ b/src/devices/bus/ieee488/c2040.cpp @@ -471,7 +471,7 @@ void c2040_device::add_common_devices(machine_config &config) M6504(config, m_fdccpu, XTAL(16'000'000)/16); m_fdccpu->set_addrmap(AS_PROGRAM, &c2040_device::c2040_fdc_mem); - VIA6522(config, m_via, XTAL(16'000'000)/16); + MOS6522(config, m_via, XTAL(16'000'000)/16); m_via->readpa_handler().set(m_fdc, FUNC(c2040_fdc_device::read)); m_via->writepb_handler().set(FUNC(c2040_device::via_pb_w)); m_via->ca2_handler().set(m_fdc, FUNC(c2040_fdc_device::mode_sel_w)); diff --git a/src/devices/bus/ieee488/c8050.cpp b/src/devices/bus/ieee488/c8050.cpp index 367c4299857..7c25022051f 100644 --- a/src/devices/bus/ieee488/c8050.cpp +++ b/src/devices/bus/ieee488/c8050.cpp @@ -548,7 +548,7 @@ void c8050_device::add_common_devices(machine_config &config) // controller M6504(config, m_fdccpu, XTAL(12'000'000)/12); - VIA6522(config, m_via, XTAL(12'000'000)/12); + MOS6522(config, m_via, XTAL(12'000'000)/12); m_via->readpa_handler().set(m_fdc, FUNC(c8050_fdc_device::read)); m_via->writepb_handler().set(FUNC(c8050_device::via_pb_w)); m_via->ca2_handler().set(m_fdc, FUNC(c8050_fdc_device::mode_sel_w)); diff --git a/src/devices/bus/ieee488/d9060.cpp b/src/devices/bus/ieee488/d9060.cpp index 1de4dfd9347..15b8d4cc5c8 100644 --- a/src/devices/bus/ieee488/d9060.cpp +++ b/src/devices/bus/ieee488/d9060.cpp @@ -383,7 +383,7 @@ void d9060_device_base::device_add_mconfig(machine_config &config) M6502(config, m_hdccpu, XTAL(4'000'000)/4); m_hdccpu->set_addrmap(AS_PROGRAM, &d9060_device::hdc_mem); - VIA6522(config, m_via, XTAL(4'000'000)/4); + MOS6522(config, m_via, XTAL(4'000'000)/4); m_via->writepa_handler().set(FUNC(d9060_device_base::scsi_data_w)); m_via->writepb_handler().set(FUNC(d9060_device_base::via_pb_w)); m_via->ca2_handler().set(FUNC(d9060_device_base::ack_w)); diff --git a/src/devices/bus/intellec4/insdatastor.cpp b/src/devices/bus/intellec4/insdatastor.cpp index 77a9cc378e5..30a7554d1ab 100644 --- a/src/devices/bus/intellec4/insdatastor.cpp +++ b/src/devices/bus/intellec4/insdatastor.cpp @@ -8,7 +8,7 @@ DEFINE_DEVICE_TYPE_NS(INTELLEC4_INST_DATA_STORAGE, bus::intellec4, imm4_22_device, "intlc4_imm4_22", "Intel imm4-22 Instruction/Data Storage Module") -namespace bus { namespace intellec4 { +namespace bus::intellec4 { namespace { @@ -188,4 +188,4 @@ void imm4_22_device::unmap_prom() rom_space().unmap_read(offs_t(m_rom_page) << 10, (offs_t(m_rom_page) << 10) | 0x03ffU, m_rom_mirror ? 0x1000U : 0x0000U); } -} } // namespace bus::intellec4 +} // namespace bus::intellec4 diff --git a/src/devices/bus/intellec4/insdatastor.h b/src/devices/bus/intellec4/insdatastor.h index 9c6acad729f..d7c83c30307 100644 --- a/src/devices/bus/intellec4/insdatastor.h +++ b/src/devices/bus/intellec4/insdatastor.h @@ -144,7 +144,7 @@ P2 outputs (40-pin IDC) #include "intellec4.h" -namespace bus { namespace intellec4 { +namespace bus::intellec4 { class imm4_22_device : public device_t, public device_univ_card_interface, public device_image_interface { @@ -192,7 +192,7 @@ private: std::unique_ptr<u8 []> m_prom; }; -} } // namespace bus::intellec4 +} // namespace bus::intellec4 DECLARE_DEVICE_TYPE_NS(INTELLEC4_INST_DATA_STORAGE, bus::intellec4, imm4_22_device) diff --git a/src/devices/bus/intellec4/intellec4.cpp b/src/devices/bus/intellec4/intellec4.cpp index 07b42f3ae52..5c0de621b50 100644 --- a/src/devices/bus/intellec4/intellec4.cpp +++ b/src/devices/bus/intellec4/intellec4.cpp @@ -11,7 +11,7 @@ DEFINE_DEVICE_TYPE_NS(INTELLEC4_UNIV_SLOT, bus::intellec4, univ_slot_device, "in DEFINE_DEVICE_TYPE_NS(INTELLEC4_UNIV_BUS, bus::intellec4, univ_bus_device, "intlc4univbus", "INTELLEC 4 Universal Bus") -namespace bus { namespace intellec4 { +namespace bus::intellec4 { /*********************************************************************** SLOT DEVICE @@ -256,7 +256,7 @@ void device_univ_card_interface::set_bus(univ_bus_device &bus) m_index = (m_bus = &bus)->add_card(*this); } -} } // namespace bus::intellec4 +} // namespace bus::intellec4 diff --git a/src/devices/bus/intellec4/intellec4.h b/src/devices/bus/intellec4/intellec4.h index 8ae65f94487..230e1c80fd4 100644 --- a/src/devices/bus/intellec4/intellec4.h +++ b/src/devices/bus/intellec4/intellec4.h @@ -114,7 +114,7 @@ to implement the card in both systems. #pragma once -namespace bus { namespace intellec4 { +namespace bus::intellec4 { class univ_slot_device; class univ_bus_device; @@ -247,7 +247,7 @@ private: unsigned m_index; }; -} } // namespace bus::intellec4 +} // namespace bus::intellec4 DECLARE_DEVICE_TYPE_NS(INTELLEC4_UNIV_SLOT, bus::intellec4, univ_slot_device) diff --git a/src/devices/bus/intellec4/prommemory.cpp b/src/devices/bus/intellec4/prommemory.cpp index 0eab857a72f..7ce7dd962fd 100644 --- a/src/devices/bus/intellec4/prommemory.cpp +++ b/src/devices/bus/intellec4/prommemory.cpp @@ -8,7 +8,7 @@ DEFINE_DEVICE_TYPE_NS(INTELLEC4_PROM_MEMORY, bus::intellec4, imm6_26_device, "intlc4_imm6_26", "Intel imm6-26 PROM Memory Module") -namespace bus { namespace intellec4 { +namespace bus::intellec4 { imm6_26_device::imm6_26_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, INTELLEC4_PROM_MEMORY, tag, owner, clock) @@ -64,4 +64,4 @@ void imm6_26_device::unmap() rom_space().unmap_read(0x1000U, 0x1fffU); } -} } // namespace bus::intellec4 +} // namespace bus::intellec4 diff --git a/src/devices/bus/intellec4/prommemory.h b/src/devices/bus/intellec4/prommemory.h index 14724a0e437..9003129c54c 100644 --- a/src/devices/bus/intellec4/prommemory.h +++ b/src/devices/bus/intellec4/prommemory.h @@ -89,7 +89,7 @@ RAM MOD ENBL not jumpered in on INTELLEC 4, allows PROM to overlay RAM on #include "intellec4.h" -namespace bus { namespace intellec4 { +namespace bus::intellec4 { class imm6_26_device : public device_t, public device_univ_card_interface, public device_image_interface { @@ -119,7 +119,7 @@ private: std::unique_ptr<u8 []> m_data; }; -} } // namespace bus::intellec4 +} // namespace bus::intellec4 DECLARE_DEVICE_TYPE_NS(INTELLEC4_PROM_MEMORY, bus::intellec4, imm6_26_device) diff --git a/src/devices/bus/intellec4/tapereader.cpp b/src/devices/bus/intellec4/tapereader.cpp index ba9566fad2d..1f32815fbd5 100644 --- a/src/devices/bus/intellec4/tapereader.cpp +++ b/src/devices/bus/intellec4/tapereader.cpp @@ -8,7 +8,7 @@ DEFINE_DEVICE_TYPE_NS(INTELLEC4_TAPE_READER, bus::intellec4, imm4_90_device, "intlc4_imm4_90", "Intel imm4-90 High-Speed Paper Tape Reader") -namespace bus { namespace intellec4 { +namespace bus::intellec4 { imm4_90_device::imm4_90_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, INTELLEC4_TAPE_READER, tag, owner, clock) @@ -83,4 +83,4 @@ TIMER_CALLBACK_MEMBER(imm4_90_device::step) } } -} } // namespace bus::intellec4 +} // namespace bus::intellec4 diff --git a/src/devices/bus/intellec4/tapereader.h b/src/devices/bus/intellec4/tapereader.h index 64e1727e5d5..963bf2ae404 100644 --- a/src/devices/bus/intellec4/tapereader.h +++ b/src/devices/bus/intellec4/tapereader.h @@ -19,7 +19,7 @@ interface and paper tape reader as a single device. #include "intellec4.h" -namespace bus { namespace intellec4 { +namespace bus::intellec4 { class imm4_90_device : public device_t, public device_univ_card_interface, public device_image_interface { @@ -56,7 +56,7 @@ private: bool m_stepping; }; -} } // namespace bus::intellec4 +} // namespace bus::intellec4 DECLARE_DEVICE_TYPE_NS(INTELLEC4_TAPE_READER, bus::intellec4, imm4_90_device) diff --git a/src/devices/bus/interpro/keyboard/hle.cpp b/src/devices/bus/interpro/keyboard/hle.cpp index 15dd262eddf..66fa8e44a30 100644 --- a/src/devices/bus/interpro/keyboard/hle.cpp +++ b/src/devices/bus/interpro/keyboard/hle.cpp @@ -122,7 +122,7 @@ DEFINE_DEVICE_TYPE_NS(INTERPRO_HLE_EN_US_KEYBOARD, bus::interpro::keyboard, hle_en_us_device, "kbd_hle_en_us", "InterPro Keyboard (HLE, US English)") -namespace bus { namespace interpro { namespace keyboard { +namespace bus::interpro::keyboard { namespace { @@ -461,4 +461,4 @@ u8 hle_en_us_device::translate(u8 row, u8 column) return TRANSLATION_TABLE[map][row][column]; } -} } } // namespace bus::interpro::keyboard +} // namespace bus::interpro::keyboard diff --git a/src/devices/bus/interpro/keyboard/hle.h b/src/devices/bus/interpro/keyboard/hle.h index 944569b9658..1f4e2066829 100644 --- a/src/devices/bus/interpro/keyboard/hle.h +++ b/src/devices/bus/interpro/keyboard/hle.h @@ -10,7 +10,7 @@ #include "sound/beep.h" #include "diserial.h" -namespace bus { namespace interpro { namespace keyboard { +namespace bus::interpro::keyboard { class hle_device_base : public device_t @@ -113,7 +113,7 @@ public: required_ioport m_modifiers; }; -} } } // namespace bus::interpro::keyboard +} // namespace bus::interpro::keyboard DECLARE_DEVICE_TYPE_NS(INTERPRO_HLE_EN_US_KEYBOARD, bus::interpro::keyboard, hle_en_us_device) diff --git a/src/devices/bus/interpro/keyboard/lle.cpp b/src/devices/bus/interpro/keyboard/lle.cpp index 6beb3581d13..7151f1e0fc0 100644 --- a/src/devices/bus/interpro/keyboard/lle.cpp +++ b/src/devices/bus/interpro/keyboard/lle.cpp @@ -157,7 +157,7 @@ DEFINE_DEVICE_TYPE_NS(INTERPRO_LLE_EN_US_KEYBOARD, bus::interpro::keyboard, lle_en_us_device, "kbd_lle_en_us", "InterPro Keyboard (LLE, US English)") -namespace bus { namespace interpro { namespace keyboard { +namespace bus::interpro::keyboard { namespace { @@ -610,4 +610,4 @@ ioport_constructor lle_en_us_device::device_input_ports() const return INPUT_PORTS_NAME(lle_en_us_device); } -} } } // namespace bus::interpro::keyboard +} // namespace bus::interpro::keyboard diff --git a/src/devices/bus/interpro/keyboard/lle.h b/src/devices/bus/interpro/keyboard/lle.h index 98c565e6cfa..385f2484fab 100644 --- a/src/devices/bus/interpro/keyboard/lle.h +++ b/src/devices/bus/interpro/keyboard/lle.h @@ -12,7 +12,7 @@ #include "machine/bankdev.h" #include "sound/spkrdev.h" -namespace bus { namespace interpro { namespace keyboard { +namespace bus::interpro::keyboard { class lle_device_base : public device_t @@ -66,7 +66,7 @@ public: virtual tiny_rom_entry const *device_rom_region() const override; }; -} } } // namespace bus::interpro::keyboard +} // namespace bus::interpro::keyboard DECLARE_DEVICE_TYPE_NS(INTERPRO_LLE_EN_US_KEYBOARD, bus::interpro::keyboard, lle_en_us_device) diff --git a/src/devices/bus/interpro/sr/gt.cpp b/src/devices/bus/interpro/sr/gt.cpp index 768bf221ec5..4d7318eea19 100644 --- a/src/devices/bus/interpro/sr/gt.cpp +++ b/src/devices/bus/interpro/sr/gt.cpp @@ -687,7 +687,7 @@ void gt_device_base::ri_xfer_w(offs_t offset, u32 data, u32 mem_mask) // initiate ri line draw u32 address = m_ri_initial_address; - u32 error = m_ri_initial_error; + s32 error = m_ri_initial_error; for (int i = 0; i < m_ri_stop_count; i++) { @@ -1571,7 +1571,7 @@ u32 gtdb_device::vram_r(offs_t offset, const bool linear) const return gt_device_base::vram_r(offset, linear); } -void gtdb_device::vram_w(const offs_t offset, const u32 data, const u32 mem_mask, const bool linear) const +void gtdb_device::vram_w(const offs_t offset, const u32 data, u32 mem_mask, const bool linear) const { if (m_control & GFX_HILITE_SEL) { diff --git a/src/devices/bus/interpro/sr/sr.h b/src/devices/bus/interpro/sr/sr.h index ef9d01d2f29..0d30905943b 100644 --- a/src/devices/bus/interpro/sr/sr.h +++ b/src/devices/bus/interpro/sr/sr.h @@ -75,7 +75,7 @@ public: offs_t end = start + (CBUS_SIZE - 1); // install the idprom region - read32_delegate idprom_r(*this, [idprom] (address_space &space, offs_t offset, u32 mem_mask) { return idprom->as_u32(offset); }, idprom->name()); + read32sm_delegate idprom_r(*this, [idprom] (offs_t offset) { return idprom->as_u32(offset); }, idprom->name().c_str()); m_main_space->install_read_handler(start, start | 0x7f, idprom_r); m_io_space->install_read_handler(start, start | 0x7f, idprom_r); @@ -171,7 +171,7 @@ public: offs_t end = start + (SRX_SIZE - 1); // install the idprom region - read32_delegate idprom_r(*this, [idprom] (address_space &space, offs_t offset, u32 mem_mask) { return idprom->as_u32(offset); }, idprom->name()); + read32sm_delegate idprom_r(*this, [idprom] (offs_t offset) { return idprom->as_u32(offset); }, idprom->name().c_str()); m_main_space->install_read_handler(start | 0x7f80, start | 0x7fff, idprom_r); m_io_space->install_read_handler(start | 0x7f80, start | 0x7fff, idprom_r); diff --git a/src/devices/bus/intv/slot.cpp b/src/devices/bus/intv/slot.cpp index c0c39d5613d..3e086f9c530 100644 --- a/src/devices/bus/intv/slot.cpp +++ b/src/devices/bus/intv/slot.cpp @@ -74,9 +74,9 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" + #include "hashfile.h" #define INTELLIVOICE_MASK 0x02 @@ -198,7 +198,7 @@ static int intv_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/isa/3c503.cpp b/src/devices/bus/isa/3c503.cpp index de7363ceb26..0bf96c34f53 100644 --- a/src/devices/bus/isa/3c503.cpp +++ b/src/devices/bus/isa/3c503.cpp @@ -55,7 +55,7 @@ void el2_3c503_device::device_reset() { m_regs.ctrl = 0x0a; m_irq_state = CLEAR_LINE; m_isa->unmap_bank(SADDR, SADDR + 0x1fff); - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 rom", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); } void el2_3c503_device::set_irq(int state) { @@ -191,13 +191,13 @@ void el2_3c503_device::el2_3c503_hiport_w(offs_t offset, uint8_t data) { m_isa->unmap_bank(SADDR, SADDR + 0x1fff); switch(data & 0xf) { case 0: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 rom", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); break; case 9: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 ram", m_board_ram); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_board_ram); break; default: - m_isa->install_bank(SADDR, SADDR + 0x1fff, "3c503 no map", m_rom); + m_isa->install_bank(SADDR, SADDR + 0x1fff, m_rom); break; } } @@ -245,6 +245,7 @@ void el2_3c503_device::el2_3c503_hiport_w(offs_t offset, uint8_t data) { default: logerror("3c503: trying to set multiple drqs %X\n", data); } + break; case 9: if(m_regs.ctrl & 0x80) logerror("3c503: changing dma address during dma is undefined\n"); m_regs.da = (data << 8) | (m_regs.da & 0xff); diff --git a/src/devices/bus/isa/3c505.cpp b/src/devices/bus/isa/3c505.cpp index c45f3e9b78a..55f853acc42 100644 --- a/src/devices/bus/isa/3c505.cpp +++ b/src/devices/bus/isa/3c505.cpp @@ -280,7 +280,7 @@ void isa16_3c505_device::device_reset() offs_t const rom_base = (m_romopts->read() & 0xfe) << 12; if (m_isa->is_option_rom_space_available(rom_base, 0x2000)) - m_isa->install_rom(this, rom_base, rom_base | 0x01fff, "host", "host"); + m_isa->install_rom(this, rom_base, rom_base | 0x01fff, "host"); } m_isa->set_dma_channel(m_isa_drq, this, true); diff --git a/src/devices/bus/isa/3xtwin.cpp b/src/devices/bus/isa/3xtwin.cpp new file mode 100644 index 00000000000..b30c83ab1ce --- /dev/null +++ b/src/devices/bus/isa/3xtwin.cpp @@ -0,0 +1,95 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*************************************************************************** + + Emerald Technology Inc. 3XTwin IBM 5251/11 twinax emulation board + + This smallish card is rather tightly packed with DIP ICs (mostly simple + LSTTL and a few line drivers/receivers) to the point where their + location numbers are difficult to read. There is no host BIOS, and the + 65C02's "TWINMON" firmware does very little, clearly relying on + external software. + + Communication between the host system and local CPU seems to take place + via shared access to a KM62256LP-10 SRAM. + +***************************************************************************/ + +#include "emu.h" +#include "3xtwin.h" + +#include "cpu/m6502/r65c02.h" +#include "machine/com52c50.h" + + +// device type definition +DEFINE_DEVICE_TYPE(ISA8_3XTWIN, isa8_3xtwin_device, "3xtwin", "Emerald Technology 3XTwin Twinax Emulation Card") + +isa8_3xtwin_device::isa8_3xtwin_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, ISA8_3XTWIN, tag, owner, clock) + , device_isa8_card_interface(mconfig, *this) +{ +} + +void isa8_3xtwin_device::device_start() +{ +} + +void isa8_3xtwin_device::mpu_map(address_map &map) +{ + map(0x0000, 0x1fff).ram(); + map(0x2000, 0x2007).m("tic", FUNC(com52c50_device::map)); + map(0x4000, 0xbfff).ram(); + map(0xe000, 0xffff).rom().region("firmware", 0); +} + + +static INPUT_PORTS_START(3xtwin) + PORT_START("IOBASE") + PORT_DIPNAME(0x1f, 0x19, "Base I/O Address") PORT_DIPLOCATION("S1:5,4,3,2,1") + PORT_DIPSETTING(0x10, "200") + PORT_DIPSETTING(0x11, "220") + PORT_DIPSETTING(0x12, "240") + PORT_DIPSETTING(0x13, "260") + PORT_DIPSETTING(0x14, "280") + PORT_DIPSETTING(0x15, "2A0") + PORT_DIPSETTING(0x16, "2C0") + PORT_DIPSETTING(0x17, "2E0") + PORT_DIPSETTING(0x18, "300") + PORT_DIPSETTING(0x19, "320") + PORT_DIPSETTING(0x1a, "340") + PORT_DIPSETTING(0x1b, "360") + PORT_DIPSETTING(0x1c, "380") + PORT_DIPSETTING(0x1d, "3A0") + PORT_DIPSETTING(0x1e, "3C0") + PORT_DIPSETTING(0x1f, "3E0") + + // TODO: IRQ jumpers +INPUT_PORTS_END + +ioport_constructor isa8_3xtwin_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(3xtwin); +} + +void isa8_3xtwin_device::device_add_mconfig(machine_config &config) +{ + r65c02_device &mpu(R65C02(config, "mpu", 16_MHz_XTAL / 4)); // R65C02P4 + mpu.set_addrmap(AS_PROGRAM, &isa8_3xtwin_device::mpu_map); + + com52c50_device &tic(COM52C50(config, "tic", 16_MHz_XTAL)); + tic.int1_callback().set_inputline("mpu", r65c02_device::IRQ_LINE); + tic.int2_callback().set_inputline("mpu", r65c02_device::NMI_LINE); +} + +ROM_START(3xtwin) + ROM_REGION(0x2000, "firmware", 0) // "MON VER E.01" + ROM_LOAD("370906502.u2", 0x0000, 0x2000, CRC(d4157bc4) SHA1(359428ce0047f9192a44790c8670af956cf6ed70)) + + // PLDs (undumped) marked "TWINCLK" (U9: ULC24/22V10-15) and "TWINLGC" (U12: PAL20L10ACNS) +ROM_END + +const tiny_rom_entry *isa8_3xtwin_device::device_rom_region() const +{ + return ROM_NAME(3xtwin); +} diff --git a/src/devices/bus/isa/3xtwin.h b/src/devices/bus/isa/3xtwin.h new file mode 100644 index 00000000000..cb9aeb286eb --- /dev/null +++ b/src/devices/bus/isa/3xtwin.h @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*************************************************************************** + + Emerald Technology Inc. 3XTwin IBM 5251/11 emulation board + +***************************************************************************/ + +#ifndef MAME_BUS_ISA_3XTWIN_H +#define MAME_BUS_ISA_3XTWIN_H + +#pragma once + +#include "isa.h" + + +// ======================> isa8_3xtwin_device + +class isa8_3xtwin_device : public device_t, public device_isa8_card_interface +{ +public: + // device type constructor + isa8_3xtwin_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + // local memory map + void mpu_map(address_map &map); +}; + +// device type declaration +DECLARE_DEVICE_TYPE(ISA8_3XTWIN, isa8_3xtwin_device) + +#endif // MAME_BUS_ISA_3XTWIN_H diff --git a/src/devices/bus/isa/aha1542c.cpp b/src/devices/bus/isa/aha1542c.cpp index de8e2f1fb65..34e716647ac 100644 --- a/src/devices/bus/isa/aha1542c.cpp +++ b/src/devices/bus/isa/aha1542c.cpp @@ -383,7 +383,7 @@ aha1542cp_device::aha1542cp_device(const machine_config &mconfig, const char *ta void aha1542c_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542", "aha1542"); + m_isa->install_rom(this, 0xdc000, 0xdffff, "aha1542"); m_isa->install_device(0x330, 0x333, read8sm_delegate(*this, FUNC(aha1542cf_device::aha1542_r)), write8sm_delegate(*this, FUNC(aha1542cf_device::aha1542_w))); diff --git a/src/devices/bus/isa/asc88.cpp b/src/devices/bus/isa/asc88.cpp index 8843aad29a1..be80911d399 100644 --- a/src/devices/bus/isa/asc88.cpp +++ b/src/devices/bus/isa/asc88.cpp @@ -50,8 +50,8 @@ void asc88_device::device_start() void asc88_device::device_reset() { const offs_t baseaddr = 0xc0000 | (u32(m_baseaddr->read()) << 14); - m_isa->install_rom(this, baseaddr, baseaddr | 0x37ff, "asc88", "bios"); - m_isa->install_bank(baseaddr | 0x3800, baseaddr | 0x3fef, "ascram", m_ram.get()); + m_isa->install_rom(this, baseaddr, baseaddr | 0x37ff, "bios"); + m_isa->install_bank(baseaddr | 0x3800, baseaddr | 0x3fef, m_ram.get()); m_isa->install_memory(baseaddr | 0x3ff0, baseaddr | 0x3ff7, read8sm_delegate(*m_scsic, FUNC(ncr5380n_device::read)), write8sm_delegate(*m_scsic, FUNC(ncr5380n_device::write))); diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 52a0407f065..410231822a7 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -332,9 +332,9 @@ void isa8_cga_device::device_start() set_isa_device(); m_vram.resize(m_vram_size); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_cga_device::io_read)), write8sm_delegate(*this, FUNC(isa8_cga_device::io_write))); - m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, &m_vram[0]); if(m_vram_size == 0x4000) - m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xbc000, 0xbffff, &m_vram[0]); /* Initialise the cga palette */ int i; @@ -1341,7 +1341,7 @@ void isa8_cga_pc1512_device::device_start() isa8_cga_device::device_start(); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_cga_pc1512_device::io_read)), write8sm_delegate(*this, FUNC(isa8_cga_pc1512_device::io_write))); - m_isa->install_bank(0xb8000, 0xbbfff, "bank1", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xbbfff, &m_vram[0]); address_space &space = m_isa->memspace(); @@ -1480,8 +1480,8 @@ void isa8_wyse700_device::device_start() isa8_cga_device::device_start(); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_wyse700_device::io_read)), write8sm_delegate(*this, FUNC(isa8_wyse700_device::io_write))); - m_isa->install_bank(0xa0000, 0xaffff, "bank_wy1", &m_vram[0x00000]); - m_isa->install_bank(0xb0000, 0xbffff, "bank_cga", &m_vram[0x10000]); + m_isa->install_bank(0xa0000, 0xaffff, &m_vram[0x00000]); + m_isa->install_bank(0xb0000, 0xbffff, &m_vram[0x10000]); } void isa8_wyse700_device::device_reset() @@ -1588,9 +1588,9 @@ void isa8_ec1841_0002_device::io_write(offs_t offset, uint8_t data) read8sm_delegate( *this, FUNC(isa8_ec1841_0002_device::char_ram_read)), write8sm_delegate(*this, FUNC(isa8_ec1841_0002_device::char_ram_write))); } else { - m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + (std::min<size_t>)(0x8000, m_vram_size) - 1, &m_vram[0]); if(m_vram_size == 0x4000) - m_isa->install_bank(0xbc000, 0xbffff, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xbc000, 0xbffff, &m_vram[0]); } break; default: @@ -1985,6 +1985,6 @@ void isa8_cga_cportiii_device::port_23c6_w(uint8_t data) if(BIT(data, 3)) m_isa->install_memory(0xb8000, 0xb9fff, read8sm_delegate(*this, FUNC(isa8_cga_cportiii_device::char_ram_read)), write8sm_delegate(*this, FUNC(isa8_cga_cportiii_device::char_ram_write))); else - m_isa->install_bank(0xb8000, 0xb8000 + 0x8000 - 1, "bank_cga", &m_vram[0]); + m_isa->install_bank(0xb8000, 0xb8000 + 0x8000 - 1, &m_vram[0]); } diff --git a/src/devices/bus/isa/chessmsr.cpp b/src/devices/bus/isa/chessmsr.cpp index 7b2dab6e286..f466f392227 100644 --- a/src/devices/bus/isa/chessmsr.cpp +++ b/src/devices/bus/isa/chessmsr.cpp @@ -32,8 +32,7 @@ isa8_chessmsr_device::isa8_chessmsr_device(const machine_config &mconfig, const device_isa8_card_interface(mconfig, *this), m_maincpu(*this, "maincpu"), m_mainlatch(*this, "mainlatch"), - m_sublatch(*this, "sublatch"), - m_ram(*this, "ram") + m_sublatch(*this, "sublatch") { } @@ -50,6 +49,11 @@ void isa8_chessmsr_device::device_start() save_item(NAME(m_installed)); save_item(NAME(m_suspended)); save_item(NAME(m_ram_offset)); + + // allocate maximum RAM beforehand + const u32 maxram = 1 << 21; + m_ram = std::make_unique<u32[]>(maxram / 4); + save_pointer(NAME(m_ram), maxram / 4); } @@ -70,8 +74,7 @@ void isa8_chessmsr_device::device_reset() // install RAM u32 ramsize = 1 << ioport("RAM")->read(); - m_ram.allocate(ramsize / 4); - m_maincpu->space(AS_PROGRAM).install_ram(0, ramsize - 1, m_ram); + m_maincpu->space(AS_PROGRAM).install_ram(0, ramsize - 1, m_ram.get()); m_installed = true; } diff --git a/src/devices/bus/isa/chessmsr.h b/src/devices/bus/isa/chessmsr.h index 9144db455dd..6d4becc4b64 100644 --- a/src/devices/bus/isa/chessmsr.h +++ b/src/devices/bus/isa/chessmsr.h @@ -37,7 +37,7 @@ private: required_device<arm_cpu_device> m_maincpu; required_device<generic_latch_8_device> m_mainlatch; required_device<generic_latch_8_device> m_sublatch; - optional_shared_ptr<u32> m_ram; + std::unique_ptr<u32[]> m_ram; u8 m_ram_offset; bool m_suspended; diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp index 45d169f3dff..71665cd62dd 100644 --- a/src/devices/bus/isa/ega.cpp +++ b/src/devices/bus/isa/ega.cpp @@ -636,7 +636,7 @@ void isa8_ega_device::device_start() m_plane[2] = m_videoram + 0x20000; m_plane[3] = m_videoram + 0x30000; - m_isa->install_rom(this, 0xc0000, 0xc3fff, "ega", "user2"); + m_isa->install_rom(this, 0xc0000, 0xc3fff, "user2"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_w))); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_w))); diff --git a/src/devices/bus/isa/eis_hgb107x.cpp b/src/devices/bus/isa/eis_hgb107x.cpp index 25b16a38fe3..ed3100c3e97 100644 --- a/src/devices/bus/isa/eis_hgb107x.cpp +++ b/src/devices/bus/isa/eis_hgb107x.cpp @@ -243,13 +243,13 @@ void isa8_epc_mda_device::device_reset() if (m_installed == false) { m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_write))); - m_isa->install_bank(0xb0000, 0xb7fff, "bank_epc", &m_videoram[0]); // Monochrome emulation mode VRAM address + m_isa->install_bank(0xb0000, 0xb7fff, &m_videoram[0]); // Monochrome emulation mode VRAM address // This check allows a color monitor adapter to be installed at this address range if color emulation is disabled if (m_color_mode & 1) { m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_epc_mda_device::io_write))); - m_isa->install_bank(0xb8000, 0xbffff, "bank_epc", &m_videoram[0]); // Color emulation mode VRAM address, but same 32KB areas as there are only this amount on the board + m_isa->install_bank(0xb8000, 0xbffff, &m_videoram[0]); // Color emulation mode VRAM address, but same 32KB areas as there are only this amount on the board } m_installed = true; } diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index 237211047a2..6f839321e0c 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -502,6 +502,7 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) m_dma_irq_handler(0); return ret; } + break; case 0x45: // Timer control if(offset == 1) return m_timer_ctrl & 0x0c; @@ -509,15 +510,18 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x49: // Sampling control if(offset == 1) return m_sampling_ctrl & 0xe7; + break; case 0x4c: // Reset if(offset == 1) return m_reset; + break; case 0x80: // Voice control /* bit 0 - 1 if voice is stopped * bit 6 - 1 if addresses are decreasing, can change when looping is enabled * bit 7 - 1 if Wavetable IRQ is pending */ if(offset == 1) return m_voice[m_current_voice].voice_ctrl & 0xff; + break; case 0x81: // Frequency Control ret = m_voice[m_current_voice].freq_ctrl; if(offset == 0) @@ -551,12 +555,15 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x86: // Volume Ramp rate if(offset == 1) return m_voice[m_current_voice].vol_ramp_rate; + break; case 0x87: // Volume Ramp start (high 4 bits = exponent, low 4 bits = mantissa) if(offset == 1) return m_voice[m_current_voice].vol_ramp_start; + break; case 0x88: // Volume Ramp end (high 4 bits = exponent, low 4 bits = mantissa) if(offset == 1) return m_voice[m_current_voice].vol_ramp_end; + break; case 0x89: // Current Volume (high 4 bits = exponent, middle 8 bits = mantissa, low 4 bits = 0 [reserved]) ret = m_voice[m_current_voice].current_vol; if(offset == 0) @@ -578,15 +585,18 @@ uint8_t gf1_device::global_reg_data_r(offs_t offset) case 0x8c: // Pan position (4 bits, 0=full left, 15=full right) if(offset == 1) return m_voice[m_current_voice].pan_position; + break; case 0x8d: // Volume Ramp control /* bit 0 - Ramp has stopped * bit 6 - Ramp direction * bit 7 - Ramp IRQ pending */ if(offset == 1) return m_voice[m_current_voice].vol_ramp_ctrl; + break; case 0x8e: // Active voices (6 bits, high 2 bits are always 1) if(offset == 1) return (m_active_voices - 1) | 0xc0; + break; case 0x8f: // IRQ source register if(offset == 1) { diff --git a/src/devices/bus/isa/hdc.cpp b/src/devices/bus/isa/hdc.cpp index 06d18b3c600..3a890ebd93c 100644 --- a/src/devices/bus/isa/hdc.cpp +++ b/src/devices/bus/isa/hdc.cpp @@ -1000,7 +1000,7 @@ void isa8_hdc_device::device_reset() dip = ioport("HDD")->read(); if (ioport("ROM")->read() == 1 && m_hdc->install_rom()) - m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc", "hdc"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc"); } /************************************************************************* diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp index bc653258375..8a25218d2bd 100644 --- a/src/devices/bus/isa/isa.cpp +++ b/src/devices/bus/isa/isa.cpp @@ -356,10 +356,9 @@ template void isa8_device::install_space<read8smo_delegate, write8sm_delegate >( template void isa8_device::install_space<read8smo_delegate, write8mo_delegate >(int spacenum, offs_t start, offs_t end, read8smo_delegate rhandler, write8mo_delegate whandler); template void isa8_device::install_space<read8smo_delegate, write8smo_delegate>(int spacenum, offs_t start, offs_t end, read8smo_delegate rhandler, write8smo_delegate whandler); -void isa8_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void isa8_device::install_bank(offs_t start, offs_t end, uint8_t *data) { - m_memspace->install_readwrite_bank(start, end, 0, tag ); - machine().root_device().membank(m_memspace->device().siblingtag(tag).c_str())->set_base(data); + m_memspace->install_ram(start, end, data); } void isa8_device::unmap_bank(offs_t start, offs_t end) @@ -367,16 +366,15 @@ void isa8_device::unmap_bank(offs_t start, offs_t end) m_memspace->unmap_readwrite(start, end); } -void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region) +void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, const char *region) { if (machine().root_device().memregion("isa")) { uint8_t *src = dev->memregion(region)->base(); uint8_t *dest = machine().root_device().memregion("isa")->base() + start - 0xc0000; memcpy(dest,src, end - start + 1); } else { - m_memspace->install_read_bank(start, end, 0, tag); + m_memspace->install_rom(start, end, machine().root_device().memregion(dev->subtag(region).c_str())->base()); m_memspace->unmap_write(start, end); - machine().root_device().membank(m_memspace->device().siblingtag(tag).c_str())->set_base(machine().root_device().memregion(dev->subtag(region).c_str())->base()); } } diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h index 696d825a55e..1e9fdaeddfe 100644 --- a/src/devices/bus/isa/isa.h +++ b/src/devices/bus/isa/isa.h @@ -151,8 +151,8 @@ public: { m_iospace->install_device(addrstart, addrend, device, map, unitmask); } - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); - void install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region); + void install_bank(offs_t start, offs_t end, uint8_t *data); + void install_rom(device_t *dev, offs_t start, offs_t end, const char *region); template<typename R, typename W> void install_memory(offs_t start, offs_t end, R rhandler, W whandler) { install_space(AS_ISA_MEM, start, end, rhandler, whandler); diff --git a/src/devices/bus/isa/isa_cards.cpp b/src/devices/bus/isa/isa_cards.cpp index 8f1232dcd13..ce23388ea1d 100644 --- a/src/devices/bus/isa/isa_cards.cpp +++ b/src/devices/bus/isa/isa_cards.cpp @@ -72,6 +72,7 @@ #include "eis_sad8852.h" #include "eis_twib.h" #include "np600.h" +#include "3xtwin.h" // communication ports #include "lpt.h" @@ -138,6 +139,7 @@ void pc_isa8_cards(device_slot_interface &device) device.option_add("epc_twib", ISA8_EIS_TWIB); device.option_add("babyblue2", ISA8_BABYBLUE2); device.option_add("acb2072", ACB2072); + device.option_add("3xtwin", ISA8_3XTWIN); } void pc_isa16_cards(device_slot_interface &device) @@ -183,6 +185,7 @@ void pc_isa16_cards(device_slot_interface &device) device.option_add("epc_twib", ISA8_EIS_TWIB); device.option_add("babyblue2", ISA8_BABYBLUE2); device.option_add("acb2072", ACB2072); + device.option_add("3xtwin", ISA8_3XTWIN); // 16-bit device.option_add("ide", ISA16_IDE); device.option_add("ne2000", NE2000); diff --git a/src/devices/bus/isa/lbaenhancer.cpp b/src/devices/bus/isa/lbaenhancer.cpp index f8ebedb130c..242f1f47afe 100644 --- a/src/devices/bus/isa/lbaenhancer.cpp +++ b/src/devices/bus/isa/lbaenhancer.cpp @@ -133,7 +133,7 @@ void lba_enhancer_device::device_reset() m_current_rom_start = 0xc8000 + (ioport("ROM_ADDRESS")->read()* 0x4000); uint32_t current_rom_end = m_current_rom_start + 0x04000 - 1; - m_isa->install_rom(this, m_current_rom_start, current_rom_end, "lbabios", "lbabios"); + m_isa->install_rom(this, m_current_rom_start, current_rom_end, "lbabios"); logerror("LBA enhancer (for 28 bit LBA) located at BIOS address %x - %x\n", m_current_rom_start, current_rom_end); } diff --git a/src/devices/bus/isa/mc1502_rom.cpp b/src/devices/bus/isa/mc1502_rom.cpp index 7e612c10832..f3a78cb93a6 100644 --- a/src/devices/bus/isa/mc1502_rom.cpp +++ b/src/devices/bus/isa/mc1502_rom.cpp @@ -59,7 +59,7 @@ mc1502_rom_device::mc1502_rom_device(const machine_config &mconfig, const char * void mc1502_rom_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe8000, 0xeffff, "XXX", "mc1502_rom"); + m_isa->install_rom(this, 0xe8000, 0xeffff, "mc1502_rom"); } diff --git a/src/devices/bus/isa/mcd.cpp b/src/devices/bus/isa/mcd.cpp index 0e184f56da4..a06e269302c 100644 --- a/src/devices/bus/isa/mcd.cpp +++ b/src/devices/bus/isa/mcd.cpp @@ -224,6 +224,7 @@ void mcd_isa_device::cmd_w(uint8_t data) { case 5: m_readmsf = 0; + [[fallthrough]]; case 4: case 3: m_readmsf |= bcd_2_dec(data) << ((m_cmdrd_count - 3) * 8); diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index ae61e78e116..e3ff8e90f99 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -183,14 +183,14 @@ void isa8_mda_device::device_start() set_isa_device(); m_videoram.resize(0x1000); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_mda_device::io_read)), write8sm_delegate(*this, FUNC(isa8_mda_device::io_write))); - m_isa->install_bank(0xb0000, 0xb0fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb1000, 0xb1fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb2000, 0xb2fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb3000, 0xb3fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb4000, 0xb4fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb5000, 0xb5fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb6000, 0xb6fff, "bank_mda", &m_videoram[0]); - m_isa->install_bank(0xb7000, 0xb7fff, "bank_mda", &m_videoram[0]); + m_isa->install_bank(0xb0000, 0xb0fff, &m_videoram[0]); + m_isa->install_bank(0xb1000, 0xb1fff, &m_videoram[0]); + m_isa->install_bank(0xb2000, 0xb2fff, &m_videoram[0]); + m_isa->install_bank(0xb3000, 0xb3fff, &m_videoram[0]); + m_isa->install_bank(0xb4000, 0xb4fff, &m_videoram[0]); + m_isa->install_bank(0xb5000, 0xb5fff, &m_videoram[0]); + m_isa->install_bank(0xb6000, 0xb6fff, &m_videoram[0]); + m_isa->install_bank(0xb7000, 0xb7fff, &m_videoram[0]); /* Initialise the mda palette */ for (int i = 0; i < 4; i++) @@ -601,7 +601,7 @@ void isa8_hercules_device::device_start() m_videoram.resize(0x10000); set_isa_device(); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_hercules_device::io_read)), write8sm_delegate(*this, FUNC(isa8_hercules_device::io_write))); - m_isa->install_bank(0xb0000, 0xbffff, "bank_hercules", &m_videoram[0]); + m_isa->install_bank(0xb0000, 0xbffff, &m_videoram[0]); /* Initialise the mda palette */ for(int i = 0; i < (sizeof(mda_palette) / 3); i++) @@ -797,8 +797,8 @@ void isa8_ec1840_0002_device::device_start() isa8_mda_device::device_start(); m_soft_chr_gen = std::make_unique<uint8_t[]>(0x2000); - m_isa->install_bank(0xdc000, 0xddfff, "bank_chargen", m_soft_chr_gen.get()); - m_isa->install_bank(0xde000, 0xdffff, "bank_chargen", m_soft_chr_gen.get()); + m_isa->install_bank(0xdc000, 0xddfff, m_soft_chr_gen.get()); + m_isa->install_bank(0xde000, 0xdffff, m_soft_chr_gen.get()); } void isa8_ec1840_0002_device::device_reset() diff --git a/src/devices/bus/isa/mufdc.cpp b/src/devices/bus/isa/mufdc.cpp index 58408d191e7..652090d7c1d 100644 --- a/src/devices/bus/isa/mufdc.cpp +++ b/src/devices/bus/isa/mufdc.cpp @@ -160,7 +160,7 @@ void mufdc_device::device_start() void mufdc_device::device_reset() { - m_isa->install_rom(this, 0xc8000, 0xc9fff, shortname(), "option"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "option"); m_isa->install_device(0x3f0, 0x3f7, *m_fdc, &mcs3201_device::map); m_isa->set_dma_channel(2, this, true); } diff --git a/src/devices/bus/isa/myb3k_fdc.cpp b/src/devices/bus/isa/myb3k_fdc.cpp index dcef550db51..6aab8787c6b 100644 --- a/src/devices/bus/isa/myb3k_fdc.cpp +++ b/src/devices/bus/isa/myb3k_fdc.cpp @@ -194,8 +194,10 @@ WRITE_LINE_MEMBER( isa8_myb3k_fdc471x_device_base::drq_w ) { case 1: m_isa->drq1_w(state); + [[fallthrough]]; // FIXME: really? case 2: m_isa->drq2_w(state); + [[fallthrough]]; // FIXME: really? default: break; } diff --git a/src/devices/bus/isa/p1_fdc.cpp b/src/devices/bus/isa/p1_fdc.cpp index c1671279b08..92915dc3d9b 100644 --- a/src/devices/bus/isa/p1_fdc.cpp +++ b/src/devices/bus/isa/p1_fdc.cpp @@ -172,7 +172,7 @@ p1_fdc_device::p1_fdc_device(const machine_config &mconfig, const char *tag, dev void p1_fdc_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe0000, 0xe07ff, "XXX", "p1_fdc"); + m_isa->install_rom(this, 0xe0000, 0xe07ff, "p1_fdc"); m_isa->install_device(0x00c0, 0x00c3, read8sm_delegate(*m_fdc, FUNC(fd1793_device::read)), write8sm_delegate(*m_fdc, FUNC(fd1793_device::write))); m_isa->install_device(0x00c4, 0x00c7, read8sm_delegate(*this, FUNC(p1_fdc_device::p1_fdc_r)), write8sm_delegate(*this, FUNC(p1_fdc_device::p1_fdc_w))); } diff --git a/src/devices/bus/isa/p1_hdc.cpp b/src/devices/bus/isa/p1_hdc.cpp index b9b3aad2981..9ee84ece875 100644 --- a/src/devices/bus/isa/p1_hdc.cpp +++ b/src/devices/bus/isa/p1_hdc.cpp @@ -126,7 +126,7 @@ p1_hdc_device::p1_hdc_device(const machine_config &mconfig, const char *tag, dev void p1_hdc_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xe2000, 0xe27ff, "XXX", "p1_hdc"); + m_isa->install_rom(this, 0xe2000, 0xe27ff, "p1_hdc"); m_isa->install_memory(0xd0000, 0xd0fff, read8sm_delegate(*this, FUNC(p1_hdc_device::p1_HDC_r)), write8sm_delegate(*this, FUNC(p1_hdc_device::p1_HDC_w))); } diff --git a/src/devices/bus/isa/p1_rom.cpp b/src/devices/bus/isa/p1_rom.cpp index 22faf40df01..76013aca719 100644 --- a/src/devices/bus/isa/p1_rom.cpp +++ b/src/devices/bus/isa/p1_rom.cpp @@ -64,7 +64,7 @@ p1_rom_device::p1_rom_device(const machine_config &mconfig, const char *tag, dev void p1_rom_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc1fff, "XXX", "p1_rom"); + m_isa->install_rom(this, 0xc0000, 0xc1fff, "p1_rom"); } diff --git a/src/devices/bus/isa/pc1640_iga.cpp b/src/devices/bus/isa/pc1640_iga.cpp index 4c9b2719b7c..96ae2da109b 100644 --- a/src/devices/bus/isa/pc1640_iga.cpp +++ b/src/devices/bus/isa/pc1640_iga.cpp @@ -101,7 +101,7 @@ void isa8_pc1640_iga_device::device_start() m_plane[2] = m_videoram + 0x20000; m_plane[3] = m_videoram + 0x30000; - m_isa->install_rom(this, 0xc0000, 0xc7fff, "ega", "iga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "iga"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3c0_w))); m_isa->install_device(0x3d0, 0x3df, read8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_r)), write8sm_delegate(*this, FUNC(isa8_ega_device::pc_ega8_3d0_w))); diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index f204333f9f2..4b51ebcd0de 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -71,8 +71,6 @@ ROM_START( pgc ) ROMX_LOAD("pgc_u44.bin", 0x00000, 0x8000, CRC(71280241) SHA1(7042ccd4ebd03f576a256a433b8aa38d1b4fefa8), ROM_BIOS(1)) ROMX_LOAD("pgc_u43.bin", 0x08000, 0x8000, CRC(923f5ea3) SHA1(2b2a55d64b20d3a613b00c51443105aa03eca5d6), ROM_BIOS(1)) - ROM_REGION(0x800, "commarea", ROMREGION_ERASE00) - ROM_REGION(0x1000, "chargen", 0) ROM_LOAD("pgc_u27.bin", 0x0000, 0x1000, CRC(6be256cc) SHA1(deb1195886268dcddce10459911e020f7a9f74f7)) ROM_END @@ -113,7 +111,7 @@ void isa8_pgc_device::pgc_map(address_map &map) map(0x08000, 0x0ffff).rom().region("maincpu", 0x8000); map(0x10000, 0x1001f).rw(FUNC(isa8_pgc_device::stateparam_r), FUNC(isa8_pgc_device::stateparam_w)); // map(0x18000, 0x18fff).ram(); // ?? - map(0x28000, 0x287ff).ram().region("commarea", 0).mirror(0x800); + map(0x28000, 0x287ff).ram().share("commarea").mirror(0x800); map(0x32001, 0x32001).nopw(); map(0x32020, 0x3203f).w(FUNC(isa8_pgc_device::accel_w)); map(0x3c000, 0x3c001).r(FUNC(isa8_pgc_device::init_r)); @@ -210,7 +208,8 @@ isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, device_type type m_cpu(*this, "maincpu"), m_screen(*this, PGC_SCREEN_NAME), m_palette(*this, "palette"), - m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr) + m_commarea(*this, "commarea"), + m_vram(nullptr), m_eram(nullptr) { } @@ -246,11 +245,10 @@ void isa8_pgc_device::device_reset() memset(m_lut, 0, sizeof(m_lut)); m_accel = 0; - m_commarea = memregion("commarea")->base(); if (BIT(ioport("DSW")->read(), 1)) - m_isa->install_bank(0xc6400, 0xc67ff, "commarea", m_commarea); + m_isa->install_bank(0xc6400, 0xc67ff, m_commarea); else - m_isa->install_bank(0xc6000, 0xc63ff, "commarea", m_commarea); + m_isa->install_bank(0xc6000, 0xc63ff, m_commarea); } // @@ -389,8 +387,7 @@ uint8_t isa8_pgc_device::init_r() space.unmap_read(0xf8000, 0xfffff); LOG("INIT: mapping emulator RAM\n"); - space.install_readwrite_bank(0xf8000, 0xfffff, "eram"); - membank("eram")->set_base(m_eram.get()); + space.install_ram(0xf8000, 0xfffff, m_eram.get()); LOG("INIT: mapping LUT\n"); space.install_write_handler(0xf8400, 0xf85ff, write8sm_delegate(*this, FUNC(isa8_pgc_device::lut_w))); diff --git a/src/devices/bus/isa/pgc.h b/src/devices/bus/isa/pgc.h index b14ea6e5797..d560dbdda09 100644 --- a/src/devices/bus/isa/pgc.h +++ b/src/devices/bus/isa/pgc.h @@ -60,8 +60,8 @@ private: required_device<i8088_cpu_device> m_cpu; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_shared_ptr<uint8_t> m_commarea; - uint8_t *m_commarea; std::unique_ptr<uint8_t[]> m_vram; std::unique_ptr<uint8_t[]> m_eram; uint8_t m_stateparam[16]; diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp index 554eabf6763..af7bb302511 100644 --- a/src/devices/bus/isa/sblaster.cpp +++ b/src/devices/bus/isa/sblaster.cpp @@ -344,6 +344,7 @@ void sb_device::process_fifo(uint8_t cmd) case 0x17: // 2-bit ADPCM w/new reference m_dsp.adpcm_new_ref = true; m_dsp.adpcm_step = 0; + [[fallthrough]]; case 0x16: // 2-bit ADPCM m_dsp.adpcm_count = 0; m_dsp.dma_length = (m_dsp.fifo[1] + (m_dsp.fifo[2]<<8)) + 1; @@ -406,6 +407,7 @@ void sb_device::process_fifo(uint8_t cmd) case 0x75: // 4-bit ADPCM w/new reference m_dsp.adpcm_new_ref = true; m_dsp.adpcm_step = 0; + [[fallthrough]]; case 0x74: // 4-bit ADPCM m_dsp.adpcm_count = 0; m_dsp.dma_length = (m_dsp.fifo[1] + (m_dsp.fifo[2]<<8)) + 1; @@ -420,6 +422,7 @@ void sb_device::process_fifo(uint8_t cmd) case 0x77: // 2.6-bit ADPCM w/new reference m_dsp.adpcm_new_ref = true; m_dsp.adpcm_step = 0; + [[fallthrough]]; case 0x76: // 2.6-bit ADPCM m_dsp.adpcm_count = 0; m_dsp.dma_length = (m_dsp.fifo[1] + (m_dsp.fifo[2]<<8)) + 1; @@ -553,6 +556,7 @@ void sb_device::process_fifo(uint8_t cmd) { case 0x0f: // read asp reg queue_r(0); + [[fallthrough]]; case 0x0e: // write asp reg case 0x02: // get asp version case 0x04: // set asp mode register diff --git a/src/devices/bus/isa/side116.cpp b/src/devices/bus/isa/side116.cpp index e45d66b26bd..bad6645bf5a 100644 --- a/src/devices/bus/isa/side116.cpp +++ b/src/devices/bus/isa/side116.cpp @@ -112,10 +112,10 @@ void side116_device::device_reset() { switch ((m_config->read() >> 1) & 0x03) { - case 0: m_isa->install_rom(this, 0xc8000, 0xc9fff, "side116", "option"); break; - case 1: m_isa->install_rom(this, 0xd8000, 0xd9fff, "side116", "option"); break; - case 2: m_isa->install_rom(this, 0xcc000, 0xcdfff, "side116", "option"); break; - case 3: m_isa->install_rom(this, 0xdc000, 0xddfff, "side116", "option"); break; + case 0: m_isa->install_rom(this, 0xc8000, 0xc9fff, "option"); break; + case 1: m_isa->install_rom(this, 0xd8000, 0xd9fff, "option"); break; + case 2: m_isa->install_rom(this, 0xcc000, 0xcdfff, "option"); break; + case 3: m_isa->install_rom(this, 0xdc000, 0xddfff, "option"); break; } } diff --git a/src/devices/bus/isa/svga_cirrus.cpp b/src/devices/bus/isa/svga_cirrus.cpp index e1cebaf9a32..943606e9be4 100644 --- a/src/devices/bus/isa/svga_cirrus.cpp +++ b/src/devices/bus/isa/svga_cirrus.cpp @@ -72,7 +72,7 @@ void isa16_svga_cirrus_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "dm_clgd5430"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "dm_clgd5430"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5430_device::port_03c0_w))); @@ -150,7 +150,7 @@ void isa16_svga_cirrus_gd542x_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "clgd542x"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "clgd542x"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(cirrus_gd5428_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_s3.cpp b/src/devices/bus/isa/svga_s3.cpp index a50c3a8d0fb..b4334f269ef 100644 --- a/src/devices/bus/isa/svga_s3.cpp +++ b/src/devices/bus/isa/svga_s3.cpp @@ -82,7 +82,7 @@ void isa16_svga_s3_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3_764"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3_764"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3_vga_device::port_03c0_w))); @@ -196,7 +196,7 @@ void isa16_s3virge_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3virge"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3virge"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); @@ -302,7 +302,7 @@ void isa16_s3virgedx_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "s3virgedx"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "s3virgedx"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); @@ -400,7 +400,7 @@ void isa16_stealth3d2kpro_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "svga", "stealth3d"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "stealth3d"); m_isa->install_device(0x03b0, 0x03bf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03b0_w))); m_isa->install_device(0x03c0, 0x03cf, read8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(s3virge_vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_trident.cpp b/src/devices/bus/isa/svga_trident.cpp index 5c934e99bf0..7eda60d2446 100644 --- a/src/devices/bus/isa/svga_trident.cpp +++ b/src/devices/bus/isa/svga_trident.cpp @@ -72,7 +72,7 @@ void isa16_svga_tgui9680_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "tgui9680", "tgui9680"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "tgui9680"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(trident_vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/svga_tseng.cpp b/src/devices/bus/isa/svga_tseng.cpp index 48ee7324b2e..ab5bbb755f0 100644 --- a/src/devices/bus/isa/svga_tseng.cpp +++ b/src/devices/bus/isa/svga_tseng.cpp @@ -114,5 +114,5 @@ void isa8_svga_et4k_device::map_ram() void isa8_svga_et4k_device::map_rom() { - m_isa->install_rom(this, 0xc0000, 0xc7fff, "et4000", "et4000"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "et4000"); } diff --git a/src/devices/bus/isa/vga.cpp b/src/devices/bus/isa/vga.cpp index 9772690c46e..11d94d7fbdd 100644 --- a/src/devices/bus/isa/vga.cpp +++ b/src/devices/bus/isa/vga.cpp @@ -69,7 +69,7 @@ void isa8_vga_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "ibm_vga", "ibm_vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "ibm_vga"); m_isa->install_device(0x3b0, 0x3bf, read8sm_delegate(*m_vga, FUNC(vga_device::port_03b0_r)), write8sm_delegate(*m_vga, FUNC(vga_device::port_03b0_w))); m_isa->install_device(0x3c0, 0x3cf, read8sm_delegate(*m_vga, FUNC(vga_device::port_03c0_r)), write8sm_delegate(*m_vga, FUNC(vga_device::port_03c0_w))); diff --git a/src/devices/bus/isa/vga_ati.cpp b/src/devices/bus/isa/vga_ati.cpp index 177e30f14c7..d6ce586a9fd 100644 --- a/src/devices/bus/isa/vga_ati.cpp +++ b/src/devices/bus/isa/vga_ati.cpp @@ -163,7 +163,7 @@ void isa16_vga_gfxultra_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultra"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "gfxultra"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(ati_vga_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(ati_vga_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_8514, FUNC(mach8_device::ibm8514_status_r)), write8sm_delegate(*m_8514, FUNC(mach8_device::ibm8514_htotal_w))); @@ -224,7 +224,7 @@ void isa16_vga_gfxultrapro_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "gfxultrapro"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "gfxultrapro"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(mach32_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(mach32_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_vga, FUNC(mach32_device::mach32_status_r)), write8sm_delegate(*m_vga, FUNC(mach32_device::ibm8514_htotal_w))); @@ -293,7 +293,7 @@ void isa16_vga_mach64_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc0000, 0xc7fff, "vga", "mach64"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, "mach64"); m_isa->install_device(0x1ce, 0x1cf, read8sm_delegate(*m_vga, FUNC(mach64_device::ati_port_ext_r)), write8sm_delegate(*m_vga, FUNC(mach64_device::ati_port_ext_w))); m_isa->install_device(0x2e8, 0x2ef, read8sm_delegate(*m_vga, FUNC(mach64_device::mach32_status_r)), write8sm_delegate(*m_vga, FUNC(mach64_device::ibm8514_htotal_w))); diff --git a/src/devices/bus/isa/wdxt_gen.cpp b/src/devices/bus/isa/wdxt_gen.cpp index b86188d3249..fb2a8fd1965 100644 --- a/src/devices/bus/isa/wdxt_gen.cpp +++ b/src/devices/bus/isa/wdxt_gen.cpp @@ -199,7 +199,7 @@ wdxt_gen_device::wdxt_gen_device(const machine_config &mconfig, const char *tag, void wdxt_gen_device::device_start() { set_isa_device(); - m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc", "hdc"); + m_isa->install_rom(this, 0xc8000, 0xc9fff, "hdc"); m_isa->install_device(0x0320, 0x0323, read8sm_delegate(*m_host, FUNC(wd11c00_17_device::io_r)), write8sm_delegate(*m_host, FUNC(wd11c00_17_device::io_w))); m_isa->set_dma_channel(3, this, false); } diff --git a/src/devices/bus/isbx/isbc_218a.cpp b/src/devices/bus/isbx/isbc_218a.cpp index 0a1cff5f235..8e57a13877b 100644 --- a/src/devices/bus/isbx/isbc_218a.cpp +++ b/src/devices/bus/isbx/isbc_218a.cpp @@ -47,6 +47,7 @@ static void isbc_218a_floppies(device_slot_interface &device) { device.option_add("8dd", FLOPPY_8_DSDD); device.option_add("525dd", FLOPPY_525_DD); + device.option_add("525qd", FLOPPY_525_QD); } diff --git a/src/devices/bus/jakks_gamekey/slot.cpp b/src/devices/bus/jakks_gamekey/slot.cpp index 2072b8cc3f3..e66e1fed6cd 100644 --- a/src/devices/bus/jakks_gamekey/slot.cpp +++ b/src/devices/bus/jakks_gamekey/slot.cpp @@ -102,7 +102,7 @@ static int jakks_gamekey_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/lpci/northbridge.cpp b/src/devices/bus/lpci/northbridge.cpp index 57c802a9e20..0384a9637e4 100644 --- a/src/devices/bus/lpci/northbridge.cpp +++ b/src/devices/bus/lpci/northbridge.cpp @@ -33,9 +33,7 @@ void northbridge_device::device_start() if (m_ram->size() > 0x100000) { offs_t ram_limit = 0x100000 + m_ram->size() - 0x100000; - space.install_read_bank (0x100000, ram_limit - 1, "bank1"); - space.install_write_bank(0x100000, ram_limit - 1, "bank1"); - machine().root_device().membank("bank1")->set_base(m_ram->pointer() + 0x100000); + space.install_ram(0x100000, ram_limit - 1, m_ram->pointer() + 0x100000); } } diff --git a/src/devices/bus/lpci/southbridge.cpp b/src/devices/bus/lpci/southbridge.cpp index 247bc9a48db..2f9faa4aab0 100644 --- a/src/devices/bus/lpci/southbridge.cpp +++ b/src/devices/bus/lpci/southbridge.cpp @@ -524,13 +524,12 @@ void southbridge_extended_device::device_add_mconfig(machine_config &config) keybc.hot_res().set_inputline(":maincpu", INPUT_LINE_RESET); keybc.gate_a20().set_inputline(":maincpu", INPUT_LINE_A20); keybc.kbd_irq().set("pic8259_master", FUNC(pic8259_device::ir1_w)); - keybc.kbd_clk().set("pc_kbdc", FUNC(pc_kbdc_device::clock_write_from_mb)); - keybc.kbd_data().set("pc_kbdc", FUNC(pc_kbdc_device::data_write_from_mb)); + keybc.kbd_clk().set(m_pc_kbdc, FUNC(pc_kbdc_device::clock_write_from_mb)); + keybc.kbd_data().set(m_pc_kbdc, FUNC(pc_kbdc_device::data_write_from_mb)); - PC_KBDC(config, m_pc_kbdc, 0); + PC_KBDC(config, m_pc_kbdc, pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL); m_pc_kbdc->out_clock_cb().set(m_keybc, FUNC(at_keyboard_controller_device::kbd_clk_w)); m_pc_kbdc->out_data_cb().set(m_keybc, FUNC(at_keyboard_controller_device::kbd_data_w)); - PC_KBDC_SLOT(config, "kbd", pc_at_keyboards, STR_KBD_MICROSOFT_NATURAL).set_pc_kbdc_slot(m_pc_kbdc); ds12885_device &rtc(DS12885(config, "rtc")); rtc.irq().set("pic8259_slave", FUNC(pic8259_device::ir0_w)); @@ -546,7 +545,7 @@ southbridge_extended_device::southbridge_extended_device(const machine_config &m : southbridge_device(mconfig, type, tag, owner, clock), m_keybc(*this, "keybc"), m_ds12885(*this, "rtc"), - m_pc_kbdc(*this, "pc_kbdc") + m_pc_kbdc(*this, "kbd") { } diff --git a/src/devices/bus/m5/slot.cpp b/src/devices/bus/m5/slot.cpp index 6d7a2e15c77..b134679e6bb 100644 --- a/src/devices/bus/m5/slot.cpp +++ b/src/devices/bus/m5/slot.cpp @@ -7,7 +7,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "slot.h" @@ -123,7 +122,7 @@ static int m5_get_pcb_id(const char *slot) { for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) { - if (!core_stricmp(slot_list[i].slot_option, slot)) + if (!strcmp(slot_list[i].slot_option, slot)) return slot_list[i].pcb_id; } diff --git a/src/devices/bus/macpds/macpds.cpp b/src/devices/bus/macpds/macpds.cpp index 3a7a87f85d2..9f17df8cb6d 100644 --- a/src/devices/bus/macpds/macpds.cpp +++ b/src/devices/bus/macpds/macpds.cpp @@ -111,13 +111,12 @@ template void macpds_device::install_device<read16s_delegate, write16s_delegat template void macpds_device::install_device<read16sm_delegate, write16sm_delegate >(offs_t start, offs_t end, read16sm_delegate rhandler, write16sm_delegate whandler, uint32_t mask); template void macpds_device::install_device<read16smo_delegate, write16smo_delegate>(offs_t start, offs_t end, read16smo_delegate rhandler, write16smo_delegate whandler, uint32_t mask); -void macpds_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void macpds_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); m_maincpu = machine().device<cpu_device>(m_cputag); address_space &space = m_maincpu->space(AS_PROGRAM); - space.install_readwrite_bank(start, end, 0, tag ); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + space.install_ram(start, end, data); } void macpds_device::set_irq_line(int line, int state) @@ -160,22 +159,15 @@ void device_macpds_card_interface::set_macpds_device() m_macpds->add_macpds_card(this); } -void device_macpds_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_macpds_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - snprintf(bank, sizeof(bank), "%s_%s", tag, m_macpds_slottag); - - m_macpds->install_bank(start, end, bank, data); + m_macpds->install_bank(start, end, data); } void device_macpds_card_interface::install_rom(device_t *dev, const char *romregion, uint32_t addr) { uint8_t *rom = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->base(); uint32_t romlen = device().machine().root_device().memregion(dev->subtag(romregion).c_str())->bytes(); - char bankname[128]; - sprintf(bankname, "rom_%x", addr); - m_macpds->install_bank(addr, addr+romlen-1, bankname, rom); + m_macpds->install_bank(addr, addr+romlen-1, rom); } diff --git a/src/devices/bus/macpds/macpds.h b/src/devices/bus/macpds/macpds.h index 1977447a87b..cd3f84659d0 100644 --- a/src/devices/bus/macpds/macpds.h +++ b/src/devices/bus/macpds/macpds.h @@ -74,7 +74,7 @@ public: void add_macpds_card(device_macpds_card_interface *card); template<typename R, typename W> void install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask=0xffffffff); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void set_irq_line(int line, int state); protected: @@ -111,7 +111,7 @@ public: void set_macpds_device(); // helper functions for card devices - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void install_rom(device_t *dev, const char *romregion, uint32_t addr); // inline configuration diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index 6d9dd93b4ed..2b0ca60c281 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -109,8 +109,7 @@ void macpds_sedisplay_device::device_start() m_vram = std::make_unique<uint8_t[]>(VRAM_SIZE); - static const char bankname[] = { "radpds_ram" }; - m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, bankname, m_vram.get()); + m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, m_vram.get()); m_macpds->install_device(0x770000, 0x77000f, read16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_r)), write16s_delegate(*this, FUNC(macpds_sedisplay_device::ramdac_w))); m_macpds->install_device(0xc10000, 0xc2ffff, read16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_r)), write16sm_delegate(*this, FUNC(macpds_sedisplay_device::sedisplay_w))); diff --git a/src/devices/bus/megadrive/jcart.cpp b/src/devices/bus/megadrive/jcart.cpp index 26c99b2ef5f..4bda9522e9d 100644 --- a/src/devices/bus/megadrive/jcart.cpp +++ b/src/devices/bus/megadrive/jcart.cpp @@ -165,14 +165,14 @@ uint16_t md_jcart_device::read(offs_t offset) if (m_jcart_io_data[0] & 0x40) { - joy[0] = m_jcart3.read_safe(0); - joy[1] = m_jcart4.read_safe(0); + joy[0] = m_jcart3->read(); + joy[1] = m_jcart4->read(); return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); } else { - joy[0] = ((m_jcart3.read_safe(0) & 0xc0) >> 2) | (m_jcart3.read_safe(0) & 0x03); - joy[1] = ((m_jcart4.read_safe(0) & 0xc0) >> 2) | (m_jcart4.read_safe(0) & 0x03); + joy[0] = ((m_jcart3->read() & 0xc0) >> 2) | (m_jcart3->read() & 0x03); + joy[1] = ((m_jcart4->read() & 0xc0) >> 2) | (m_jcart4->read() & 0x03); return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); } } @@ -208,14 +208,14 @@ uint16_t md_seprom_codemast_device::read(offs_t offset) if (m_jcart_io_data[0] & 0x40) { - joy[0] = m_jcart3.read_safe(0); - joy[1] = m_jcart4.read_safe(0); + joy[0] = m_jcart3->read(); + joy[1] = m_jcart4->read(); return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); } else { - joy[0] = ((m_jcart3.read_safe(0) & 0xc0) >> 2) | (m_jcart3.read_safe(0) & 0x03); - joy[1] = ((m_jcart4.read_safe(0) & 0xc0) >> 2) | (m_jcart4.read_safe(0) & 0x03); + joy[0] = ((m_jcart3->read() & 0xc0) >> 2) | (m_jcart3->read() & 0x03); + joy[1] = ((m_jcart4->read() & 0xc0) >> 2) | (m_jcart4->read() & 0x03); return (m_jcart_io_data[0] & 0x40) | joy[0] | (joy[1] << 8); } } diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 5a793f7495a..d36ea109bf6 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -43,7 +43,6 @@ ***********************************************************************************************************/ - #include "emu.h" #include "md_slot.h" @@ -282,7 +281,7 @@ static int md_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/msx_cart/yamaha.cpp b/src/devices/bus/msx_cart/yamaha.cpp index 34c87e88a9e..c03d44837ce 100644 --- a/src/devices/bus/msx_cart/yamaha.cpp +++ b/src/devices/bus/msx_cart/yamaha.cpp @@ -81,7 +81,7 @@ void msx_cart_sfg05_device::device_add_mconfig(machine_config &config) ROM_START( msx_sfg01 ) ROM_REGION(0x4000, "sfg", 0) - ROM_LOAD("sfg01.rom", 0x0, 0x4000, CRC(0995fb36) SHA1(434651305f92aa770a89e40b81125fb22d91603d)) + ROM_LOAD("sfg01.rom", 0x0, 0x4000, CRC(0995fb36) SHA1(434651305f92aa770a89e40b81125fb22d91603d)) // correct label is almost certainly "yamaha__ym2211-22702__48_18_89_b.ic104" though the datecode portion may vary between late 1983 and mid 1984 ROM_END @@ -94,9 +94,9 @@ const tiny_rom_entry *msx_cart_sfg01_device::device_rom_region() const ROM_START( msx_sfg05 ) ROM_REGION(0x8000, "sfg", 0) ROM_SYSTEM_BIOS( 0, "sfg05", "SFG05 (original)" ) - ROMX_LOAD( "sfg05.rom", 0x0, 0x8000, CRC(2425c279) SHA1(d956167e234f60ad916120437120f86fc8c3c321), ROM_BIOS(0) ) + ROMX_LOAD( "sfg05.rom", 0x0, 0x8000, CRC(2425c279) SHA1(d956167e234f60ad916120437120f86fc8c3c321), ROM_BIOS(0) ) // correct label MIGHT be "yamaha__ym2301-23959.ic104" but this needs redump/verification ROM_SYSTEM_BIOS( 1, "sfg05a", "SFG05 (SFG01 upgrade)" ) // SFG01 PCB, Yamaha official upgrade, has YM2151 instead of YM2164 - ROMX_LOAD( "sfg05a.rom", 0x0, 0x8000, CRC(5bc237f8) SHA1(930338f45c08228108c0831cc4a26014c2674718), ROM_BIOS(1) ) + ROMX_LOAD( "sfg05a.rom", 0x0, 0x8000, CRC(5bc237f8) SHA1(930338f45c08228108c0831cc4a26014c2674718), ROM_BIOS(1) ) // this came on a single eprom on a daughterboard on an SFG01 board which had been factory upgraded to SFG05 ROM_END diff --git a/src/devices/bus/msx_slot/bunsetsu.cpp b/src/devices/bus/msx_slot/bunsetsu.cpp index 79a07b2e53a..9c73a37dbd8 100644 --- a/src/devices/bus/msx_slot/bunsetsu.cpp +++ b/src/devices/bus/msx_slot/bunsetsu.cpp @@ -13,7 +13,7 @@ DEFINE_DEVICE_TYPE(MSX_SLOT_BUNSETSU, msx_slot_bunsetsu_device, "msx_slot_bunset msx_slot_bunsetsu_device::msx_slot_bunsetsu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : msx_slot_rom_device(mconfig, MSX_SLOT_BUNSETSU, tag, owner, clock) - , m_bunsetsu_region(*this, finder_base::DUMMY_TAG, 0x20000) + , m_bunsetsu_region(*this, finder_base::DUMMY_TAG) , m_bunsetsu_address(0) { } diff --git a/src/devices/bus/mtx/sdx.cpp b/src/devices/bus/mtx/sdx.cpp index 09e7199ac53..150ff7b6d1a 100644 --- a/src/devices/bus/mtx/sdx.cpp +++ b/src/devices/bus/mtx/sdx.cpp @@ -281,7 +281,7 @@ uint8_t mtx_sdx_device::sdx_status_r() uint8_t data = 0x00; - data |= m_dsw[BIT(m_control, 0)].read_safe(0x0f) & 0x0f; + data |= m_dsw[BIT(m_control, 0)]->read() & 0x0f; data |= (m_floppy0->get_device() && m_floppy1->get_device()) ? 0x10 : 0x00; diff --git a/src/devices/bus/neogeo/prot_sma.cpp b/src/devices/bus/neogeo/prot_sma.cpp index 3f771781fa8..ccb569fec6e 100644 --- a/src/devices/bus/neogeo/prot_sma.cpp +++ b/src/devices/bus/neogeo/prot_sma.cpp @@ -50,13 +50,7 @@ void sma_prot_device::kof99_bankswitch_w(uint16_t data) }; // unscramble bank number - data = - (BIT(data, 14) << 0)+ - (BIT(data, 6) << 1)+ - (BIT(data, 8) << 2)+ - (BIT(data, 10) << 3)+ - (BIT(data, 12) << 4)+ - (BIT(data, 5) << 5); + data = bitswap<6>(data, 5, 12, 10, 8, 6, 14); bankaddress = 0x100000 + bankoffset[data]; m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress); @@ -85,13 +79,7 @@ void sma_prot_device::garou_bankswitch_w(uint16_t data) }; // unscramble bank number - data = - (BIT(data, 5) << 0)+ - (BIT(data, 9) << 1)+ - (BIT(data, 7) << 2)+ - (BIT(data, 6) << 3)+ - (BIT(data, 14) << 4)+ - (BIT(data, 12) << 5); + data = bitswap<6>(data, 12, 14, 6, 7, 9, 5); bankaddress = 0x100000 + bankoffset[data]; m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress); @@ -122,13 +110,7 @@ void sma_prot_device::garouh_bankswitch_w(uint16_t data) }; // unscramble bank number - data = - (BIT(data, 4) << 0)+ - (BIT(data, 8) << 1)+ - (BIT(data, 14) << 2)+ - (BIT(data, 2) << 3)+ - (BIT(data, 11) << 4)+ - (BIT(data, 13) << 5); + data = bitswap<6>(data, 13, 11, 2, 14, 8, 4); bankaddress = 0x100000 + bankoffset[data]; m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress); @@ -156,13 +138,7 @@ void sma_prot_device::mslug3_bankswitch_w(uint16_t data) }; // unscramble bank number - data = - (BIT(data, 14) << 0)+ - (BIT(data, 12) << 1)+ - (BIT(data, 15) << 2)+ - (BIT(data, 6) << 3)+ - (BIT(data, 3) << 4)+ - (BIT(data, 9) << 5); + data = bitswap<6>(data, 9, 3, 6, 15, 12, 14); bankaddress = 0x100000 + bankoffset[data]; m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress); @@ -186,13 +162,7 @@ void sma_prot_device::kof2000_bankswitch_w(uint16_t data) }; // unscramble bank number - data = - (BIT(data, 15) << 0)+ - (BIT(data, 14) << 1)+ - (BIT(data, 7) << 2)+ - (BIT(data, 3) << 3)+ - (BIT(data, 10) << 4)+ - (BIT(data, 5) << 5); + data = bitswap<6>(data, 5, 10, 3, 7, 14, 15); bankaddress = 0x100000 + bankoffset[data]; m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress); @@ -215,13 +185,7 @@ uint32_t sma_prot_device::kof99_bank_base(uint16_t sel) }; /* unscramble bank number */ - int data = - (BIT(sel, 14) << 0)+ - (BIT(sel, 6) << 1)+ - (BIT(sel, 8) << 2)+ - (BIT(sel, 10) << 3)+ - (BIT(sel, 12) << 4)+ - (BIT(sel, 5) << 5); + int data = bitswap<6>(sel, 5, 12, 10, 8, 6, 14); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -248,13 +212,7 @@ uint32_t sma_prot_device::garou_bank_base(uint16_t sel) }; // unscramble bank number - int data = - (BIT(sel, 5) << 0)+ - (BIT(sel, 9) << 1)+ - (BIT(sel, 7) << 2)+ - (BIT(sel, 6) << 3)+ - (BIT(sel, 14) << 4)+ - (BIT(sel, 12) << 5); + int data = bitswap<6>(sel, 12, 14, 6, 7, 9, 5); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -283,13 +241,7 @@ uint32_t sma_prot_device::garouh_bank_base(uint16_t sel) }; // unscramble bank number - int data = - (BIT(sel, 4) << 0)+ - (BIT(sel, 8) << 1)+ - (BIT(sel, 14) << 2)+ - (BIT(sel, 2) << 3)+ - (BIT(sel, 11) << 4)+ - (BIT(sel, 13) << 5); + int data = bitswap<6>(sel, 13, 11, 2, 14, 8, 4); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -315,13 +267,7 @@ uint32_t sma_prot_device::mslug3_bank_base(uint16_t sel) }; // unscramble bank number - int data = - (BIT(sel, 14) << 0)+ - (BIT(sel, 12) << 1)+ - (BIT(sel, 15) << 2)+ - (BIT(sel, 6) << 3)+ - (BIT(sel, 3) << 4)+ - (BIT(sel, 9) << 5); + int data = bitswap<6>(sel, 9, 3, 6, 15, 12, 14); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -347,13 +293,7 @@ uint32_t sma_prot_device::mslug3a_bank_base(uint16_t sel) }; // unscramble bank number - int data = - (BIT(sel, 15) << 0)+ - (BIT(sel, 3) << 1)+ - (BIT(sel, 1) << 2)+ - (BIT(sel, 6) << 3)+ - (BIT(sel, 12) << 4)+ - (BIT(sel, 11) << 5); + int data = bitswap<6>(sel, 11, 12, 6, 1, 3, 15); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -375,13 +315,7 @@ uint32_t sma_prot_device::kof2000_bank_base(uint16_t sel) }; // unscramble bank number - int data = - (BIT(sel, 15) << 0)+ - (BIT(sel, 14) << 1)+ - (BIT(sel, 7) << 2)+ - (BIT(sel, 3) << 3)+ - (BIT(sel, 10) << 4)+ - (BIT(sel, 5) << 5); + int data = bitswap<6>(sel, 5, 10, 3, 7, 14, 15); int bankaddress = 0x100000 + bankoffset[data]; return bankaddress; @@ -431,13 +365,13 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base) uint16_t buffer[0x800/2]; memcpy(buffer, &rom[i], 0x800); for (int j = 0; j < 0x800/2; j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)]; + rom[i+j] = buffer[bitswap<10>(j,6,2,4,9,8,3,1,7,0,5)]; } // swap address lines & relocate fixed part rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x700000/2 + bitswap<24>(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)]; + rom[i] = rom[0x700000/2 + bitswap<19>(i,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)]; } @@ -452,7 +386,7 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base) // swap address lines & relocate fixed part rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x710000/2 + bitswap<24>(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)]; + rom[i] = rom[0x710000/2 + bitswap<19>(i,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)]; // swap address lines for the banked part rom = (uint16_t *)(base + 0x100000); @@ -461,7 +395,7 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base) uint16_t buffer[0x8000/2]; memcpy(buffer, &rom[i], 0x8000); for (int j = 0; j < 0x8000/2; j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)]; + rom[i+j] = buffer[bitswap<14>(j,9,4,8,3,13,6,2,7,0,12,1,11,10,5)]; } } @@ -477,7 +411,7 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base) // swap address lines & relocate fixed part rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x7f8000/2 + bitswap<24>(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)]; + rom[i] = rom[0x7f8000/2 + bitswap<19>(i,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)]; // swap address lines for the banked part rom = (uint16_t *)(base + 0x100000); @@ -486,7 +420,7 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base) uint16_t buffer[0x8000/2]; memcpy(buffer, &rom[i], 0x8000); for (int j = 0; j < 0x8000/2; j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)]; + rom[i+j] = buffer[bitswap<14>(j,12,8,1,7,11,3,13,10,6,9,5,4,0,2)]; } } @@ -502,7 +436,7 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base) // swap address lines & relocate fixed part rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x5d0000/2 + bitswap<24>(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)]; + rom[i] = rom[0x5d0000/2 + bitswap<19>(i,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)]; // swap address lines for the banked part rom = (uint16_t *)(base + 0x100000); @@ -511,7 +445,7 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base) uint16_t buffer[0x10000/2]; memcpy(buffer, &rom[i], 0x10000); for (int j = 0; j < 0x10000/2; j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)]; + rom[i+j] = buffer[bitswap<15>(j,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)]; } } @@ -526,7 +460,7 @@ void sma_prot_device::mslug3a_decrypt_68k(uint8_t* base) /* swap address lines & relocate fixed part */ rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x5d0000/2 + bitswap<24>(i,23,22,21,20,19,18,1,16,14,7,17,5,8,4,15,6,3,2,0,13,10,12,9,11)]; + rom[i] = rom[0x5d0000/2 + bitswap<19>(i,18,1,16,14,7,17,5,8,4,15,6,3,2,0,13,10,12,9,11)]; rom = (uint16_t *)(base + 0x100000); /* swap address lines for the banked part */ @@ -535,7 +469,7 @@ void sma_prot_device::mslug3a_decrypt_68k(uint8_t* base) uint16_t buffer[0x10000/2]; memcpy(buffer,&rom[i],0x10000); for (int j = 0;j < 0x10000/2;j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,12,0,11,3,4,13,6,8,14,7,5,2,10,9,1)]; + rom[i+j] = buffer[bitswap<15>(j,12,0,11,3,4,13,6,8,14,7,5,2,10,9,1)]; } } @@ -554,11 +488,11 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base) uint16_t buffer[0x800/2]; memcpy(buffer, &rom[i], 0x800); for (int j = 0; j < 0x800/2; j++) - rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)]; + rom[i+j] = buffer[bitswap<10>(j,4,1,3,8,6,2,7,0,9,5)]; } // swap address lines & relocate fixed part rom = (uint16_t *)base; for (int i = 0; i < 0x0c0000/2; i++) - rom[i] = rom[0x73a000/2 + bitswap<24>(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)]; + rom[i] = rom[0x73a000/2 + bitswap<19>(i,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)]; } diff --git a/src/devices/bus/neogeo/slot.cpp b/src/devices/bus/neogeo/slot.cpp index 8f0b3e0e268..6800664d39e 100644 --- a/src/devices/bus/neogeo/slot.cpp +++ b/src/devices/bus/neogeo/slot.cpp @@ -207,7 +207,7 @@ static int neogeo_get_pcb_id(const char *slot) { for (auto & elem : slot_list) { - if (!core_stricmp(elem.slot_option, slot)) + if (!strcmp(elem.slot_option, slot)) return elem.pcb_id; } diff --git a/src/devices/bus/nes/cony.cpp b/src/devices/bus/nes/cony.cpp index e42ae833f82..922942ffa56 100644 --- a/src/devices/bus/nes/cony.cpp +++ b/src/devices/bus/nes/cony.cpp @@ -237,6 +237,7 @@ void nes_cony_device::write_h(offs_t offset, uint8_t data) { case 0x0000: m_latch1 = 1; + [[fallthrough]]; case 0x3000: case 0x30ff: case 0x31ff: @@ -283,6 +284,7 @@ void nes_cony_device::write_h(offs_t offset, uint8_t data) case 0x0314: case 0x0315: m_latch2 = 1; + [[fallthrough]]; case 0x0310: case 0x0311: case 0x0316: diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp index 9be591c7d9f..4db056dc6f4 100644 --- a/src/devices/bus/nes/mmc3_clones.cpp +++ b/src/devices/bus/nes/mmc3_clones.cpp @@ -775,6 +775,7 @@ void nes_pikay2k_device::write_h(offs_t offset, uint8_t data) case 0x2000: m_reg[0] = 0; + [[fallthrough]]; default: txrom_write(offset, data); break; @@ -2488,6 +2489,7 @@ void nes_pjoy84_device::write_m(offs_t offset, uint8_t data) case 0x03: if (m_reg[3] & 0x80) return; // else we act as if offset & 3 = 1,2 + [[fallthrough]]; case 0x01: case 0x02: m_reg[offset & 0x03] = data; diff --git a/src/devices/bus/nes/multigame.cpp b/src/devices/bus/nes/multigame.cpp index c117520afe5..3a78dee027a 100644 --- a/src/devices/bus/nes/multigame.cpp +++ b/src/devices/bus/nes/multigame.cpp @@ -1770,6 +1770,7 @@ void nes_bmc_ball11_device::write_h(offs_t offset, uint8_t data) { case 0x4000: // here we also update reg[0] upper bit m_reg[0] = (m_reg[0] & 0x01) | ((data >> 3) & 0x02); + [[fallthrough]]; case 0x0000: case 0x2000: case 0x6000: diff --git a/src/devices/bus/nes/namcot.cpp b/src/devices/bus/nes/namcot.cpp index 4e0951bf92a..21f49636727 100644 --- a/src/devices/bus/nes/namcot.cpp +++ b/src/devices/bus/nes/namcot.cpp @@ -454,10 +454,12 @@ uint8_t nes_namcot340_device::n340_loread(offs_t offset) { case 0x1000: return m_irq_count & 0xff; - set_irq_line(CLEAR_LINE); + set_irq_line(CLEAR_LINE); // FIXME: unreachable + [[fallthrough]]; case 0x1800: return (m_irq_count >> 8) & 0xff; - set_irq_line(CLEAR_LINE); + set_irq_line(CLEAR_LINE); // FIXME: unreachable + [[fallthrough]]; default: return 0x00; } diff --git a/src/devices/bus/nes/nes_ines.hxx b/src/devices/bus/nes/nes_ines.hxx index 6887256fc59..7cbf7cf27dc 100644 --- a/src/devices/bus/nes/nes_ines.hxx +++ b/src/devices/bus/nes/nes_ines.hxx @@ -372,6 +372,7 @@ void nes_cart_slot_device::call_load_ines() case 0x8: // it's iNES 2.0 format ines20 = true; + [[fallthrough]]; case 0x0: default: mapper |= header[7] & 0xf0; @@ -840,6 +841,7 @@ const char * nes_cart_slot_device::get_default_card_ines(get_default_card_softwa case 0x8: // it's iNES 2.0 format ines20 = true; + [[fallthrough]]; case 0x0: default: mapper |= ROM[7] & 0xf0; diff --git a/src/devices/bus/nes/nes_pcb.hxx b/src/devices/bus/nes/nes_pcb.hxx index e26bd71dfd2..b70340e6479 100644 --- a/src/devices/bus/nes/nes_pcb.hxx +++ b/src/devices/bus/nes/nes_pcb.hxx @@ -337,7 +337,7 @@ static const nes_pcb *nes_pcb_lookup( const char *slot ) { for (auto & elem : pcb_list) { - if (!core_stricmp(elem.slot_opt, slot)) + if (!strcmp(elem.slot_opt, slot)) return &elem; } return nullptr; diff --git a/src/devices/bus/nes/nes_unif.hxx b/src/devices/bus/nes/nes_unif.hxx index 51843f60c2e..af4839f4ebf 100644 --- a/src/devices/bus/nes/nes_unif.hxx +++ b/src/devices/bus/nes/nes_unif.hxx @@ -11,6 +11,7 @@ ****************************************************************************************/ +#include "corestr.h" /* Set to generate prg & chr files when the cart is loaded */ #define SPLIT_PRG 0 diff --git a/src/devices/bus/nes/pirate.cpp b/src/devices/bus/nes/pirate.cpp index acda901ecca..13a5d61c0be 100644 --- a/src/devices/bus/nes/pirate.cpp +++ b/src/devices/bus/nes/pirate.cpp @@ -1204,7 +1204,7 @@ void nes_cityfight_device::write_h(offs_t offset, uint8_t data) case 0x4008: case 0x400c: m_prg_mode = data & 1; - + [[fallthrough]]; case 0x7000: m_irq_count = (m_irq_count & 0x1e0) | ((data & 0x0f) << 1); break; diff --git a/src/devices/bus/nes/waixing.cpp b/src/devices/bus/nes/waixing.cpp index 3706d64b26e..2aba7b3f412 100644 --- a/src/devices/bus/nes/waixing.cpp +++ b/src/devices/bus/nes/waixing.cpp @@ -746,6 +746,7 @@ void nes_waixing_h_device::write_h(offs_t offset, uint8_t data) m_prg_base = (data << 5) & 0x40; m_prg_mask = 0x3f; set_prg(m_prg_base, m_prg_mask); + [[fallthrough]]; case 1: case 2: case 3: case 4: case 5: m_mmc_vrom_bank[cmd] = data; @@ -787,6 +788,7 @@ void nes_waixing_h1_device::write_h(offs_t offset, uint8_t data) m_prg_base = (data << 5) & 0x40; m_prg_mask = 0x3f; set_prg(m_prg_base, m_prg_mask); + [[fallthrough]]; case 1: case 2: case 3: case 4: case 5: m_mmc_vrom_bank[cmd] = data; diff --git a/src/devices/bus/nscsi/applecd.cpp b/src/devices/bus/nscsi/applecd.cpp new file mode 100644 index 00000000000..4f526de85fa --- /dev/null +++ b/src/devices/bus/nscsi/applecd.cpp @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/******************************************************************************* + + Skeleton device for Apple external CD-ROM drives. + + PCB: 1-631-957-15 + + Microcontrollers: + - Intel S80C31-1 + - Mitsubishi M37450M8-452FP © SONY '91 + + Memories: + - National NMC27C256Q (or BQ) 32,768x8 EEPROM (for 80C31) + - Sony CXK5864BM-12L 8,192x8 Static RAM (x2) + (one near EEPROM, one between LC8951 and M37450M8) + - Fujitsu MB81464-12 65,536x4 Dynamic RAM (x2: for CXD1184) + - Fujitsu MB81C79A-45 8,192x9 Static RAM (for LC8951) + - Sony CXK5816MS-12L 2,048x8 Static RAM (near CXD1135) + + Other major digital ICs: + - Sony CXD1180AQ SCSI Controller + - Sony CXD1184Q + - Sanyo LC8951 CD-ROM Error Correction & Host Interface Processor + - Sony CXD1135Q + + Linear ICs: + - Toshiba TC9154AP Dual Volume Control + - Burr-Brown PCM67U Dual Audio DAC + - Sony CXA1182Q-Z CD Servo Signal Processor + - Sony CXA1081M + - Toshiba TA8406P Dual Power Operational Amplifier (x3) + + XTALs: 12A KSS2A (80C31?), 20A KSS2A (CXD1184), D167 (LC8951?) + +*******************************************************************************/ + +#include "emu.h" +#include "applecd.h" + +#include "cpu/mcs51/mcs51.h" +#include "cpu/m6502/m3745x.h" +#include "machine/ncr5380n.h" + +DEFINE_DEVICE_TYPE(APPLECD150, applecd150_device, "aplcd150", "AppleCD 150") + +applecd150_device::applecd150_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, APPLECD150, tag, owner, clock) + , nscsi_slot_card_interface(mconfig, *this, "scsic") +{ +} + +void applecd150_device::device_start() +{ +} + +void applecd150_device::prog_map(address_map &map) +{ + map(0x0000, 0x7fff).rom().region("eeprom", 0); +} + +void applecd150_device::ext_map(address_map &map) +{ + map(0xc020, 0xc027).m("scsic", FUNC(cxd1180_device::map)); +} + +void applecd150_device::device_add_mconfig(machine_config &config) +{ + i80c31_device &mcu1(I80C31(config, "mcu1", 12_MHz_XTAL)); + mcu1.set_addrmap(AS_PROGRAM, &applecd150_device::prog_map); + mcu1.set_addrmap(AS_IO, &applecd150_device::ext_map); + + M37450(config, "mcu2", 16.9344_MHz_XTAL / 2).set_disable(); + + CXD1180(config, "scsic").irq_handler().set_inputline("mcu1", MCS51_INT1_LINE); + + //LC8951(config, "cdintf", 16.9344_MHz_XTAL); +} + +ROM_START(aplcd150) + ROM_REGION(0x8000, "eeprom", 0) + ROM_LOAD("apl_1.8g_1289.ic303", 0x0000, 0x8000, CRC(54ebf81f) SHA1(e4cd656e2a433229543e874a29f1567758170fc6)) + + ROM_REGION(0x4000, "mcu2", 0) + ROM_LOAD("m37450m8-452fp.ic201", 0x0000, 0x4000, NO_DUMP) +ROM_END + +const tiny_rom_entry *applecd150_device::device_rom_region() const +{ + return ROM_NAME(aplcd150); +} + diff --git a/src/devices/bus/nscsi/applecd.h b/src/devices/bus/nscsi/applecd.h new file mode 100644 index 00000000000..577dfcf5b01 --- /dev/null +++ b/src/devices/bus/nscsi/applecd.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#ifndef MAME_BUS_NSCSI_APPLECD_H +#define MAME_BUS_NSCSI_APPLECD_H + +#pragma once + +#include "machine/nscsi_bus.h" + +class applecd150_device : public device_t, public nscsi_slot_card_interface +{ +public: + applecd150_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + static constexpr feature_type unemulated_features() { return feature::DISK; } + +protected: + virtual void device_start() override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + void prog_map(address_map &map); + void ext_map(address_map &map); +}; + +DECLARE_DEVICE_TYPE(APPLECD150, applecd150_device) + +#endif // MAME_BUS_NSCSI_APPLECD_H diff --git a/src/devices/bus/nscsi/cd.cpp b/src/devices/bus/nscsi/cd.cpp index 4d81d3dc9a2..0271efbf082 100644 --- a/src/devices/bus/nscsi/cd.cpp +++ b/src/devices/bus/nscsi/cd.cpp @@ -460,7 +460,7 @@ void nscsi_cdrom_device::scsi_command() "Session info", "Full TOC", "PMA", - "ATIP" + "ATIP", "Reserved 5", "Reserved 6", "Reserved 7", diff --git a/src/devices/bus/nscsi/devices.cpp b/src/devices/bus/nscsi/devices.cpp index b4ed8530db4..cc44339902a 100644 --- a/src/devices/bus/nscsi/devices.cpp +++ b/src/devices/bus/nscsi/devices.cpp @@ -3,6 +3,7 @@ #include "emu.h" +#include "bus/nscsi/applecd.h" #include "bus/nscsi/cd.h" #include "bus/nscsi/cdd2000.h" #include "bus/nscsi/cdrn820s.h" @@ -21,4 +22,5 @@ void default_scsi_devices(device_slot_interface &device) device.option_add("cdrn820s", CDRN820S); device.option_add("cdd2000", CDD2000); device.option_add("smoc501", SMOC501); + device.option_add("aplcd150", APPLECD150); }; diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp index 7e802b58988..bd9647c9e72 100644 --- a/src/devices/bus/nubus/laserview.cpp +++ b/src/devices/bus/nubus/laserview.cpp @@ -88,8 +88,8 @@ void nubus_laserview_device::device_start() // printf("[laserview %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_laserview", &m_vram[0]); - install_bank(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, "bank_laserview2", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); + install_bank(slotspace+0x900000, slotspace+0x900000+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0xB0000, slotspace+0xBFFFF, read32s_delegate(*this, FUNC(nubus_laserview_device::regs_r)), write32s_delegate(*this, FUNC(nubus_laserview_device::regs_w))); } diff --git a/src/devices/bus/nubus/nubus.cpp b/src/devices/bus/nubus/nubus.cpp index 64c48a9bb1d..31c169017f3 100644 --- a/src/devices/bus/nubus/nubus.cpp +++ b/src/devices/bus/nubus/nubus.cpp @@ -185,11 +185,10 @@ void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_de } } -void nubus_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void nubus_device::install_bank(offs_t start, offs_t end, uint8_t *data) { // printf("install_bank: %s @ %x->%x\n", tag, start, end); - m_space->install_readwrite_bank(start, end, 0, tag); - machine().root_device().membank(siblingtag(tag).c_str())->set_base(data); + m_space->install_ram(start, end, data); } void nubus_device::set_irq_line(int slot, int state) @@ -278,14 +277,9 @@ void device_nubus_card_interface::interface_pre_start() } } -void device_nubus_card_interface::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data) +void device_nubus_card_interface::install_bank(offs_t start, offs_t end, uint8_t *data) { - char bank[256]; - - // append an underscore and the slot name to the bank so it's guaranteed unique - snprintf(bank, sizeof(bank), "%s_%s", tag, m_nubus_slottag); - - nubus().install_bank(start, end, bank, data); + nubus().install_bank(start, end, data); } void device_nubus_card_interface::install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb, bool reverse_rom) @@ -424,20 +418,18 @@ void device_nubus_card_interface::install_declaration_rom(device_t *dev, const c // now install the ROM uint32_t addr = get_slotspace() + 0x01000000; - char bankname[128]; - snprintf(bankname, sizeof(bankname), "rom_%s", m_nubus_slottag); addr -= romlen; // printf("Installing ROM at %x, length %x\n", addr, romlen); if (mirror_all_mb) // mirror the declaration ROM across all 16 megs of the slot space { uint32_t off = 0; while(off < 0x1000000) { - nubus().install_bank(addr + off, addr+off+romlen-1, bankname, &m_declaration_rom[0]); + nubus().install_bank(addr + off, addr+off+romlen-1, &m_declaration_rom[0]); off += romlen; } } else { - nubus().install_bank(addr, addr+romlen-1, bankname, &m_declaration_rom[0]); + nubus().install_bank(addr, addr+romlen-1, &m_declaration_rom[0]); } } diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h index 2fc5f048e67..0b07b04b381 100644 --- a/src/devices/bus/nubus/nubus.h +++ b/src/devices/bus/nubus/nubus.h @@ -37,7 +37,7 @@ public: // helper functions for card devices void install_declaration_rom(device_t *dev, const char *romregion, bool mirror_all_mb = false, bool reverse_rom = false); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); uint32_t get_slotspace() { return 0xf0000000 | (m_slot<<24); } uint32_t get_super_slotspace() { return m_slot<<28; } @@ -125,7 +125,7 @@ public: template<typename R, typename W> void install_device(offs_t start, offs_t end, R rhandler, W whandler, uint32_t mask=0xffffffff); void install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask=0xffffffff); void install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask=0xffffffff); - void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); + void install_bank(offs_t start, offs_t end, uint8_t *data); void set_irq_line(int slot, int state); DECLARE_WRITE_LINE_MEMBER( irq9_w ); diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index b9b831c6de2..58875e591b6 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -110,7 +110,7 @@ void jmfb_device::device_start() // printf("[JMFB %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_48gc", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0x200000, slotspace+0x2003ff, read32s_delegate(*this, FUNC(jmfb_device::mac_48gc_r)), write32s_delegate(*this, FUNC(jmfb_device::mac_48gc_w))); diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index db1fd821a11..b3af9d82fba 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -96,7 +96,7 @@ void nubus_cb264_device::device_start() // printf("[cb264 %p] slotspace = %x\n", this, slotspace); m_vram.resize(VRAM_SIZE); - install_bank(slotspace, slotspace+VRAM_SIZE-1, "bank_cb264", &m_vram[0]); + install_bank(slotspace, slotspace+VRAM_SIZE-1, &m_vram[0]); nubus().install_device(slotspace+0xff6000, slotspace+0xff60ff, read32s_delegate(*this, FUNC(nubus_cb264_device::cb264_r)), write32s_delegate(*this, FUNC(nubus_cb264_device::cb264_w))); nubus().install_device(slotspace+0xff7000, slotspace+0xff70ff, read32sm_delegate(*this, FUNC(nubus_cb264_device::cb264_ramdac_r)), write32sm_delegate(*this, FUNC(nubus_cb264_device::cb264_ramdac_w))); diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp index 32b1d33100a..5cdaabeb995 100644 --- a/src/devices/bus/nubus/nubus_image.cpp +++ b/src/devices/bus/nubus/nubus_image.cpp @@ -6,12 +6,26 @@ HFS images, including floppy images (DD and HD) and vMac/Basilisk HDD volumes up to 256 MB in size. + TODO: + * Get get directory and get listing commands have no way to indicate + that the path/name is too long for the buffer. + * The set directory command doesn't work well with host filesystems that + have roots (e.g. Windows drive letters). + * The set directory command assumes '/' is a valid host directory + separator character. + * The get listing commands have no way to indicate whether an entry is + a directory. + ***************************************************************************/ #include "emu.h" #include "nubus_image.h" + #include "osdcore.h" +#include <algorithm> + + #define IMAGE_ROM_REGION "image_rom" #define IMAGE_DISK0_TAG "nb_disk" @@ -89,9 +103,8 @@ image_init_result nubus_image_device::messimg_disk_image_device::call_load() return image_init_result::FAIL; } - m_data = make_unique_clear<uint8_t[]>(m_size); fseek(0, SEEK_SET); - fread(m_data.get(), m_size); + fread(m_data, m_size); m_ejected = false; return image_init_result::PASS; @@ -190,10 +203,9 @@ void nubus_image_device::device_start() m_image = subdevice<messimg_disk_image_device>(IMAGE_DISK0_TAG); - filectx.curdir[0] = '.'; - filectx.curdir[1] = '\0'; - filectx.dirp = nullptr; - filectx.fd = nullptr; + filectx.curdir = "."; + filectx.dirp.reset(); + filectx.fd.reset(); } //------------------------------------------------- @@ -250,54 +262,51 @@ void nubus_image_device::file_cmd_w(uint32_t data) { // data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24); filectx.curcmd = data; - switch(data) { + switch (data) { case kFileCmdGetDir: - strcpy((char*)filectx.filename, (char*)filectx.curdir); + strncpy(filectx.filename, filectx.curdir.c_str(), ARRAY_LENGTH(filectx.filename)); break; case kFileCmdSetDir: if ((filectx.filename[0] == '/') || (filectx.filename[0] == '$')) { - strcpy((char*)filectx.curdir, |