summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2015-04-14 19:25:29 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2015-04-14 19:25:29 +0200
commit75e8861950d520e83740b7b5747735f0286df145 (patch)
tree6562b24ce3350a2c6203de2d7028725e37658831 /src
parent405fc13168830aca07fa860a9168a541d9141bd6 (diff)
shangkid.c, shaolins.c: added save state support (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/shangkid.c72
-rw-r--r--src/mame/drivers/shaolins.c30
-rw-r--r--src/mame/includes/shangkid.h45
-rw-r--r--src/mame/includes/shaolins.h31
-rw-r--r--src/mame/video/shangkid.c29
-rw-r--r--src/mame/video/shaolins.c40
6 files changed, 130 insertions, 117 deletions
diff --git a/src/mame/drivers/shangkid.c b/src/mame/drivers/shangkid.c
index 6f35463e666..a554facbc14 100644
--- a/src/mame/drivers/shangkid.c
+++ b/src/mame/drivers/shangkid.c
@@ -56,17 +56,17 @@ Games by Nihon Game/Culture Brain:
/***************************************************************************************/
-WRITE8_MEMBER(shangkid_state::shangkid_maincpu_bank_w)
+WRITE8_MEMBER(shangkid_state::maincpu_bank_w)
{
membank("bank1")->set_entry(data & 1);
}
-WRITE8_MEMBER(shangkid_state::shangkid_bbx_enable_w)
+WRITE8_MEMBER(shangkid_state::bbx_enable_w)
{
m_bbx->set_input_line(INPUT_LINE_HALT, data?0:1 );
}
-WRITE8_MEMBER(shangkid_state::shangkid_cpu_reset_w)
+WRITE8_MEMBER(shangkid_state::cpu_reset_w)
{
if( data == 0 )
{
@@ -78,7 +78,7 @@ WRITE8_MEMBER(shangkid_state::shangkid_cpu_reset_w)
}
}
-WRITE8_MEMBER(shangkid_state::shangkid_sound_enable_w)
+WRITE8_MEMBER(shangkid_state::sound_enable_w)
{
m_bbx_sound_enable = data;
}
@@ -112,7 +112,7 @@ WRITE8_MEMBER(shangkid_state::ay8910_portb_w)
/***************************************************************************************/
-READ8_MEMBER(shangkid_state::shangkid_soundlatch_r)
+READ8_MEMBER(shangkid_state::soundlatch_r)
{
return m_sound_latch;
}
@@ -122,6 +122,9 @@ READ8_MEMBER(shangkid_state::shangkid_soundlatch_r)
DRIVER_INIT_MEMBER(shangkid_state,chinhero)
{
m_gfx_type = 0;
+
+ save_item(NAME(m_bbx_sound_enable));
+ save_item(NAME(m_sound_latch));
}
DRIVER_INIT_MEMBER(shangkid_state,shangkid)
@@ -131,6 +134,9 @@ DRIVER_INIT_MEMBER(shangkid_state,shangkid)
/* set up banking */
membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x8000, 0x8000);
membank("bank2")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x0000, 0x10000);
+
+ save_item(NAME(m_bbx_sound_enable));
+ save_item(NAME(m_sound_latch));
}
/***************************************************************************************/
@@ -231,18 +237,18 @@ GFXDECODE_END
static ADDRESS_MAP_START( chinhero_main_map, AS_PROGRAM, 8, shangkid_state )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xa000, 0xa000) AM_WRITENOP /* ? */
- AM_RANGE(0xb000, 0xb000) AM_WRITE(shangkid_bbx_enable_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(shangkid_sound_enable_w)
+ AM_RANGE(0xb000, 0xb000) AM_WRITE(bbx_enable_w)
+ AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_enable_w)
AM_RANGE(0xb002, 0xb002) AM_WRITENOP /* main CPU interrupt-related */
AM_RANGE(0xb003, 0xb003) AM_WRITENOP /* BBX interrupt-related */
- AM_RANGE(0xb004, 0xb004) AM_WRITE(shangkid_cpu_reset_w)
+ AM_RANGE(0xb004, 0xb004) AM_WRITE(cpu_reset_w)
AM_RANGE(0xb006, 0xb006) AM_WRITENOP /* coin counter */
AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW")
AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM")
AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2")
AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1")
AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_SHARE("videoreg")
- AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_SHARE("videoram")
+ AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2")
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END
@@ -251,19 +257,19 @@ static ADDRESS_MAP_START( shangkid_main_map, AS_PROGRAM, 8, shangkid_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
AM_RANGE(0xa000, 0xa000) AM_WRITENOP /* ? */
- AM_RANGE(0xb000, 0xb000) AM_WRITE(shangkid_bbx_enable_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(shangkid_sound_enable_w)
+ AM_RANGE(0xb000, 0xb000) AM_WRITE(bbx_enable_w)
+ AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_enable_w)
AM_RANGE(0xb002, 0xb002) AM_WRITENOP /* main CPU interrupt-related */
AM_RANGE(0xb003, 0xb003) AM_WRITENOP /* BBX interrupt-related */
- AM_RANGE(0xb004, 0xb004) AM_WRITE(shangkid_cpu_reset_w)
+ AM_RANGE(0xb004, 0xb004) AM_WRITE(cpu_reset_w)
AM_RANGE(0xb006, 0xb006) AM_WRITENOP /* coin counter */
- AM_RANGE(0xb007, 0xb007) AM_WRITE(shangkid_maincpu_bank_w)
+ AM_RANGE(0xb007, 0xb007) AM_WRITE(maincpu_bank_w)
AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW")
AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM")
AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2")
AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1")
AM_RANGE(0xc000, 0xc002) AM_WRITEONLY AM_SHARE("videoreg")
- AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_SHARE("videoram")
+ AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2")
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END
@@ -273,17 +279,17 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( chinhero_bbx_map, AS_PROGRAM, 8, shangkid_state )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xa000, 0xa000) AM_WRITENOP /* ? */
- AM_RANGE(0xb000, 0xb000) AM_WRITE(shangkid_bbx_enable_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(shangkid_sound_enable_w)
+ AM_RANGE(0xb000, 0xb000) AM_WRITE(bbx_enable_w)
+ AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_enable_w)
AM_RANGE(0xb002, 0xb002) AM_WRITENOP /* main CPU interrupt-related */
AM_RANGE(0xb003, 0xb003) AM_WRITENOP /* BBX interrupt-related */
- AM_RANGE(0xb004, 0xb004) AM_WRITE(shangkid_cpu_reset_w)
+ AM_RANGE(0xb004, 0xb004) AM_WRITE(cpu_reset_w)
AM_RANGE(0xb006, 0xb006) AM_WRITENOP /* coin counter */
AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW")
AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM")
AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2")
AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1")
- AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_SHARE("videoram")
+ AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2")
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END
@@ -291,18 +297,18 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( shangkid_bbx_map, AS_PROGRAM, 8, shangkid_state )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xa000, 0xa000) AM_WRITENOP /* ? */
- AM_RANGE(0xb000, 0xb000) AM_WRITE(shangkid_bbx_enable_w)
- AM_RANGE(0xb001, 0xb001) AM_WRITE(shangkid_sound_enable_w)
+ AM_RANGE(0xb000, 0xb000) AM_WRITE(bbx_enable_w)
+ AM_RANGE(0xb001, 0xb001) AM_WRITE(sound_enable_w)
AM_RANGE(0xb002, 0xb002) AM_WRITENOP /* main CPU interrupt-related */
AM_RANGE(0xb003, 0xb003) AM_WRITENOP /* BBX interrupt-related */
- AM_RANGE(0xb004, 0xb004) AM_WRITE(shangkid_cpu_reset_w)
+ AM_RANGE(0xb004, 0xb004) AM_WRITE(cpu_reset_w)
AM_RANGE(0xb006, 0xb006) AM_WRITENOP /* coin counter */
- AM_RANGE(0xb007, 0xb007) AM_WRITE(shangkid_maincpu_bank_w)
+ AM_RANGE(0xb007, 0xb007) AM_WRITE(maincpu_bank_w)
AM_RANGE(0xb800, 0xb800) AM_READ_PORT("DSW")
AM_RANGE(0xb801, 0xb801) AM_READ_PORT("SYSTEM")
AM_RANGE(0xb802, 0xb802) AM_READ_PORT("P2")
AM_RANGE(0xb803, 0xb803) AM_READ_PORT("P1")
- AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(shangkid_videoram_w) AM_SHARE("videoram")
+ AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xe000, 0xfdff) AM_RAM AM_SHARE("share2")
AM_RANGE(0xfe00, 0xffff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END
@@ -331,7 +337,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, shangkid_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_READ(shangkid_soundlatch_r) AM_DEVWRITE("dac", dac_device, write_unsigned8)
+ AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) AM_DEVWRITE("dac", dac_device, write_unsigned8)
ADDRESS_MAP_END
/***************************************************************************************/
@@ -847,7 +853,7 @@ ROM_START( shangkid )
ROM_LOAD( "cr02ic04.bin", 0x08000, 0x2000, CRC(85b6e455) SHA1(3b2cd1e55355d24c014c5afe0212c6c9f0899a28) ) /* banked at 0x8000 */
ROM_LOAD( "cr03ic05.bin", 0x10000, 0x2000, CRC(3b383863) SHA1(3fb10a7f89cf2387d70b0337916063fd4ec5f754) ) /* banked at 0x8000 */
- /* The BBX coprocessor is burried in an epoxy block. It contains:
+ /* The BBX coprocessor is buried in an epoxy block. It contains:
** - a surface-mounted Z80 (TMPZ84C00P)
** - LS245 logic IC
** - battery backed ram chip Fujitsu MB8464
@@ -911,7 +917,7 @@ ROM_START( hiryuken )
ROM_LOAD( "3.4", 0x08000, 0x2000, CRC(ad210482) SHA1(9a32bbaf601d3b00f0a79ce90bb9a32e8e608977) ) /* banked at 0x8000 */
ROM_LOAD( "4.5", 0x10000, 0x2000, CRC(6518943a) SHA1(b5e78267d5a58c466c9ae20ba4f9c5e14e252287) ) /* banked at 0x8000 */
- /* The BBX coprocessor is burried in an epoxy block. It contains:
+ /* The BBX coprocessor is buried in an epoxy block. It contains:
** - a surface-mounted Z80 (TMPZ84C00P)
** - LS245 logic IC
** - battery backed ram chip Fujitsu MB8464
@@ -995,10 +1001,10 @@ ROM_START( dynamski )
ROM_END
-GAME( 1984, dynamski, 0, dynamski, dynamski, driver_device, 0, ROT90, "Taiyo", "Dynamic Ski", GAME_NO_COCKTAIL )
-GAME( 1984, chinhero, 0, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero", 0 ) // by Nihon Game?
-GAME( 1984, chinhero2,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 1)", 0 )
-GAME( 1984, chinhero3,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 2)", 0 )
-GAME( 1984, chinherot,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo (Taito license)", "Chinese Heroe (Taito)", 0 )
-GAME( 1985, shangkid, 0, shangkid, shangkid, shangkid_state, shangkid, ROT0, "Taiyo (Data East license)", "Shanghai Kid", GAME_NO_COCKTAIL )
-GAME( 1985, hiryuken, shangkid, shangkid, shangkid, shangkid_state, shangkid, ROT0, "Taiyo (Taito license)", "Hokuha Syourin Hiryu no Ken", GAME_NO_COCKTAIL )
+GAME( 1984, dynamski, 0, dynamski, dynamski, driver_device, 0, ROT90, "Taiyo", "Dynamic Ski", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
+GAME( 1984, chinhero, 0, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero", GAME_SUPPORTS_SAVE ) // by Nihon Game?
+GAME( 1984, chinhero2,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 1)", GAME_SUPPORTS_SAVE )
+GAME( 1984, chinhero3,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo", "Chinese Hero (older, set 2)", GAME_SUPPORTS_SAVE )
+GAME( 1984, chinherot,chinhero, chinhero, chinhero, shangkid_state, chinhero, ROT90, "Taiyo (Taito license)", "Chinese Heroe (Taito)", GAME_SUPPORTS_SAVE )
+GAME( 1985, shangkid, 0, shangkid, shangkid, shangkid_state, shangkid, ROT0, "Taiyo (Data East license)", "Shanghai Kid", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
+GAME( 1985, hiryuken, shangkid, shangkid, shangkid, shangkid_state, shangkid, ROT0, "Taiyo (Taito license)", "Hokuha Syourin Hiryu no Ken", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/shaolins.c b/src/mame/drivers/shaolins.c
index e64713ee1aa..a7386605038 100644
--- a/src/mame/drivers/shaolins.c
+++ b/src/mame/drivers/shaolins.c
@@ -13,7 +13,7 @@ driver by Allard Van Der Bas
#define MASTER_CLOCK XTAL_18_432MHz
-TIMER_DEVICE_CALLBACK_MEMBER(shaolins_state::shaolins_interrupt)
+TIMER_DEVICE_CALLBACK_MEMBER(shaolins_state::interrupt)
{
int scanline = param;
@@ -26,7 +26,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(shaolins_state::shaolins_interrupt)
static ADDRESS_MAP_START( shaolins_map, AS_PROGRAM, 8, shaolins_state )
- AM_RANGE(0x0000, 0x0000) AM_WRITE(shaolins_nmi_w) /* bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? */
+ AM_RANGE(0x0000, 0x0000) AM_WRITE(nmi_w) /* bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? */
/* bit 3, bit 4 = coin counters */
AM_RANGE(0x0100, 0x0100) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x0300, 0x0300) AM_DEVWRITE("sn1", sn76489a_device, write) /* trigger chip to read from latch. The program always */
@@ -40,13 +40,13 @@ static ADDRESS_MAP_START( shaolins_map, AS_PROGRAM, 8, shaolins_state )
AM_RANGE(0x0703, 0x0703) AM_READ_PORT("DSW3")
AM_RANGE(0x0800, 0x0800) AM_WRITENOP /* latch for 76496 #0 */
AM_RANGE(0x1000, 0x1000) AM_WRITENOP /* latch for 76496 #1 */
- AM_RANGE(0x1800, 0x1800) AM_WRITE(shaolins_palettebank_w)
- AM_RANGE(0x2000, 0x2000) AM_WRITE(shaolins_scroll_w)
+ AM_RANGE(0x1800, 0x1800) AM_WRITE(palettebank_w)
+ AM_RANGE(0x2000, 0x2000) AM_WRITE(scroll_w)
AM_RANGE(0x2800, 0x2bff) AM_RAM /* RAM BANK 2 */
AM_RANGE(0x3000, 0x30ff) AM_RAM /* RAM BANK 1 */
AM_RANGE(0x3100, 0x33ff) AM_RAM AM_SHARE("spriteram")
- AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(shaolins_colorram_w) AM_SHARE("colorram")
- AM_RANGE(0x3c00, 0x3fff) AM_RAM_WRITE(shaolins_videoram_w) AM_SHARE("videoram")
+ AM_RANGE(0x3800, 0x3bff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
+ AM_RANGE(0x3c00, 0x3fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x4000, 0x5fff) AM_ROM /* Machine checks for extra rom */
AM_RANGE(0x6000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -155,7 +155,7 @@ INPUT_PORTS_END
-static const gfx_layout shaolins_charlayout =
+static const gfx_layout charlayout =
{
8,8, /* 8*8 chars */
512, /* 512 characters */
@@ -166,7 +166,7 @@ static const gfx_layout shaolins_charlayout =
16*8 /* every char takes 16 consecutive bytes */
};
-static const gfx_layout shaolins_spritelayout =
+static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
256, /* 256 sprites */
@@ -180,8 +180,8 @@ static const gfx_layout shaolins_spritelayout =
};
static GFXDECODE_START( shaolins )
- GFXDECODE_ENTRY( "gfx1", 0, shaolins_charlayout, 0, 16*8 )
- GFXDECODE_ENTRY( "gfx2", 0, shaolins_spritelayout, 16*8*16, 16*8 )
+ GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16*8 )
+ GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*8*16, 16*8 )
GFXDECODE_END
@@ -190,7 +190,7 @@ static MACHINE_CONFIG_START( shaolins, shaolins_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/12) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(shaolins_map)
- MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", shaolins_state, shaolins_interrupt, "screen", 0, 1)
+ MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", shaolins_state, interrupt, "screen", 0, 1)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -198,7 +198,7 @@ static MACHINE_CONFIG_START( shaolins, shaolins_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
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(shaolins_state, screen_update_shaolins)
+ MCFG_SCREEN_UPDATE_DRIVER(shaolins_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", shaolins)
@@ -335,6 +335,6 @@ ROM_END
/* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */
-GAME( 1985, kicker, 0, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Kicker", 0 )
-GAME( 1985, shaolins, kicker, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Shao-lin's Road (set 1)", 0 )
-GAME( 1985, shaolinb, kicker, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Shao-lin's Road (set 2)", 0 )
+GAME( 1985, kicker, 0, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Kicker", GAME_SUPPORTS_SAVE )
+GAME( 1985, shaolins, kicker, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Shao-lin's Road (set 1)", GAME_SUPPORTS_SAVE )
+GAME( 1985, shaolinb, kicker, shaolins, shaolins, driver_device, 0, ROT90, "Konami", "Shao-lin's Road (set 2)", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/includes/shangkid.h b/src/mame/includes/shangkid.h
index f8ef89ac0ed..263092adb9d 100644
--- a/src/mame/includes/shangkid.h
+++ b/src/mame/includes/shangkid.h
@@ -3,47 +3,56 @@ class shangkid_state : public driver_device
public:
shangkid_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_videoreg(*this, "videoreg"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_bbx(*this, "bbx"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_videoreg(*this, "videoreg") { }
+
+ required_device<cpu_device> m_maincpu;
+ optional_device<cpu_device> m_audiocpu;
+ optional_device<cpu_device> m_bbx;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_spriteram;
+ optional_shared_ptr<UINT8> m_videoreg;
+
UINT8 m_bbx_sound_enable;
UINT8 m_sound_latch;
- optional_shared_ptr<UINT8> m_videoreg;
int m_gfx_type;
tilemap_t *m_background;
- DECLARE_WRITE8_MEMBER(shangkid_maincpu_bank_w);
- DECLARE_WRITE8_MEMBER(shangkid_bbx_enable_w);
- DECLARE_WRITE8_MEMBER(shangkid_cpu_reset_w);
- DECLARE_WRITE8_MEMBER(shangkid_sound_enable_w);
- DECLARE_READ8_MEMBER(shangkid_soundlatch_r);
- DECLARE_WRITE8_MEMBER(shangkid_videoram_w);
+
+ // shangkid and chinhero
+ DECLARE_WRITE8_MEMBER(maincpu_bank_w);
+ DECLARE_WRITE8_MEMBER(bbx_enable_w);
+ DECLARE_WRITE8_MEMBER(cpu_reset_w);
+ DECLARE_WRITE8_MEMBER(sound_enable_w);
+ DECLARE_READ8_MEMBER(soundlatch_r);
+ DECLARE_WRITE8_MEMBER(videoram_w);
+ DECLARE_WRITE8_MEMBER(ay8910_portb_w);
+
+ // game specific
DECLARE_WRITE8_MEMBER(chinhero_ay8910_porta_w);
DECLARE_WRITE8_MEMBER(shangkid_ay8910_porta_w);
- DECLARE_WRITE8_MEMBER(ay8910_portb_w);
+
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+
DECLARE_DRIVER_INIT(shangkid);
DECLARE_DRIVER_INIT(chinhero);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_MACHINE_RESET(chinhero);
DECLARE_VIDEO_START(shangkid);
DECLARE_PALETTE_INIT(dynamski);
DECLARE_MACHINE_RESET(shangkid);
+
UINT32 screen_update_shangkid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_dynamski(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprite(const UINT8 *source, bitmap_ind16 &bitmap, const rectangle &cliprect);
void shangkid_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
void dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
- required_device<cpu_device> m_maincpu;
- optional_device<cpu_device> m_audiocpu;
- optional_device<cpu_device> m_bbx;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
};
diff --git a/src/mame/includes/shaolins.h b/src/mame/includes/shaolins.h
index b7ae65c9bae..bb57a0efdc4 100644
--- a/src/mame/includes/shaolins.h
+++ b/src/mame/includes/shaolins.h
@@ -4,32 +4,37 @@ public:
shaolins_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_videoram(*this, "videoram") { }
required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_videoram;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- int m_palettebank;
+ int m_palettebank;
tilemap_t *m_bg_tilemap;
UINT8 m_nmi_enable;
- DECLARE_WRITE8_MEMBER(shaolins_videoram_w);
- DECLARE_WRITE8_MEMBER(shaolins_colorram_w);
- DECLARE_WRITE8_MEMBER(shaolins_palettebank_w);
- DECLARE_WRITE8_MEMBER(shaolins_scroll_w);
- DECLARE_WRITE8_MEMBER(shaolins_nmi_w);
+ DECLARE_WRITE8_MEMBER(videoram_w);
+ DECLARE_WRITE8_MEMBER(colorram_w);
+ DECLARE_WRITE8_MEMBER(palettebank_w);
+ DECLARE_WRITE8_MEMBER(scroll_w);
+ DECLARE_WRITE8_MEMBER(nmi_w);
+
TILE_GET_INFO_MEMBER(get_bg_tile_info);
+
virtual void video_start();
DECLARE_PALETTE_INIT(shaolins);
- UINT32 screen_update_shaolins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(shaolins_interrupt);
+
+ UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
};
diff --git a/src/mame/video/shangkid.c b/src/mame/video/shangkid.c
index 5cd57e1d675..1bb0c6d720d 100644
--- a/src/mame/video/shangkid.c
+++ b/src/mame/video/shangkid.c
@@ -1,14 +1,12 @@
/* video/shangkid */
#include "emu.h"
-#include "cpu/z80/z80.h"
#include "includes/shangkid.h"
TILE_GET_INFO_MEMBER(shangkid_state::get_bg_tile_info){
- UINT8 *videoram = m_videoram;
- int attributes = videoram[tile_index+0x800];
- int tile_number = videoram[tile_index]+0x100*(attributes&0x3);
+ int attributes = m_videoram[tile_index+0x800];
+ int tile_number = m_videoram[tile_index]+0x100*(attributes&0x3);
int color;
if( m_gfx_type==1 )
@@ -48,10 +46,9 @@ VIDEO_START_MEMBER(shangkid_state,shangkid)
m_background = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(shangkid_state::get_bg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
}
-WRITE8_MEMBER(shangkid_state::shangkid_videoram_w)
+WRITE8_MEMBER(shangkid_state::videoram_w)
{
- UINT8 *videoram = m_videoram;
- videoram[offset] = data;
+ m_videoram[offset] = data;
m_background->mark_tile_dirty(offset&0x7ff );
}
@@ -226,7 +223,6 @@ PALETTE_INIT_MEMBER(shangkid_state,dynamski)
void shangkid_state::dynamski_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
{
- UINT8 *videoram = m_videoram;
int i;
int sx,sy;
int tile;
@@ -255,8 +251,8 @@ void shangkid_state::dynamski_draw_background(bitmap_ind16 &bitmap, const rectan
sx+=16;
}
- tile = videoram[i];
- attr = videoram[i+0x400];
+ tile = m_videoram[i];
+ attr = m_videoram[i+0x400];
/*
x---.---- priority?
-xx-.---- bank
@@ -279,7 +275,6 @@ void shangkid_state::dynamski_draw_background(bitmap_ind16 &bitmap, const rectan
void shangkid_state::dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{
- UINT8 *videoram = m_videoram;
int i;
int sx,sy;
int tile;
@@ -288,13 +283,13 @@ void shangkid_state::dynamski_draw_sprites(bitmap_ind16 &bitmap, const rectangle
int color;
for( i=0x7e; i>=0x00; i-=2 )
{
- bank = videoram[0x1b80+i];
- attr = videoram[0x1b81+i];
- tile = videoram[0xb80+i];
- color = videoram[0xb81+i];
- sy = 240-videoram[0x1380+i];
+ bank = m_videoram[0x1b80+i];
+ attr = m_videoram[0x1b81+i];
+ tile = m_videoram[0xb80+i];
+ color = m_videoram[0xb81+i];
+ sy = 240-m_videoram[0x1380+i];
- sx = videoram[0x1381+i]-64+8+16;
+ sx = m_videoram[0x1381+i]-64+8+16;
if( attr&1 ) sx += 0x100;
diff --git a/src/mame/video/shaolins.c b/src/mame/video/shaolins.c
index c7f3d76e900..afe34f881f7 100644
--- a/src/mame/video/shaolins.c
+++ b/src/mame/video/shaolins.c
@@ -1,6 +1,6 @@
/***************************************************************************
- video.c
+ shaolins.c
Functions to emulate the video hardware of the machine.
@@ -86,19 +86,19 @@ PALETTE_INIT_MEMBER(shaolins_state, shaolins)
}
}
-WRITE8_MEMBER(shaolins_state::shaolins_videoram_w)
+WRITE8_MEMBER(shaolins_state::videoram_w)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_MEMBER(shaolins_state::shaolins_colorram_w)
+WRITE8_MEMBER(shaolins_state::colorram_w)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_MEMBER(shaolins_state::shaolins_palettebank_w)
+WRITE8_MEMBER(shaolins_state::palettebank_w)
{
if (m_palettebank != (data & 0x07))
{
@@ -107,15 +107,13 @@ WRITE8_MEMBER(shaolins_state::shaolins_palettebank_w)
}
}
-WRITE8_MEMBER(shaolins_state::shaolins_scroll_w)
+WRITE8_MEMBER(shaolins_state::scroll_w)
{
- int col;
-
- for (col = 4; col < 32; col++)
+ for (int col = 4; col < 32; col++)
m_bg_tilemap->set_scrolly(col, data + 1);
}
-WRITE8_MEMBER(shaolins_state::shaolins_nmi_w)
+WRITE8_MEMBER(shaolins_state::nmi_w)
{
m_nmi_enable = data;
@@ -142,23 +140,23 @@ void shaolins_state::video_start()
8, 8, 32, 32);
m_bg_tilemap->set_scroll_cols(32);
+
+ save_item(NAME(m_palettebank));
+ save_item(NAME(m_nmi_enable));
}
void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- UINT8 *spriteram = m_spriteram;
- int offs;
-
- for (offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32 ) /* max 24 sprites */
+ for (int offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32 ) /* max 24 sprites */
{
- if (spriteram[offs] && spriteram[offs + 6]) /* stop rogue sprites on high score screen */
+ if (m_spriteram[offs] && m_spriteram[offs + 6]) /* stop rogue sprites on high score screen */
{
- int code = spriteram[offs + 8];
- int color = (spriteram[offs + 9] & 0x0f) | (m_palettebank << 4);
- int flipx = !(spriteram[offs + 9] & 0x40);
- int flipy = spriteram[offs + 9] & 0x80;
- int sx = 240 - spriteram[offs + 6];
- int sy = 248 - spriteram[offs + 4];
+ int code = m_spriteram[offs + 8];
+ int color = (m_spriteram[offs + 9] & 0x0f) | (m_palettebank << 4);
+ int flipx = !(m_spriteram[offs + 9] & 0x40);
+ int flipy = m_spriteram[offs + 9] & 0x80;
+ int sx = 240 - m_spriteram[offs + 6];
+ int sy = 248 - m_spriteram[offs + 4];
if (flip_screen())
{
@@ -177,7 +175,7 @@ void shaolins_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
}
}
-UINT32 shaolins_state::screen_update_shaolins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+UINT32 shaolins_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);