From 347d50ad4cb282625418cddb365fa5ae0f54b53d Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 5 Oct 2024 01:21:18 +1000 Subject: -igs/igs_m027xa.xpp: Fixed inputs for Crazy Bugs (V103JP). * The hopper is hooked up because an input for it appears in the I/O test, however both the Payout and Ticket buttons seem to use the ticker dispenser to pay out credits. -machine/sc16is741.cpp: Implemented CTS/RTS deasserted interrupt. -bus/spectrum/musicmachine.cpp: Get device out of global namespace, and some cleanup. -lnux4004.xml: Include Linux distro in software item description. --- hash/lnux4004.xml | 2 +- src/devices/bus/spectrum/musicmachine.cpp | 45 +++++++++++++++-- src/devices/bus/spectrum/musicmachine.h | 31 +----------- src/devices/machine/sc16is741.cpp | 27 ++++++++++- src/mame/hitachi/bml3.h | 2 +- src/mame/igs/igs_m027xa.cpp | 80 +++++++++++++++++++++++-------- 6 files changed, 129 insertions(+), 58 deletions(-) diff --git a/hash/lnux4004.xml b/hash/lnux4004.xml index 1bf677eb7b5..96ac8fe94d7 100644 --- a/hash/lnux4004.xml +++ b/hash/lnux4004.xml @@ -7,7 +7,7 @@ license:CC0-1.0 - uMIPS Linux 4.4.292+ + Debian GNU/Linux 7 (Linux uMIPS 4.4.292+) 2024 Dmitry Grinberg diff --git a/src/devices/bus/spectrum/musicmachine.cpp b/src/devices/bus/spectrum/musicmachine.cpp index 3b3417dc56b..2ee26d6f283 100644 --- a/src/devices/bus/spectrum/musicmachine.cpp +++ b/src/devices/bus/spectrum/musicmachine.cpp @@ -9,15 +9,39 @@ #include "musicmachine.h" #include "bus/midi/midi.h" +#include "machine/6850acia.h" #include "machine/clock.h" +#include "sound/dac.h" + #include "speaker.h" -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** +namespace { + +class spectrum_musicmachine_device : public device_t, public device_spectrum_expansion_interface +{ +public: + // construction/destruction + spectrum_musicmachine_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + void write_acia_clock(u8 data); + +protected: + // device_t implementation + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + + // device_spectrum_expansion_interface implementation + virtual u8 iorq_r(offs_t offset) override; + virtual void iorq_w(offs_t offset, u8 data) override; -DEFINE_DEVICE_TYPE(SPECTRUM_MUSICMACHINE, spectrum_musicmachine_device, "spectrummusic", "The Music Machine (ZX)") +private: + required_device m_acia; + required_device m_dac; + + bool m_irq_select; +}; void spectrum_musicmachine_device::device_add_mconfig(machine_config &config) @@ -33,6 +57,7 @@ void spectrum_musicmachine_device::device_add_mconfig(machine_config &config) ZN429E(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.2); } + //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -51,6 +76,7 @@ spectrum_musicmachine_device::spectrum_musicmachine_device(const machine_config void spectrum_musicmachine_device::device_start() { + save_item(NAME(m_irq_select)); } //------------------------------------------------- @@ -70,7 +96,7 @@ void spectrum_musicmachine_device::write_acia_clock(u8 data) u8 spectrum_musicmachine_device::iorq_r(offs_t offset) { - u8 data = offset & 1 ? m_slot->fb_r() : 0xff; + u8 data = (offset & 1) ? m_slot->fb_r() : 0xff; switch (offset & 0xff) { @@ -112,3 +138,12 @@ void spectrum_musicmachine_device::iorq_w(offs_t offset, u8 data) break; } } + +} // anonymous namespace + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE_PRIVATE(SPECTRUM_MUSICMACHINE, device_spectrum_expansion_interface, spectrum_musicmachine_device, "spectrummusic", "The Music Machine (ZX)") diff --git a/src/devices/bus/spectrum/musicmachine.h b/src/devices/bus/spectrum/musicmachine.h index 651f396e07f..59efe6e04e8 100644 --- a/src/devices/bus/spectrum/musicmachine.h +++ b/src/devices/bus/spectrum/musicmachine.h @@ -13,37 +13,8 @@ #pragma once #include "exp.h" -#include "machine/6850acia.h" -#include "sound/dac.h" -class spectrum_musicmachine_device : public device_t - , public device_spectrum_expansion_interface -{ -public: - // construction/destruction - spectrum_musicmachine_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - void write_acia_clock(u8 data); - -protected: - // device-level overrides - virtual void device_start() override ATTR_COLD; - virtual void device_reset() override ATTR_COLD; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; - - virtual u8 iorq_r(offs_t offset) override; - virtual void iorq_w(offs_t offset, u8 data) override; - -private: - required_device m_acia; - required_device m_dac; - - bool m_irq_select; -}; - -// device type definition -DECLARE_DEVICE_TYPE(SPECTRUM_MUSICMACHINE, spectrum_musicmachine_device) +DECLARE_DEVICE_TYPE(SPECTRUM_MUSICMACHINE, device_spectrum_expansion_interface) #endif // MAME_BUS_SPECTRUM_MUSICMACHINE_H diff --git a/src/devices/machine/sc16is741.cpp b/src/devices/machine/sc16is741.cpp index c0a92d88943..694d0362e9e 100644 --- a/src/devices/machine/sc16is741.cpp +++ b/src/devices/machine/sc16is741.cpp @@ -126,7 +126,7 @@ enum sc16is741a_device::interrupt : u8 INTERRUPT_MODEM_STATUS = 0x08, INTERRUPT_XOFF = 0x04, INTERRUPT_SPECIAL_CHAR = 0x02, - INTERRUPT_RTS_CTS = 0x01 + INTERRUPT_CTS_RTS = 0x01 }; @@ -254,6 +254,11 @@ void sc16is741a_device::cts_w(int state) if (bool(state) != bool(m_cts)) { m_interrupts |= INTERRUPT_MODEM_STATUS; + if (state && IER_CTS_INT() && !(m_interrupts & INTERRUPT_CTS_RTS)) + { + LOG("CTS deasserted, setting CTS interrupt\n"); + m_interrupts |= INTERRUPT_CTS_RTS; + } update_irq(); } m_cts = state ? 1 : 0; @@ -572,6 +577,7 @@ inline void sc16is741a_device::iir_r(bool first) else if (IER_THR_INT() && (m_interrupts & INTERRUPT_THR)) { m_buffer |= 0x02; + LOG("clearing THR interrupt\n"); m_interrupts &= ~INTERRUPT_THR; } @@ -579,6 +585,13 @@ inline void sc16is741a_device::iir_r(bool first) { m_buffer |= 0x00; } + else if ((IER_CTS_INT() || IER_RTS_INT()) && (m_interrupts & INTERRUPT_CTS_RTS)) + { + m_buffer |= 0x20; + + LOG("clearing CTS/RTS interrupt\n"); + m_interrupts &= ~INTERRUPT_CTS_RTS; + } LOG("read IIR (0x%1$02x)\n", m_buffer); } @@ -1144,12 +1157,24 @@ TIMER_CALLBACK_MEMBER(sc16is741a_device::rx_shift) if (level >= (trigger * 4)) { LOG("RX FIFO level %1$u exceeds %2$u*4, deasserting RTS\n", level, trigger); + if (IER_RTS_INT() && !(m_interrupts & INTERRUPT_CTS_RTS)) + { + LOG("setting RTS interrupt\n"); + m_interrupts |= INTERRUPT_CTS_RTS; + update_irq(); + } set_rts(1); } } else { LOG("RHR full, deasserting RTS\n"); + if (IER_RTS_INT() && !(m_interrupts & INTERRUPT_CTS_RTS)) + { + LOG("setting RTS interrupt\n"); + m_interrupts |= INTERRUPT_CTS_RTS; + update_irq(); + } set_rts(1); } } diff --git a/src/mame/hitachi/bml3.h b/src/mame/hitachi/bml3.h index 392373bca79..8b38e4836a0 100644 --- a/src/mame/hitachi/bml3.h +++ b/src/mame/hitachi/bml3.h @@ -9,9 +9,9 @@ #include "bus/bml3/bml3bus.h" #include "imagedev/cassette.h" #include "machine/6850acia.h" +#include "machine/timer.h" #include "sound/spkrdev.h" #include "sound/ymopn.h" -#include "machine/timer.h" #include "video/mc6845.h" #include "emupal.h" diff --git a/src/mame/igs/igs_m027xa.cpp b/src/mame/igs/igs_m027xa.cpp index 1805c2d6814..97da91afe44 100644 --- a/src/mame/igs/igs_m027xa.cpp +++ b/src/mame/igs/igs_m027xa.cpp @@ -9,6 +9,9 @@ These games use the IGS027A processor. Triple Fever (V105US) (tripfevb) hangs after paying out tickets, with the MCU apparently attempting serial communication with something. +TODO: +* Does crzybugsj actually support a hopper? It shows in the input test, but + both the Payout and Ticket buttons seem to use the ticket dispenser. */ #include "emu.h" @@ -31,9 +34,6 @@ apparently attempting serial communication with something. #include "crzybugs.lh" #include "tripfev.lh" -#define LOG_DEBUG (1U << 1) -//#define VERBOSE (LOG_DEBUG) -#include "logmacro.h" namespace { @@ -49,14 +49,16 @@ public: m_oki(*this, "oki"), m_screen(*this, "screen"), m_ticket(*this, "ticket"), + m_hopper(*this, "hopper"), m_external_rom(*this, "user1"), m_io_test(*this, "TEST%u", 0U), m_io_dsw(*this, "DSW%u", 1U), m_out_lamps(*this, "lamp%u", 1U) { } - void igs_mahjong_xa(machine_config &config); - void igs_mahjong_xa_xor(machine_config &config); + void base(machine_config &config); + void base_xor(machine_config &config); + void hopper_xor(machine_config &config); void init_crzybugs(); void init_crzybugsj(); @@ -77,6 +79,7 @@ private: required_device m_oki; required_device m_screen; optional_device m_ticket; + optional_device m_hopper; required_region_ptr m_external_rom; optional_ioport_array<3> m_io_test; @@ -226,13 +229,19 @@ INPUT_PORTS_START( crzybugs ) PORT_MODIFY("TEST1") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Stop All Reels") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Ticket") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("ticket", ticket_dispenser_device, line_r) PORT_MODIFY("TEST2") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop Reel 2 / Small") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SLOT_STOP3 ) PORT_NAME("Stop Reel 3 / Take Score") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SLOT_STOP1 ) PORT_NAME("Stop Reel 1 / Double Up") +INPUT_PORTS_END + +INPUT_PORTS_START( crzybugs_us ) + PORT_INCLUDE(crzybugs) + + PORT_MODIFY("TEST1") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Ticket") PORT_MODIFY("DSW1") PORT_DIPNAME( 0x01, 0x01, DEF_STR(Demo_Sounds) ) PORT_DIPLOCATION("SW1:1") @@ -278,6 +287,30 @@ INPUT_PORTS_START( crzybugs ) PORT_DIPSETTING( 0x00, DEF_STR(Yes) ) INPUT_PORTS_END +INPUT_PORTS_START( crzybugs_jp ) + PORT_INCLUDE(crzybugs) + + PORT_MODIFY("TEST0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", hopper_device, line_r) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) + + PORT_MODIFY("TEST1") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Ticket") + + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR(Demo_Sounds) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x00, DEF_STR(Off) ) + PORT_DIPSETTING( 0x01, DEF_STR(On) ) + PORT_DIPNAME( 0x06, 0x06, "Symbol" ) PORT_DIPLOCATION("SW1:2,3") + PORT_DIPSETTING( 0x00, "Both" ) + PORT_DIPSETTING( 0x02, "Both (duplicate)" ) + PORT_DIPSETTING( 0x04, "Fruit" ) + PORT_DIPSETTING( 0x06, "Bug" ) + PORT_DIPNAME( 0x08, 0x08, "Hold Pair" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x08, DEF_STR(Off) ) + PORT_DIPSETTING( 0x00, "Regular" ) +INPUT_PORTS_END + INPUT_PORTS_START( tripfev ) PORT_INCLUDE(base) @@ -436,7 +469,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(igs_m027xa_state::interrupt) } -void igs_m027xa_state::igs_mahjong_xa(machine_config &config) +void igs_m027xa_state::base(machine_config &config) { IGS027A(config, m_maincpu, 22'000'000); // Crazy Bugs has a 22MHz crystal, what about the others? m_maincpu->set_addrmap(AS_PROGRAM, &igs_m027xa_state::main_map); @@ -479,13 +512,20 @@ void igs_m027xa_state::igs_mahjong_xa(machine_config &config) OKIM6295(config, m_oki, 1000000, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.5); } -void igs_m027xa_state::igs_mahjong_xa_xor(machine_config &config) +void igs_m027xa_state::base_xor(machine_config &config) { - igs_mahjong_xa(config); + base(config); m_maincpu->set_addrmap(AS_PROGRAM, &igs_m027xa_state::main_xor_map); } +void igs_m027xa_state::hopper_xor(machine_config &config) +{ + base_xor(config); + + HOPPER(config, m_hopper, attotime::from_msec(50)); +} + // prg at u34 // text at u15 // cg at u32 / u12 @@ -733,7 +773,7 @@ void igs_m027xa_state::pgm_create_dummy_internal_arm_region() for (int i = 0; i < 0x4000 / 2; i += 2) { temp16[i] = 0xff1e; - temp16[i +1] = 0xe12f; + temp16[i + 1] = 0xe12f; } @@ -788,17 +828,17 @@ void igs_m027xa_state::init_wldfruit() // These use the MX10EXAQC (80c51XA from Philips) // the PCBs are closer to igs_fear.cpp in terms of layout -GAME( 2008, haunthig, 0, igs_mahjong_xa, base, igs_m027xa_state, init_hauntedh, ROT0, "IGS", "Haunted House (IGS, V109US)", MACHINE_NOT_WORKING ) // IGS FOR V109US 2008 10 14 -GAME( 2006, haunthiga, haunthig, igs_mahjong_xa, base, igs_m027xa_state, init_hauntedh, ROT0, "IGS", "Haunted House (IGS, V101US)", MACHINE_NOT_WORKING ) // IGS FOR V101US 2006 08 23 +GAME( 2008, haunthig, 0, base, base, igs_m027xa_state, init_hauntedh, ROT0, "IGS", "Haunted House (IGS, V109US)", MACHINE_NOT_WORKING ) // IGS FOR V109US 2008 10 14 +GAME( 2006, haunthiga, haunthig, base, base, igs_m027xa_state, init_hauntedh, ROT0, "IGS", "Haunted House (IGS, V101US)", MACHINE_NOT_WORKING ) // IGS FOR V101US 2006 08 23 -GAMEL( 2009, crzybugs, 0, igs_mahjong_xa_xor, crzybugs, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V204US)", 0, layout_crzybugs ) // IGS FOR V204US 2009 5 19 -GAMEL( 2006, crzybugsa, crzybugs, igs_mahjong_xa_xor, crzybugs, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V202US)", 0, layout_crzybugs ) // IGS FOR V100US 2006 3 29 but also V202US string -GAMEL( 2005, crzybugsb, crzybugs, igs_mahjong_xa_xor, crzybugs, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V200US)", 0, layout_crzybugs ) // FOR V100US 2005 7 20 but also V200US string +GAMEL( 2009, crzybugs, 0, base_xor, crzybugs_us, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V204US)", 0, layout_crzybugs ) // IGS FOR V204US 2009 5 19 +GAMEL( 2006, crzybugsa, crzybugs, base_xor, crzybugs_us, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V202US)", 0, layout_crzybugs ) // IGS FOR V100US 2006 3 29 but also V202US string +GAMEL( 2005, crzybugsb, crzybugs, base_xor, crzybugs_us, igs_m027xa_state, init_crzybugs, ROT0, "IGS", "Crazy Bugs (V200US)", 0, layout_crzybugs ) // FOR V100US 2005 7 20 but also V200US string -GAMEL( 2007, crzybugsj, crzybugs, igs_mahjong_xa_xor, crzybugs, igs_m027xa_state, init_crzybugsj, ROT0, "IGS", "Crazy Bugs (V103JP)", 0, layout_crzybugs ) // IGS FOR V101JP 2007 06 08 (test mode calls this V102JP, ROM label was V103JP) +GAMEL( 2007, crzybugsj, crzybugs, hopper_xor, crzybugs_jp, igs_m027xa_state, init_crzybugsj, ROT0, "IGS", "Crazy Bugs (V103JP)", 0, layout_crzybugs ) // IGS FOR V101JP 2007 06 08 (test mode calls this V102JP, ROM label was V103JP) -GAMEL( 2006, tripfev, 0, igs_mahjong_xa_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V108US)", 0, layout_tripfev ) -GAMEL( 2006, tripfeva, tripfev, igs_mahjong_xa_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V107US)", 0, layout_tripfev ) // IGS FOR V107US 2006 09 07 -GAMEL( 2006, tripfevb, tripfev, igs_mahjong_xa_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V105US)", MACHINE_NOT_WORKING, layout_tripfev ) +GAMEL( 2006, tripfev, 0, base_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V108US)", 0, layout_tripfev ) +GAMEL( 2006, tripfeva, tripfev, base_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V107US)", 0, layout_tripfev ) // IGS FOR V107US 2006 09 07 +GAMEL( 2006, tripfevb, tripfev, base_xor, tripfev, igs_m027xa_state, init_tripfev, ROT0, "IGS", "Triple Fever (V105US)", MACHINE_NOT_WORKING, layout_tripfev ) -GAME( 200?, wldfruit, 0, igs_mahjong_xa, base, igs_m027xa_state, init_wldfruit, ROT0, "IGS", "Wild Fruit (V208US)", MACHINE_NOT_WORKING ) // IGS-----97----V208US +GAME( 200?, wldfruit, 0, base, base, igs_m027xa_state, init_wldfruit, ROT0, "IGS", "Wild Fruit (V208US)", MACHINE_NOT_WORKING ) // IGS-----97----V208US -- cgit v1.2.3