summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/rmhaihai.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/rmhaihai.cpp')
-rw-r--r--src/mame/drivers/rmhaihai.cpp79
1 files changed, 48 insertions, 31 deletions
diff --git a/src/mame/drivers/rmhaihai.cpp b/src/mame/drivers/rmhaihai.cpp
index 09b84f648f5..45bb8e1865c 100644
--- a/src/mame/drivers/rmhaihai.cpp
+++ b/src/mame/drivers/rmhaihai.cpp
@@ -40,49 +40,69 @@ TODO:
class rmhaihai_state : public driver_device
{
public:
- rmhaihai_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ rmhaihai_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_msm(*this, "msm"),
m_gfxdecode(*this, "gfxdecode"),
m_colorram(*this, "colorram"),
m_videoram(*this, "videoram") { }
- required_device<cpu_device> m_maincpu;
- required_device<msm5205_device> m_msm;
- required_device<gfxdecode_device> m_gfxdecode;
-
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
-
- tilemap_t *m_bg_tilemap;
- int m_keyboard_cmd;
- int m_gfxbank;
+ DECLARE_DRIVER_INIT(rmhaihai);
+ void rmhaihai(machine_config &config);
+protected:
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(colorram_w);
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_WRITE8_MEMBER(keyboard_w);
DECLARE_READ8_MEMBER(samples_r);
DECLARE_WRITE8_MEMBER(ctrl_w);
- DECLARE_WRITE8_MEMBER(themj_rombank_w);
DECLARE_WRITE8_MEMBER(adpcm_w);
- DECLARE_DRIVER_INIT(rmhaihai);
virtual void video_start() override;
- DECLARE_MACHINE_START(themj);
- DECLARE_MACHINE_RESET(themj);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- void themj(machine_config &config);
- void rmhaisei(machine_config &config);
- void rmhaihai(machine_config &config);
+
void rmhaihai_io_map(address_map &map);
void rmhaihai_map(address_map &map);
+
+private:
+ required_device<cpu_device> m_maincpu;
+ required_device<msm5205_device> m_msm;
+ required_device<gfxdecode_device> m_gfxdecode;
+
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+
+ tilemap_t *m_bg_tilemap;
+ int m_keyboard_cmd;
+ int m_gfxbank;
+};
+
+
+class rmhaisei_state : public rmhaihai_state
+{
+public:
+ using rmhaihai_state::rmhaihai_state;
+ void rmhaisei(machine_config &config);
+};
+
+
+class themj_state : public rmhaihai_state
+{
+public:
+ using rmhaihai_state::rmhaihai_state;
+ void themj(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
void themj_io_map(address_map &map);
void themj_map(address_map &map);
+ DECLARE_WRITE8_MEMBER(themj_rombank_w);
};
@@ -210,20 +230,20 @@ WRITE8_MEMBER(rmhaihai_state::ctrl_w)
m_gfxbank = (data & 0x40) >> 6; /* rmhaisei only */
}
-WRITE8_MEMBER(rmhaihai_state::themj_rombank_w)
+WRITE8_MEMBER(themj_state::themj_rombank_w)
{
logerror("banksw %d\n", data & 0x03);
membank("bank1")->set_entry(data & 0x03);
membank("bank2")->set_entry(data & 0x03);
}
-MACHINE_START_MEMBER(rmhaihai_state,themj)
+void themj_state::machine_start()
{
membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000);
membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x12000, 0x4000);
}
-MACHINE_RESET_MEMBER(rmhaihai_state,themj)
+void themj_state::machine_reset()
{
membank("bank1")->set_entry(0);
membank("bank2")->set_entry(0);
@@ -255,7 +275,7 @@ ADDRESS_MAP_START(rmhaihai_state::rmhaihai_io_map)
AM_RANGE(0xbc0c, 0xbc0c) AM_WRITENOP // ??
ADDRESS_MAP_END
-ADDRESS_MAP_START(rmhaihai_state::themj_map)
+ADDRESS_MAP_START(themj_state::themj_map)
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
AM_RANGE(0xa000, 0xa7ff) AM_RAM
@@ -265,7 +285,7 @@ ADDRESS_MAP_START(rmhaihai_state::themj_map)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
-ADDRESS_MAP_START(rmhaihai_state::themj_io_map)
+ADDRESS_MAP_START(themj_state::themj_io_map)
AM_RANGE(0x0000, 0x7fff) AM_READ(samples_r)
AM_RANGE(0x8000, 0x8000) AM_READ(keyboard_r) AM_WRITENOP // ??
AM_RANGE(0x8001, 0x8001) AM_READNOP AM_WRITE(keyboard_w) // ??
@@ -514,7 +534,7 @@ MACHINE_CONFIG_START(rmhaihai_state::rmhaihai)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(rmhaihai_state::rmhaisei)
+MACHINE_CONFIG_START(rmhaisei_state::rmhaisei)
rmhaihai(config);
/* basic machine hardware */
@@ -525,7 +545,7 @@ MACHINE_CONFIG_START(rmhaihai_state::rmhaisei)
MCFG_PALETTE_ENTRIES(0x200)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(rmhaihai_state::themj)
+MACHINE_CONFIG_START(themj_state::themj)
rmhaihai(config);
/* basic machine hardware */
@@ -534,9 +554,6 @@ MACHINE_CONFIG_START(rmhaihai_state::themj)
MCFG_CPU_PROGRAM_MAP(themj_map)
MCFG_CPU_IO_MAP(themj_io_map)
- MCFG_MACHINE_START_OVERRIDE(rmhaihai_state,themj)
- MCFG_MACHINE_RESET_OVERRIDE(rmhaihai_state,themj)
-
MCFG_DEVICE_REMOVE("nvram")
/* video hardware */
@@ -743,5 +760,5 @@ GAME( 1985, rmhaihai, 0, rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, R
GAME( 1985, rmhaihai2, rmhaihai, rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba", "Real Mahjong Haihai (Japan, older)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, rmhaihib, rmhaihai, rmhaihai, rmhaihib, rmhaihai_state, rmhaihai, ROT0, "Alba", "Real Mahjong Haihai [BET] (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, rmhaijin, 0, rmhaihai, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Alba", "Real Mahjong Haihai Jinji Idou Hen (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, rmhaisei, 0, rmhaisei, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "Real Mahjong Haihai Seichouhen (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1987, themj, 0, themj, rmhaihai, rmhaihai_state, rmhaihai, ROT0, "Visco", "The Mah-jong (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, rmhaisei, 0, rmhaisei, rmhaihai, rmhaisei_state, rmhaihai, ROT0, "Visco", "Real Mahjong Haihai Seichouhen (Japan)", MACHINE_SUPPORTS_SAVE )
+GAME( 1987, themj, 0, themj, rmhaihai, themj_state, rmhaihai, ROT0, "Visco", "The Mah-jong (Japan)", MACHINE_SUPPORTS_SAVE )