sidepckt.c: added save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-02-17 20:57:53 +01:00
parent 81f7539918
commit ab6765d639
3 changed files with 52 additions and 39 deletions

View File

@ -146,12 +146,12 @@ WRITE8_MEMBER(sidepckt_state::sound_cpu_command_w)
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
READ8_MEMBER(sidepckt_state::sidepckt_i8751_r)
READ8_MEMBER(sidepckt_state::i8751_r)
{
return m_i8751_return;
}
WRITE8_MEMBER(sidepckt_state::sidepckt_i8751_w)
WRITE8_MEMBER(sidepckt_state::i8751_w)
{
m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE); /* i8751 triggers FIRQ on main cpu */
@ -193,9 +193,9 @@ WRITE8_MEMBER(sidepckt_state::sidepckt_i8751_w)
static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sidepckt_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x1400, 0x17ff) AM_RAM // ???
AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(sidepckt_colorram_w) AM_SHARE("colorram")
AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0x1c00, 0x1fff) AM_RAM // ???
AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x2100, 0x24ff) AM_RAM // ???
@ -204,9 +204,9 @@ static ADDRESS_MAP_START( sidepckt_map, AS_PROGRAM, 8, sidepckt_state )
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("DSW1")
AM_RANGE(0x3003, 0x3003) AM_READ_PORT("DSW2")
AM_RANGE(0x3004, 0x3004) AM_WRITE(sound_cpu_command_w)
AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE(sidepckt_flipscreen_w)
AM_RANGE(0x3014, 0x3014) AM_READ(sidepckt_i8751_r)
AM_RANGE(0x3018, 0x3018) AM_WRITE(sidepckt_i8751_w)
AM_RANGE(0x300c, 0x300c) AM_READNOP AM_WRITE(flipscreen_w)
AM_RANGE(0x3014, 0x3014) AM_READ(i8751_r)
AM_RANGE(0x3018, 0x3018) AM_WRITE(i8751_w)
AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -377,7 +377,7 @@ static MACHINE_CONFIG_START( sidepckt, sidepckt_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */ )
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sidepckt_state, screen_update_sidepckt)
MCFG_SCREEN_UPDATE_DRIVER(sidepckt_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", sidepckt)
@ -488,6 +488,12 @@ DRIVER_INIT_MEMBER(sidepckt_state,sidepckt)
m_prot_table[0] = sidepckt_prot_table_1;
m_prot_table[1] = sidepckt_prot_table_2;
m_prot_table[2] = sidepckt_prot_table_3;
save_item(NAME(m_i8751_return));
save_item(NAME(m_current_ptr));
save_item(NAME(m_current_table));
save_item(NAME(m_in_math));
save_item(NAME(m_math_param));
}
DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj)
@ -495,9 +501,15 @@ DRIVER_INIT_MEMBER(sidepckt_state,sidepcktj)
m_prot_table[0] = sidepcktj_prot_table_1;
m_prot_table[1] = sidepcktj_prot_table_2;
m_prot_table[2] = sidepcktj_prot_table_3;
save_item(NAME(m_i8751_return));
save_item(NAME(m_current_ptr));
save_item(NAME(m_current_table));
save_item(NAME(m_in_math));
save_item(NAME(m_math_param));
}
GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", GAME_NO_COCKTAIL )
GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", GAME_NO_COCKTAIL )
GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device, 0, ROT0, "bootleg", "Side Pocket (bootleg)", GAME_NO_COCKTAIL )
GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, sidepcktj, ROT0, "Data East Corporation", "Side Pocket (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, driver_device, 0, ROT0, "bootleg", "Side Pocket (bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )

View File

@ -11,22 +11,23 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
m_spriteram(*this, "spriteram")
{ }
tilemap_t *m_bg_tilemap;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_spriteram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_spriteram;
tilemap_t *m_bg_tilemap;
const UINT8* m_prot_table[3];
UINT8 m_i8751_return;
UINT8 m_current_ptr;
@ -35,18 +36,21 @@ public:
UINT8 m_math_param;
DECLARE_WRITE8_MEMBER(sound_cpu_command_w);
DECLARE_READ8_MEMBER(sidepckt_i8751_r);
DECLARE_WRITE8_MEMBER(sidepckt_i8751_w);
DECLARE_WRITE8_MEMBER(sidepctj_i8751_w);
DECLARE_WRITE8_MEMBER(sidepckt_videoram_w);
DECLARE_WRITE8_MEMBER(sidepckt_colorram_w);
DECLARE_WRITE8_MEMBER(sidepckt_flipscreen_w);
DECLARE_READ8_MEMBER(i8751_r);
DECLARE_WRITE8_MEMBER(i8751_w);
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(colorram_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_DRIVER_INIT(sidepckt);
DECLARE_DRIVER_INIT(sidepcktj);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_reset();
virtual void video_start();
DECLARE_PALETTE_INIT(sidepckt);
UINT32 screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
};

View File

@ -86,19 +86,19 @@ void sidepckt_state::video_start()
***************************************************************************/
WRITE8_MEMBER(sidepckt_state::sidepckt_videoram_w)
WRITE8_MEMBER(sidepckt_state::videoram_w)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(sidepckt_state::sidepckt_colorram_w)
WRITE8_MEMBER(sidepckt_state::colorram_w)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(sidepckt_state::sidepckt_flipscreen_w)
WRITE8_MEMBER(sidepckt_state::flipscreen_w)
{
int flipscreen = data;
machine().tilemap().set_flip_all(flipscreen ? TILEMAP_FLIPY : TILEMAP_FLIPX);
@ -113,21 +113,18 @@ WRITE8_MEMBER(sidepckt_state::sidepckt_flipscreen_w)
void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
UINT8 *spriteram = m_spriteram;
int offs;
for (offs = 0;offs < m_spriteram.bytes(); offs += 4)
for (int offs = 0;offs < m_spriteram.bytes(); offs += 4)
{
int sx,sy,code,color,flipx,flipy;
code = spriteram[offs+3] + ((spriteram[offs+1] & 0x03) << 8);
color = (spriteram[offs+1] & 0xf0) >> 4;
code = m_spriteram[offs+3] + ((m_spriteram[offs+1] & 0x03) << 8);
color = (m_spriteram[offs+1] & 0xf0) >> 4;
sx = spriteram[offs+2]-2;
sy = spriteram[offs];
sx = m_spriteram[offs+2]-2;
sy = m_spriteram[offs];
flipx = spriteram[offs+1] & 0x08;
flipy = spriteram[offs+1] & 0x04;
flipx = m_spriteram[offs+1] & 0x08;
flipy = m_spriteram[offs+1] & 0x04;
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code,
@ -144,7 +141,7 @@ void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect
}
UINT32 sidepckt_state::screen_update_sidepckt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 sidepckt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
draw_sprites(bitmap,cliprect);