mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
seta/srmp2.cpp: Consolidate driver in single file
This commit is contained in:
parent
34287c3719
commit
7589a714cb
@ -58,17 +58,166 @@ Note:
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "srmp2.h"
|
||||
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "video/x1_001.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class srmp2_state : public driver_device
|
||||
{
|
||||
public:
|
||||
srmp2_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_spritegen(*this, "spritegen"),
|
||||
m_msm(*this, "msm"),
|
||||
m_adpcm_rom(*this, "adpcm"),
|
||||
m_mainbank(*this, "mainbank"),
|
||||
m_keys(*this, "KEY%u", 0U),
|
||||
m_service(*this, "SERVICE")
|
||||
{ }
|
||||
|
||||
void mjyuugi(machine_config &config);
|
||||
void srmp2(machine_config &config);
|
||||
void rmgoldyh(machine_config &config);
|
||||
void srmp3(machine_config &config);
|
||||
|
||||
private:
|
||||
struct iox_t
|
||||
{
|
||||
int reset = 0, ff_event,ff_1 = 0, protcheck[4]{}, protlatch[4]{};
|
||||
uint8_t data = 0;
|
||||
uint8_t mux = 0;
|
||||
uint8_t ff = 0;
|
||||
};
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<x1_001_device> m_spritegen;
|
||||
required_device<msm5205_device> m_msm;
|
||||
required_region_ptr<uint8_t> m_adpcm_rom;
|
||||
optional_memory_bank m_mainbank;
|
||||
required_ioport_array<8> m_keys;
|
||||
required_ioport m_service;
|
||||
|
||||
uint8_t m_color_bank = 0;
|
||||
uint8_t m_gfx_bank = 0;
|
||||
uint8_t m_adpcm_bank = 0;
|
||||
int16_t m_adpcm_data = 0;
|
||||
uint32_t m_adpcm_sptr = 0;
|
||||
uint32_t m_adpcm_eptr = 0;
|
||||
iox_t m_iox;
|
||||
|
||||
// common
|
||||
uint8_t vox_status_r();
|
||||
uint8_t iox_mux_r();
|
||||
uint8_t iox_status_r();
|
||||
void iox_command_w(uint8_t data);
|
||||
void iox_data_w(uint8_t data);
|
||||
void adpcm_int(int state);
|
||||
|
||||
// mjuugi
|
||||
void mjyuugi_flags_w(uint16_t data);
|
||||
void mjyuugi_adpcm_bank_w(uint16_t data);
|
||||
uint8_t mjyuugi_irq2_ack_r(address_space &space);
|
||||
uint8_t mjyuugi_irq4_ack_r(address_space &space);
|
||||
|
||||
// rmgoldyh
|
||||
void rmgoldyh_rombank_w(uint8_t data);
|
||||
|
||||
// srmp2
|
||||
void srmp2_irq2_ack_w(uint8_t data);
|
||||
void srmp2_irq4_ack_w(uint8_t data);
|
||||
void srmp2_flags_w(uint16_t data);
|
||||
void adpcm_code_w(uint8_t data);
|
||||
|
||||
// srmp3
|
||||
void srmp3_rombank_w(uint8_t data);
|
||||
void srmp3_flags_w(uint8_t data);
|
||||
void srmp3_irq_ack_w(uint8_t data);
|
||||
|
||||
virtual void machine_start() override;
|
||||
DECLARE_MACHINE_START(srmp2);
|
||||
void srmp2_palette(palette_device &palette) const;
|
||||
DECLARE_MACHINE_START(srmp3);
|
||||
void srmp3_palette(palette_device &palette) const;
|
||||
DECLARE_MACHINE_START(rmgoldyh);
|
||||
DECLARE_MACHINE_START(mjyuugi);
|
||||
|
||||
uint32_t screen_update_srmp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
X1_001_SPRITE_GFXBANK_CB_MEMBER(srmp3_gfxbank_callback);
|
||||
|
||||
uint8_t iox_key_matrix_calc(uint8_t p_side);
|
||||
|
||||
void mjyuugi_map(address_map &map);
|
||||
void rmgoldyh_io_map(address_map &map);
|
||||
void rmgoldyh_map(address_map &map);
|
||||
void srmp2_map(address_map &map);
|
||||
void srmp3_io_map(address_map &map);
|
||||
void srmp3_map(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Video hardware
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void srmp2_state::srmp2_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
for (int i = 0; i < palette.entries(); i++)
|
||||
{
|
||||
int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
|
||||
palette.set_pen_color(i ^ 0x0f, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void srmp2_state::srmp3_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
for (int i = 0; i < palette.entries(); i++)
|
||||
{
|
||||
int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
|
||||
palette.set_pen_color(i,pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
|
||||
}
|
||||
}
|
||||
|
||||
X1_001_SPRITE_GFXBANK_CB_MEMBER(srmp2_state::srmp3_gfxbank_callback)
|
||||
{
|
||||
return (code & 0x3fff) + ((code & 0x2000) ? (m_gfx_bank<<13) : 0);
|
||||
}
|
||||
|
||||
|
||||
uint32_t srmp2_state::screen_update_srmp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1ff, cliprect);
|
||||
|
||||
m_spritegen->set_colorbase(m_color_bank<<5);
|
||||
|
||||
m_spritegen->draw_sprites(screen,bitmap,cliprect,0x1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t srmp2_state::screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1f0, cliprect);
|
||||
|
||||
m_spritegen->draw_sprites(screen,bitmap,cliprect,0x1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -1586,6 +1735,7 @@ ROM_START( ponchina )
|
||||
ROM_LOAD( "um2_1_10.u63", 0x080000, 0x080000, CRC(53e643e9) SHA1(3b221217e8f846ae96a9a47149037cea19d97549) )
|
||||
ROM_END
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
GAME( 1987, srmp1, 0, srmp2, srmp2, srmp2_state, empty_init, ROT0, "Seta", "Super Real Mahjong Part 1 (Japan)", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -1,106 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Yochizo, Takahiro Nogi
|
||||
#ifndef MAME_SETA_SRMP2_H
|
||||
#define MAME_SETA_SRMP2_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sound/msm5205.h"
|
||||
#include "video/x1_001.h"
|
||||
#include "emupal.h"
|
||||
|
||||
class srmp2_state : public driver_device
|
||||
{
|
||||
public:
|
||||
srmp2_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_spritegen(*this, "spritegen"),
|
||||
m_msm(*this, "msm"),
|
||||
m_adpcm_rom(*this, "adpcm"),
|
||||
m_mainbank(*this, "mainbank"),
|
||||
m_keys(*this, "KEY%u", 0U),
|
||||
m_service(*this, "SERVICE")
|
||||
{ }
|
||||
|
||||
void mjyuugi(machine_config &config);
|
||||
void srmp2(machine_config &config);
|
||||
void rmgoldyh(machine_config &config);
|
||||
void srmp3(machine_config &config);
|
||||
|
||||
private:
|
||||
struct iox_t
|
||||
{
|
||||
int reset = 0, ff_event,ff_1 = 0, protcheck[4]{}, protlatch[4]{};
|
||||
uint8_t data = 0;
|
||||
uint8_t mux = 0;
|
||||
uint8_t ff = 0;
|
||||
};
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<x1_001_device> m_spritegen;
|
||||
required_device<msm5205_device> m_msm;
|
||||
required_region_ptr<uint8_t> m_adpcm_rom;
|
||||
optional_memory_bank m_mainbank;
|
||||
required_ioport_array<8> m_keys;
|
||||
required_ioport m_service;
|
||||
|
||||
uint8_t m_color_bank = 0;
|
||||
uint8_t m_gfx_bank = 0;
|
||||
uint8_t m_adpcm_bank = 0;
|
||||
int16_t m_adpcm_data = 0;
|
||||
uint32_t m_adpcm_sptr = 0;
|
||||
uint32_t m_adpcm_eptr = 0;
|
||||
iox_t m_iox;
|
||||
|
||||
// common
|
||||
uint8_t vox_status_r();
|
||||
uint8_t iox_mux_r();
|
||||
uint8_t iox_status_r();
|
||||
void iox_command_w(uint8_t data);
|
||||
void iox_data_w(uint8_t data);
|
||||
void adpcm_int(int state);
|
||||
|
||||
// mjuugi
|
||||
void mjyuugi_flags_w(uint16_t data);
|
||||
void mjyuugi_adpcm_bank_w(uint16_t data);
|
||||
uint8_t mjyuugi_irq2_ack_r(address_space &space);
|
||||
uint8_t mjyuugi_irq4_ack_r(address_space &space);
|
||||
|
||||
// rmgoldyh
|
||||
void rmgoldyh_rombank_w(uint8_t data);
|
||||
|
||||
// srmp2
|
||||
void srmp2_irq2_ack_w(uint8_t data);
|
||||
void srmp2_irq4_ack_w(uint8_t data);
|
||||
void srmp2_flags_w(uint16_t data);
|
||||
void adpcm_code_w(uint8_t data);
|
||||
|
||||
// srmp3
|
||||
void srmp3_rombank_w(uint8_t data);
|
||||
void srmp3_flags_w(uint8_t data);
|
||||
void srmp3_irq_ack_w(uint8_t data);
|
||||
|
||||
virtual void machine_start() override;
|
||||
DECLARE_MACHINE_START(srmp2);
|
||||
void srmp2_palette(palette_device &palette) const;
|
||||
DECLARE_MACHINE_START(srmp3);
|
||||
void srmp3_palette(palette_device &palette) const;
|
||||
DECLARE_MACHINE_START(rmgoldyh);
|
||||
DECLARE_MACHINE_START(mjyuugi);
|
||||
|
||||
uint32_t screen_update_srmp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
X1_001_SPRITE_GFXBANK_CB_MEMBER(srmp3_gfxbank_callback);
|
||||
|
||||
uint8_t iox_key_matrix_calc(uint8_t p_side);
|
||||
|
||||
void mjyuugi_map(address_map &map);
|
||||
void rmgoldyh_io_map(address_map &map);
|
||||
void rmgoldyh_map(address_map &map);
|
||||
void srmp2_map(address_map &map);
|
||||
void srmp3_io_map(address_map &map);
|
||||
void srmp3_map(address_map &map);
|
||||
};
|
||||
|
||||
#endif // MAME_SETA_SRMP2_H
|
@ -1,56 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Yochizo, Takahiro Nogi
|
||||
/***************************************************************************
|
||||
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "srmp2.h"
|
||||
|
||||
void srmp2_state::srmp2_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
for (int i = 0; i < palette.entries(); i++)
|
||||
{
|
||||
int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
|
||||
palette.set_pen_color(i ^ 0x0f, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void srmp2_state::srmp3_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
for (int i = 0; i < palette.entries(); i++)
|
||||
{
|
||||
int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
|
||||
palette.set_pen_color(i,pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
|
||||
}
|
||||
}
|
||||
|
||||
X1_001_SPRITE_GFXBANK_CB_MEMBER(srmp2_state::srmp3_gfxbank_callback)
|
||||
{
|
||||
return (code & 0x3fff) + ((code & 0x2000) ? (m_gfx_bank<<13) : 0);
|
||||
}
|
||||
|
||||
|
||||
uint32_t srmp2_state::screen_update_srmp2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1ff, cliprect);
|
||||
|
||||
m_spritegen->set_colorbase(m_color_bank<<5);
|
||||
|
||||
m_spritegen->draw_sprites(screen,bitmap,cliprect,0x1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t srmp2_state::screen_update_srmp3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(0x1f0, cliprect);
|
||||
|
||||
m_spritegen->draw_sprites(screen,bitmap,cliprect,0x1000);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user