shootout.c: added save state support, removed a couple of sound trampolines (nw)

This commit is contained in:
Ivan Vangelista 2015-02-17 21:24:41 +01:00
parent ab6765d639
commit 0490b53f5c
3 changed files with 55 additions and 57 deletions

View File

@ -42,7 +42,7 @@
/*******************************************************************************/
WRITE8_MEMBER(shootout_state::shootout_bankswitch_w)
WRITE8_MEMBER(shootout_state::bankswitch_w)
{
membank("bank1")->set_entry(data & 0x0f);
}
@ -53,12 +53,12 @@ WRITE8_MEMBER(shootout_state::sound_cpu_command_w)
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
}
WRITE8_MEMBER(shootout_state::shootout_flipscreen_w)
WRITE8_MEMBER(shootout_state::flipscreen_w)
{
flip_screen_set(data & 0x01);
}
WRITE8_MEMBER(shootout_state::shootout_coin_counter_w)
WRITE8_MEMBER(shootout_state::coincounter_w)
{
coin_counter_w(machine(), 0, data);
}
@ -67,14 +67,14 @@ WRITE8_MEMBER(shootout_state::shootout_coin_counter_w)
static ADDRESS_MAP_START( shootout_map, AS_PROGRAM, 8, shootout_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x1000) AM_READ_PORT("DSW1") AM_WRITE(shootout_bankswitch_w)
AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1") AM_WRITE(shootout_flipscreen_w)
AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2") AM_WRITE(shootout_coin_counter_w)
AM_RANGE(0x1000, 0x1000) AM_READ_PORT("DSW1") AM_WRITE(bankswitch_w)
AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1") AM_WRITE(flipscreen_w)
AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2") AM_WRITE(coincounter_w)
AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2") AM_WRITE(sound_cpu_command_w)
AM_RANGE(0x1004, 0x17ff) AM_RAM
AM_RANGE(0x1800, 0x19ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(shootout_textram_w) AM_SHARE("textram")
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(shootout_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram")
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -85,11 +85,11 @@ static ADDRESS_MAP_START( shootouj_map, AS_PROGRAM, 8, shootout_state )
AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1")
AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2")
AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2")
AM_RANGE(0x1800, 0x1800) AM_WRITE(shootout_coin_counter_w)
AM_RANGE(0x1800, 0x1800) AM_WRITE(coincounter_w)
AM_RANGE(0x2000, 0x21ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(shootout_textram_w) AM_SHARE("textram")
AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(shootout_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(textram_w) AM_SHARE("textram")
AM_RANGE(0x3800, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -229,15 +229,7 @@ static GFXDECODE_START( shootout )
GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 0, 16 ) /* tiles */
GFXDECODE_END
WRITE_LINE_MEMBER(shootout_state::shootout_snd_irq)
{
m_audiocpu->set_input_line(0, state);
}
WRITE_LINE_MEMBER(shootout_state::shootout_snd2_irq)
{
m_maincpu->set_input_line(0, state);
}
static MACHINE_CONFIG_START( shootout, shootout_state )
@ -265,7 +257,7 @@ static MACHINE_CONFIG_START( shootout, shootout_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(shootout_state, shootout_snd_irq))
MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", M6502_IRQ_LINE))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
@ -293,9 +285,9 @@ static MACHINE_CONFIG_START( shootouj, shootout_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
MCFG_YM2203_IRQ_HANDLER(WRITELINE(shootout_state, shootout_snd2_irq))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(shootout_state, shootout_bankswitch_w))
MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(shootout_state, shootout_flipscreen_w))
MCFG_YM2203_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(shootout_state, bankswitch_w))
MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(shootout_state, flipscreen_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
@ -398,6 +390,6 @@ DRIVER_INIT_MEMBER(shootout_state,shootout)
}
GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", 0)
GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", 0 )
GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", 0 )
GAME( 1985, shootout, 0, shootout, shootout, shootout_state, shootout, ROT0, "Data East USA", "Shoot Out (US)", GAME_SUPPORTS_SAVE )
GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, shootout, ROT0, "Data East Corporation", "Shoot Out (Japan)", GAME_SUPPORTS_SAVE )
GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, shootout, ROT0, "bootleg", "Shoot Out (Korean Bootleg)", GAME_SUPPORTS_SAVE )

View File

@ -3,39 +3,44 @@ class shootout_state : public driver_device
public:
shootout_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_textram(*this, "textram"),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_textram(*this, "textram"),
m_videoram(*this, "videoram") { }
tilemap_t *m_background;
tilemap_t *m_foreground;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_textram;
required_shared_ptr<UINT8> m_videoram;
int m_bFlicker;
DECLARE_WRITE8_MEMBER(shootout_bankswitch_w);
DECLARE_WRITE8_MEMBER(sound_cpu_command_w);
DECLARE_WRITE8_MEMBER(shootout_flipscreen_w);
DECLARE_WRITE8_MEMBER(shootout_coin_counter_w);
DECLARE_WRITE8_MEMBER(shootout_videoram_w);
DECLARE_WRITE8_MEMBER(shootout_textram_w);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_DRIVER_INIT(shootout);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
DECLARE_PALETTE_INIT(shootout);
UINT32 screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits );
DECLARE_WRITE_LINE_MEMBER(shootout_snd_irq);
DECLARE_WRITE_LINE_MEMBER(shootout_snd2_irq);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_textram;
required_shared_ptr<UINT8> m_videoram;
tilemap_t *m_background;
tilemap_t *m_foreground;
int m_bFlicker;
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(sound_cpu_command_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_WRITE8_MEMBER(coincounter_w);
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(textram_w);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_DRIVER_INIT(shootout);
virtual void video_start();
DECLARE_PALETTE_INIT(shootout);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
UINT32 screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits );
};

View File

@ -63,13 +63,13 @@ TILE_GET_INFO_MEMBER(shootout_state::get_fg_tile_info)
0);
}
WRITE8_MEMBER(shootout_state::shootout_videoram_w)
WRITE8_MEMBER(shootout_state::videoram_w)
{
m_videoram[offset] = data;
m_background->mark_tile_dirty(offset&0x3ff );
}
WRITE8_MEMBER(shootout_state::shootout_textram_w)
WRITE8_MEMBER(shootout_state::textram_w)
{
m_textram[offset] = data;
m_foreground->mark_tile_dirty(offset&0x3ff );
@ -80,13 +80,14 @@ void shootout_state::video_start()
m_background = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shootout_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_foreground = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shootout_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_foreground->set_transparent_pen(0 );
save_item(NAME(m_bFlicker));
}
void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits )
{
UINT8 *spriteram = m_spriteram;
gfx_element *gfx = m_gfxdecode->gfx(1);
const UINT8 *source = spriteram+127*4;
const UINT8 *source = m_spriteram+127*4;
int count;
m_bFlicker = !m_bFlicker;