wrally.c: enabled save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-02-09 18:46:28 +01:00
parent 36247f2ffd
commit 3387b04afa
4 changed files with 34 additions and 29 deletions

View File

@ -103,7 +103,7 @@ produces a high clock frequency, slow movements a low freq.
static ADDRESS_MAP_START( wrally_map, AS_PROGRAM, 16, wrally_state ) static ADDRESS_MAP_START( wrally_map, AS_PROGRAM, 16, wrally_state )
AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */
AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(wrally_vram_w) AM_SHARE("videoram") /* encrypted Video RAM */ AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* encrypted Video RAM */
AM_RANGE(0x108000, 0x108007) AM_RAM AM_SHARE("vregs") /* Video Registers */ AM_RANGE(0x108000, 0x108007) AM_RAM AM_SHARE("vregs") /* Video Registers */
AM_RANGE(0x10800c, 0x10800d) AM_WRITENOP /* CLR INT Video */ AM_RANGE(0x10800c, 0x10800d) AM_WRITENOP /* CLR INT Video */
AM_RANGE(0x200000, 0x203fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette */ AM_RANGE(0x200000, 0x203fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* Palette */
@ -112,12 +112,12 @@ static ADDRESS_MAP_START( wrally_map, AS_PROGRAM, 16, wrally_state )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2") AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P1_P2")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("WHEEL") AM_RANGE(0x700004, 0x700005) AM_READ_PORT("WHEEL")
AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM") AM_RANGE(0x700008, 0x700009) AM_READ_PORT("SYSTEM")
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ AM_RANGE(0x70000c, 0x70000d) AM_WRITE(okim6295_bankswitch_w) /* OKI6295 bankswitch */
AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status/data register */ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status/data register */
AM_RANGE(0x70000a, 0x70001b) AM_WRITE(wrally_coin_lockout_w) /* Coin lockouts */ AM_RANGE(0x70000a, 0x70001b) AM_WRITE(wrally_coin_lockout_w) /* Coin lockouts */
AM_RANGE(0x70002a, 0x70003b) AM_WRITE(wrally_coin_counter_w) /* Coin counters */ AM_RANGE(0x70002a, 0x70003b) AM_WRITE(wrally_coin_counter_w) /* Coin counters */
AM_RANGE(0x70004a, 0x70004b) AM_WRITENOP /* Sound muting */ AM_RANGE(0x70004a, 0x70004b) AM_WRITENOP /* Sound muting */
AM_RANGE(0x70005a, 0x70005b) AM_WRITE(wrally_flipscreen_w) /* Flip screen */ AM_RANGE(0x70005a, 0x70005b) AM_WRITE(flipscreen_w) /* Flip screen */
AM_RANGE(0x70006a, 0x70007b) AM_WRITENOP /* ??? */ AM_RANGE(0x70006a, 0x70007b) AM_WRITENOP /* ??? */
AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with DS5002FP) */ AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with DS5002FP) */
ADDRESS_MAP_END ADDRESS_MAP_END
@ -255,7 +255,7 @@ static MACHINE_CONFIG_START( wrally, wrally_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*16, 32*16) MCFG_SCREEN_SIZE(64*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(8, 24*16-8-1, 16, 16*16-8-1) MCFG_SCREEN_VISIBLE_AREA(8, 24*16-8-1, 16, 16*16-8-1)
MCFG_SCREEN_UPDATE_DRIVER(wrally_state, screen_update_wrally) MCFG_SCREEN_UPDATE_DRIVER(wrally_state, screen_update)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", wrally) MCFG_GFXDECODE_ADD("gfxdecode", "palette", wrally)
@ -352,6 +352,6 @@ ROM_START( wrallyb ) /* Board Marked 930217, Atari License */
ROM_END ROM_END
GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 1)", 0 ) /* Dallas DS5002FP power failure shows as: "Tension baja " */ GAME( 1993, wrally, 0, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 1)", GAME_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Tension baja " */
GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 2)", 0 ) /* Dallas DS5002FP power failure shows as: "Power Failure" */ GAME( 1993, wrallya, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco", "World Rally (set 2)", GAME_SUPPORTS_SAVE ) /* Dallas DS5002FP power failure shows as: "Power Failure" */
GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", 0 ) GAME( 1993, wrallyb, wrally, wrally, wrally, driver_device, 0, ROT0, "Gaelco (Atari license)", "World Rally (US, 930217)", GAME_SUPPORTS_SAVE )

View File

