Skip to content

Commit

Permalink
-dynax.cpp: More I/O stuff:
Browse files Browse the repository at this point in the history
* Added hopper to Mahjong Electron Base games.
* Suppress side effects for Mahjong Electromagnetic Base keyboard read.
* Started moving common mahjong DIP switches to macros.

-toaplan: Cleanup:
* Renamed "reset" member function as it clashes with device_t::reset.
* Removed some pointless tests of required object finders.
* Sorted #includes.

-Tidied some other stuff.
  • Loading branch information
cuavas committed Nov 29, 2024
1 parent 27fb4e3 commit 2fc18e5
Show file tree
Hide file tree
Showing 21 changed files with 541 additions and 634 deletions.
6 changes: 5 additions & 1 deletion src/devices/bus/heathzenith/h89/h17_fdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#define FUNCNAME __PRETTY_FUNCTION__
#endif

namespace {

class heath_h17_fdc_device : public device_t, public device_h89bus_right_card_interface
{
public:
Expand All @@ -49,7 +51,7 @@ class heath_h17_fdc_device : public device_t, public device_h89bus_right_card_in
virtual void write(u8 select_lines, u8 offset, u8 data) override;
virtual u8 read(u8 select_lines, u8 offset) override;

void side_select_w(int state);
[[maybe_unused]] void side_select_w(int state);

protected:
static constexpr u8 MAX_FLOPPY_DRIVES = 3;
Expand Down Expand Up @@ -360,4 +362,6 @@ void heath_h17_fdc_device::sync_character_received(int state)
m_sync_char_received = bool(!BIT(state, 0));
}

} // anonymous namespace

DEFINE_DEVICE_TYPE_PRIVATE(H89BUS_H_17_FDC, device_h89bus_right_card_interface, heath_h17_fdc_device, "h89_h17_fdc", "Heath H-17 Hard-sectored Controller (H-88-1)");
392 changes: 165 additions & 227 deletions src/mame/dynax/dynax.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/mame/epson/qx10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "bus/rs232/rs232.h"
#include "cpu/z80/z80.h"
#include "imagedev/floppy.h"
#include "imagedev/snapquik.h"
#include "machine/am9517a.h"
#include "machine/i8255.h"
#include "machine/mc146818.h"
Expand All @@ -50,13 +51,12 @@
#include "machine/upd765.h"
#include "machine/z80sio.h"
#include "sound/spkrdev.h"
#include "speaker.h"
#include "video/upd7220.h"
#include "emupal.h"

#include "emupal.h"
#include "speaker.h"
#include "screen.h"
#include "softlist_dev.h"
#include "imagedev/snapquik.h"


