diff --git a/src/mame/drivers/namcos1.c b/src/mame/drivers/namcos1.c index 97e28586122..d5ba6c3bfe7 100644 --- a/src/mame/drivers/namcos1.c +++ b/src/mame/drivers/namcos1.c @@ -345,6 +345,9 @@ C - uses sub board with support for player 3 and 4 controls #include "sound/namco.h" #include "sound/dac.h" +static int dac0_value, dac1_value, dac0_gain, dac1_gain; + + /* from video */ VIDEO_START( namcos1 ); VIDEO_UPDATE( namcos1 ); @@ -420,13 +423,19 @@ static WRITE8_HANDLER( namcos1_coin_w ) coin_counter_w(1,data & 4); } -static int dac0_value ,dac1_value, dac0_gain=0x80, dac1_gain=0x80; - static void namcos1_update_DACs(void) { DAC_signed_data_16_w(0,0x8000 + (dac0_value * dac0_gain) + (dac1_value * dac1_gain)); } +void namcos1_init_DACs(void) +{ + dac0_value = 0; + dac1_value = 0; + dac0_gain=0x80; + dac1_gain=0x80; +} + static WRITE8_HANDLER( namcos1_dac_gain_w ) { int value; diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 7186e51e32e..26b6b921fc3 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -4,6 +4,9 @@ #define NAMCOS1_MAX_BANK 0x400 +/* from drivers */ +void namcos1_init_DACs(void); + /* from video */ READ8_HANDLER( namcos1_videoram_r ); WRITE8_HANDLER( namcos1_videoram_w ); @@ -570,6 +573,8 @@ WRITE8_HANDLER( namcos1_sound_bankswitch_w ) static int mcu_patch_data; static int namcos1_reset = 0; +static int wdog; +static int chip[16]; WRITE8_HANDLER( namcos1_cpu_control_w ) { @@ -589,8 +594,6 @@ WRITE8_HANDLER( namcos1_cpu_control_w ) WRITE8_HANDLER( namcos1_watchdog_w ) { - static int wdog; - wdog |= 1 << (cpu_getactivecpu()); if (wdog == 7 || !namcos1_reset) { @@ -702,7 +705,6 @@ static void set_bank(int banknum, const bankhandler *handler) static void namcos1_bankswitch(int cpu, offs_t offset, UINT8 data) { - static int chip[16]; int bank = (cpu*8) + (( offset >> 9) & 0x07); if (offset & 1) @@ -865,6 +867,11 @@ MACHINE_RESET( namcos1 ) /* mcu patch data clear */ mcu_patch_data = 0; namcos1_reset = 0; + + namcos1_init_DACs(); + memset(key, 0, sizeof(key)); + memset(chip, 0, sizeof(chip)); + wdog = 0; } @@ -949,7 +956,7 @@ struct namcos1_specific static void namcos1_driver_init(const struct namcos1_specific *specific ) { - const struct namcos1_specific no_key = + static const struct namcos1_specific no_key = { no_key_r,no_key_w }; @@ -998,7 +1005,7 @@ DRIVER_INIT( shadowld ) *******************************************************************************/ DRIVER_INIT( dspirit ) { - const struct namcos1_specific dspirit_specific= + static const struct namcos1_specific dspirit_specific= { key_type1_r,key_type1_w, 0x36 }; @@ -1010,7 +1017,7 @@ DRIVER_INIT( dspirit ) *******************************************************************************/ DRIVER_INIT( wldcourt ) { - const struct namcos1_specific worldcourt_specific= + static const struct namcos1_specific worldcourt_specific= { key_type1_r,key_type1_w, 0x35 }; @@ -1022,7 +1029,7 @@ DRIVER_INIT( wldcourt ) *******************************************************************************/ DRIVER_INIT( blazer ) { - const struct namcos1_specific blazer_specific= + static const struct namcos1_specific blazer_specific= { key_type1_r,key_type1_w, 0x13 }; @@ -1034,7 +1041,7 @@ DRIVER_INIT( blazer ) *******************************************************************************/ DRIVER_INIT( puzlclub ) { - const struct namcos1_specific puzlclub_specific= + static const struct namcos1_specific puzlclub_specific= { key_type1_r,key_type1_w, 0x35 }; @@ -1046,7 +1053,7 @@ DRIVER_INIT( puzlclub ) *******************************************************************************/ DRIVER_INIT( pacmania ) { - const struct namcos1_specific pacmania_specific= + static const struct namcos1_specific pacmania_specific= { key_type2_r,key_type2_w, 0x12 }; @@ -1058,7 +1065,7 @@ DRIVER_INIT( pacmania ) *******************************************************************************/ DRIVER_INIT( alice ) { - const struct namcos1_specific alice_specific= + static const struct namcos1_specific alice_specific= { key_type2_r,key_type2_w, 0x25 }; @@ -1070,7 +1077,7 @@ DRIVER_INIT( alice ) *******************************************************************************/ DRIVER_INIT( galaga88 ) { - const struct namcos1_specific galaga88_specific= + static const struct namcos1_specific galaga88_specific= { key_type2_r,key_type2_w, 0x31 }; @@ -1082,7 +1089,7 @@ DRIVER_INIT( galaga88 ) *******************************************************************************/ DRIVER_INIT( ws ) { - const struct namcos1_specific ws_specific= + static const struct namcos1_specific ws_specific= { key_type2_r,key_type2_w, 0x07 }; @@ -1094,7 +1101,7 @@ DRIVER_INIT( ws ) *******************************************************************************/ DRIVER_INIT( bakutotu ) { - const struct namcos1_specific bakutotu_specific= + static const struct namcos1_specific bakutotu_specific= { key_type2_r,key_type2_w, 0x22 }; @@ -1131,7 +1138,7 @@ DRIVER_INIT( bakutotu ) *******************************************************************************/ DRIVER_INIT( splatter ) { - const struct namcos1_specific splatter_specific= + static const struct namcos1_specific splatter_specific= { key_type3_r,key_type3_w, 181, 3, 4,-1,-1,-1,-1 }; @@ -1144,7 +1151,7 @@ DRIVER_INIT( splatter ) *******************************************************************************/ DRIVER_INIT( rompers ) { - const struct namcos1_specific rompers_specific= + static const struct namcos1_specific rompers_specific= { key_type3_r,key_type3_w, 182, 7,-1,-1,-1,-1,-1 }; @@ -1156,7 +1163,7 @@ DRIVER_INIT( rompers ) *******************************************************************************/ DRIVER_INIT( blastoff ) { - const struct namcos1_specific blastoff_specific= + static const struct namcos1_specific blastoff_specific= { key_type3_r,key_type3_w, 183, 0, 7, 3, 5,-1,-1 }; @@ -1168,7 +1175,7 @@ DRIVER_INIT( blastoff ) *******************************************************************************/ DRIVER_INIT( ws89 ) { - const struct namcos1_specific ws89_specific= + static const struct namcos1_specific ws89_specific= { key_type3_r,key_type3_w, 184, 2,-1,-1,-1,-1,-1 }; @@ -1180,7 +1187,7 @@ DRIVER_INIT( ws89 ) *******************************************************************************/ DRIVER_INIT( tankfrce ) { - const struct namcos1_specific tankfrce_specific= + static const struct namcos1_specific tankfrce_specific= { key_type3_r,key_type3_w, 185, 5,-1, 1,-1, 2,-1 }; @@ -1192,7 +1199,7 @@ DRIVER_INIT( tankfrce ) *******************************************************************************/ DRIVER_INIT( dangseed ) { - const struct namcos1_specific dangseed_specific= + static const struct namcos1_specific dangseed_specific= { key_type3_r,key_type3_w, 308, 6,-1, 5,-1, 0, 4 }; @@ -1204,7 +1211,7 @@ DRIVER_INIT( dangseed ) *******************************************************************************/ DRIVER_INIT( pistoldm ) { - const struct namcos1_specific pistoldm_specific= + static const struct namcos1_specific pistoldm_specific= { key_type3_r,key_type3_w, 309, 1, 2, 0,-1, 4,-1 }; @@ -1216,7 +1223,7 @@ DRIVER_INIT( pistoldm ) *******************************************************************************/ DRIVER_INIT( ws90 ) { - const struct namcos1_specific ws90_specific= + static const struct namcos1_specific ws90_specific= { key_type3_r,key_type3_w, 310, 4,-1, 7,-1, 3,-1 }; @@ -1228,7 +1235,7 @@ DRIVER_INIT( ws90 ) *******************************************************************************/ DRIVER_INIT( soukobdx ) { - const struct namcos1_specific soukobdx_specific= + static const struct namcos1_specific soukobdx_specific= { key_type3_r,key_type3_w, 311, 2, 3/*?*/, 0,-1, 4,-1 }; diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c index 9d2eb40a1a9..350e2c4984b 100644 --- a/src/mame/video/namcos1.c +++ b/src/mame/video/namcos1.c @@ -50,6 +50,7 @@ static UINT8 namcos1_playfield_control[0x20]; static tilemap *bg_tilemap[6]; static UINT8 *tilemap_maskdata; +static int copy_sprites; @@ -142,6 +143,9 @@ VIDEO_START( namcos1 ) machine->shadow_table[machine->pens[i]] = machine->pens[i + 0x0800]; spriteram = &namcos1_spriteram[0x800]; + + memset(namcos1_playfield_control, 0, sizeof(namcos1_playfield_control)); + copy_sprites = 0; } @@ -212,7 +216,6 @@ WRITE8_HANDLER( namcos1_paletteram_w ) -static int copy_sprites; READ8_HANDLER( namcos1_spriteram_r ) {