@ -3,33 +3,38 @@ class wrally_state : public driver_device
public: public:
wrally_state(const machine_config &mconfig, device_type type, const char *tag) wrally_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_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_vregs(*this, "vregs"), m_vregs(*this, "vregs"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_shareram(*this, "shareram"), m_shareram(*this, "shareram") { }
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"), required_device<cpu_device> m_maincpu;
m_palette(*this, "palette") { } required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
tilemap_t *m_pant[2];
required_shared_ptr<UINT16> m_videoram; required_shared_ptr<UINT16> m_videoram;
required_shared_ptr<UINT16> m_vregs; required_shared_ptr<UINT16> m_vregs;
required_shared_ptr<UINT16> m_spriteram; required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr<UINT16> m_shareram; required_shared_ptr<UINT16> m_shareram;
tilemap_t *m_pant[2];
DECLARE_READ8_MEMBER(dallas_share_r); DECLARE_READ8_MEMBER(dallas_share_r);
DECLARE_WRITE8_MEMBER(dallas_share_w); DECLARE_WRITE8_MEMBER(dallas_share_w);
DECLARE_WRITE16_MEMBER(wrally_vram_w); DECLARE_WRITE16_MEMBER(vram_w);
DECLARE_WRITE16_MEMBER(wrally_flipscreen_w); DECLARE_WRITE16_MEMBER(flipscreen_w);
DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w); DECLARE_WRITE16_MEMBER(okim6295_bankswitch_w);
DECLARE_WRITE16_MEMBER(wrally_coin_counter_w); DECLARE_WRITE16_MEMBER(wrally_coin_counter_w);
DECLARE_WRITE16_MEMBER(wrally_coin_lockout_w); DECLARE_WRITE16_MEMBER(wrally_coin_lockout_w);
TILE_GET_INFO_MEMBER(get_tile_info_wrally_screen0);
TILE_GET_INFO_MEMBER(get_tile_info_wrally_screen1); TILE_GET_INFO_MEMBER(get_tile_info_screen0);
TILE_GET_INFO_MEMBER(get_tile_info_screen1);
virtual void video_start(); virtual void video_start();
UINT32 screen_update_wrally(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, int priority); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
}; };

View File

@ -18,7 +18,7 @@
***************************************************************************/ ***************************************************************************/
WRITE16_MEMBER(wrally_state::wrally_vram_w) WRITE16_MEMBER(wrally_state::vram_w)
{ {
data = gaelco_decrypt(space, offset, data, 0x1f, 0x522a); data = gaelco_decrypt(space, offset, data, 0x1f, 0x522a);
COMBINE_DATA(&m_videoram[offset]); COMBINE_DATA(&m_videoram[offset]);
@ -26,12 +26,12 @@ WRITE16_MEMBER(wrally_state::wrally_vram_w)
m_pant[(offset & 0x1fff) >> 12]->mark_tile_dirty(((offset << 1) & 0x1fff) >> 2); m_pant[(offset & 0x1fff) >> 12]->mark_tile_dirty(((offset << 1) & 0x1fff) >> 2);
} }
WRITE16_MEMBER(wrally_state::wrally_flipscreen_w) WRITE16_MEMBER(wrally_state::flipscreen_w)
{ {
flip_screen_set(data & 0x01); flip_screen_set(data & 0x01);
} }
WRITE16_MEMBER(wrally_state::OKIM6295_bankswitch_w) WRITE16_MEMBER(wrally_state::okim6295_bankswitch_w)
{ {
UINT8 *RAM = memregion("oki")->base(); UINT8 *RAM = memregion("oki")->base();

View File

@ -34,7 +34,7 @@
1 | xxx----- -------- | not used? 1 | xxx----- -------- | not used?
*/ */
TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_wrally_screen0) TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_screen0)
{ {
int data = m_videoram[tile_index << 1]; int data = m_videoram[tile_index << 1];
int data2 = m_videoram[(tile_index << 1) + 1]; int data2 = m_videoram[(tile_index << 1) + 1];
@ -45,7 +45,7 @@ TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_wrally_screen0)
SET_TILE_INFO_MEMBER(0, code, data2 & 0x1f, TILE_FLIPYX((data2 >> 6) & 0x03)); SET_TILE_INFO_MEMBER(0, code, data2 & 0x1f, TILE_FLIPYX((data2 >> 6) & 0x03));
} }
TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_wrally_screen1) TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_screen1)
{ {
int data = m_videoram[(0x2000/2) + (tile_index << 1)]; int data = m_videoram[(0x2000/2) + (tile_index << 1)];
int data2 = m_videoram[(0x2000/2) + (tile_index << 1) + 1]; int data2 = m_videoram[(0x2000/2) + (tile_index << 1) + 1];
@ -64,8 +64,8 @@ TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_wrally_screen1)
void wrally_state::video_start() void wrally_state::video_start()
{ {
m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_wrally_screen0),this),TILEMAP_SCAN_ROWS,16,16,64,32); m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_screen0),this),TILEMAP_SCAN_ROWS,16,16,64,32);
m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_wrally_screen1),this),TILEMAP_SCAN_ROWS,16,16,64,32); m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_screen1),this),TILEMAP_SCAN_ROWS,16,16,64,32);
m_pant[0]->set_transmask(0,0xff01,0x00ff); /* this layer is split in two (pens 1..7, pens 8-15) */ m_pant[0]->set_transmask(0,0xff01,0x00ff); /* this layer is split in two (pens 1..7, pens 8-15) */
m_pant[1]->set_transparent_pen(0); m_pant[1]->set_transparent_pen(0);
@ -172,7 +172,7 @@ void wrally_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect,
***************************************************************************/ ***************************************************************************/
UINT32 wrally_state::screen_update_wrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 wrally_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
/* set scroll registers */ /* set scroll registers */
if (!flip_screen()) { if (!flip_screen()) {