Skip to content

Commit

Permalink
-igs/igs_m027xa.xpp: Fixed inputs for Crazy Bugs (V103JP).
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
cuavas committed Oct 4, 2024
1 parent 3526880 commit 347d50a
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 58 deletions.
2 changes: 1 addition & 1 deletion hash/lnux4004.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license:CC0-1.0
<softwarelist name="lnux4004" description="Linux/4004 SD Card images">

<software name="linux">
<description>uMIPS Linux 4.4.292+</description>
<description>Debian GNU/Linux 7 (Linux uMIPS 4.4.292+)</description>
<year>2024</year>
<publisher>Dmitry Grinberg</publisher>
<part name="linux4004" interface="sdcard">
Expand Down
45 changes: 40 additions & 5 deletions src/devices/bus/spectrum/musicmachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<acia6850_device> m_acia;
required_device<dac_byte_interface> m_dac;

bool m_irq_select;
};


void spectrum_musicmachine_device::device_add_mconfig(machine_config &config)
Expand All @@ -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
//**************************************************************************
Expand All @@ -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));
}

//-------------------------------------------------
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)")
31 changes: 1 addition & 30 deletions src/devices/bus/spectrum/musicmachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<acia6850_device> m_acia;
required_device<dac_byte_interface> 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
27 changes: 26 additions & 1 deletion src/devices/machine/sc16is741.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -572,13 +577,21 @@ 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;
}
else if (IER_MODEM_STATUS_INT() && (m_interrupts & INTERRUPT_MODEM_STATUS))
{
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);
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mame/hitachi/bml3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
80 changes: 60 additions & 20 deletions src/mame/igs/igs_m027xa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {

Expand All @@ -49,14 +49,16 @@ class igs_m027xa_state : public driver_device
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();
Expand All @@ -77,6 +79,7 @@ class igs_m027xa_state : public driver_device
required_device<okim6295_device> m_oki;
required_device<screen_device> m_screen;
optional_device<ticket_dispenser_device> m_ticket;
optional_device<hopper_device> m_hopper;
required_region_ptr<u32> m_external_rom;

optional_ioport_array<3> m_io_test;
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

}

Expand Down Expand Up @@ -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

0 comments on commit 347d50a

Please sign in to comment.