bwing.c, wiping.c: added / enabled save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-05-07 18:51:40 +02:00
parent a20b254ca1
commit ba41d0dce6
6 changed files with 87 additions and 68 deletions

View File

@ -10,7 +10,7 @@ revised by Alex W. Jackson
Known issues: Known issues:
- The main program is responsible for sprite clipping but occational - The main program is responsible for sprite clipping but occasional
glitches can be seen at the top and bottom screen edges. (post rotate) glitches can be seen at the top and bottom screen edges. (post rotate)
- B-Wings bosses sometimes flicker. (sync issue) - B-Wings bosses sometimes flicker. (sync issue)
@ -133,11 +133,11 @@ static ADDRESS_MAP_START( bwp1_map, AS_PROGRAM, 8, bwing_state )
AM_RANGE(0x1b00, 0x1b07) AM_READ(bwp1_io_r) AM_RANGE(0x1b00, 0x1b07) AM_READ(bwp1_io_r)
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("sharedram") AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("sharedram")
AM_RANGE(0x0800, 0x0fff) AM_RAM AM_RANGE(0x0800, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(bwing_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(0x1400, 0x17ff) AM_RAM
AM_RANGE(0x1800, 0x19ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x1800, 0x19ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x1a00, 0x1aff) AM_RAM_WRITE(bwing_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x1a00, 0x1aff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0x1b00, 0x1b07) AM_RAM_WRITE(bwing_scrollreg_w) AM_RANGE(0x1b00, 0x1b07) AM_RAM_WRITE(scrollreg_w)
AM_RANGE(0x1c00, 0x1c07) AM_RAM_WRITE(bwp1_ctrl_w) AM_RANGE(0x1c00, 0x1c07) AM_RAM_WRITE(bwp1_ctrl_w)
AM_RANGE(0x2000, 0x3fff) AM_DEVICE("vrambank", address_map_bank_device, amap8) AM_RANGE(0x2000, 0x3fff) AM_DEVICE("vrambank", address_map_bank_device, amap8)
AM_RANGE(0x4000, 0xffff) AM_ROM // "B-Wings US" writes to 9631-9632(debug?) AM_RANGE(0x4000, 0xffff) AM_ROM // "B-Wings US" writes to 9631-9632(debug?)
@ -383,7 +383,7 @@ static MACHINE_CONFIG_START( bwing, bwing_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600)) // must be long enough for polling MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600)) // must be long enough for polling
MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(bwing_state, screen_update_bwing) MCFG_SCREEN_UPDATE_DRIVER(bwing_state, screen_update)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", bwing) MCFG_GFXDECODE_ADD("gfxdecode", "palette", bwing)
@ -570,9 +570,9 @@ DRIVER_INIT_MEMBER(bwing_state,bwing)
//**************************************************************************** //****************************************************************************
// Game Entries // Game Entries
GAME( 1984, bwings, 0, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Japan new Ver.)", 0 ) GAME( 1984, bwings, 0, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Japan new Ver.)", GAME_SUPPORTS_SAVE )
GAME( 1984, bwingso, bwings, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Japan old Ver.)", 0 ) GAME( 1984, bwingso, bwings, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Japan old Ver.)", GAME_SUPPORTS_SAVE )
GAME( 1984, bwingsa, bwings, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Alt Ver.?)", 0 ) GAME( 1984, bwingsa, bwings, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "B-Wings (Alt Ver.?)", GAME_SUPPORTS_SAVE )
GAME( 1984, zaviga, 0, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "Zaviga", 0 ) GAME( 1984, zaviga, 0, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "Zaviga", GAME_SUPPORTS_SAVE )
GAME( 1984, zavigaj, zaviga, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "Zaviga (Japan)", 0 ) GAME( 1984, zavigaj, zaviga, bwing, bwing, bwing_state, bwing, ROT90, "Data East Corporation", "Zaviga (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -41,6 +41,13 @@ dip: 6.7 7.7
#include "includes/wiping.h" #include "includes/wiping.h"
void wiping_state::machine_start()
{
save_item(NAME(m_flipscreen));
save_item(NAME(m_main_irq_mask));
save_item(NAME(m_sound_irq_mask));
}
/* input ports are rotated 90 degrees */ /* input ports are rotated 90 degrees */
READ8_MEMBER(wiping_state::ports_r) READ8_MEMBER(wiping_state::ports_r)
{ {
@ -78,7 +85,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, wiping_state )
AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("share1") AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("share1")
AM_RANGE(0x9800, 0x9bff) AM_RAM AM_SHARE("share2") AM_RANGE(0x9800, 0x9bff) AM_RAM AM_SHARE("share2")
AM_RANGE(0xa000, 0xa000) AM_WRITE(main_irq_mask_w) AM_RANGE(0xa000, 0xa000) AM_WRITE(main_irq_mask_w)
AM_RANGE(0xa002, 0xa002) AM_WRITE(wiping_flipscreen_w) AM_RANGE(0xa002, 0xa002) AM_WRITE(flipscreen_w)
AM_RANGE(0xa003, 0xa003) AM_WRITE(subcpu_reset_w) AM_RANGE(0xa003, 0xa003) AM_WRITE(subcpu_reset_w)
AM_RANGE(0xa800, 0xa807) AM_READ(ports_r) AM_RANGE(0xa800, 0xa807) AM_READ(ports_r)
AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_RANGE(0xb000, 0xb7ff) AM_RAM
@ -293,7 +300,7 @@ static MACHINE_CONFIG_START( wiping, wiping_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(36*8, 28*8) MCFG_SCREEN_SIZE(36*8, 28*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1) MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(wiping_state, screen_update_wiping) MCFG_SCREEN_UPDATE_DRIVER(wiping_state, screen_update)
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", wiping) MCFG_GFXDECODE_ADD("gfxdecode", "palette", wiping)
@ -376,5 +383,5 @@ ROM_END
GAME( 1982, wiping, 0, wiping, wiping, driver_device, 0, ROT90, "Nichibutsu", "Wiping", 0 ) GAME( 1982, wiping, 0, wiping, wiping, driver_device, 0, ROT90, "Nichibutsu", "Wiping", GAME_SUPPORTS_SAVE )
GAME( 1983, rugrats, wiping, wiping, rugrats, driver_device, 0, ROT90, "Nichibutsu", "Rug Rats", 0 ) GAME( 1983, rugrats, wiping, wiping, rugrats, driver_device, 0, ROT90, "Nichibutsu", "Rug Rats", GAME_SUPPORTS_SAVE )

View File

@ -15,18 +15,26 @@ class bwing_state : public driver_device
public: public:
bwing_state(const machine_config &mconfig, device_type type, const char *tag) bwing_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_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_fgscrollram(*this, "fgscrollram"),
m_bgscrollram(*this, "bgscrollram"),
m_gfxram(*this, "gfxram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"), m_subcpu(*this, "sub"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
m_vrambank(*this, "vrambank") { } m_vrambank(*this, "vrambank"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_fgscrollram(*this, "fgscrollram"),
m_bgscrollram(*this, "bgscrollram"),
m_gfxram(*this, "gfxram") { }
/* device */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<address_map_bank_device> m_vrambank;
/* memory pointers */ /* memory pointers */
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
@ -51,39 +59,37 @@ public:
/* misc */ /* misc */
UINT8 *m_bwp123_membase[3]; UINT8 *m_bwp123_membase[3];
/* device */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<address_map_bank_device> m_vrambank;
DECLARE_WRITE8_MEMBER(bwp3_u8F_w); DECLARE_WRITE8_MEMBER(bwp3_u8F_w);
DECLARE_WRITE8_MEMBER(bwp3_nmimask_w); DECLARE_WRITE8_MEMBER(bwp3_nmimask_w);
DECLARE_WRITE8_MEMBER(bwp3_nmiack_w); DECLARE_WRITE8_MEMBER(bwp3_nmiack_w);
DECLARE_READ8_MEMBER(bwp1_io_r); DECLARE_READ8_MEMBER(bwp1_io_r);
DECLARE_WRITE8_MEMBER(bwp1_ctrl_w); DECLARE_WRITE8_MEMBER(bwp1_ctrl_w);
DECLARE_WRITE8_MEMBER(bwp2_ctrl_w); DECLARE_WRITE8_MEMBER(bwp2_ctrl_w);
DECLARE_WRITE8_MEMBER(bwing_spriteram_w); DECLARE_WRITE8_MEMBER(spriteram_w);
DECLARE_WRITE8_MEMBER(bwing_videoram_w); DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(fgscrollram_w); DECLARE_WRITE8_MEMBER(fgscrollram_w);
DECLARE_WRITE8_MEMBER(bgscrollram_w); DECLARE_WRITE8_MEMBER(bgscrollram_w);
DECLARE_WRITE8_MEMBER(gfxram_w); DECLARE_WRITE8_MEMBER(gfxram_w);
DECLARE_WRITE8_MEMBER(bwing_scrollreg_w); DECLARE_WRITE8_MEMBER(scrollreg_w);
DECLARE_WRITE8_MEMBER(bwing_paletteram_w); DECLARE_WRITE8_MEMBER(paletteram_w);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_INPUT_CHANGED_MEMBER(tilt_pressed); DECLARE_INPUT_CHANGED_MEMBER(tilt_pressed);
DECLARE_DRIVER_INIT(bwing);
TILE_GET_INFO_MEMBER(get_fgtileinfo); TILE_GET_INFO_MEMBER(get_fgtileinfo);
TILE_GET_INFO_MEMBER(get_bgtileinfo); TILE_GET_INFO_MEMBER(get_bgtileinfo);
TILE_GET_INFO_MEMBER(get_charinfo); TILE_GET_INFO_MEMBER(get_charinfo);
TILEMAP_MAPPER_MEMBER(bwing_scan_cols); TILEMAP_MAPPER_MEMBER(scan_cols);
DECLARE_DRIVER_INIT(bwing);
virtual void machine_start(); virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_bwing(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(bwp3_interrupt); UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bmp, const rectangle &clip, UINT8 *ram, int pri ); void draw_sprites( bitmap_ind16 &bmp, const rectangle &clip, UINT8 *ram, int pri );
INTERRUPT_GEN_MEMBER(bwp3_interrupt);
void fix_bwp3( ); void fix_bwp3( );
}; };

View File

@ -5,33 +5,39 @@ class wiping_state : public driver_device
public: public:
wiping_state(const machine_config &mconfig, device_type type, const char *tag) wiping_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_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { } m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram") { }
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
int m_flipscreen;
UINT8 *m_soundregs;
required_shared_ptr<UINT8> m_spriteram;
UINT8 m_main_irq_mask;
UINT8 m_sound_irq_mask;
DECLARE_READ8_MEMBER(ports_r);
DECLARE_WRITE8_MEMBER(subcpu_reset_w);
DECLARE_WRITE8_MEMBER(main_irq_mask_w);
DECLARE_WRITE8_MEMBER(sound_irq_mask_w);
DECLARE_WRITE8_MEMBER(wiping_flipscreen_w);
DECLARE_PALETTE_INIT(wiping);
UINT32 screen_update_wiping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
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<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_spriteram;
int m_flipscreen;
UINT8 *m_soundregs; // if 0-ed
UINT8 m_main_irq_mask;
UINT8 m_sound_irq_mask;
DECLARE_READ8_MEMBER(ports_r);
DECLARE_WRITE8_MEMBER(subcpu_reset_w);
DECLARE_WRITE8_MEMBER(main_irq_mask_w);
DECLARE_WRITE8_MEMBER(sound_irq_mask_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_PALETTE_INIT(wiping);
virtual void machine_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
}; };

View File

@ -19,7 +19,7 @@ revised by Alex W. Jackson
// Exports // Exports
WRITE8_MEMBER(bwing_state::bwing_videoram_w) WRITE8_MEMBER(bwing_state::videoram_w)
{ {
m_videoram[offset] = data; m_videoram[offset] = data;
m_charmap->mark_tile_dirty(offset); m_charmap->mark_tile_dirty(offset);
@ -48,7 +48,7 @@ WRITE8_MEMBER(bwing_state::gfxram_w)
} }
WRITE8_MEMBER(bwing_state::bwing_scrollreg_w) WRITE8_MEMBER(bwing_state::scrollreg_w)
{ {
m_sreg[offset] = data; m_sreg[offset] = data;
@ -64,7 +64,7 @@ WRITE8_MEMBER(bwing_state::bwing_scrollreg_w)
} }
WRITE8_MEMBER(bwing_state::bwing_paletteram_w) WRITE8_MEMBER(bwing_state::paletteram_w)
{ {
static const float rgb[4][3] = { static const float rgb[4][3] = {
{0.85f, 0.95f, 1.00f}, {0.85f, 0.95f, 1.00f},
@ -115,7 +115,7 @@ TILE_GET_INFO_MEMBER(bwing_state::get_charinfo)
SET_TILE_INFO_MEMBER(0, m_videoram[tile_index], 0, 0); SET_TILE_INFO_MEMBER(0, m_videoram[tile_index], 0, 0);
} }
TILEMAP_MAPPER_MEMBER(bwing_state::bwing_scan_cols) TILEMAP_MAPPER_MEMBER(bwing_state::scan_cols)
{ {
return (row & 0xf) | ((col & 0xf) << 4) | ((row & 0x30) << 4) | ((col & 0x30) << 6); return (row & 0xf) | ((col & 0xf) << 4) | ((row & 0x30) << 4) | ((col & 0x30) << 6);
} }
@ -126,8 +126,8 @@ void bwing_state::video_start()
int i; int i;
m_charmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_charinfo),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32); m_charmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_charinfo),this), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
m_fgmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_fgtileinfo),this), tilemap_mapper_delegate(FUNC(bwing_state::bwing_scan_cols),this), 16, 16, 64, 64); m_fgmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_fgtileinfo),this), tilemap_mapper_delegate(FUNC(bwing_state::scan_cols),this), 16, 16, 64, 64);
m_bgmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_bgtileinfo),this), tilemap_mapper_delegate(FUNC(bwing_state::bwing_scan_cols),this), 16, 16, 64, 64); m_bgmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(bwing_state::get_bgtileinfo),this), tilemap_mapper_delegate(FUNC(bwing_state::scan_cols),this), 16, 16, 64, 64);
m_charmap->set_transparent_pen(0); m_charmap->set_transparent_pen(0);
m_fgmap->set_transparent_pen(0); m_fgmap->set_transparent_pen(0);
@ -180,7 +180,7 @@ void bwing_state::draw_sprites( bitmap_ind16 &bmp, const rectangle &clip, UINT8
} }
UINT32 bwing_state::screen_update_bwing(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 bwing_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
unsigned flip, x, y, shiftx; unsigned flip, x, y, shiftx;

View File

@ -2,7 +2,7 @@
// copyright-holders:??? // copyright-holders:???
/*************************************************************************** /***************************************************************************
video.c wiping.c
Functions to emulate the video hardware of the machine. Functions to emulate the video hardware of the machine.
@ -79,13 +79,13 @@ PALETTE_INIT_MEMBER(wiping_state, wiping)
WRITE8_MEMBER(wiping_state::wiping_flipscreen_w) WRITE8_MEMBER(wiping_state::flipscreen_w)
{ {
m_flipscreen = (data & 1); m_flipscreen = (data & 1);
} }
UINT32 wiping_state::screen_update_wiping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 wiping_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
UINT8 *spriteram = m_spriteram; UINT8 *spriteram = m_spriteram;
int offs; int offs;