stadhero.cpp : Minor cleanups, Add notes

Removal some MCFGs, Fix some namings, Cleanup gfxdecode, Reduce unnecessary handlers
This commit is contained in:
cam900 2018-11-09 10:47:32 +09:00
parent ae69b747b8
commit 3dcc8ec155
5 changed files with 56 additions and 68 deletions

View File

@ -18,6 +18,9 @@
HSync = 15.6246kHz HSync = 15.6246kHz
VSync = 57.4434Hz VSync = 57.4434Hz
TODO : RNG issue? Some behavior isn't correct (ex: BGM randomizer).
reference: https://youtu.be/6azneK6uUnA
***************************************************************************/ ***************************************************************************/
#include "emu.h" #include "emu.h"
@ -35,20 +38,9 @@
/******************************************************************************/ /******************************************************************************/
WRITE16_MEMBER(stadhero_state::stadhero_control_w) WRITE16_MEMBER(stadhero_state::int_ack_w)
{ {
switch (offset<<1) m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE);
{
case 4: /* Interrupt ack (VBL - IRQ 5) */
break;
case 6: /* 6502 sound cpu */
m_soundlatch->write(space, 0, data & 0xff);
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
break;
default:
logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",m_maincpu->pc(),data,0x30c010+offset);
break;
}
} }
@ -57,14 +49,14 @@ WRITE16_MEMBER(stadhero_state::stadhero_control_w)
void stadhero_state::main_map(address_map &map) void stadhero_state::main_map(address_map &map)
{ {
map(0x000000, 0x01ffff).rom(); map(0x000000, 0x01ffff).rom();
map(0x200000, 0x2007ff).ram().w(FUNC(stadhero_state::stadhero_pf1_data_w)).share("pf1_data"); map(0x200000, 0x2007ff).ram().w(FUNC(stadhero_state::pf1_data_w)).share("pf1_data");
map(0x240000, 0x240007).w(m_tilegen1, FUNC(deco_bac06_device::pf_control_0_w)); /* text layer */ map(0x240000, 0x240007).w(m_tilegen, FUNC(deco_bac06_device::pf_control_0_w)); /* text layer */
map(0x240010, 0x240017).w(m_tilegen1, FUNC(deco_bac06_device::pf_control_1_w)); map(0x240010, 0x240017).w(m_tilegen, FUNC(deco_bac06_device::pf_control_1_w));
map(0x260000, 0x261fff).rw(m_tilegen1, FUNC(deco_bac06_device::pf_data_r), FUNC(deco_bac06_device::pf_data_w)); map(0x260000, 0x261fff).rw(m_tilegen, FUNC(deco_bac06_device::pf_data_r), FUNC(deco_bac06_device::pf_data_w));
map(0x30c000, 0x30c001).portr("INPUTS"); map(0x30c000, 0x30c001).portr("INPUTS");
map(0x30c002, 0x30c003).portr("COIN"); map(0x30c002, 0x30c003).portr("COIN");
map(0x30c004, 0x30c005).portr("DSW"); map(0x30c004, 0x30c005).portr("DSW").w(FUNC(stadhero_state::int_ack_w));
map(0x30c000, 0x30c00b).w(FUNC(stadhero_state::stadhero_control_w)); map(0x30c007, 0x30c007).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x310000, 0x3107ff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x310000, 0x3107ff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
map(0xff8000, 0xffbfff).ram(); /* Main ram */ map(0xff8000, 0xffbfff).ram(); /* Main ram */
map(0xffc000, 0xffc7ff).mirror(0x000800).ram().share("spriteram"); map(0xffc000, 0xffc7ff).mirror(0x000800).ram().share("spriteram");
@ -160,37 +152,33 @@ INPUT_PORTS_END
static const gfx_layout charlayout = static const gfx_layout charlayout =
{ {
8,8, /* 8*8 chars */ 8,8, /* 8*8 chars */
4096, RGN_FRAC(1,3),
3, /* 4 bits per pixel */ 3, /* 4 bits per pixel */
{ 0x00000*8,0x8000*8,0x10000*8 }, { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) },
{ 0, 1, 2, 3, 4, 5, 6, 7 }, { STEP8(0,1) },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, { STEP8(0,8) },
8*8 /* every char takes 8 consecutive bytes */ 8*8 /* every char takes 8 consecutive bytes */
}; };
static const gfx_layout tile_3bpp = static const gfx_layout tile_3bpp =
{ {
16,16, 16,16,
2048, RGN_FRAC(1,3),
3, 3,
{ 0x20000*8, 0x10000*8, 0x00000*8 }, { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
{ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, { STEP8(16*8,1), STEP8(0,1) },
0, 1, 2, 3, 4, 5, 6, 7 }, { STEP16(0,8) },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
16*16 16*16
}; };
static const gfx_layout spritelayout = static const gfx_layout spritelayout =
{ {
16,16, 16,16,
4096, RGN_FRAC(1,4),
4, 4,
{ 0x60000*8,0x40000*8,0x20000*8,0x00000*8 }, { RGN_FRAC(3,4), RGN_FRAC(2,4), RGN_FRAC(1,4), RGN_FRAC(0,4) },
{ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7, { STEP8(16*8,1), STEP8(0,1) },
0, 1, 2, 3, 4, 5, 6, 7 }, { STEP16(0,8) },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
16*16 16*16
}; };
@ -207,37 +195,37 @@ MACHINE_CONFIG_START(stadhero_state::stadhero)
/* basic machine hardware */ /* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", M68000, 20_MHz_XTAL/2) MCFG_DEVICE_ADD("maincpu", M68000, 20_MHz_XTAL/2)
MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_PROGRAM_MAP(main_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", stadhero_state, irq5_line_hold) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", stadhero_state, irq5_line_assert)
MCFG_DEVICE_ADD("audiocpu", M6502, 24_MHz_XTAL/16) MCFG_DEVICE_ADD("audiocpu", M6502, 24_MHz_XTAL/16)
MCFG_DEVICE_PROGRAM_MAP(audio_map) MCFG_DEVICE_PROGRAM_MAP(audio_map)
/* video hardware */ /* video hardware */
MCFG_SCREEN_ADD("screen", RASTER) screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
MCFG_SCREEN_REFRESH_RATE(58) screen.set_refresh(HZ_TO_ATTOSECONDS(58));
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529)) screen.set_vblank_time(ATTOSECONDS_IN_USEC(529));
MCFG_SCREEN_SIZE(32*8, 32*8) screen.set_size(32*8, 32*8);
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1);
MCFG_SCREEN_UPDATE_DRIVER(stadhero_state, screen_update_stadhero) screen.set_screen_update(FUNC(stadhero_state::screen_update));
MCFG_SCREEN_PALETTE("palette") screen.set_palette("palette");
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_stadhero) GFXDECODE(config, m_gfxdecode, "palette", gfx_stadhero);
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0) PALETTE(config, "palette", 1024).set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
MCFG_DECO_BAC06_GFX_REGION_WIDE(1, 1, 2)
MCFG_DECO_BAC06_GFXDECODE("gfxdecode")
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0) DECO_BAC06(config, m_tilegen, 0);
MCFG_DECO_MXC06_GFX_REGION(2) m_tilegen->set_gfx_region_wide(1, 1, 2);
MCFG_DECO_MXC06_GFXDECODE("gfxdecode") m_tilegen->set_gfxdecode_tag(m_gfxdecode);
DECO_MXC06(config, m_spritegen, 0);
m_spritegen->set_gfx_region(2);
m_spritegen->set_gfxdecode_tag(m_gfxdecode);
/* sound hardware */ /* sound hardware */
SPEAKER(config, "mono").front_center(); SPEAKER(config, "mono").front_center();
MCFG_GENERIC_LATCH_8_ADD("soundlatch") GENERIC_LATCH_8(config, m_soundlatch, 0);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
MCFG_DEVICE_ADD("ym1", YM2203, 24_MHz_XTAL/16) MCFG_DEVICE_ADD("ym1", YM2203, 24_MHz_XTAL/16)
MCFG_SOUND_ROUTE(0, "mono", 0.95) MCFG_SOUND_ROUTE(0, "mono", 0.95)

