usgames.c: enabled save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-05-02 09:14:15 +02:00
parent b108f487f8
commit 938b279ad6
3 changed files with 39 additions and 35 deletions

View File

@ -35,7 +35,7 @@ void usgames_state::machine_start()
membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000); membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
} }
WRITE8_MEMBER(usgames_state::usgames_rombank_w) WRITE8_MEMBER(usgames_state::rombank_w)
{ {
membank("bank1")->set_entry(data); membank("bank1")->set_entry(data);
} }
@ -67,11 +67,11 @@ static ADDRESS_MAP_START( usgames_map, AS_PROGRAM, 8, usgames_state )
AM_RANGE(0x2040, 0x2040) AM_DEVWRITE("crtc", mc6845_device, address_w) AM_RANGE(0x2040, 0x2040) AM_DEVWRITE("crtc", mc6845_device, address_w)
AM_RANGE(0x2041, 0x2041) AM_READ_PORT("UNK1") AM_RANGE(0x2041, 0x2041) AM_READ_PORT("UNK1")
AM_RANGE(0x2041, 0x2041) AM_DEVWRITE("crtc", mc6845_device, register_w) AM_RANGE(0x2041, 0x2041) AM_DEVWRITE("crtc", mc6845_device, register_w)
AM_RANGE(0x2060, 0x2060) AM_WRITE(usgames_rombank_w) AM_RANGE(0x2060, 0x2060) AM_WRITE(rombank_w)
AM_RANGE(0x2070, 0x2070) AM_READ_PORT("UNK2") AM_RANGE(0x2070, 0x2070) AM_READ_PORT("UNK2")
AM_RANGE(0x2400, 0x2401) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) AM_RANGE(0x2400, 0x2401) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_SHARE("charram") AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(charram_w) AM_SHARE("charram")
AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(usgames_videoram_w) AM_SHARE("videoram") AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0xffff) AM_ROM AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -87,10 +87,10 @@ static ADDRESS_MAP_START( usg185_map, AS_PROGRAM, 8, usgames_state )
AM_RANGE(0x2440, 0x2440) AM_DEVWRITE("crtc", mc6845_device, address_w) AM_RANGE(0x2440, 0x2440) AM_DEVWRITE("crtc", mc6845_device, address_w)
AM_RANGE(0x2441, 0x2441) AM_READ_PORT("UNK1") AM_RANGE(0x2441, 0x2441) AM_READ_PORT("UNK1")
AM_RANGE(0x2441, 0x2441) AM_DEVWRITE("crtc", mc6845_device, register_w) AM_RANGE(0x2441, 0x2441) AM_DEVWRITE("crtc", mc6845_device, register_w)
AM_RANGE(0x2460, 0x2460) AM_WRITE(usgames_rombank_w) AM_RANGE(0x2460, 0x2460) AM_WRITE(rombank_w)
AM_RANGE(0x2470, 0x2470) AM_READ_PORT("UNK2") AM_RANGE(0x2470, 0x2470) AM_READ_PORT("UNK2")
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(usgames_charram_w) AM_SHARE("charram") AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(charram_w) AM_SHARE("charram")
AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(usgames_videoram_w) AM_SHARE("videoram") AM_RANGE(0x3000, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
AM_RANGE(0x8000, 0xffff) AM_ROM AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -226,7 +226,7 @@ static MACHINE_CONFIG_START( usg32, usgames_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(7*8, 57*8-1, 0*8, 31*8-1) MCFG_SCREEN_VISIBLE_AREA(7*8, 57*8-1, 0*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(usgames_state, screen_update_usgames) MCFG_SCREEN_UPDATE_DRIVER(usgames_state, screen_update)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", usgames) MCFG_GFXDECODE_ADD("gfxdecode", "palette", usgames)
@ -399,11 +399,11 @@ ROM_START( usg182 ) /* Version 18.2 */
ROM_END ROM_END
GAME( 1987, usg32, 0, usg32, usg32, driver_device, 0, ROT0, "U.S. Games", "Super Duper Casino (California V3.2)", 0 ) GAME( 1987, usg32, 0, usg32, usg32, driver_device, 0, ROT0, "U.S. Games", "Super Duper Casino (California V3.2)", GAME_SUPPORTS_SAVE )
GAME( 1988, superten, 0, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.3", 0 ) GAME( 1988, superten, 0, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.3", GAME_SUPPORTS_SAVE )
GAME( 1988, usg83x, superten, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.3X", 0 ) /* "Experimental" version?? */ GAME( 1988, usg83x, superten, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.3X", GAME_SUPPORTS_SAVE ) /* "Experimental" version?? */
GAME( 1988, usg82, superten, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.2" , 0) GAME( 1988, usg82, superten, usg32, usg83, driver_device, 0, ROT0, "U.S. Games", "Super Ten V8.2" , GAME_SUPPORTS_SAVE )
GAME( 1992, usgames, 0, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V25.4X", 0 ) GAME( 1992, usgames, 0, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V25.4X", GAME_SUPPORTS_SAVE )
GAME( 1991, usg187c, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.7C", 0 ) GAME( 1991, usg187c, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.7C", GAME_SUPPORTS_SAVE )
GAME( 1990, usg185, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.5", 0 ) GAME( 1990, usg185, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.5", GAME_SUPPORTS_SAVE )
GAME( 1989, usg182, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.2", 0 ) GAME( 1989, usg182, usgames, usg185, usg83, driver_device, 0, ROT0, "U.S. Games", "Games V18.2", GAME_SUPPORTS_SAVE )

View File

@ -3,24 +3,30 @@ class usgames_state : public driver_device
public: public:
usgames_state(const machine_config &mconfig, device_type type, const char *tag) usgames_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_charram(*this, "charram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode") { } m_gfxdecode(*this, "gfxdecode"),
m_videoram(*this, "videoram"),
m_charram(*this, "charram") { }
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_charram; required_shared_ptr<UINT8> m_charram;
tilemap_t *m_tilemap; tilemap_t *m_tilemap;
DECLARE_WRITE8_MEMBER(usgames_rombank_w);
DECLARE_WRITE8_MEMBER(rombank_w);
DECLARE_WRITE8_MEMBER(lamps1_w); DECLARE_WRITE8_MEMBER(lamps1_w);
DECLARE_WRITE8_MEMBER(lamps2_w); DECLARE_WRITE8_MEMBER(lamps2_w);
DECLARE_WRITE8_MEMBER(usgames_videoram_w); DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(usgames_charram_w); DECLARE_WRITE8_MEMBER(charram_w);
TILE_GET_INFO_MEMBER(get_usgames_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_start(); virtual void machine_start();
virtual void video_start(); virtual void video_start();
DECLARE_PALETTE_INIT(usgames); DECLARE_PALETTE_INIT(usgames);
UINT32 screen_update_usgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu; UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<gfxdecode_device> m_gfxdecode;
}; };

View File

@ -31,37 +31,35 @@ PALETTE_INIT_MEMBER(usgames_state, usgames)
TILE_GET_INFO_MEMBER(usgames_state::get_usgames_tile_info) TILE_GET_INFO_MEMBER(usgames_state::get_tile_info)
{ {
int tileno, colour; int tileno = m_videoram[tile_index*2];
int colour = m_videoram[tile_index*2+1];
tileno = m_videoram[tile_index*2];
colour = m_videoram[tile_index*2+1];
SET_TILE_INFO_MEMBER(0,tileno,colour,0); SET_TILE_INFO_MEMBER(0,tileno,colour,0);
} }
void usgames_state::video_start() void usgames_state::video_start()
{ {
m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(usgames_state::get_usgames_tile_info),this),TILEMAP_SCAN_ROWS, 8, 8,64,32); m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(usgames_state::get_tile_info),this),TILEMAP_SCAN_ROWS, 8, 8,64,32);
m_gfxdecode->gfx(0)->set_source(m_charram); m_gfxdecode->gfx(0)->set_source(m_charram);
} }
WRITE8_MEMBER(usgames_state::usgames_videoram_w) WRITE8_MEMBER(usgames_state::videoram_w)
{ {
m_videoram[offset] = data; m_videoram[offset] = data;
m_tilemap->mark_tile_dirty(offset/2); m_tilemap->mark_tile_dirty(offset/2);
} }
WRITE8_MEMBER(usgames_state::usgames_charram_w) WRITE8_MEMBER(usgames_state::charram_w)
{ {
m_charram[offset] = data; m_charram[offset] = data;
m_gfxdecode->gfx(0)->mark_dirty(offset/8); m_gfxdecode->gfx(0)->mark_dirty(offset/8);
} }
UINT32 usgames_state::screen_update_usgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 usgames_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_tilemap->draw(screen, bitmap, cliprect, 0,0); m_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0; return 0;