namespace {
Expand Down
22 changes: 11 additions & 11 deletions src/mame/toaplan/batsugun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

#include "emu.h"

#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"

#include "gp9001.h"
#include "toaplan_coincounter.h"
#include "toaplipt.h"
#include "gp9001.h"

#include "cpu/m68000/m68000.h"
#include "cpu/nec/v25.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"

#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"

/*
Name Board No Maker Game name
----------------------------------------------------------------------------
Expand Down Expand Up @@ -51,7 +51,7 @@ class batsugun_state : public driver_device
, m_coincounter(*this, "coincounter")
{ }

void batsugun(machine_config &config);
void batsugun(machine_config &config) ATTR_COLD;

protected:
virtual void machine_reset() override ATTR_COLD;
Expand All @@ -74,7 +74,7 @@ class batsugun_state : public driver_device

void screen_vblank(int state);

void reset(int state);
void reset_audiocpu(int state);

optional_shared_ptr<u8> m_shared_ram; // 8 bit RAM shared between 68K and sound CPU
optional_device<cpu_device> m_audiocpu;
Expand Down Expand Up @@ -190,15 +190,15 @@ void batsugun_state::screen_vblank(int state)
}


void batsugun_state::reset(int state)
void batsugun_state::reset_audiocpu(int state)
{
if (state)
coin_sound_reset_w(0);
}

void batsugun_state::machine_reset()
{
if (m_audiocpu.found())
if (m_audiocpu)
coin_sound_reset_w(0);
}

Expand Down Expand Up @@ -389,7 +389,7 @@ void batsugun_state::batsugun(machine_config &config)
/* basic machine hardware */
M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator
m_maincpu->set_addrmap(AS_PROGRAM, &batsugun_state::batsugun_68k_mem);
m_maincpu->reset_cb().set(FUNC(batsugun_state::reset));
m_maincpu->reset_cb().set(FUNC(batsugun_state::reset_audiocpu));

v25_device &audiocpu(V25(config, m_audiocpu, 32_MHz_XTAL/2)); // NEC V25 type Toaplan marked CPU ???
audiocpu.set_addrmap(AS_PROGRAM, &batsugun_state::v25_mem);
Expand Down
111 changes: 45 additions & 66 deletions src/mame/toaplan/dogyuun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@

#include "emu.h"

#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"

#include "gp9001.h"
#include "toaplan_coincounter.h"
#include "toaplan_v25_tables.h"
#include "toaplipt.h"
#include "gp9001.h"

#include "cpu/m68000/m68000.h"
#include "cpu/nec/v25.h"
#include "cpu/z80/z80.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"

#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"

/*
Name Board No Maker Game name
----------------------------------------------------------------------------
Expand All @@ -35,10 +35,10 @@ dogyuun - In the location test version, if you are hit while you have a bomb, t

namespace {

class dogyuun_base_state : public driver_device
class dogyuun_state : public driver_device
{
public:
dogyuun_base_state(const machine_config &mconfig, device_type type, const char *tag)
dogyuun_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
Expand All @@ -50,7 +50,8 @@ class dogyuun_base_state : public driver_device
, m_screen(*this, "screen")
{ }

void dogyuun_base(machine_config &config);
void dogyuun(machine_config &config) ATTR_COLD;
void dogyuunto(machine_config &config) ATTR_COLD;

protected:
virtual void machine_reset() override ATTR_COLD;
Expand All @@ -59,9 +60,9 @@ class dogyuun_base_state : public driver_device
u8 shared_ram_r(offs_t offset) { return m_shared_ram[offset]; }
void shared_ram_w(offs_t offset, u8 data) { m_shared_ram[offset] = data; }

void coin_sound_reset_w(u8 data);
template <unsigned B> void coin_sound_reset_w(u8 data);

u8 m_sound_reset_bit = 0;
void dogyuun_base(machine_config &config) ATTR_COLD;

required_device<m68000_base_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
Expand All @@ -75,58 +76,35 @@ class dogyuun_base_state : public driver_device

void screen_vblank(int state);

void reset(int state);
void reset_audiocpu(int state);

void dogyuun_68k_mem(address_map &map) ATTR_COLD;
void v25_mem(address_map &map) ATTR_COLD;
void dogyuunto_68k_mem(address_map &map) ATTR_COLD;
void dogyuunto_sound_z80_mem(address_map &map) ATTR_COLD;

required_device<toaplan_coincounter_device> m_coincounter;
required_device<screen_device> m_screen;
bitmap_ind8 m_custom_priority_bitmap;
bitmap_ind16 m_secondary_render_bitmap;
};

class dogyuun_state : public dogyuun_base_state
void dogyuun_state::reset_audiocpu(int state)
{
public:
dogyuun_state(const machine_config &mconfig, device_type type, const char *tag)
: dogyuun_base_state(mconfig, type, tag)
{
m_sound_reset_bit = 0x20;
}

void dogyuun(machine_config &config);

private:
void dogyuun_68k_mem(address_map &map) ATTR_COLD;
void v25_mem(address_map &map) ATTR_COLD;
};

class dogyuunto_state : public dogyuun_base_state
{
public:
dogyuunto_state(const machine_config &mconfig, device_type type, const char *tag)
: dogyuun_base_state(mconfig, type, tag)
if (state)
{
m_sound_reset_bit = 0x10;
m_coincounter->coin_w(0);
m_audiocpu->set_input_line(ASSERT_LINE);
}

void dogyuunto(machine_config &config);

private:
void dogyuunto_68k_mem(address_map &map) ATTR_COLD;
void dogyuunto_sound_z80_mem(address_map &map) ATTR_COLD;
};

void dogyuun_base_state::reset(int state)
{
if (state)
coin_sound_reset_w(0);
}

void dogyuun_base_state::machine_reset()
void dogyuun_state::machine_reset()
{
coin_sound_reset_w(0);
m_coincounter->coin_w(0);
m_audiocpu->set_input_line(ASSERT_LINE);
}

void dogyuun_base_state::video_start()
void dogyuun_state::video_start()
{
m_screen->register_screen_bitmap(m_custom_priority_bitmap);
m_secondary_render_bitmap.reset();
Expand All @@ -135,7 +113,7 @@ void dogyuun_base_state::video_start()
m_vdp[1]->custom_priority_bitmap = &m_custom_priority_bitmap;
}

void dogyuun_base_state::screen_vblank(int state)
void dogyuun_state::screen_vblank(int state)
{
if (state) // rising edge
{
Expand All @@ -144,7 +122,7 @@ void dogyuun_base_state::screen_vblank(int state)
}
}

u32 dogyuun_base_state::screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 dogyuun_state::screen_update_dogyuun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(0, cliprect);
m_custom_priority_bitmap.fill(0, cliprect);
Expand Down Expand Up @@ -286,10 +264,11 @@ static INPUT_PORTS_START( dogyuunt )
PORT_CONFSETTING( 0x00f0, "Japan (Taito Corp.)" )
INPUT_PORTS_END

void dogyuun_base_state::coin_sound_reset_w(u8 data)
template <unsigned B>
void dogyuun_state::coin_sound_reset_w(u8 data)
{
m_coincounter->coin_w(data & ~m_sound_reset_bit);
m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & m_sound_reset_bit) ? CLEAR_LINE : ASSERT_LINE);
m_coincounter->coin_w(data & ~(u8(1) << B));
m_audiocpu->set_input_line(INPUT_LINE_RESET, BIT(data, B) ? CLEAR_LINE : ASSERT_LINE);
}

void dogyuun_state::dogyuun_68k_mem(address_map &map)
Expand All @@ -299,7 +278,7 @@ void dogyuun_state::dogyuun_68k_mem(address_map &map)
map(0x200010, 0x200011).portr("IN1");
map(0x200014, 0x200015).portr("IN2");
map(0x200018, 0x200019).portr("SYS");
map(0x20001d, 0x20001d).w(FUNC(dogyuun_state::coin_sound_reset_w)); // Coin count/lock + v25 reset line
map(0x20001d, 0x20001d).w(FUNC(dogyuun_state::coin_sound_reset_w<5>)); // Coin count/lock + v25 reset line
map(0x210000, 0x21ffff).rw(FUNC(dogyuun_state::shared_ram_r), FUNC(dogyuun_state::shared_ram_w)).umask16(0x00ff);
map(0x300000, 0x30000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x400000, 0x400fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
Expand All @@ -308,12 +287,12 @@ void dogyuun_state::dogyuun_68k_mem(address_map &map)
}


void dogyuunto_state::dogyuunto_68k_mem(address_map &map)
void dogyuun_state::dogyuunto_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x103fff).ram();
map(0x218000, 0x218fff).rw(FUNC(dogyuunto_state::shared_ram_r), FUNC(dogyuunto_state::shared_ram_w)).umask16(0x00ff); // reads the same area as the finished game on startup, but then uses only this part
map(0x21c01d, 0x21c01d).w(FUNC(dogyuunto_state::coin_sound_reset_w)); // Coin count/lock + Z80 reset line
map(0x218000, 0x218fff).rw(FUNC(dogyuun_state::shared_ram_r), FUNC(dogyuun_state::shared_ram_w)).umask16(0x00ff); // reads the same area as the finished game on startup, but then uses only this part
map(0x21c01d, 0x21c01d).w(FUNC(dogyuun_state::coin_sound_reset_w<4>)); // Coin count/lock + Z80 reset line
map(0x21c020, 0x21c021).portr("IN1");
map(0x21c024, 0x21c025).portr("IN2");
map(0x21c028, 0x21c029).portr("SYS");
Expand All @@ -325,7 +304,7 @@ void dogyuunto_state::dogyuunto_68k_mem(address_map &map)
map(0x700000, 0x700001).r(m_vdp[0], FUNC(gp9001vdp_device::vdpcount_r)); // test bit 8
}

void dogyuunto_state::dogyuunto_sound_z80_mem(address_map &map)
void dogyuun_state::dogyuunto_sound_z80_mem(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0xc000, 0xc7ff).ram().share(m_shared_ram);
Expand All @@ -340,20 +319,20 @@ void dogyuun_state::v25_mem(address_map &map)
map(0x80000, 0x87fff).mirror(0x78000).ram().share(m_shared_ram);
}

void dogyuun_base_state::dogyuun_base(machine_config &config)
void dogyuun_state::dogyuun_base(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, 25_MHz_XTAL/2); /* verified on pcb */
m_maincpu->reset_cb().set(FUNC(dogyuun_base_state::reset));
m_maincpu->reset_cb().set(FUNC(dogyuun_state::reset_audiocpu));

TOAPLAN_COINCOUNTER(config, m_coincounter, 0);

/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240);
m_screen->set_screen_update(FUNC(dogyuun_base_state::screen_update_dogyuun));
m_screen->screen_vblank().set(FUNC(dogyuun_base_state::screen_vblank));
m_screen->set_screen_update(FUNC(dogyuun_state::screen_update_dogyuun));
m_screen->screen_vblank().set(FUNC(dogyuun_state::screen_vblank));
m_screen->set_palette(m_palette);