View File

@ -8,11 +8,11 @@
class stadhero_state : public driver_device class stadhero_state : public driver_device
{ {
public: public:
stadhero_state(const machine_config &mconfig, device_type type, const char *tag) stadhero_state(const machine_config &mconfig, device_type type, const char *tag) :
: driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_tilegen1(*this, "tilegen1"), m_tilegen(*this, "tilegen"),
m_spritegen(*this, "spritegen"), m_spritegen(*this, "spritegen"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_soundlatch(*this, "soundlatch"), m_soundlatch(*this, "soundlatch"),
@ -24,7 +24,7 @@ public:
private: private:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<deco_bac06_device> m_tilegen1; required_device<deco_bac06_device> m_tilegen;
required_device<deco_mxc06_device> m_spritegen; required_device<deco_mxc06_device> m_spritegen;
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<generic_latch_8_device> m_soundlatch; required_device<generic_latch_8_device> m_soundlatch;
@ -34,13 +34,13 @@ private:
tilemap_t *m_pf1_tilemap; tilemap_t *m_pf1_tilemap;
DECLARE_WRITE16_MEMBER(stadhero_control_w); DECLARE_WRITE16_MEMBER(int_ack_w);
DECLARE_WRITE16_MEMBER(stadhero_pf1_data_w); DECLARE_WRITE16_MEMBER(pf1_data_w);
virtual void video_start() override; virtual void video_start() override;
TILE_GET_INFO_MEMBER(get_pf1_tile_info); TILE_GET_INFO_MEMBER(get_pf1_tile_info);
uint32_t screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void audio_map(address_map &map); void audio_map(address_map &map);
void main_map(address_map &map); void main_map(address_map &map);
}; };

View File

@ -23,7 +23,7 @@ public:
deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration // configuration
void set_gfxdecode_tag(const char *tag) { m_gfxdecode.set_tag(tag); } template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
void set_gfx_region_wide(int region8x8, int region16x16, int wide) void set_gfx_region_wide(int region8x8, int region16x16, int wide)
{ {
m_gfxregion8x8 = region8x8; m_gfxregion8x8 = region8x8;

View File

@ -12,7 +12,7 @@ public:
deco_mxc06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); deco_mxc06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration // configuration
void set_gfxdecode_tag(const char *tag) { m_gfxdecode.set_tag(tag); } template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
void set_gfx_region(int region) { m_gfxregion = region; } void set_gfx_region(int region) { m_gfxregion = region; }
void set_ram_size(int size) { m_ramsize = size; } void set_ram_size(int size) { m_ramsize = size; }

View File

@ -20,15 +20,15 @@
/******************************************************************************/ /******************************************************************************/
uint32_t stadhero_state::screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) uint32_t stadhero_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bool flip = m_tilegen1->get_flip_state(); bool flip = m_tilegen->get_flip_state();
m_tilegen1->set_flip_screen(flip); m_tilegen->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip); m_spritegen->set_flip_screen(flip);
m_pf1_tilemap->set_flip(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); m_pf1_tilemap->set_flip(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilegen1->set_bppmultmask(0x8, 0x7); m_tilegen->set_bppmultmask(0x8, 0x7);
m_tilegen1->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00); m_tilegen->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f); m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0,0); m_pf1_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0; return 0;
@ -36,7 +36,7 @@ uint32_t stadhero_state::screen_update_stadhero(screen_device &screen, bitmap_in
/******************************************************************************/ /******************************************************************************/
WRITE16_MEMBER(stadhero_state::stadhero_pf1_data_w) WRITE16_MEMBER(stadhero_state::pf1_data_w)
{ {
COMBINE_DATA(&m_pf1_data[offset]); COMBINE_DATA(&m_pf1_data[offset]);
m_pf1_tilemap->mark_tile_dirty(offset); m_pf1_tilemap->mark_tile_dirty(offset);