From 036777b70e98d09646cf17d4a2e7ce276ae61e8b Mon Sep 17 00:00:00 2001 From: cam900 Date: Wed, 17 Apr 2024 02:21:49 +0900 Subject: midway/midwayic.cpp: Reduced hardcoded tags and cleaned up code. (#12262) * Suppress side effects for debugger reads. * Use C++ style line comments for single line comments. * Reduced use of literal tags. --- src/mame/midway/atlantis.cpp | 7 +- src/mame/midway/midvunit.cpp | 5 + src/mame/midway/midwayic.cpp | 344 ++++++++++++++++++++++--------------------- src/mame/midway/midwayic.h | 163 ++++++++++---------- src/mame/midway/midzeus.cpp | 14 +- src/mame/midway/seattle.cpp | 135 ++++++++++++----- src/mame/midway/vegas.cpp | 84 +++++++++-- 7 files changed, 442 insertions(+), 310 deletions(-) diff --git a/src/mame/midway/atlantis.cpp b/src/mame/midway/atlantis.cpp index 91b092457e3..49af22b22cc 100644 --- a/src/mame/midway/atlantis.cpp +++ b/src/mame/midway/atlantis.cpp @@ -851,7 +851,12 @@ void atlantis_state::mwskins(machine_config &config) m_dcs->add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_yearoffs(80); m_ioasic->set_upper(342); // 325 m_ioasic->irq_handler().set(FUNC(atlantis_state::ioasic_irq)); diff --git a/src/mame/midway/midvunit.cpp b/src/mame/midway/midvunit.cpp index 68ff90becb2..6113d9b113a 100644 --- a/src/mame/midway/midvunit.cpp +++ b/src/mame/midway/midvunit.cpp @@ -1147,6 +1147,11 @@ void midvunit_state::midvplus(machine_config &config) ATA_INTERFACE(config, m_ata).options(ata_devices, "hdd", nullptr, true); MIDWAY_IOASIC(config, m_midway_ioasic, 0); + m_midway_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_midway_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_midway_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_midway_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_midway_ioasic->set_dcs_tag(m_dcs); m_midway_ioasic->set_shuffle(0); m_midway_ioasic->set_upper(452); /* no alternates */ m_midway_ioasic->set_yearoffs(94); diff --git a/src/mame/midway/midwayic.cpp b/src/mame/midway/midwayic.cpp index 67538fa78a3..5395ba13aaf 100644 --- a/src/mame/midway/midwayic.cpp +++ b/src/mame/midway/midwayic.cpp @@ -35,7 +35,7 @@ * *************************************/ -#define FIFO_SIZE 512 +static constexpr uint32_t FIFO_SIZE = 512; /************************************* * @@ -93,8 +93,8 @@ void midway_serial_pic_device::generate_serial_data(int upper) m_data[12] = machine().rand() & 0xff; m_data[13] = machine().rand() & 0xff; - m_data[14] = 0; /* ??? */ - m_data[15] = 0; /* ??? */ + m_data[14] = 0; // ??? + m_data[15] = 0; // ??? temp = 0x174 * (year - 1980) + 0x1f * (month - 1) + day; m_data[10] = (temp >> 8) & 0xff; @@ -208,13 +208,13 @@ void midway_serial_pic_device::write(u8 data) { LOGPIC("%s:security W = %04X\n", machine().describe_context(), data); - /* status seems to reflect the clock bit */ + // status seems to reflect the clock bit m_status = (data >> 4) & 1; - /* on the falling edge, clock the next data byte through */ + // on the falling edge, clock the next data byte through if (!m_status) { - /* the self-test writes 1F, 0F, and expects to read an F in the low 4 bits */ + // the self-test writes 1F, 0F, and expects to read an F in the low 4 bits if (data & 0x0f) m_buff = data & 0xf; else @@ -247,8 +247,12 @@ DEFINE_DEVICE_TYPE(MIDWAY_SERIAL_PIC_EMU, midway_serial_pic_emu_device, "midway_ //------------------------------------------------- midway_serial_pic_emu_device::midway_serial_pic_emu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, MIDWAY_SERIAL_PIC_EMU, tag, owner, clock) - , m_pic(*this, "pic") + device_t(mconfig, MIDWAY_SERIAL_PIC_EMU, tag, owner, clock), + m_pic(*this, "pic"), + m_command(0), + m_data_out(0), + m_clk(0), + m_status(0) { } @@ -309,7 +313,7 @@ void midway_serial_pic_emu_device::write_c(u8 data) void midway_serial_pic_emu_device::device_add_mconfig(machine_config &config) { - PIC16C57(config, m_pic, 4000000); /* ? Mhz */ + PIC16C57(config, m_pic, 4000000); // ? Mhz m_pic->read_a().set([this]() { return m_command; }); m_pic->write_b().set([this](u8 data) { m_data_out = data; }); m_pic->read_c().set(FUNC(midway_serial_pic_emu_device::read_c)); @@ -357,9 +361,9 @@ midway_serial_pic2_device::midway_serial_pic2_device(const machine_config &mconf m_time_write_timer(nullptr) { memset(m_buffer,0,sizeof(m_buffer)); - memset(m_time_buf,0,sizeof(m_time_buf)); memset(m_nvram,0,sizeof(m_nvram)); memset(m_default_nvram,0,sizeof(m_default_nvram)); + memset(m_time_buf,0,sizeof(m_time_buf)); } @@ -417,7 +421,7 @@ u8 midway_serial_pic2_device::status_r() if (!machine().side_effects_disabled()) { - /* if we're still holding the data ready bit high, do it */ + // if we're still holding the data ready bit high, do it if (m_latch & 0xf00) { if (machine().time() > m_latch_expire_time) @@ -437,15 +441,15 @@ u8 midway_serial_pic2_device::read() { uint8_t result = 0; - /* PIC data register */ + // PIC data register if (!machine().side_effects_disabled()) LOGPIC("%s:PIC data read (index=%d total=%d latch=%03X) =", machine().describe_context(), m_index, m_total, m_latch); - /* return the current result */ + // return the current result if (m_latch & 0xf00) result = m_latch & 0xff; - /* otherwise, return 0xff if we have data ready */ + // otherwise, return 0xff if we have data ready else if (m_index < m_total) result = 0xff; @@ -457,13 +461,13 @@ u8 midway_serial_pic2_device::read() void midway_serial_pic2_device::write(u8 data) { - /* PIC command register */ + // PIC command register if (m_state == 0) LOGPIC("%s:PIC command %02X\n", machine().describe_context(), data); else LOGPIC("%s:PIC data %02X\n", machine().describe_context(), data); - /* store in the latch, along with a bit to indicate we have data */ + // store in the latch, along with a bit to indicate we have data m_latch = (data & 0x00f) | 0x480; m_latch_expire_time = machine().time() + attotime::from_msec(1); if (data & 0x10) @@ -471,15 +475,15 @@ void midway_serial_pic2_device::write(u8 data) int cmd = m_state ? (m_state & 0x0f) : (m_latch & 0x0f); switch (cmd) { - /* written to latch the next byte of data */ + // written to latch the next byte of data case 0: if (m_index < m_total) m_latch = 0x400 | m_buffer[m_index++]; break; - /* fetch the serial number */ + // fetch the serial number case 1: - /* note: Biofreaks assumes that it can latch the next byte this way */ + // note: Biofreaks assumes that it can latch the next byte this way if (m_index < m_total) m_latch = 0x400 | m_buffer[m_index++]; else @@ -491,16 +495,16 @@ void midway_serial_pic2_device::write(u8 data) } break; - /* read the clock */ + // read the clock case 3: { - /* stuff it into the data bytes */ + // stuff it into the data bytes m_index = 0; m_total = 0; - /* if we haven't written a new time recently, use the real live time */ if (!m_time_just_written) { + // if we haven't written a new time recently, use the real live time system_time systime; machine().base_datetime(systime); @@ -512,10 +516,9 @@ void midway_serial_pic2_device::write(u8 data) m_buffer[m_total++] = make_bcd(systime.local_time.month + 1); m_buffer[m_total++] = make_bcd(systime.local_time.year - 1900 - m_yearoffs); } - - /* otherwise, just parrot back what was written to pass self tests */ else { + // otherwise, just parrot back what was written to pass self tests m_buffer[m_total++] = m_time_buf[0]; m_buffer[m_total++] = m_time_buf[1]; m_buffer[m_total++] = m_time_buf[2]; @@ -527,33 +530,32 @@ void midway_serial_pic2_device::write(u8 data) break; } - /* write the clock */ + // write the clock case 4: - /* if coming from state 0, go to state 1 (this is just the command byte) */ if (m_state == 0) { + // if coming from state 0, go to state 1 (this is just the command byte) m_state = 0x14; m_time_index = 0; } - - /* if in states 1-2 put data in the buffer until it's full */ else if (m_state == 0x14) { + // if in states 1-2 put data in the buffer until it's full m_time_buf[m_time_index] = m_latch & 0x0f; m_state = 0x24; } else if (m_state == 0x24) { m_time_buf[m_time_index++] |= m_latch << 4; - - /* if less than 7 bytes accumulated, go back to state 1 */ if (m_time_index < 7) + { + // if less than 7 bytes accumulated, go back to state 1 m_state = 0x14; - - /* otherwise, flag the time as having just been written for 1/2 second */ + } else { + // otherwise, flag the time as having just been written for 1/2 second m_time_write_timer->adjust(attotime::from_msec(500)); m_time_just_written = 1; m_state = 0; @@ -561,60 +563,56 @@ void midway_serial_pic2_device::write(u8 data) } break; - /* write to NVRAM */ + // write to NVRAM case 5: - - /* if coming from state 0, go to state 1 (this is just the command byte) */ if (m_state == 0) + { + // if coming from state 0, go to state 1 (this is just the command byte) m_state = 0x15; - - /* coming from state 1, go to state 2 and latch the low 4 address bits */ + } else if (m_state == 0x15) { + // coming from state 1, go to state 2 and latch the low 4 address bits m_nvram_addr = m_latch & 0x0f; m_state = 0x25; } - - /* coming from state 2, go to state 3 and latch the high 4 address bits */ else if (m_state == 0x25) { + // coming from state 2, go to state 3 and latch the high 4 address bits m_state = 0x35; m_nvram_addr |= m_latch << 4; } - - /* coming from state 3, go to state 4 and write the low 4 bits */ else if (m_state == 0x35) { + // coming from state 3, go to state 4 and write the low 4 bits m_state = 0x45; m_nvram[m_nvram_addr] = m_latch & 0x0f; } - - /* coming from state 4, reset the states and write the upper 4 bits */ else if (m_state == 0x45) { + // coming from state 4, reset the states and write the upper 4 bits m_state = 0; m_nvram[m_nvram_addr] |= m_latch << 4; LOGNVRAM("Write byte %02X = %02X\n", m_nvram_addr, m_nvram[m_nvram_addr]); } break; - /* read from NVRAM */ + // read from NVRAM case 6: - - /* if coming from state 0, go to state 1 (this is just the command byte) */ if (m_state == 0) + { + // if coming from state 0, go to state 1 (this is just the command byte) m_state = 0x16; - - /* coming from state 1, go to state 2 and latch the low 4 address bits */ + } else if (m_state == 0x16) { + // coming from state 1, go to state 2 and latch the low 4 address bits m_nvram_addr = m_latch & 0x0f; m_state = 0x26; } - - /* coming from state 2, reset the states and make the data available */ else if (m_state == 0x26) { + // coming from state 2, reset the states and make the data available m_state = 0; m_nvram_addr |= m_latch << 4; @@ -625,7 +623,7 @@ void midway_serial_pic2_device::write(u8 data) } break; - /* reflect inverted? (Cruisin' Exotica) */ + // reflect inverted? (Cruisin' Exotica) case 8: m_latch = 0x400 | (~cmd & 0xff); break; @@ -661,22 +659,22 @@ bool midway_serial_pic2_device::nvram_write(util::write_stream &file) enum { - IOASIC_PORT0, /* 0: input port 0 */ - IOASIC_PORT1, /* 1: input port 1 */ - IOASIC_PORT2, /* 2: input port 2 */ - IOASIC_PORT3, /* 3: input port 3 */ - IOASIC_UARTCONTROL, /* 4: controls some UART behavior */ - IOASIC_UARTOUT, /* 5: UART output */ - IOASIC_UARTIN, /* 6: UART input */ - IOASIC_COIN, /* 7: triggered on coin insertion */ - IOASIC_SOUNDCTL, /* 8: sound communications control */ - IOASIC_SOUNDOUT, /* 9: sound output port */ - IOASIC_SOUNDSTAT, /* a: sound status port */ - IOASIC_SOUNDIN, /* b: sound input port */ - IOASIC_PICOUT, /* c: PIC output port */ - IOASIC_PICIN, /* d: PIC input port */ - IOASIC_INTSTAT, /* e: interrupt status */ - IOASIC_INTCTL /* f: interrupt control */ + IOASIC_PORT0, // 0: input port 0 + IOASIC_PORT1, // 1: input port 1 + IOASIC_PORT2, // 2: input port 2 + IOASIC_PORT3, // 3: input port 3 + IOASIC_UARTCONTROL, // 4: controls some UART behavior + IOASIC_UARTOUT, // 5: UART output + IOASIC_UARTIN, // 6: UART input + IOASIC_COIN, // 7: triggered on coin insertion + IOASIC_SOUNDCTL, // 8: sound communications control + IOASIC_SOUNDOUT, // 9: sound output port + IOASIC_SOUNDSTAT, // a: sound status port + IOASIC_SOUNDIN, // b: sound input port + IOASIC_PICOUT, // c: PIC output port + IOASIC_PICIN, // d: PIC input port + IOASIC_INTSTAT, // e: interrupt status + IOASIC_INTCTL // f: interrupt control }; void midway_ioasic_device::ioasic_register_state() @@ -703,20 +701,17 @@ DEFINE_DEVICE_TYPE(MIDWAY_IOASIC, midway_ioasic_device, "midway_ioasic", "Midway midway_ioasic_device::midway_ioasic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : midway_serial_pic2_device(mconfig, MIDWAY_IOASIC, tag, owner, clock), - m_io_dips(*this, ":DIPS"), - m_io_system(*this, ":SYSTEM"), - m_io_in1(*this, ":IN1"), - m_io_in2(*this, ":IN2"), + m_cage(*this, finder_base::DUMMY_TAG), + m_dcs(*this, finder_base::DUMMY_TAG), + m_irq_callback(*this), + m_input_cb(*this, 0), m_serial_tx_cb(*this), m_aux_output_cb(*this), - m_has_dcs(0), - m_has_cage(0), m_dcs_cpu(nullptr), m_shuffle_type(0), m_shuffle_default(0), m_shuffle_active(0), m_shuffle_map(nullptr), - m_irq_callback(*this), m_irq_state(0), m_sound_irq_state(0), m_auto_ack(0), @@ -724,9 +719,7 @@ midway_ioasic_device::midway_ioasic_device(const machine_config &mconfig, const m_fifo_in(0), m_fifo_out(0), m_fifo_bytes(0), - m_fifo_force_buffer_empty_pc(0), - m_cage(*this, ":cage"), - m_dcs(*this, ":dcs") + m_fifo_force_buffer_empty_pc(0) { memset(m_fifo,0,sizeof(m_fifo)); memset(m_reg,0,sizeof(m_reg)); @@ -742,41 +735,38 @@ void midway_ioasic_device::device_start() { static const uint8_t shuffle_maps[][16] = { - { 0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf }, /* WarGods, WG3DH, SFRush, MK4 */ - { 0x4,0x5,0x6,0x7,0xb,0xa,0x9,0x8,0x3,0x2,0x1,0x0,0xf,0xe,0xd,0xc }, /* Blitz, Blitz99 */ - { 0x7,0x3,0x2,0x0,0x1,0xc,0xd,0xe,0xf,0x4,0x5,0x6,0x8,0x9,0xa,0xb }, /* Carnevil */ - { 0x8,0x9,0xa,0xb,0x0,0x1,0x2,0x3,0xf,0xe,0xc,0xd,0x4,0x5,0x6,0x7 }, /* Calspeed, Gauntlet Legends */ - { 0xf,0xe,0xd,0xc,0x4,0x5,0x6,0x7,0x9,0x8,0xa,0xb,0x2,0x3,0x1,0x0 }, /* Mace */ - { 0xc,0xd,0xe,0xf,0x0,0x1,0x2,0x3,0x7,0x8,0x9,0xb,0xa,0x5,0x6,0x4 }, /* Gauntlet Dark Legacy */ - { 0x7,0x4,0x5,0x6,0x2,0x0,0x1,0x3,0x8,0x9,0xa,0xb,0xd,0xc,0xe,0xf }, /* Vapor TRX */ - { 0x7,0x4,0x5,0x6,0x2,0x0,0x1,0x3,0x8,0x9,0xa,0xb,0xd,0xc,0xe,0xf }, /* San Francisco Rush: The Rock */ - { 0x1,0x2,0x3,0x0,0x4,0x5,0x6,0x7,0xa,0xb,0x8,0x9,0xc,0xd,0xe,0xf }, /* Hyperdrive */ + { 0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf }, // WarGods, WG3DH, SFRush, MK4 + { 0x4,0x5,0x6,0x7,0xb,0xa,0x9,0x8,0x3,0x2,0x1,0x0,0xf,0xe,0xd,0xc }, // Blitz, Blitz99 + { 0x7,0x3,0x2,0x0,0x1,0xc,0xd,0xe,0xf,0x4,0x5,0x6,0x8,0x9,0xa,0xb }, // Carnevil + { 0x8,0x9,0xa,0xb,0x0,0x1,0x2,0x3,0xf,0xe,0xc,0xd,0x4,0x5,0x6,0x7 }, // Calspeed, Gauntlet Legends + { 0xf,0xe,0xd,0xc,0x4,0x5,0x6,0x7,0x9,0x8,0xa,0xb,0x2,0x3,0x1,0x0 }, // Mace + { 0xc,0xd,0xe,0xf,0x0,0x1,0x2,0x3,0x7,0x8,0x9,0xb,0xa,0x5,0x6,0x4 }, // Gauntlet Dark Legacy + { 0x7,0x4,0x5,0x6,0x2,0x0,0x1,0x3,0x8,0x9,0xa,0xb,0xd,0xc,0xe,0xf }, // Vapor TRX + { 0x7,0x4,0x5,0x6,0x2,0x0,0x1,0x3,0x8,0x9,0xa,0xb,0xd,0xc,0xe,0xf }, // San Francisco Rush: The Rock + { 0x1,0x2,0x3,0x0,0x4,0x5,0x6,0x7,0xa,0xb,0x8,0x9,0xc,0xd,0xe,0xf }, // Hyperdrive }; ioasic_register_state(); - /* do we have a DCS2 sound chip connected? */ - m_has_dcs = (m_dcs != nullptr); - m_has_cage = (m_cage != nullptr); - - if (m_has_dcs) + // do we have a DCS2 sound chip connected? + if (m_dcs) { m_dcs_cpu = m_dcs->get_cpu(); } m_shuffle_map = &shuffle_maps[m_shuffle_type][0]; - /* initialize the PIC */ + // initialize the PIC midway_serial_pic2_device::device_start(); - /* reset the chip */ + // reset the chip ioasic_reset(); m_reg[IOASIC_SOUNDCTL] = 0x0001; - /* configure the fifo */ - if (m_has_dcs) + // configure the fifo + if (m_dcs) { m_dcs->set_fifo_callbacks( read16smo_delegate(*this, FUNC(midway_ioasic_device::fifo_r)), @@ -801,7 +791,7 @@ void midway_ioasic_device::ioasic_reset() m_shuffle_active = m_shuffle_default; m_sound_irq_state = 0x0080; m_reg[IOASIC_INTCTL] = 0; - if (m_has_dcs) + if (m_dcs) fifo_reset_w(1); update_ioasic_irq(); midway_serial_pic_device::reset_w(1); @@ -879,31 +869,34 @@ uint16_t midway_ioasic_device::fifo_r() { uint16_t result = 0; - /* we can only read data if there's some to read! */ + // we can only read data if there's some to read! if (m_fifo_bytes != 0) { - /* fetch the data from the buffer and update the IOASIC state */ - result = m_fifo[m_fifo_out++ % FIFO_SIZE]; - m_fifo_bytes--; - update_ioasic_irq(); + // fetch the data from the buffer and update the IOASIC state + result = m_fifo[m_fifo_out]; + if (!machine().side_effects_disabled()) + { + m_fifo_out = (m_fifo_out + 1) % FIFO_SIZE; + m_fifo_bytes--; + update_ioasic_irq(); - if (m_fifo_bytes < 4 || m_fifo_bytes >= FIFO_SIZE - 4) - LOGFIFO("fifo_r(%04X): FIFO bytes = %d!\n", result, m_fifo_bytes); + if (m_fifo_bytes < 4 || m_fifo_bytes >= FIFO_SIZE - 4) + LOGFIFO("fifo_r(%04X): FIFO bytes = %d!\n", result, m_fifo_bytes); - /* if we just cleared the buffer, this may generate an IRQ on the master CPU */ - /* because of the way the streaming code works, we need to make sure that the */ - /* next status read indicates an empty buffer, even if we've timesliced and the */ - /* main CPU is handling the I/O ASIC interrupt */ - if (m_fifo_bytes == 0 && m_has_dcs) - { - m_fifo_force_buffer_empty_pc = m_dcs_cpu->pc(); - LOGFIFO("fifo_r(%04X): FIFO empty, PC = %04X\n", result, m_fifo_force_buffer_empty_pc); + // if we just cleared the buffer, this may generate an IRQ on the master CPU + // because of the way the streaming code works, we need to make sure that the + // next status read indicates an empty buffer, even if we've timesliced and the + // main CPU is handling the I/O ASIC interrupt + if (m_fifo_bytes == 0 && m_dcs) + { + m_fifo_force_buffer_empty_pc = m_dcs_cpu->pc(); + LOGFIFO("fifo_r(%04X): FIFO empty, PC = %04X\n", result, m_fifo_force_buffer_empty_pc); + } } } - else - { + else if (!machine().side_effects_disabled()) LOGFIFO("fifo_r(): nothing to read!\n"); - } + return result; } @@ -927,17 +920,20 @@ uint16_t midway_ioasic_device::fifo_status_r(address_space &space) { uint16_t result = get_fifo_status(); - // kludge alert: if we're reading this from the DCS CPU itself, and we recently cleared - // the FIFO, and we're within 16 instructions of the read that cleared the FIFO, make - // sure the FIFO clear bit is set - if (m_fifo_force_buffer_empty_pc && &space.device() == m_dcs_cpu) + if (!machine().side_effects_disabled()) { - offs_t currpc = m_dcs_cpu->pc(); - if (currpc >= m_fifo_force_buffer_empty_pc && currpc < m_fifo_force_buffer_empty_pc + 0x10) + // kludge alert: if we're reading this from the DCS CPU itself, and we recently cleared + // the FIFO, and we're within 16 instructions of the read that cleared the FIFO, make + // sure the FIFO clear bit is set + if (m_fifo_force_buffer_empty_pc && &space.device() == m_dcs_cpu) { - m_fifo_force_buffer_empty_pc = 0; - result |= 0x08; - LOGFIFO("ioasic_fifo_status_r(%04X): force empty, PC = %04X\n", result, currpc); + offs_t currpc = m_dcs_cpu->pc(); + if (currpc >= m_fifo_force_buffer_empty_pc && currpc < m_fifo_force_buffer_empty_pc + 0x10) + { + m_fifo_force_buffer_empty_pc = 0; + result |= 0x08; + LOGFIFO("ioasic_fifo_status_r(%04X): force empty, PC = %04X\n", result, currpc); + } } } @@ -947,7 +943,7 @@ uint16_t midway_ioasic_device::fifo_status_r(address_space &space) void midway_ioasic_device::fifo_reset_w(int state) { - /* on the high state, reset the FIFO data */ + // on the high state, reset the FIFO data if (state) { m_fifo_in = 0; @@ -962,7 +958,7 @@ void midway_ioasic_device::fifo_reset_w(int state) void midway_ioasic_device::fifo_w(uint16_t data) { - /* if we have room, add it to the FIFO buffer */ + // if we have room, add it to the FIFO buffer if (m_fifo_bytes < FIFO_SIZE) { m_fifo[m_fifo_in++ % FIFO_SIZE] = data; @@ -1020,46 +1016,50 @@ uint32_t midway_ioasic_device::read(address_space &space, offs_t offset) // bits 15:13 == 001 if (!m_shuffle_active) { - /* blitz99 wants bit bits 13-15 to be 1 */ + // blitz99 wants bit bits 13-15 to be 1 result = 0x2001; } - else { - result = m_io_dips->read(); + else + { + result = m_input_cb[0](); } break; case IOASIC_PORT1: - result = m_io_system->read(); + result = m_input_cb[1](); break; case IOASIC_PORT2: - result = m_io_in1->read(); + result = m_input_cb[2](); break; case IOASIC_PORT3: - result = m_io_in2->read(); + result = m_input_cb[3](); break; case IOASIC_UARTIN: - m_reg[offset] &= ~0x1000; - if (result & 0x1000) - LOGUART("%s: ioasic_r(%d) = %08X\n", machine().describe_context(), offset, result); - // Add lf - if ((result & 0xff)==0x0d) - m_reg[offset] = 0x300a; - update_ioasic_irq(); + if (!machine().side_effects_disabled()) + { + m_reg[offset] &= ~0x1000; + if (result & 0x1000) + LOGUART("%s: ioasic_r(%d) = %08X\n", machine().describe_context(), offset, result); + // Add lf + if ((result & 0xff)==0x0d) + m_reg[offset] = 0x300a; + update_ioasic_irq(); + } break; case IOASIC_SOUNDSTAT: - /* status from sound CPU */ + // status from sound CPU result = 0; - if (m_has_dcs) + if (m_dcs) { result |= ((m_dcs->control_r() >> 4) ^ 0x40) & 0x00c0; result |= fifo_status_r(space) & 0x0038; result |= m_dcs->data2_r() & 0xff00; } - else if (m_has_cage) + else if (m_cage) { result |= (m_cage->control_r() << 6) ^ 0x80; } @@ -1069,13 +1069,16 @@ uint32_t midway_ioasic_device::read(address_space &space, offs_t offset) case IOASIC_SOUNDIN: result = 0; - if (m_has_dcs) + if (m_dcs) { result = m_dcs->data_r(); - if (m_auto_ack) - m_dcs->ack_w(); + if (!machine().side_effects_disabled()) + { + if (m_auto_ack) + m_dcs->ack_w(); + } } - else if (m_has_cage) + else if (m_cage) result = m_cage->main_r(); else { @@ -1126,15 +1129,13 @@ void midway_ioasic_device::serial_rx_w(u8 data) void midway_ioasic_device::write(offs_t offset, uint32_t data, uint32_t mem_mask) { - uint32_t oldreg, newreg; - offset = m_shuffle_active ? m_shuffle_map[offset & 15] : offset; - oldreg = m_reg[offset]; + uint32_t const oldreg = m_reg[offset]; // Block register updates until ioasic is unlocked // mwskins and thegrid use this as test to see if the ioasic is unlocked if (m_shuffle_active) COMBINE_DATA(&m_reg[offset]); - newreg = m_reg[offset]; + uint32_t const newreg = m_reg[offset]; if (offset != IOASIC_SOUNDOUT) LOGIOASIC("%s ioasic_w(%d) = %08X\n", machine().describe_context(), offset, data); @@ -1142,19 +1143,19 @@ void midway_ioasic_device::write(offs_t offset, uint32_t data, uint32_t mem_mask switch (offset) { case IOASIC_PORT0: - /* the last write here seems to turn on shuffling */ + // the last write here seems to turn on shuffling if (data == 0xe2) { m_shuffle_active = 1; logerror("*** I/O ASIC unlocked!\n"); m_reg[IOASIC_INTCTL] = 0; - m_reg[IOASIC_UARTCONTROL] = 0; /* bug in 10th Degree assumes this */ + m_reg[IOASIC_UARTCONTROL] = 0; // bug in 10th Degree assumes this } break; case IOASIC_PORT2: case IOASIC_PORT3: - /* ignore writes here if we're not shuffling yet */ + // ignore writes here if we're not shuffling yet if (!m_shuffle_active) break; break; @@ -1166,11 +1167,12 @@ void midway_ioasic_device::write(offs_t offset, uint32_t data, uint32_t mem_mask case IOASIC_UARTOUT: if (m_reg[IOASIC_UARTCONTROL] & 0x800) { - /* we're in loopback mode -- copy to the input */ + // we're in loopback mode -- copy to the input m_reg[IOASIC_UARTIN] = (newreg & 0x00ff) | 0x3000; update_ioasic_irq(); } - else { + else + { m_serial_tx_cb(data); m_reg[IOASIC_UARTIN] |= 0x2000; update_ioasic_irq(); @@ -1184,12 +1186,12 @@ void midway_ioasic_device::write(offs_t offset, uint32_t data, uint32_t mem_mask case IOASIC_SOUNDCTL: LOGIOASIC("%s: write IOASIC_SOUNDCTL=%04x\n", machine().describe_context(), data); - /* sound reset? */ - if (m_has_dcs) + // sound reset? + if (m_dcs) { m_dcs->reset_w(newreg & 1); } - else if (m_has_cage) + else if (m_cage) { if ((oldreg ^ newreg) & 1) { @@ -1199,44 +1201,44 @@ void midway_ioasic_device::write(offs_t offset, uint32_t data, uint32_t mem_mask } } - /* FIFO reset? */ + // FIFO reset? fifo_reset_w(~newreg & 4); break; case IOASIC_SOUNDOUT: - if (m_has_dcs) + if (m_dcs) m_dcs->data_w(newreg); - else if (m_has_cage) + else if (m_cage) m_cage->main_w(newreg); break; case IOASIC_SOUNDIN: m_dcs->ack_w(); - /* acknowledge data read */ + // acknowledge data read break; case IOASIC_PICOUT: - if (m_shuffle_type == MIDWAY_IOASIC_VAPORTRX) + if (m_shuffle_type == SHUFFLE_VAPORTRX) midway_serial_pic2_device::write(newreg ^ 0x0a); - else if (m_shuffle_type == MIDWAY_IOASIC_SFRUSHRK) + else if (m_shuffle_type == SHUFFLE_SFRUSHRK) midway_serial_pic2_device::write(newreg ^ 0x05); else midway_serial_pic2_device::write(newreg); break; case IOASIC_PICIN: - /* This is P15 on vegas boards */ + // This is P15 on vegas boards m_aux_output_cb(data); break; case IOASIC_INTCTL: - /* interrupt enables */ - /* bit 0 = global interrupt enable */ - /* bit 3 = FIFO empty */ - /* bit 6 = sound input buffer full */ - /* bit 7 = sound output buffer empty */ - /* bit 14 = LED */ - /* bit 15 = TI320Cx Mode Enable */ + // interrupt enables + // bit 0 = global interrupt enable + // bit 3 = FIFO empty + // bit 6 = sound input buffer full + // bit 7 = sound output buffer empty + // bit 14 = LED + // bit 15 = TI320Cx Mode Enable if ((oldreg ^ newreg) & 0x3ff6) LOGMASKED(LOG_IOASIC | LOG_IRQ, "IOASIC interrupt control = %04X\n", data); update_ioasic_irq(); diff --git a/src/mame/midway/midwayic.h b/src/mame/midway/midwayic.h index 5a4c06e1696..92f10e5ce35 100644 --- a/src/mame/midway/midwayic.h +++ b/src/mame/midway/midwayic.h @@ -5,19 +5,18 @@ Emulation of various Midway ICs ***************************************************************************/ -#ifndef MAME_MIDWAY_MIDWAY_IC_H -#define MAME_MIDWAY_MIDWAY_IC_H +#ifndef MAME_MIDWAY_MIDWAYIC_H +#define MAME_MIDWAY_MIDWAYIC_H #pragma once - #include "cage.h" #include "dcs.h" #include "cpu/pic16c5x/pic16c5x.h" -/* 1st generation Midway serial PIC - simulation*/ +// 1st generation Midway serial PIC - simulation class midway_serial_pic_device : public device_t { @@ -35,7 +34,7 @@ public: protected: midway_serial_pic_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; virtual ioport_constructor device_input_ports() const override; @@ -45,21 +44,18 @@ protected: required_ioport m_io_serial_digit; - uint8_t m_data[16]{}; // reused by other devices - int m_upper = 0; + uint8_t m_data[16]; // reused by other devices + int m_upper; private: - uint8_t m_buff = 0; - uint8_t m_idx = 0; - uint8_t m_status = 0; - uint8_t m_bits = 0; + uint8_t m_buff; + uint8_t m_idx; + uint8_t m_status; + uint8_t m_bits; }; -// device type definition -DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC, midway_serial_pic_device) - -/* 1st generation Midway serial PIC - emulation */ +// 1st generation Midway serial PIC - emulation class midway_serial_pic_emu_device : public device_t { @@ -75,7 +71,7 @@ public: protected: midway_serial_pic_emu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides + // device_t implementation virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; @@ -85,19 +81,15 @@ private: u8 read_c(); void write_c(u8 data); - u8 m_command = 0; - u8 m_data_out = 0; - u8 m_clk = 0; - u8 m_status = 0; + u8 m_command; + u8 m_data_out; + u8 m_clk; + u8 m_status; }; -// device type definition -DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC_EMU, midway_serial_pic_emu_device) - - -/* 2nd generation Midway serial/NVRAM/RTC PIC */ +// 2nd generation Midway serial/NVRAM/RTC PIC // ======================> midway_serial_pic2_device @@ -118,10 +110,10 @@ public: protected: midway_serial_pic2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides + // device_t implementation virtual void device_start() override; - // device_nvram_interface overrides + // device_nvram_interface implementation virtual void nvram_default() override; virtual bool nvram_read(util::read_stream &file) override; virtual bool nvram_write(util::write_stream &file) override; @@ -131,36 +123,49 @@ private: void pic_register_state(); TIMER_CALLBACK_MEMBER(reset_timer); - uint16_t m_latch = 0; + uint16_t m_latch; attotime m_latch_expire_time; - uint8_t m_state = 0; - uint8_t m_index = 0; - uint8_t m_total = 0; - uint8_t m_nvram_addr = 0; - uint8_t m_buffer[0x10]{}; - uint8_t m_nvram[0x100]{}; - uint8_t m_default_nvram[0x100]{}; - uint8_t m_time_buf[8]{}; - uint8_t m_time_index = 0; - uint8_t m_time_just_written = 0; - uint16_t m_yearoffs = 0; - emu_timer *m_time_write_timer = nullptr; + uint8_t m_state; + uint8_t m_index; + uint8_t m_total; + uint8_t m_nvram_addr; + uint8_t m_buffer[0x10]; + uint8_t m_nvram[0x100]; + uint8_t m_default_nvram[0x100]; + uint8_t m_time_buf[8]; + uint8_t m_time_index; + uint8_t m_time_just_written; + uint16_t m_yearoffs; + emu_timer *m_time_write_timer; }; -// device type definition -DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC2, midway_serial_pic2_device) - -/* I/O ASIC connected to 2nd generation PIC */ +// I/O ASIC connected to 2nd generation PIC // ======================> midway_ioasic_device class midway_ioasic_device : public midway_serial_pic2_device { public: + enum + { + SHUFFLE_STANDARD = 0, + SHUFFLE_BLITZ99, + SHUFFLE_CARNEVIL, + SHUFFLE_CALSPEED, + SHUFFLE_MACE, + SHUFFLE_GAUNTDL, + SHUFFLE_VAPORTRX, + SHUFFLE_SFRUSHRK, + SHUFFLE_HYPRDRIV + }; + // construction/destruction midway_ioasic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template auto in_port_cb() { return m_input_cb[Port].bind(); } + template void set_cage_tag(T &&tag) { m_cage.set_tag(std::forward(tag)); } + template void set_dcs_tag(T &&tag) { m_dcs.set_tag(std::forward(tag)); } void set_shuffle(uint8_t shuffle) { m_shuffle_type = shuffle; } void set_shuffle_default(uint8_t shuffle) { m_shuffle_default = shuffle; } void set_auto_ack(uint8_t auto_ack) { m_auto_ack = auto_ack; } @@ -191,7 +196,7 @@ public: void ioasic_reset(); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: @@ -199,53 +204,39 @@ private: void update_ioasic_irq(); uint16_t get_fifo_status(); - required_ioport m_io_dips; - required_ioport m_io_system; - required_ioport m_io_in1; - required_ioport m_io_in2; - - devcb_write8 m_serial_tx_cb; - devcb_write32 m_aux_output_cb; + optional_device m_cage; + optional_device m_dcs; - uint32_t m_reg[16]{}; - uint8_t m_has_dcs = 0; - uint8_t m_has_cage = 0; - cpu_device *m_dcs_cpu = nullptr; - uint8_t m_shuffle_type = 0; - uint8_t m_shuffle_default = 0; - uint8_t m_shuffle_active = 0; - const uint8_t * m_shuffle_map = nullptr; devcb_write8 m_irq_callback; - uint8_t m_irq_state = 0; - uint16_t m_sound_irq_state = 0; - uint8_t m_auto_ack = 0; - uint8_t m_force_fifo_full = 0; - uint16_t m_fifo[512]{}; - uint16_t m_fifo_in = 0; - uint16_t m_fifo_out = 0; - uint16_t m_fifo_bytes = 0; - offs_t m_fifo_force_buffer_empty_pc = 0; + devcb_read32::array<4> m_input_cb; - optional_device m_cage; - optional_device m_dcs; + devcb_write8 m_serial_tx_cb; + devcb_write32 m_aux_output_cb; + + uint32_t m_reg[16]; + cpu_device *m_dcs_cpu; + uint8_t m_shuffle_type; + uint8_t m_shuffle_default; + uint8_t m_shuffle_active; + const uint8_t * m_shuffle_map; + uint8_t m_irq_state; + uint16_t m_sound_irq_state; + uint8_t m_auto_ack; + uint8_t m_force_fifo_full; + + uint16_t m_fifo[512]; + uint16_t m_fifo_in; + uint16_t m_fifo_out; + uint16_t m_fifo_bytes; + offs_t m_fifo_force_buffer_empty_pc; }; -// device type definition +// device type declarations +DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC, midway_serial_pic_device) +DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC_EMU, midway_serial_pic_emu_device) +DECLARE_DEVICE_TYPE(MIDWAY_SERIAL_PIC2, midway_serial_pic2_device) DECLARE_DEVICE_TYPE(MIDWAY_IOASIC, midway_ioasic_device) -enum -{ - MIDWAY_IOASIC_STANDARD = 0, - MIDWAY_IOASIC_BLITZ99, - MIDWAY_IOASIC_CARNEVIL, - MIDWAY_IOASIC_CALSPEED, - MIDWAY_IOASIC_MACE, - MIDWAY_IOASIC_GAUNTDL, - MIDWAY_IOASIC_VAPORTRX, - MIDWAY_IOASIC_SFRUSHRK, - MIDWAY_IOASIC_HYPRDRIV -}; - -#endif // MAME_MIDWAY_MIDWAY_IC_H +#endif // MAME_MIDWAY_MIDWAYIC_H diff --git a/src/mame/midway/midzeus.cpp b/src/mame/midway/midzeus.cpp index fc37ee57bcc..f2e6ab042d8 100644 --- a/src/mame/midway/midzeus.cpp +++ b/src/mame/midway/midzeus.cpp @@ -1290,7 +1290,12 @@ void midzeus_state::midzeus(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag("dcs"); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_yearoffs(94); } @@ -1338,7 +1343,12 @@ void midzeus2_state::midzeus2(machine_config &config) /* I/O hardware */ MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag("dcs"); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_yearoffs(99); m_ioasic->set_upper(474); diff --git a/src/mame/midway/seattle.cpp b/src/mame/midway/seattle.cpp index 784c6a266eb..ae5a1fb52d0 100644 --- a/src/mame/midway/seattle.cpp +++ b/src/mame/midway/seattle.cpp @@ -2128,7 +2128,7 @@ void seattle_state::wg3dh(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x3839); @@ -2136,7 +2136,12 @@ void seattle_state::wg3dh(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_upper(310); // no alternates m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2149,7 +2154,7 @@ void seattle_state::mace(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x3839); @@ -2157,7 +2162,12 @@ void seattle_state::mace(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_MACE); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_MACE); m_ioasic->set_upper(319); // or 314 m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2173,17 +2183,22 @@ void seattle_state::sfrush(machine_config &config) SPEAKER(config, "rrspeaker").headrest_right(); //SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output; - atari_cage_seattle_device &cage(ATARI_CAGE_SEATTLE(config, "cage", 0)); - cage.set_speedup(0x5236); - cage.irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler)); + ATARI_CAGE_SEATTLE(config, m_cage, 0); + m_cage->set_speedup(0x5236); + m_cage->irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler)); // TODO: copied from atarigt.cpp; Same configurations as T-Mek? - cage.add_route(0, "frspeaker", 1.0); // Foward Right - cage.add_route(1, "rlspeaker", 1.0); // Back Left - cage.add_route(2, "flspeaker", 1.0); // Foward Left - cage.add_route(3, "rrspeaker", 1.0); // Back Right + m_cage->add_route(0, "frspeaker", 1.0); // Foward Right + m_cage->add_route(1, "rlspeaker", 1.0); // Back Left + m_cage->add_route(2, "flspeaker", 1.0); // Foward Left + m_cage->add_route(3, "rrspeaker", 1.0); // Back Right MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_cage_tag(m_cage); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_upper(315); // no alternates m_ioasic->set_yearoffs(100); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2200,18 +2215,22 @@ void seattle_state::sfrushrk(machine_config &config) SPEAKER(config, "rrspeaker").headrest_right(); //SPEAKER(config, "subwoofer").seat(); Not implemented, Quad Amp PCB output; - atari_cage_seattle_device &cage(ATARI_CAGE_SEATTLE(config, "cage", 0)); - cage.set_speedup(0x5329); - cage.irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler)); + ATARI_CAGE_SEATTLE(config, m_cage, 0); + m_cage->set_speedup(0x5329); + m_cage->irq_handler().set(m_ioasic, FUNC(midway_ioasic_device::cage_irq_handler)); // TODO: copied from atarigt.cpp; Same configurations as T-Mek? - cage.add_route(0, "frspeaker", 1.0); // Foward Right - cage.add_route(1, "rlspeaker", 1.0); // Back Left - cage.add_route(2, "flspeaker", 1.0); // Foward Left - cage.add_route(3, "rrspeaker", 1.0); // Back Right - + m_cage->add_route(0, "frspeaker", 1.0); // Foward Right + m_cage->add_route(1, "rlspeaker", 1.0); // Back Left + m_cage->add_route(2, "flspeaker", 1.0); // Foward Left + m_cage->add_route(3, "rrspeaker", 1.0); // Back Right MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_SFRUSHRK); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_cage_tag(m_cage); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_SFRUSHRK); m_ioasic->set_upper(331); // no alternates m_ioasic->set_yearoffs(100); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2221,7 +2240,7 @@ void seattle_state::sfrushrk(machine_config &config) void seattle_state::sfrushrkw(machine_config &config) { sfrushrk(config); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); } void seattle_state::calspeed(machine_config &config) @@ -2231,7 +2250,7 @@ void seattle_state::calspeed(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x39c0); @@ -2239,7 +2258,12 @@ void seattle_state::calspeed(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_CALSPEED); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_CALSPEED); m_ioasic->set_upper(328); // 328 = 27"; may or may not have a 31" ID m_ioasic->set_yearoffs(100); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2253,7 +2277,7 @@ void seattle_state::vaportrx(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x39c2); @@ -2261,7 +2285,12 @@ void seattle_state::vaportrx(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_VAPORTRX); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_VAPORTRX); m_ioasic->set_upper(324); // or 334 m_ioasic->set_yearoffs(100); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2274,7 +2303,7 @@ void seattle_state::biofreak(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x3835); @@ -2282,7 +2311,12 @@ void seattle_state::biofreak(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_upper(231); // no alternates m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2295,7 +2329,7 @@ void seattle_state::blitz(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x39c2); @@ -2303,7 +2337,12 @@ void seattle_state::blitz(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_BLITZ99); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_BLITZ99); m_ioasic->set_upper(444); // or 528 m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2317,7 +2356,7 @@ void seattle_state::blitz99(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x0afb); @@ -2325,7 +2364,12 @@ void seattle_state::blitz99(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_BLITZ99); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_BLITZ99); m_ioasic->set_upper(481); // or 484 or 520 m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2339,7 +2383,7 @@ void seattle_state::blitz2k(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x0b5d); @@ -2347,7 +2391,12 @@ void seattle_state::blitz2k(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_BLITZ99); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_BLITZ99); m_ioasic->set_upper(494); // or 498 m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2362,7 +2411,7 @@ void seattle_state::carnevil(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x0af7); @@ -2370,7 +2419,12 @@ void seattle_state::carnevil(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_CARNEVIL); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_CARNEVIL); m_ioasic->set_upper(469); // 469 = 25"; 486 = 39"; m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); @@ -2383,7 +2437,7 @@ void seattle_state::hyprdriv(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, "dcs", 0)); + dcs2_audio_2115_device &dcs(DCS2_AUDIO_2115(config, m_dcs, 0)); dcs.set_maincpu_tag(m_maincpu); dcs.set_dram_in_mb(2); dcs.set_polling_offset(0x0af7); @@ -2391,7 +2445,12 @@ void seattle_state::hyprdriv(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_HYPRDRIV); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_HYPRDRIV); m_ioasic->set_upper(471); // 471 = 25"; 479 = 31" m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(seattle_state::ioasic_irq)); diff --git a/src/mame/midway/vegas.cpp b/src/mame/midway/vegas.cpp index d83bb0f9683..4e5c70096b3 100644 --- a/src/mame/midway/vegas.cpp +++ b/src/mame/midway/vegas.cpp @@ -2049,7 +2049,12 @@ void vegas_state::gauntleg(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_CALSPEED); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_CALSPEED); m_ioasic->set_upper(340); // 340=39", 322=27" others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2072,7 +2077,12 @@ void vegas_state::gauntdl(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_GAUNTDL); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_GAUNTDL); m_ioasic->set_upper(346); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2094,7 +2104,12 @@ void vegas_state::warfa(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_MACE); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_MACE); m_ioasic->set_upper(337); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2116,7 +2131,12 @@ void vegas_state::tenthdeg(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_GAUNTDL); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_GAUNTDL); m_ioasic->set_upper(330); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2138,7 +2158,12 @@ void vegas_state::roadburn(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_upper(325); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2160,7 +2185,12 @@ void vegas_state::nbashowt(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_MACE); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_MACE); // 528 494 478 development pic, 487 NBA m_ioasic->set_upper(487); // or 478 or 487 m_ioasic->set_yearoffs(80); @@ -2184,7 +2214,12 @@ void vegas_state::nbanfl(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_BLITZ99); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_BLITZ99); m_ioasic->set_upper(498); // or 478 or 487 m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2212,7 +2247,12 @@ void vegas_state::nbagold(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_GAUNTDL); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_GAUNTDL); m_ioasic->set_upper(109); // 494 109 ??? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2241,7 +2281,12 @@ void vegas_state::sf2049(machine_config &config) dcs.add_route(4, "subwoofer", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_STANDARD); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_STANDARD); m_ioasic->set_upper(336); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2270,7 +2315,12 @@ void vegas_state::sf2049se(machine_config &config) dcs.add_route(4, "subwoofer", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_SFRUSHRK); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_SFRUSHRK); m_ioasic->set_upper(352); // 352 336 others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2299,7 +2349,12 @@ void vegas_state::sf2049te(machine_config &config) dcs.add_route(4, "subwoofer", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_SFRUSHRK); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_SFRUSHRK); m_ioasic->set_upper(348); // others? m_ioasic->set_yearoffs(80); m_ioasic->irq_handler().set(FUNC(vegas_state::ioasic_irq)); @@ -2321,7 +2376,12 @@ void vegas_state::cartfury(machine_config &config) dcs.add_route(1, "lspeaker", 1.0); MIDWAY_IOASIC(config, m_ioasic, 0); - m_ioasic->set_shuffle(MIDWAY_IOASIC_CARNEVIL); + m_ioasic->in_port_cb<0>().set_ioport("DIPS"); + m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); + m_ioasic->in_port_cb<2>().set_ioport("IN1"); + m_ioasic->in_port_cb<3>().set_ioport("IN2"); + m_ioasic->set_dcs_tag(m_dcs); + m_ioasic->set_shuffle(midway_ioasic_device::SHUFFLE_CARNEVIL); // 433, 495, 490 Development PIC m_ioasic->set_upper(495/*433, 495 others? */); m_ioasic->set_yearoffs(80); -- cgit v1.2.3