PALETTE(config, m_palette).set_format(palette_device::xBGR_555, gp9001vdp_device::VDP_PALETTE_LENGTH);
Expand Down Expand Up @@ -390,15 +369,15 @@ void dogyuun_state::dogyuun(machine_config& config)
}


void dogyuunto_state::dogyuunto(machine_config &config)
void dogyuun_state::dogyuunto(machine_config &config)
{
dogyuun_base(config);

m_maincpu->set_addrmap(AS_PROGRAM, &dogyuunto_state::dogyuunto_68k_mem);
m_maincpu->set_addrmap(AS_PROGRAM, &dogyuun_state::dogyuunto_68k_mem);
m_maincpu->set_clock(24_MHz_XTAL / 2); // 24 MHz instead of 25

z80_device &audiocpu(Z80(config, "audiocpu", 27_MHz_XTAL / 8)); // guessed divisor
audiocpu.set_addrmap(AS_PROGRAM, &dogyuunto_state::dogyuunto_sound_z80_mem);
audiocpu.set_addrmap(AS_PROGRAM, &dogyuun_state::dogyuunto_sound_z80_mem);

m_oki->set_clock(1.056_MHz_XTAL); // blue resonator 1056J
}
Expand Down Expand Up @@ -524,4 +503,4 @@ GAME( 1992, dogyuun, 0, dogyuun, dogyuun, dogyuun_state, empt
GAME( 1992, dogyuuna, dogyuun, dogyuun, dogyuuna, dogyuun_state, empty_init, ROT270, "Toaplan", "Dogyuun (older set)", MACHINE_SUPPORTS_SAVE )
GAME( 1992, dogyuunb, dogyuun, dogyuun, dogyuunt, dogyuun_state, empty_init, ROT270, "Toaplan", "Dogyuun (oldest set)", MACHINE_SUPPORTS_SAVE ) // maybe a newer location test version, instead
GAME( 1992, dogyuunt, dogyuun, dogyuun, dogyuunt, dogyuun_state, empty_init, ROT270, "Toaplan", "Dogyuun (10/9/1992 location test)", MACHINE_SUPPORTS_SAVE )
GAME( 1992, dogyuunto, dogyuun, dogyuunto, dogyuunt, dogyuunto_state, empty_init, ROT270, "Toaplan", "Dogyuun (8/25/1992 location test)", MACHINE_SUPPORTS_SAVE )
GAME( 1992, dogyuunto, dogyuun, dogyuunto, dogyuunt, dogyuun_state, empty_init, ROT270, "Toaplan", "Dogyuun (8/25/1992 location test)", MACHINE_SUPPORTS_SAVE )
Loading

0 comments on commit 2fc18e5

Please sign in to comment.