summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-07-24 06:18:01 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-07-24 06:18:01 +0000
commit9b63c422030b302154ad57541ccc5375cdc7e215 (patch)
tree6b044748b88c9a24c916e7c8042462ece99f5f96 /src
parent0865f72a9a1a0150c1320dad2c5940fd736bc640 (diff)
From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] .data removals to fix reset/multisession bugs Hi mamedev, One nice artifact of properly constifying data structures in MAME is that it makes it relatively easy to spot a class of reset/multisession bugs, namely that almost any object in .data is probably in error. Unless the value is properly initialized in a reset routine the initial non-zero value can't be relied upon, so there's no need to have a non-zero value to begin with. With that in mind, here's a patch to move more items out of .data by either applying const, removing the non-zero initializer (if its overwritten by init/reset) or by adding appropriate initialization code. In most cases I tried to add initialization code to a reset routine, but in some cases I chose an init routine, possibly leaving a reset bug intact. Some interesting bits: 1. tms9900 core. The use of .data to initialize the irq_level wasn't correct in some cases as the layout of the structure was core dependent. 2. bfcobra.c. By introducing a VIDEO_START routine a hack in VIDEO_UPDATE could be removed. ~aa
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/konami/konami.c2
-rw-r--r--src/emu/cpu/m68000/m68kdasm.c12
-rw-r--r--src/emu/cpu/mb86233/mb86233d.c4
-rw-r--r--src/emu/cpu/tms9900/99xxcore.h9
-rw-r--r--src/emu/machine/68681.c8
-rw-r--r--src/emu/sound/sn76477.c6
-rw-r--r--src/mame/audio/attckufo.c14
-rw-r--r--src/mame/audio/exidy.c8
-rw-r--r--src/mame/audio/galaxian.c4
-rw-r--r--src/mame/audio/meadows.c31
-rw-r--r--src/mame/drivers/airbustr.c16
-rw-r--r--src/mame/drivers/argus.c8
-rw-r--r--src/mame/drivers/bfcobra.c55
-rw-r--r--src/mame/drivers/cntsteer.c7
-rw-r--r--src/mame/drivers/ddenlovr.c10
-rw-r--r--src/mame/drivers/galaxian.c16
-rw-r--r--src/mame/drivers/gladiatr.c9
-rw-r--r--src/mame/drivers/hal21.c12
-rw-r--r--src/mame/drivers/konamim2.c4
-rw-r--r--src/mame/drivers/mediagx.c5
-rw-r--r--src/mame/drivers/megadriv.c20
-rw-r--r--src/mame/drivers/nemesis.c3
-rw-r--r--src/mame/drivers/superdq.c11
-rw-r--r--src/mame/drivers/suprnova.c2
-rw-r--r--src/mame/drivers/tubep.c2
-rw-r--r--src/mame/drivers/vigilant.c4
-rw-r--r--src/mame/drivers/wiz.c10
-rw-r--r--src/mame/includes/tecmosys.h12
-rw-r--r--src/mame/includes/tubep.h1
-rw-r--r--src/mame/machine/decocass.c9
-rw-r--r--src/mame/machine/fd1089.c2
-rw-r--r--src/mame/machine/opwolf.c11
-rw-r--r--src/mame/machine/tecmosys.c16
-rw-r--r--src/mame/video/argus.c59
-rw-r--r--src/mame/video/konamiic.c2
-rw-r--r--src/mame/video/model3.c76
-rw-r--r--src/mame/video/ninjakd2.c2
-rw-r--r--src/mame/video/suprnova.c25
-rw-r--r--src/mame/video/taito_f3.c132
-rw-r--r--src/mame/video/tubep.c33
-rw-r--r--src/mame/video/vigilant.c15
41 files changed, 439 insertions, 248 deletions
diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c
index 5933ffe1fb7..7642ac07152 100644
--- a/src/emu/cpu/konami/konami.c
+++ b/src/emu/cpu/konami/konami.c
@@ -162,7 +162,7 @@ static PAIR ea; /* effective address */
}
/* public globals */
-static int konami_ICount=50000;
+static int konami_ICount;
//int konami_Flags; /* flags for speed optimization (obsolete!!) */
/* these are re-defined in konami.h TO RAM, ROM or functions in memory.c */
diff --git a/src/emu/cpu/m68000/m68kdasm.c b/src/emu/cpu/m68000/m68kdasm.c
index 91b998febdc..ec5427d0daf 100644
--- a/src/emu/cpu/m68000/m68kdasm.c
+++ b/src/emu/cpu/m68000/m68kdasm.c
@@ -3050,7 +3050,7 @@ static void d68020_unpk_mm(void)
1 = pc idx
*/
-static opcode_struct g_opcode_info[] =
+static const opcode_struct g_opcode_info[] =
{
/* opcode handler mask match ea mask */
{d68000_1010 , 0xf000, 0xa000, 0x000},
@@ -3425,19 +3425,17 @@ static void build_opcode_table(void)
uint i;
uint opcode;
opcode_struct* ostruct;
- uint opcode_info_length = 0;
+ opcode_struct opcode_info[ARRAY_LENGTH(g_opcode_info)];
- for(ostruct = g_opcode_info;ostruct->opcode_handler != 0;ostruct++)
- opcode_info_length++;
-
- qsort((void *)g_opcode_info, opcode_info_length, sizeof(g_opcode_info[0]), compare_nof_true_bits);
+ memcpy(opcode_info, g_opcode_info, sizeof(g_opcode_info));
+ qsort((void *)opcode_info, ARRAY_LENGTH(opcode_info)-1, sizeof(opcode_info[0]), compare_nof_true_bits);
for(i=0;i<0x10000;i++)
{
g_instruction_table[i] = d68000_illegal; /* default to illegal */
opcode = i;
/* search through opcode info for a match */
- for(ostruct = g_opcode_info;ostruct->opcode_handler != 0;ostruct++)
+ for(ostruct = opcode_info;ostruct->opcode_handler != 0;ostruct++)
{
/* match opcode mask and allowed ea modes */
if((opcode & ostruct->mask) == ostruct->match)
diff --git a/src/emu/cpu/mb86233/mb86233d.c b/src/emu/cpu/mb86233/mb86233d.c
index fce114b8ee6..75db825c20f 100644
--- a/src/emu/cpu/mb86233/mb86233d.c
+++ b/src/emu/cpu/mb86233/mb86233d.c
@@ -538,8 +538,8 @@ unsigned dasm_mb86233(char *buffer, UINT32 opcode )
case 0x0e: /* Load 24 bit val */
{
- UINT32 sub=(opcode>>24)&0x3;
- const char regs[4] = { 'p', 'a', 'b', 'd' };
+ UINT32 sub=(opcode>>24)&0x3;
+ static const char regs[4] = { 'p', 'a', 'b', 'd' };
p += sprintf(p,"LDIMM24 0x%X->%c",opcode&0xffffff, regs[sub]);
}
diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h
index 95e8be33963..1854b0e1930 100644
--- a/src/emu/cpu/tms9900/99xxcore.h
+++ b/src/emu/cpu/tms9900/99xxcore.h
@@ -499,13 +499,7 @@ typedef struct
} tms99xx_Regs;
-static tms99xx_Regs I =
-{
- 0,0,0,0, /* don't care */
- 0, /* no pending interrupt */
- 0, /* LOAD* inactive */
- 16, 0, /* INTREQ* inactive */
-};
+static tms99xx_Regs I;
static UINT8 lastparity; /* rather than handling ST_OP directly, we copy the last value which
would set it here */
@@ -1280,6 +1274,7 @@ static void tms99xx_init(int index, int clock, const void *config, int (*irqcall
register_for_save_state(index);
+ I.irq_level = 16;
I.irq_callback = irqcallback;
#if (TMS99XX_MODEL == TMS9995_ID)
diff --git a/src/emu/machine/68681.c b/src/emu/machine/68681.c
index 8588bd9108b..81cf0dd4179 100644
--- a/src/emu/machine/68681.c
+++ b/src/emu/machine/68681.c
@@ -10,12 +10,12 @@
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-const char* duart68681_reg_read_names[0x10] =
+static const char *const duart68681_reg_read_names[0x10] =
{
"MRA", "SRA", "BRG Test", "RHRA", "IPCR", "ISR", "CTU", "CTL", "MRB", "SRB", "1X/16X Test", "RHRB", "IVR", "Input Ports", "Start Counter", "Stop Counter"
};
-const char* duart68681_reg_write_names[0x10] =
+static const char *const duart68681_reg_write_names[0x10] =
{
"MRA", "CSRA", "CRA", "THRA", "ACR", "IMR", "CRUR", "CTLR", "MRB", "CSRB", "CRB", "THRB", "IVR", "OPCR", "Set OP Bits", "Reset OP Bits"
};
@@ -142,8 +142,8 @@ static void duart68681_write_MR(duart68681_state *duart68681, int ch, UINT8 data
static void duart68681_write_CSR(duart68681_state *duart68681, int ch, UINT8 data, UINT8 ACR)
{
- const int baud_rate_ACR_0[] = { 50, 110, 134, 200, 300, 600, 1200, 1050, 2400, 4800, 7200, 9600, 38400, 0, 0, 0 };
- const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 0, 0, 0 };
+ static const int baud_rate_ACR_0[] = { 50, 110, 134, 200, 300, 600, 1200, 1050, 2400, 4800, 7200, 9600, 38400, 0, 0, 0 };
+ static const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, 2400, 4800, 1800, 9600, 19200, 0, 0, 0 };
duart68681->channel[ch].CSR = data;
diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c
index 28a7c2256ad..08c89678e21 100644
--- a/src/emu/sound/sn76477.c
+++ b/src/emu/sound/sn76477.c
@@ -650,7 +650,7 @@ static void log_enable_line(struct SN76477 *sn)
static void log_mixer_mode(struct SN76477 *sn)
{
- const char *desc[] =
+ static const char *const desc[] =
{
"VCO", "SLF", "Noise", "VCO/Noise",
"SLF/Noise", "SLF/VCO/Noise", "SLF/VCO", "Inhibit"
@@ -662,7 +662,7 @@ static void log_mixer_mode(struct SN76477 *sn)
static void log_envelope_mode(struct SN76477 *sn)
{
- const char *desc[] =
+ static const char *const desc[] =
{
"VCO", "One-Shot", "Mixer Only", "VCO with Alternating Polarity"
};
@@ -673,7 +673,7 @@ static void log_envelope_mode(struct SN76477 *sn)
static void log_vco_mode(struct SN76477 *sn)
{
- const char *desc[] =
+ static const char *const desc[] =
{
"External (Pin 16)", "Internal (SLF)"
};
diff --git a/src/mame/audio/attckufo.c b/src/mame/audio/attckufo.c
index b7ac3a33044..ec5be1dfa1b 100644
--- a/src/mame/audio/attckufo.c
+++ b/src/mame/audio/attckufo.c
@@ -55,11 +55,11 @@
#define NOISE_FREQUENCY ((14318181/14)/NOISE_VALUE)
#define NOISE_FREQUENCY_MAX ((14318181/14)/32/1)
-static int tone1pos = 0, tone2pos = 0, tone3pos = 0,
- tonesize, tone1samples = 1, tone2samples = 1, tone3samples = 1,
- noisesize, /* number of samples */
- noisepos = 0, /* pos of tone */
- noisesamples = 1; /* count of samples to give out per tone */
+static int tone1pos = 0, tone2pos = 0, tone3pos = 0;
+static int tonesize, tone1samples, tone2samples, tone3samples;
+static int noisesize, /* number of samples */
+ noisepos, /* pos of tone */
+ noisesamples; /* count of samples to give out per tone */
static sound_stream *channel;
static INT16 *tone;
@@ -218,6 +218,8 @@ void *attckufo_custom_start(int clock, const struct CustomSound_interface *confi
/* buffer for fastest played sample for 5 second
* so we have enough data for min 5 second */
noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
+ noisepos = 0;
+ noisesamples = 1;
noise = (INT8*) auto_malloc (noisesize * sizeof (noise[0]));
{
int noiseshift = 0x7ffff8;
@@ -250,6 +252,8 @@ void *attckufo_custom_start(int clock, const struct CustomSound_interface *confi
}
}
tonesize = OUTPUT_RATE / TONE_FREQUENCY_MIN;
+ tone1pos = tone2pos = tone3pos = 0;
+ tone1samples = tone2samples = tone3samples = 1;
tone = (INT16*) auto_malloc (tonesize * sizeof (tone[0]));
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c
index 25824cad390..e0905b43b43 100644
--- a/src/mame/audio/exidy.c
+++ b/src/mame/audio/exidy.c
@@ -75,10 +75,10 @@ static struct sh6840_timer_channel sh6840_timer[3];
static INT16 sh6840_volume[3];
static UINT8 sh6840_MSB;
static UINT8 sh6840_LFSR_oldxor = 0; /* should be saved in savestate */
-static UINT32 sh6840_LFSR_0 = 0xffffffff;/* ditto */
-static UINT32 sh6840_LFSR_1 = 0xffffffff;/* ditto */
-static UINT32 sh6840_LFSR_2 = 0xffffffff;/* ditto */
-static UINT32 sh6840_LFSR_3 = 0xffffffff;/* ditto */
+static UINT32 sh6840_LFSR_0;/* ditto */
+static UINT32 sh6840_LFSR_1;/* ditto */
+static UINT32 sh6840_LFSR_2;/* ditto */
+static UINT32 sh6840_LFSR_3;/* ditto */
static UINT32 sh6840_clocks_per_sample;
static UINT32 sh6840_clock_count;
diff --git a/src/mame/audio/galaxian.c b/src/mame/audio/galaxian.c
index 13d226dea4a..510950ae142 100644
--- a/src/mame/audio/galaxian.c
+++ b/src/mame/audio/galaxian.c
@@ -35,7 +35,7 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
static emu_timer *lfotimer = NULL;
-static INT32 freq = MAXFREQ;
+static INT32 freq;
#define STEP 1
@@ -186,6 +186,8 @@ static void galaxian_sh_start(void)
{
int i, j, sweep, charge, countdown, generator, bit1, bit2;
+ freq = MAXFREQ;
+
sample_set_volume(CHANNEL_NOISE, NOISE_VOLUME);
sample_set_volume(CHANNEL_SHOOT, SHOOT_VOLUME);
sample_set_volume(CHANNEL_LFO+0, LFO_VOLUME);
diff --git a/src/mame/audio/meadows.c b/src/mame/audio/meadows.c
index af241fc7337..4ec8d9fa309 100644
--- a/src/mame/audio/meadows.c
+++ b/src/mame/audio/meadows.c
@@ -30,18 +30,24 @@ static int dac_enable;
#define ENABLE_CTR1 0x08
static int channel;
-static int freq1 = 1000;
-static int freq2 = 1000;
+static int freq1;
+static int freq2;
static const INT16 waveform[2] = { -120*256, 120*256 };
+static UINT8 latched_0c01 = 0;
+static UINT8 latched_0c02 = 0;
+static UINT8 latched_0c03 = 0;
/************************************/
/* Sound handler start */
/************************************/
void meadows_sh_start(void)
{
- int vol[2];
-
- vol[0]=vol[1]=255;
+ meadows_0c00 = meadows_0c01 = meadows_0c02 = meadows_0c03 = 0;
+ meadows_dac = 0;
+ dac_enable = 0;
+ channel = 0;
+ freq1 = freq2 = 1000;
+ latched_0c01 = latched_0c02 = latched_0c03 = 0;
sample_set_volume(0,0);
sample_start_raw(0,waveform,ARRAY_LENGTH(waveform),freq1,1);
@@ -54,12 +60,9 @@ void meadows_sh_start(void)
/************************************/
void meadows_sh_update(void)
{
-static UINT8 latched_0c01 = 0;
-static UINT8 latched_0c02 = 0;
-static UINT8 latched_0c03 = 0;
-int preset, amp;
+ int preset, amp;
- if (latched_0c01 != meadows_0c01 || latched_0c03 != meadows_0c03)
+ if (latched_0c01 != meadows_0c01 || latched_0c03 != meadows_0c03)
{
/* amplitude is a combination of the upper 4 bits of 0c01 */
/* and bit 4 merged from S2650's flag output */
@@ -75,7 +78,7 @@ int preset, amp;
logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", channel, preset, freq1, amp);
sample_set_freq(0, freq1 * sizeof(waveform)/2);
sample_set_volume(0,amp/255.0);
- }
+ }
if (latched_0c02 != meadows_0c02 || latched_0c03 != meadows_0c03)
{
@@ -93,7 +96,7 @@ int preset, amp;
logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", channel+1, preset, freq2, amp);
sample_set_freq(1, freq2 * sizeof(waveform));
sample_set_volume(1,amp/255.0);
- }
+ }
if (latched_0c03 != meadows_0c03)
{
@@ -103,9 +106,9 @@ int preset, amp;
DAC_data_w(0, meadows_dac);
else
DAC_data_w(0, 0);
- }
+ }
- latched_0c01 = meadows_0c01;
+ latched_0c01 = meadows_0c01;
latched_0c02 = meadows_0c02;
latched_0c03 = meadows_0c03;
}
diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c
index 9dc38d44b01..9781ce66f41 100644
--- a/src/mame/drivers/airbustr.c
+++ b/src/mame/drivers/airbustr.c
@@ -226,6 +226,8 @@ Code at 505: waits for bit 1 to go low, writes command, waits for bit
static UINT8 *devram;
static int soundlatch_status, soundlatch2_status;
+static int master_addr;
+static int slave_addr;
extern UINT8 *airbustr_videoram2, *airbustr_colorram2;
@@ -575,18 +577,14 @@ static const struct YM2203interface ym2203_interface =
static INTERRUPT_GEN( master_interrupt )
{
- static int addr = 0xff;
-
- addr ^= 0x02;
- cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, addr);
+ master_addr ^= 0x02;
+ cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, master_addr);
}
static INTERRUPT_GEN( slave_interrupt )
{
- static int addr = 0xfd;
-
- addr ^= 0x02;
- cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, addr);
+ slave_addr ^= 0x02;
+ cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, slave_addr);
}
/* Machine Initialization */
@@ -594,6 +592,8 @@ static INTERRUPT_GEN( slave_interrupt )
static MACHINE_RESET( airbustr )
{
soundlatch_status = soundlatch2_status = 0;
+ master_addr = 0xff;
+ slave_addr = 0xfd;
master_bankswitch_w(machine, 0, 0x02);
slave_bankswitch_w(machine, 0, 0x02);
sound_bankswitch_w(machine, 0, 0x02);
diff --git a/src/mame/drivers/argus.c b/src/mame/drivers/argus.c
index d0cd1e3bf6c..e0d32db972c 100644
--- a/src/mame/drivers/argus.c
+++ b/src/mame/drivers/argus.c
@@ -112,6 +112,10 @@ VIDEO_START( argus );
VIDEO_START( valtric );
VIDEO_START( butasan );
VIDEO_START( bombsa );
+VIDEO_RESET( argus );
+VIDEO_RESET( valtric );
+VIDEO_RESET( butasan );
+VIDEO_RESET( bombsa );
VIDEO_UPDATE( argus );
VIDEO_UPDATE( valtric );
VIDEO_UPDATE( butasan );
@@ -719,6 +723,7 @@ static MACHINE_DRIVER_START( argus )
MDRV_PALETTE_LENGTH(896)
MDRV_VIDEO_START(argus)
+ MDRV_VIDEO_RESET(argus)
MDRV_VIDEO_UPDATE(argus)
/* sound hardware */
@@ -756,6 +761,7 @@ static MACHINE_DRIVER_START( valtric )
MDRV_PALETTE_LENGTH(768)
MDRV_VIDEO_START(valtric)
+ MDRV_VIDEO_RESET(valtric)
MDRV_VIDEO_UPDATE(valtric)
/* sound hardware */
@@ -799,6 +805,7 @@ static MACHINE_DRIVER_START( butasan )
MDRV_PALETTE_LENGTH(768)
MDRV_VIDEO_START(butasan)
+ MDRV_VIDEO_RESET(butasan)
MDRV_VIDEO_UPDATE(butasan)
/* sound hardware */
@@ -842,6 +849,7 @@ static MACHINE_DRIVER_START( bombsa )
MDRV_PALETTE_LENGTH(0x1000/2)
MDRV_VIDEO_START(bombsa)
+ MDRV_VIDEO_RESET(bombsa)
MDRV_VIDEO_UPDATE(bombsa)
/* sound hardware */
diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c
index c7b5e2863e4..055e2b101d8 100644
--- a/src/mame/drivers/bfcobra.c
+++ b/src/mame/drivers/bfcobra.c
@@ -252,7 +252,7 @@ static struct
#define RED_6 ( 6 << 5 )
#define RED_7 ( 7 << 5 )
-static UINT8 col4bit[16]=
+static const UINT8 col4bit_default[16]=
{
BLUE_0 | GREEN_0 | RED_0,
BLUE_1,
@@ -272,7 +272,7 @@ static UINT8 col4bit[16]=
RED_7 | GREEN_7 | BLUE_3
};
-static UINT8 col3bit[16]=
+static const UINT8 col3bit_default[16]=
{
0,
BLUE_3,
@@ -292,15 +292,37 @@ static UINT8 col3bit[16]=
RED_7 | GREEN_7 | BLUE_3
};
+static UINT8 col4bit[16];
+static UINT8 col3bit[16];
static UINT8 col8bit[256];
static UINT8 col7bit[256];
static UINT8 col6bit[256];
-static UINT8 col76index[] = {0, 2, 4, 7};
+static const UINT8 col76index[] = {0, 2, 4, 7};
+static VIDEO_START( bfcobra )
+{
+ int i;
+
+ memcpy(col4bit, col4bit_default, sizeof(col4bit));
+ memcpy(col3bit, col3bit_default, sizeof(col3bit));
+ for (i = 0; i < 256; ++i)
+ {
+ UINT8 col;
+
+ col8bit[i] = i;
+ col = i & 0x7f;
+ col = (col & 0x1f) | (col76index[ ( (col & 0x60) >> 5 ) & 3] << 5);
+ col7bit[i] = col;
+
+ col = (col & 3) | (col76index[( (col & 0x0c) >> 2) & 3] << 2 ) |
+ (col76index[( (col & 0x30) >> 4) & 3] << 5 );
+ col6bit[i] = col;
+ }
+}
+
static VIDEO_UPDATE( bfcobra )
{
- static int init_colour_indexes = 1;
int x, y;
UINT8 *src;
UINT32 *dest;
@@ -308,30 +330,6 @@ static VIDEO_UPDATE( bfcobra )
UINT8 *hirescol;
UINT8 *lorescol;
- /*
- The following is a dirty hack to init the palette index tables
- this should really be done elsewhere, preferably at compile time.
- */
- if (init_colour_indexes == 1)
- {
- init_colour_indexes = 0;
-
- for (x = 0; x < 256; ++x)
- {
- UINT8 col;
-
- col8bit[x] = x;
- col = x & 0x7f;
- col = (col & 0x1f) | (col76index[ ( (col & 0x60) >> 5 ) & 3] << 5);
- col7bit[x] = col;
-
- col = (col & 3) | (col76index[( (col & 0x0c) >> 2) & 3] << 2 ) |
- (col76index[( (col & 0x30) >> 4) & 3] << 5 );
- col6bit[x] = col;
- }
- }
-
-
/* Select screen has to be programmed into two registers */
/* No idea what happens if the registers are different */
if (flip_8 & 0x40 && flip_22 & 0x40)
@@ -1750,6 +1748,7 @@ static MACHINE_DRIVER_START( bfcobra )
MDRV_SOUND_CONFIG(upd7759_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+ MDRV_VIDEO_START(bfcobra)
MDRV_VIDEO_UPDATE(bfcobra)
MACHINE_DRIVER_END
diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c
index f7cf009fc57..ab57a1429b8 100644
--- a/src/mame/drivers/cntsteer.c
+++ b/src/mame/drivers/cntsteer.c
@@ -383,9 +383,10 @@ static ADDRESS_MAP_START( gekitsui_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
+static int newdata[5];
+
static WRITE8_HANDLER(scrivi)
{
- static int newdata[5] = {-1,-1,-1,-1,-1};
if(offset == 0)
{
scrolly = data;
@@ -958,6 +959,10 @@ static void init_cntsteer(void)
static DRIVER_INIT( zerotrgt )
{
+ int i;
+ for (i=0; i<ARRAY_LENGTH(newdata); i++)
+ newdata[i] = -1;
+
zerotrgt_rearrange_gfx(0x02000, 0x10000);
}
diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c
index a57e42b4d86..0721e4bd400 100644
--- a/src/mame/drivers/ddenlovr.c
+++ b/src/mame/drivers/ddenlovr.c
@@ -135,15 +135,15 @@ static int ddenlovr_blitter_irq_flag,ddenlovr_blitter_irq_enable;
static int ddenlovr_rect_width, ddenlovr_rect_height;
static int ddenlovr_clip_width, ddenlovr_clip_height;
static int ddenlovr_line_length;
-static int ddenlovr_clip_ctrl = 0xf,ddenlovr_clip_x,ddenlovr_clip_y;
+static int ddenlovr_clip_ctrl,ddenlovr_clip_x,ddenlovr_clip_y;
static int ddenlovr_scroll[8*2];
static int ddenlovr_priority, ddenlovr_priority2;
static int ddenlovr_bgcolor, ddenlovr_bgcolor2;
-static int ddenlovr_layer_enable=0x0f, ddenlovr_layer_enable2=0x0f;
+static int ddenlovr_layer_enable, ddenlovr_layer_enable2;
static int ddenlovr_palette_base[8], ddenlovr_palette_mask[8];
static int ddenlovr_transparency_pen[8], ddenlovr_transparency_mask[8];
static int ddenlovr_blit_reg;
-static int ddenlovr_blit_pen_mask = 0xff; // not implemented
+static int ddenlovr_blit_pen_mask; // not implemented
static int ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz
static const int *ddenlovr_blit_commands;
@@ -164,6 +164,10 @@ VIDEO_START(ddenlovr)
extra_layers = 0;
+ ddenlovr_clip_ctrl = 0x0f;
+ ddenlovr_layer_enable = ddenlovr_layer_enable2 = 0x0f;
+ ddenlovr_blit_pen_mask = 0xff;
+
// older games do not set these !?
ddenlovr_clip_width = 0x400;
ddenlovr_clip_height = 0x400;
diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c
index d5d0fd31d32..91ac505c9d2 100644
--- a/src/mame/drivers/galaxian.c
+++ b/src/mame/drivers/galaxian.c
@@ -1610,7 +1610,7 @@ GFXDECODE_END
*
*************************************/
-static struct AY8910interface frogger_ay8910_interface =
+static const struct AY8910interface frogger_ay8910_interface =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
@@ -1620,7 +1620,7 @@ static struct AY8910interface frogger_ay8910_interface =
NULL
};
-static struct AY8910interface konami_ay8910_interface_1 =
+static const struct AY8910interface konami_ay8910_interface_1 =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
@@ -1630,7 +1630,7 @@ static struct AY8910interface konami_ay8910_interface_1 =
NULL
};
-static struct AY8910interface konami_ay8910_interface_2 =
+static const struct AY8910interface konami_ay8910_interface_2 =
{
AY8910_DISCRETE_OUTPUT,
{RES_K(5.1), RES_K(5.1), RES_K(5.1)},
@@ -1640,7 +1640,7 @@ static struct AY8910interface konami_ay8910_interface_2 =
NULL
};
-static struct AY8910interface explorer_ay8910_interface_1 =
+static const struct AY8910interface explorer_ay8910_interface_1 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
@@ -1650,7 +1650,7 @@ static struct AY8910interface explorer_ay8910_interface_1 =
NULL
};
-static struct AY8910interface explorer_ay8910_interface_2 =
+static const struct AY8910interface explorer_ay8910_interface_2 =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
@@ -1660,7 +1660,7 @@ static struct AY8910interface explorer_ay8910_interface_2 =
NULL
};
-static struct AY8910interface sfx_ay8910_interface =
+static const struct AY8910interface sfx_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
@@ -1670,7 +1670,7 @@ static struct AY8910interface sfx_ay8910_interface =
sfx_sample_control_w
};
-static struct AY8910interface scorpion_ay8910_interface =
+static const struct AY8910interface scorpion_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
@@ -1680,7 +1680,7 @@ static struct AY8910interface scorpion_ay8910_interface =
scorpion_sound_control_w,
};
-static struct AY8910interface checkmaj_ay8910_interface =
+static const struct AY8910interface checkmaj_ay8910_interface =
{
AY8910_LEGACY_OUTPUT,
AY8910_DEFAULT_LOADS,
diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c
index ae4d1639b48..e9f2dfacf05 100644
--- a/src/mame/drivers/gladiatr.c
+++ b/src/mame/drivers/gladiatr.c
@@ -337,7 +337,7 @@ static WRITE8_HANDLER( gladiatr_irq_patch_w )
-static int data1,data2,flag1=1,flag2=1;
+static int data1,data2,flag1,flag2;
static WRITE8_HANDLER(qx0_w)
{
@@ -381,6 +381,12 @@ static READ8_HANDLER(qx1_r)
return flag1;
}
+static MACHINE_RESET( ppking )
+{
+ data1 = data2 = 0;
+ flag1 = flag2 = 1;
+}
+
static ADDRESS_MAP_START( ppking_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcbff) AM_RAM AM_BASE(&spriteram)
@@ -699,6 +705,7 @@ static MACHINE_DRIVER_START( ppking )
MDRV_INTERLEAVE(100)
+ MDRV_MACHINE_RESET(ppking)
MDRV_NVRAM_HANDLER(generic_0fill)
/* video hardware */
diff --git a/src/mame/drivers/hal21.c b/src/mame/drivers/hal21.c
index e241ebd058c..efd0de21e1e 100644
--- a/src/mame/drivers/hal21.c
+++ b/src/mame/drivers/hal21.c
@@ -61,6 +61,8 @@ AT08XX03:
static UINT8 *hal21_vreg, *hal21_sndfifo;
static UINT8 *textram;
static UINT8 *aso_scroll_sync;
+static int color[2];
+
/**************************************************************************/
// Test Handlers
@@ -179,10 +181,16 @@ static VIDEO_START( aso )
}
+static VIDEO_RESET( aso )
+{
+ color[0] = 8;
+ color[1] = 8;
+}
+
+
static void hal21_draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int scrollx, int scrolly, int attrs,
const gfx_element *gfx )
{
- static int color[2] = {8, 8};
int bankbase, c, x, y, offsx, offsy, dx, dy, sx, sy, offs, tile_number;
bankbase = attrs<<3 & 0x100;
@@ -728,6 +736,7 @@ static MACHINE_DRIVER_START( aso )
MDRV_PALETTE_INIT(aso)
MDRV_VIDEO_START(aso)
+ MDRV_VIDEO_RESET(aso)
MDRV_VIDEO_UPDATE(aso)
/* sound hardware */
@@ -773,6 +782,7 @@ static MACHINE_DRIVER_START( hal21 )
MDRV_PALETTE_INIT(aso)
MDRV_VIDEO_START(aso)
+ MDRV_VIDEO_RESET(aso)
MDRV_VIDEO_UPDATE(aso)
/* sound hardware */
diff --git a/src/mame/drivers/konamim2.c b/src/mame/drivers/konamim2.c
index 6a4a8864a29..1e070ee1c01 100644
--- a/src/mame/drivers/konamim2.c
+++ b/src/mame/drivers/konamim2.c
@@ -283,7 +283,7 @@ static READ64_HANDLER(unk2_r)
}
#endif
-static UINT64 unk3 = -1;
+static UINT64 unk3;
static READ64_HANDLER(unk3_r)
{
//return U64(0xffffffffffffffff);
@@ -1223,6 +1223,8 @@ ROM_END
static DRIVER_INIT( m2 )
{
+ unk3 = U64(0xffffffffffffffff);
+ unk20004 = 0;
cde_init();
}
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index ba05413db81..c727f5a052a 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -88,7 +88,8 @@ static UINT8 pal[768];
static UINT32 *main_ram;
static UINT32 disp_ctrl_reg[256/4];
-static int frame_width = 1, frame_height = 1;
+static int frame_width;
+static int frame_height;
static UINT32 memory_ctrl_reg[256/4];
static int pal_index = 0;
@@ -1119,6 +1120,8 @@ static void mediagx_set_keyb_int(int state) {
static void init_mediagx(running_machine *machine)
{
+ frame_width = frame_height = 1;
+
init_pc_common(machine, PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index 113a58b4921..fc29f9e94c3 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -56,12 +56,12 @@ Known Non-Issues (confirmed on Real Genesis)
/* the same on all systems? */
#define MASTER_CLOCK 53693100
/* timing details */
-static int megadriv_framerate = 60;
-static int megadrive_total_scanlines = 262;
-static int megadrive_visible_scanlines = 224;
-static int megadrive_irq6_scanline = 224;
+static int megadriv_framerate;
+static int megadrive_total_scanlines;
+static int megadrive_visible_scanlines;
+static int megadrive_irq6_scanline;
//int megadrive_irq6_hpos = 320;
-static int megadrive_z80irq_scanline = 226;
+static int megadrive_z80irq_scanline;
//int megadrive_z80irq_hpos = 320;
static int megadrive_imode = 0;
static int megadrive_imode_odd_frame = 0;
@@ -77,7 +77,6 @@ static UINT16* video_renderline;
static UINT16* megadrive_vdp_palette_lookup;
static UINT16* megadrive_vdp_palette_lookup_shadow;
static UINT16* megadrive_vdp_palette_lookup_highlight;
-static UINT8 oldscreenwidth = 3;
UINT16* megadrive_ram;
static UINT8 megadrive_vram_fill_pending = 0;
static UINT16 megadrive_vram_fill_length = 0;
@@ -2997,8 +2996,6 @@ VIDEO_START(megadriv)
highpri_renderline = auto_malloc(320);
video_renderline = auto_malloc(320*2);
- oldscreenwidth = -1; // 40 cell mode
-
megadrive_vdp_palette_lookup = auto_malloc(0x40*2);
megadrive_vdp_palette_lookup_shadow = auto_malloc(0x40*2);
megadrive_vdp_palette_lookup_highlight = auto_malloc(0x40*2);
@@ -4630,7 +4627,7 @@ INLINE UINT16 get_hposition(void)
---------- cycles 127840, 003b363e ba41aaaa (End of frame / start of next)
*/
-static int irq4counter = -1;
+static int irq4counter;
static emu_timer* render_timer;
@@ -4818,6 +4815,11 @@ MACHINE_RESET( megadriv )
memset(megadrive_ram,0x00,0x10000);
+ irq4counter = -1;
+ megadrive_total_scanlines = 262;
+ megadrive_visible_scanlines = 224;
+ megadrive_irq6_scanline = 224;
+ megadrive_z80irq_scanline = 226;
}
void megadriv_stop_scanline_timer(void)
diff --git a/src/mame/drivers/nemesis.c b/src/mame/drivers/nemesis.c
index 5ef33b86fc7..6a2f8be8cdc 100644
--- a/src/mame/drivers/nemesis.c
+++ b/src/mame/drivers/nemesis.c
@@ -80,6 +80,7 @@ static int irq_on = 0;
static int irq1_on = 0;
static int irq2_on = 0;
static int irq4_on = 0;
+static UINT8 a;
static MACHINE_RESET( nemesis )
@@ -88,6 +89,7 @@ static MACHINE_RESET( nemesis )
irq1_on = 0;
irq2_on = 0;
irq4_on = 0;
+ a = 1;
}
@@ -743,7 +745,6 @@ ADDRESS_MAP_END
static READ8_HANDLER( wd_r )
{
- static int a=1;
a^= 1;
return a;
}
diff --git a/src/mame/drivers/superdq.c b/src/mame/drivers/superdq.c
index 96571a91e57..7117741c269 100644
--- a/src/mame/drivers/superdq.c
+++ b/src/mame/drivers/superdq.c
@@ -28,7 +28,8 @@
#include "video/resnet.h"
static const device_config *laserdisc;
-static UINT8 superdq_ld_in_latch = 0, superdq_ld_out_latch = 0xff;
+static UINT8 superdq_ld_in_latch;
+static UINT8 superdq_ld_out_latch;
static tilemap *superdq_tilemap;
static int superdq_color_bank = 0;
@@ -144,6 +145,13 @@ static PALETTE_INIT( superdq )
}
}
+static MACHINE_RESET( superdq )
+{
+ superdq_ld_in_latch = 0;
+ superdq_ld_out_latch = 0xff;
+ superdq_color_bank = 0;
+}
+
static INTERRUPT_GEN( superdq_vblank )
{
laserdisc_vsync(laserdisc);
@@ -338,6 +346,7 @@ static MACHINE_DRIVER_START( superdq )
MDRV_CPU_VBLANK_INT("main", superdq_vblank)
MDRV_MACHINE_START(superdq)
+ MDRV_MACHINE_RESET(superdq)
MDRV_LASERDISC_ADD("laserdisc", PIONEER_LDV1000, 0, "laserdisc")
diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c
index fe0079e9e6c..a35c6853170 100644
--- a/src/mame/drivers/suprnova.c
+++ b/src/mame/drivers/suprnova.c
@@ -207,6 +207,7 @@ WRITE32_HANDLER ( skns_v3_regs_w );
WRITE32_HANDLER ( skns_pal_regs_w );
WRITE32_HANDLER ( skns_palette_ram_w );
VIDEO_START(skns);
+VIDEO_RESET(skns);
VIDEO_EOF(skns);
VIDEO_UPDATE(skns);
@@ -970,6 +971,7 @@ static MACHINE_DRIVER_START(skns)
MDRV_GFXDECODE(skns_bg)
MDRV_VIDEO_START(skns)
+ MDRV_VIDEO_RESET(skns)
MDRV_VIDEO_EOF(skns)
MDRV_VIDEO_UPDATE(skns)
diff --git a/src/mame/drivers/tubep.c b/src/mame/drivers/tubep.c
index dec20b5f6bf..479552a6a55 100644
--- a/src/mame/drivers/tubep.c
+++ b/src/mame/drivers/tubep.c
@@ -934,6 +934,7 @@ static MACHINE_DRIVER_START( tubep )
MDRV_PALETTE_INIT(tubep)
MDRV_VIDEO_START(tubep)
+ MDRV_VIDEO_RESET(tubep)
MDRV_VIDEO_UPDATE(tubep)
/* sound hardware */
@@ -998,6 +999,7 @@ static MACHINE_DRIVER_START( rjammer )
MDRV_PALETTE_INIT(rjammer)
MDRV_VIDEO_START(tubep)
+ MDRV_VIDEO_RESET(tubep)
MDRV_VIDEO_UPDATE(rjammer)
/* sound hardware */
diff --git a/src/mame/drivers/vigilant.c b/src/mame/drivers/vigilant.c
index 07f15d0e124..84102ac0669 100644
--- a/src/mame/drivers/vigilant.c
+++ b/src/mame/drivers/vigilant.c
@@ -23,6 +23,7 @@ Buccaneers has a 5.6888 Mhz and a 18.432 Mhz OSC
/* video/vigilant.c */
VIDEO_START( vigilant );
+VIDEO_RESET( vigilant );
WRITE8_HANDLER( vigilant_paletteram_w );
WRITE8_HANDLER( vigilant_sprite_paletteram_w );
WRITE8_HANDLER( vigilant_horiz_scroll_w );
@@ -552,6 +553,7 @@ static MACHINE_DRIVER_START( vigilant )
MDRV_PALETTE_LENGTH(512+32) /* 512 real palette, 32 virtual palette */
MDRV_VIDEO_START(vigilant)
+ MDRV_VIDEO_RESET(vigilant)
MDRV_VIDEO_UPDATE(vigilant)
/* sound hardware */
@@ -594,6 +596,7 @@ static MACHINE_DRIVER_START( buccanrs )
MDRV_PALETTE_LENGTH(512+32) /* 512 real palette, 32 virtual palette */
MDRV_VIDEO_START(vigilant)
+ MDRV_VIDEO_RESET(vigilant)
MDRV_VIDEO_UPDATE(vigilant)
/* sound hardware */
@@ -652,6 +655,7 @@ static MACHINE_DRIVER_START( kikcubic )
MDRV_PALETTE_LENGTH(256)
MDRV_VIDEO_START(vigilant)
+ MDRV_VIDEO_RESET(vigilant)
MDRV_VIDEO_UPDATE(kikcubic)
/* sound hardware */
diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c
index fd2e231b5e3..27340eb32c8 100644
--- a/src/mame/drivers/wiz.c
+++ b/src/mame/drivers/wiz.c
@@ -184,9 +184,10 @@ VIDEO_UPDATE( kungfut );
#define STINGER_BOOM_EN1 NODE_03
#define STINGER_BOOM_EN2 NODE_04
+static int dsc0, dsc1;
+
static WRITE8_HANDLER( sound_command_w )
{
- static int dsc0=1, dsc1=1;
switch (offset)
{
// 0x90 triggers a jump to non-existant address(development system?) and must be filtered
@@ -689,6 +690,11 @@ DISCRETE_SOUND_END
//* ANALOG SOUND ENDS
+static MACHINE_RESET( wiz )
+{
+ dsc0 = dsc1 = 1;
+}
+
static MACHINE_DRIVER_START( wiz )
/* basic machine hardware */
@@ -700,6 +706,8 @@ static MACHINE_DRIVER_START( wiz )
MDRV_CPU_PROGRAM_MAP(sound_map,0)
MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,4) /* ??? */
+ MDRV_MACHINE_RESET( wiz )
+
/* video hardware */
MDRV_SCREEN_ADD("main", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/includes/tecmosys.h b/src/mame/includes/tecmosys.h
index 8c1ee0d8d4a..bd35a0c3aba 100644
--- a/src/mame/includes/tecmosys.h
+++ b/src/mame/includes/tecmosys.h
@@ -17,8 +17,8 @@ enum DEV_STATUS
struct prot_data
{
UINT8 passwd_len;
- UINT8* passwd;
- UINT8* code;
+ const UINT8* passwd;
+ const UINT8* code;
UINT8 checksum_ranges[17];
UINT8 checksums[4];
};
@@ -32,10 +32,10 @@ WRITE16_HANDLER(prot_data_w);
extern UINT8 device_read_ptr;
extern UINT8 device_status;
-extern struct prot_data* device_data;
-extern struct prot_data deroon_data;
-extern struct prot_data tkdensho_data;
-extern struct prot_data tkdensha_data;
+extern const struct prot_data* device_data;
+extern const struct prot_data deroon_data;
+extern const struct prot_data tkdensho_data;
+extern const struct prot_data tkdensha_data;
diff --git a/src/mame/includes/tubep.h b/src/mame/includes/tubep.h
index 73ca2f9e2d6..5f2235be7b9 100644
--- a/src/mame/includes/tubep.h
+++ b/src/mame/includes/tubep.h
@@ -6,6 +6,7 @@ VIDEO_UPDATE( tubep );
PALETTE_INIT( rjammer );
VIDEO_UPDATE( rjammer );
VIDEO_START( tubep );
+VIDEO_RESET( tubep );
extern UINT8 *rjammer_backgroundram;
extern UINT8 *tubep_backgroundram;
diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c
index 32602b3d637..dd2ef7ffe53 100644
--- a/src/mame/machine/decocass.c
+++ b/src/mame/machine/decocass.c
@@ -15,13 +15,14 @@ INT32 tape_speed;
attotime tape_time0;
emu_timer *tape_timer;
-static INT32 firsttime = 1;
+static INT32 firsttime;
static INT32 tape_present;
static INT32 tape_blocks;
static INT32 tape_length;
static INT32 tape_bot_eot;
static UINT8 crc16_lsb;
static UINT8 crc16_msb;
+static UINT8 latch1;
/* pre-calculated crc16 of the tape blocks */
static UINT8 tape_crc16_lsb[256];
@@ -587,7 +588,6 @@ static void decocass_fno(offs_t offset, UINT8 data)
static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r )
{
- static UINT8 latch1;
UINT8 data;
if (1 == (offset & 1))
@@ -667,7 +667,6 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r )
static READ8_HANDLER( decocass_type1_pass_136_r )
{
- static UINT8 latch1;
UINT8 data;
if (1 == (offset & 1))
@@ -747,7 +746,6 @@ static READ8_HANDLER( decocass_type1_pass_136_r )
static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r )
{
- static UINT8 latch1;
UINT8 data;
if (1 == (offset & 1))
@@ -827,7 +825,6 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r )
static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r )
{
- static UINT8 latch1;
UINT8 data;
if (1 == (offset & 1))
@@ -909,7 +906,6 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r )
static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r )
{
- static UINT8 latch1;
UINT8 data;
if (1 == (offset & 1))
@@ -1660,6 +1656,7 @@ static void decocass_init_common(running_machine *machine)
tape_timer = timer_alloc(NULL, NULL);
firsttime = 1;
+ latch1 = 0;
tape_present = 1;
tape_blocks = 0;
for (i = memory_region_length(machine, REGION_USER2) / 256 - 1; !tape_blocks && i > 0; i--)
diff --git a/src/mame/machine/fd1089.c b/src/mame/machine/fd1089.c
index cdcb8ccb530..b86ea1cd002 100644
--- a/src/mame/machine/fd1089.c
+++ b/src/mame/machine/fd1089.c
@@ -6847,7 +6847,7 @@ static const UINT8 key_5021[0x2000] =
};
/* 317-xxxx FD1089A - Partial table. */
-static UINT8 key_wb35[0x2000] =
+static const UINT8 key_wb35[0x2000] =
{
/* data */
0x54,0x36,0xf5,0x8c,0x1a,0xe3,0x2f,0x3a,0x90,0x09,0x3e,0xde,0x33,0x8f,0x63,0x02,
diff --git a/src/mame/machine/opwolf.c b/src/mame/machine/opwolf.c
index 7cbc6dd408d..4eb4d603a00 100644
--- a/src/mame/machine/opwolf.c
+++ b/src/mame/machine/opwolf.c
@@ -58,9 +58,9 @@ static UINT8* cchip_ram=0;
static UINT8 cchip_last_7a=0;
static UINT8 cchip_last_04=0;
static UINT8 cchip_last_05=0;
-static UINT8 cchip_coins_for_credit[2]={1,1};
-static UINT8 cchip_credits_for_coin[2]={1,1};
-static UINT8 cchip_coins[2]={0,0};
+static UINT8 cchip_coins_for_credit[2];
+static UINT8 cchip_credits_for_coin[2];
+static UINT8 cchip_coins[2];
static UINT8 c588=0, c589=0, c58a=0; // These variables derived from the bootleg
static const UINT16 level_data_00[0xcc] =
@@ -738,9 +738,14 @@ void opwolf_cchip_init(void)
state_save_register_global(cchip_credits_for_coin[1]);
state_save_register_global_pointer(cchip_ram, 0x400 * 8);
+ current_bank=0;
+ current_cmd=0;
cchip_last_7a=0;
cchip_last_04=0xfc;
cchip_last_05=0xff;
+ c588=0;
+ c589=0;
+ c58a=0;
cchip_coins[0]=0;
cchip_coins[1]=0;
cchip_coins_for_credit[0]=1;
diff --git a/src/mame/machine/tecmosys.c b/src/mame/machine/tecmosys.c
index 370aa23bb2d..85bda4508fb 100644
--- a/src/mame/machine/tecmosys.c
+++ b/src/mame/machine/tecmosys.c
@@ -33,13 +33,13 @@
UINT8 device_read_ptr;
UINT8 device_status;
-struct prot_data* device_data;
+const struct prot_data* device_data;
static UINT8 device_value = 0xff;
// deroon prot data
-static UINT8 deroon_passwd[] = {'L','U','N','A',0};
-static UINT8 deroon_upload[] = {0x02, 0x4e, 0x75, 0x00 }; // code length, code, 0x00 trailer
-struct prot_data deroon_data =
+static const UINT8 deroon_passwd[] = {'L','U','N','A',0};
+static const UINT8 deroon_upload[] = {0x02, 0x4e, 0x75, 0x00 }; // code length, code, 0x00 trailer
+const struct prot_data deroon_data =
{
5,
deroon_passwd,
@@ -55,9 +55,9 @@ struct prot_data deroon_data =
};
// tkdensho prot data
-static UINT8 tkdensho_passwd[] = {'A','G','E','P','R','O','T','E','C','T',' ','S','T','A','R','T',0};
-static UINT8 tkdensho_upload[] = {0x06, 0x4e, 0xf9, 0x00, 0x00, 0x22, 0xc4,0x00};
-struct prot_data tkdensho_data =
+static const UINT8 tkdensho_passwd[] = {'A','G','E','P','R','O','T','E','C','T',' ','S','T','A','R','T',0};
+static const UINT8 tkdensho_upload[] = {0x06, 0x4e, 0xf9, 0x00, 0x00, 0x22, 0xc4,0x00};
+const struct prot_data tkdensho_data =
{
0x11,
tkdensho_passwd,
@@ -72,7 +72,7 @@ struct prot_data tkdensho_data =
{ 0xbf, 0xfa, 0xda, 0xda }
};
-struct prot_data tkdensha_data =
+const struct prot_data tkdensha_data =
{
0x11,
tkdensho_passwd,
diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c
index 25d10870491..a395660a74d 100644
--- a/src/mame/video/argus.c
+++ b/src/mame/video/argus.c
@@ -143,8 +143,8 @@ static tilemap *bg0_tilemap = NULL;
static tilemap *bg1_tilemap = NULL;
static tilemap *bombsa_bg_tilemap = NULL;
-static UINT8 argus_bg_status = 0x01;
-static UINT8 butasan_bg1_status = 0x01;
+static UINT8 argus_bg_status;
+static UINT8 butasan_bg1_status;
static UINT8 argus_bg_purple = 0;
static UINT8 argus_flipscreen = 0;
@@ -302,9 +302,16 @@ static TILE_GET_INFO( butasan_get_bg1_tile_info )
Initialize and destroy video hardware emulation
***************************************************************************/
+static void reset_common(void)
+{
+ argus_bg_status = 0x01;
+ argus_bg_purple = 0;
+ argus_flipscreen = 0;
+ argus_palette_intensity = 0;
+}
+
VIDEO_START( argus )
{
- lowbitscroll = 0;
/* info offset type w h col row */
bg0_tilemap = tilemap_create(argus_get_bg0_tile_info, tilemap_scan_cols, 16, 16, 32, 32);
bg1_tilemap = tilemap_create(argus_get_bg1_tile_info, tilemap_scan_cols, 16, 16, 32, 32);
@@ -312,16 +319,24 @@ VIDEO_START( argus )
/* dummy RAM for back ground */
argus_dummy_bg0ram = auto_malloc( 0x800 );
- memset( argus_dummy_bg0ram, 0, 0x800 );
-
- memset( argus_bg0_scrollx, 0x00, 2 );
tilemap_set_transparent_pen( bg0_tilemap, 15 );
tilemap_set_transparent_pen( bg1_tilemap, 15 );
tilemap_set_transparent_pen( tx_tilemap, 15 );
jal_blend_table = auto_malloc(0xc00);
- memset(jal_blend_table,0,0xc00) ;
+}
+
+VIDEO_RESET( argus )
+{
+ lowbitscroll = 0;
+ prvscrollx = 0;
+
+ memset( argus_dummy_bg0ram, 0, 0x800 );
+ memset( argus_bg0_scrollx, 0x00, 2 );
+
+ memset(jal_blend_table,0,0xc00);
+ reset_common();
}
VIDEO_START( valtric )
@@ -334,7 +349,13 @@ VIDEO_START( valtric )
tilemap_set_transparent_pen( tx_tilemap, 15 );
mosaicbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
jal_blend_table = auto_malloc(0xc00);
- memset(jal_blend_table,0,0xc00) ;
+}
+
+VIDEO_RESET( valtric )
+{
+ valtric_mosaic = 0;
+ memset(jal_blend_table,0,0xc00);
+ reset_common();
}
VIDEO_START( butasan )
@@ -349,15 +370,22 @@ VIDEO_START( butasan )
butasan_txbackram = auto_malloc( BUTASAN_TXBACK_RAMSIZE );
butasan_bg0backram = auto_malloc( BUTASAN_BG0BACK_RAMSIZE );
+ tilemap_set_transparent_pen( tx_tilemap, 15 );
+
+ jal_blend_table = auto_malloc(0xc00);
+}
+
+VIDEO_RESET( butasan )
+{
+ butasan_bg1_status = 0x01;
+
memset( butasan_txram, 0x00, BUTASAN_TEXT_RAMSIZE );
memset( butasan_bg0ram, 0x00, BUTASAN_BG0_RAMSIZE );
memset( butasan_txbackram, 0x00, BUTASAN_TXBACK_RAMSIZE );
memset( butasan_bg0backram, 0x00, BUTASAN_BG0BACK_RAMSIZE );
- tilemap_set_transparent_pen( tx_tilemap, 15 );
-
- jal_blend_table = auto_malloc(0xc00);
- memset(jal_blend_table,0,0xc00) ;
+ memset(jal_blend_table,0,0xc00);
+ reset_common();
}
#if 0
@@ -421,6 +449,13 @@ VIDEO_START( bombsa )
bomba_otherram = auto_malloc(0x1000);
}
+VIDEO_RESET( bombsa )
+{
+ bombsa_ram_page = 0;
+ memset(bomba_otherram, 0, 0x1000);
+ reset_common();
+}
+
/***************************************************************************
Functions for handler of MAP roms in Argus and palette color
***************************************************************************/
diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c
index 28facb1408d..985227282e8 100644
--- a/src/mame/video/konamiic.c
+++ b/src/mame/video/konamiic.c
@@ -2954,7 +2954,7 @@ WRITE8_HANDLER( K052109_051960_w )
/* */
/***************************************************************************/
-static int K05324x_z_rejection = -1;
+static int K05324x_z_rejection;
/*
In a K053247+K055555 setup objects with Z-code 0x00 should be ignored
diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c
index 66a22b8d9e3..cb99b6f0760 100644
--- a/src/mame/video/model3.c
+++ b/src/mame/video/model3.c
@@ -73,6 +73,7 @@ static void translate_matrix_stack(float x, float y, float z);
static void traverse_list(UINT32 address);
static void draw_block(UINT32 address);
static void draw_viewport(int pri, UINT32 address);
+static void invalidate_texture(int page, int texx, int texy, int texwidth, int texheight);
/*****************************************************************************/
@@ -118,6 +119,34 @@ static cached_texture *texcache[2][1024/32][2048/32];
static int list_depth = 0;
+static int tick = 0;
+static int debug_layer_disable = 0;
+
+
+static UINT64 vid_reg0;
+
+/* matrix stack */
+#define MATRIX_STACK_SIZE 256
+
+static int matrix_stack_ptr = 0;
+static MATRIX matrix_stack[MATRIX_STACK_SIZE];
+
+#ifdef UNUSED_DEFINITION
+static const int num_bits[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
+#endif
+
+static MATRIX coordinate_system;
+static float viewport_focal_length;
+static int viewport_region_x;
+static int viewport_region_y;
+static int viewport_region_width;
+static int viewport_region_height;
+
+static PLANE clip_plane[5];
+
+static UINT32 matrix_base_address;
+
+
#define BYTE_REVERSE32(x) (((x >> 24) & 0xff) | \
((x >> 8) & 0xff00) | \
((x << 8) & 0xff0000) | \
@@ -125,8 +154,6 @@ static int list_depth = 0;
#define BYTE_REVERSE16(x) (((x >> 8) & 0xff) | ((x << 8) & 0xff00))
-static void invalidate_texture(int page, int texx, int texy, int texwidth, int texheight);
-
static void model3_exit(running_machine *machine)
{
@@ -174,6 +201,16 @@ VIDEO_START( model3 )
memset(polygon_ram, 0, 0x400000);
memset(texture_fifo, 0, 0x100000);
+ tick = 0;
+ debug_layer_disable = 0;
+ vid_reg0 = 0;
+
+ viewport_focal_length = 300.;
+ viewport_region_x = 0;
+ viewport_region_y = 0;
+ viewport_region_width = 496;
+ viewport_region_height = 384;
+
init_matrix_stack();
}
@@ -242,7 +279,7 @@ static void draw_tile_8bit(bitmap_t *bitmap, int tx, int ty, int tilenum)
tile += 8;
}
}
-#if 0
+#ifdef UNUSED_FUNCTION
static void draw_texture_sheet(bitmap_t *bitmap, const rectangle *cliprect)
{
int x,y;
@@ -352,9 +389,6 @@ static void copy_screen(bitmap_t *bitmap, const rectangle *cliprect)
}
#endif
-static int tick = 0;
-static int debug_layer_disable = 0;
-
VIDEO_UPDATE( model3 )
{
int layer_scroll_x[4], layer_scroll_y[4];
@@ -451,7 +485,6 @@ WRITE64_HANDLER(model3_tile_w)
COMBINE_DATA(&m3_tile_ram[offset]);
}
-static UINT64 vid_reg0;
READ64_HANDLER(model3_vid_reg_r)
{
switch(offset)
@@ -918,12 +951,6 @@ static void matrix_multiply(MATRIX a, MATRIX b, MATRIX *out)
memcpy(out, &tmp, sizeof(MATRIX));
}
-/* matrix stack */
-#define MATRIX_STACK_SIZE 256
-
-static int matrix_stack_ptr = 0;
-static MATRIX matrix_stack[MATRIX_STACK_SIZE];
-
static void init_matrix_stack(void)
{
/* initialize the first matrix as identity */
@@ -952,7 +979,7 @@ static void get_top_matrix(MATRIX *out)
memcpy( out, &matrix_stack[matrix_stack_ptr], sizeof(MATRIX));
}
-void push_matrix_stack(void)
+static void push_matrix_stack(void)
{
matrix_stack_ptr++;
if (matrix_stack_ptr >= MATRIX_STACK_SIZE)
@@ -961,19 +988,19 @@ void push_matrix_stack(void)
memcpy( &matrix_stack[matrix_stack_ptr], &matrix_stack[matrix_stack_ptr-1], sizeof(MATRIX));
}
-void pop_matrix_stack(void)
+static void pop_matrix_stack(void)
{
matrix_stack_ptr--;
if (matrix_stack_ptr < 0)
fatalerror("pop_matrix_stack: matrix stack underflow");
}
-void multiply_matrix_stack(MATRIX matrix)
+static void multiply_matrix_stack(MATRIX matrix)
{
matrix_multiply(matrix, matrix_stack[matrix_stack_ptr], &matrix_stack[matrix_stack_ptr]);
}
-void translate_matrix_stack(float x, float y, float z)
+static void translate_matrix_stack(float x, float y, float z)
{
MATRIX tm;
@@ -1060,19 +1087,6 @@ static int clip_polygon(const poly_vertex *v, int num_vertices, PLANE cp, poly_v
return clip_verts;
}
-#ifdef UNUSED_DEFINITION
-static const int num_bits[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
-#endif
-
-static MATRIX coordinate_system;
-static float viewport_focal_length = 300;
-static int viewport_region_x = 0;
-static int viewport_region_y = 0;
-static int viewport_region_width = 496;
-static int viewport_region_height = 384;
-
-static PLANE clip_plane[5];
-
static void render_one(TRIANGLE *tri)
{
poly_extra_data *extra = poly_get_extra_data(poly);
@@ -1299,8 +1313,6 @@ static void draw_model(UINT32 addr)
/*****************************************************************************/
/* display list parser */
-static UINT32 matrix_base_address;
-
static UINT32 *get_memory_pointer(UINT32 address)
{
if (address & 0x800000)
diff --git a/src/mame/video/ninjakd2.c b/src/mame/video/ninjakd2.c
index e32f12005f4..f0cb7d85afd 100644
--- a/src/mame/video/ninjakd2.c
+++ b/src/mame/video/ninjakd2.c
@@ -17,7 +17,7 @@ static tilemap* bg0_tilemap;
static tilemap* bg1_tilemap;
static tilemap* bg2_tilemap;
-static int bank_mask = 1;
+static int bank_mask;
static int robokid_bg0_bank = 0;
static int robokid_bg1_bank = 0;
static int robokid_bg2_bank = 0;
diff --git a/src/mame/video/suprnova.c b/src/mame/video/suprnova.c
index 84c0aad6e4e..163a4f40725 100644
--- a/src/mame/video/suprnova.c
+++ b/src/mame/video/suprnova.c
@@ -120,11 +120,11 @@ extern UINT32 skns_v3t_4bppdirty[0x8000]; // allocate this elsewhere?
extern int skns_v3t_somedirty,skns_v3t_4bpp_somedirty;
static UINT8 decodebuffer[SUPRNOVA_DECODE_BUFFER_SIZE];
-static int old_depthA=0, depthA=0;
-static int old_depthB=0, depthB=0;
+static int depthA=0;
+static int depthB=0;
static int sprite_kludge_x=0, sprite_kludge_y=0;
-static int use_spc_bright = 1, use_v3_bright = 1; // makes sarukani rather dark, but should be default..
+static int use_spc_bright, use_v3_bright; // makes sarukani rather dark, but should be default..
static UINT8 bright_spc_b=0x00, bright_spc_g=0x00, bright_spc_r=0x00;
static UINT8 bright_spc_b_trans=0x00, bright_spc_g_trans=0x00, bright_spc_r_trans=0x00;
@@ -135,7 +135,7 @@ static UINT8 bright_v3_b_trans = 0x00, bright_v3_g_trans = 0x00, bright_v3_r_tra
// This ignores the alpha values atm.
static int spc_changed=0, v3_changed=0, palette_updated=0;
-int suprnova_alt_enable_background = 1, suprnova_alt_enable_sprites = 1;
+static int suprnova_alt_enable_background, suprnova_alt_enable_sprites;
WRITE32_HANDLER ( skns_pal_regs_w )
{
@@ -898,8 +898,8 @@ WRITE32_HANDLER ( skns_v3_regs_w )
/* if the depth changes we need to dirty the tilemap */
if (offset == 0x0c/4)
{
- old_depthA = depthA;
- old_depthB = depthB;
+ int old_depthA = depthA;
+ int old_depthB = depthB;
depthA = (skns_v3_regs[0x0c/4] & 0x0001) << 1;
depthB = (skns_v3_regs[0x0c/4] & 0x0100) >> 7;
@@ -931,6 +931,19 @@ VIDEO_START(skns)
machine->gfx[3]->color_granularity=256;
}
+VIDEO_RESET( skns )
+{
+ depthA = depthB = 0;
+ use_spc_bright = use_v3_bright = 1;
+ bright_spc_b= bright_spc_g = bright_spc_r = 0x00;
+ bright_spc_b_trans = bright_spc_g_trans = bright_spc_r_trans = 0x00;
+ bright_v3_b = bright_v3_g = bright_v3_r = 0x00;
+ bright_v3_b_trans = bright_v3_g_trans = bright_v3_r_trans = 0x00;
+
+ spc_changed = v3_changed = palette_updated = 0;
+ suprnova_alt_enable_background = suprnova_alt_enable_sprites = 1;
+}
+
static void supernova_draw_a( bitmap_t *bitmap, bitmap_t* bitmap_flags, const rectangle *cliprect, int tran )
{
int enable_a = (skns_v3_regs[0x10/4] >> 0) & 0x0001;
diff --git a/src/mame/video/taito_f3.c b/src/mame/video/taito_f3.c
index 55316039d62..372e5ab57a8 100644
--- a/src/mame/video/taito_f3.c
+++ b/src/mame/video/taito_f3.c
@@ -293,7 +293,7 @@ static struct tempsprite *spritelist;
static const struct tempsprite *sprite_end;
static void get_sprite_info(running_machine *machine, const UINT32 *spriteram32_ptr);
-static int sprite_lag=1;
+static int sprite_lag;
static UINT8 sprite_pri_usage=0;
struct f3_playfield_line_inf
@@ -348,23 +348,70 @@ pri_alp_bitmap
1--- ---- alpha level b b000
1111 1111 opaque pixel
*/
-static int f3_alpha_level_2as=127;
-static int f3_alpha_level_2ad=127;
-static int f3_alpha_level_3as=127;
-static int f3_alpha_level_3ad=127;
-static int f3_alpha_level_2bs=127;
-static int f3_alpha_level_2bd=127;
-static int f3_alpha_level_3bs=127;
-static int f3_alpha_level_3bd=127;
+static int f3_alpha_level_2as;
+static int f3_alpha_level_2ad;
+static int f3_alpha_level_3as;
+static int f3_alpha_level_3ad;
+static int f3_alpha_level_2bs;
+static int f3_alpha_level_2bd;
+static int f3_alpha_level_3bs;
+static int f3_alpha_level_3bd;
+static int alpha_level_last;
static void init_alpha_blend_func(void);
-static int width_mask=0x1ff;
-static int twidth_mask=0x1f,twidth_mask_bit=5;
+static int width_mask;
+static int twidth_mask;
+static int twidth_mask_bit;
+
static UINT8 *tile_opaque_sp;
static UINT8 *tile_opaque_pf;
+static UINT8 add_sat[256][256];
+
+static int alpha_s_1_1;
+static int alpha_s_1_2;
+static int alpha_s_1_4;
+static int alpha_s_1_5;
+static int alpha_s_1_6;
+static int alpha_s_1_8;
+static int alpha_s_1_9;
+static int alpha_s_1_a;
+
+static int alpha_s_2a_0;
+static int alpha_s_2a_4;
+static int alpha_s_2a_8;
+
+static int alpha_s_2b_0;
+static int alpha_s_2b_4;
+static int alpha_s_2b_8;
+
+static int alpha_s_3a_0;
+static int alpha_s_3a_1;
+static int alpha_s_3a_2;
+
+static int alpha_s_3b_0;
+static int alpha_s_3b_1;
+static int alpha_s_3b_2;
+
+static UINT32 dval;
+static UINT8 pval;
+static UINT8 tval;
+static UINT8 pdest_2a;
+static UINT8 pdest_2b;
+static int tr_2a;
+static int tr_2b;
+static UINT8 pdest_3a;
+static UINT8 pdest_3b;
+static int tr_3a;
+static int tr_3b;
+
+static int (*dpix_n[8][16])(UINT32 s_pix);
+static int (**dpix_lp[5])(UINT32 s_pix);
+static int (**dpix_sp[9])(UINT32 s_pix);
+
+
/******************************************************************************/
static void print_debug_info(bitmap_t *bitmap)
@@ -553,6 +600,25 @@ VIDEO_START( f3 )
const struct F3config *pCFG=&f3_config_table[0];
int tile, width, height;
+ f3_alpha_level_2as=127;
+ f3_alpha_level_2ad=127;
+ f3_alpha_level_3as=127;
+ f3_alpha_level_3ad=127;
+ f3_alpha_level_2bs=127;
+ f3_alpha_level_2bd=127;
+ f3_alpha_level_3bs=127;
+ f3_alpha_level_3bd=127;
+ alpha_level_last = -1;
+
+ pdest_2a = 0x10;
+ pdest_2b = 0x20;
+ tr_2a = 0;
+ tr_2b = 1;
+ pdest_3a = 0x40;
+ pdest_3b = 0x80;
+ tr_3a = 0;
+ tr_3b = 1;
+
spritelist=0;
spriteram32_buffered=0;
pivot_dirty=0;
@@ -836,49 +902,6 @@ WRITE32_HANDLER( f3_palette_24bit_w )
/******************************************************************************/
-static UINT8 add_sat[256][256];
-
-static int alpha_s_1_1;
-static int alpha_s_1_2;
-static int alpha_s_1_4;
-static int alpha_s_1_5;
-static int alpha_s_1_6;
-static int alpha_s_1_8;
-static int alpha_s_1_9;
-static int alpha_s_1_a;
-
-static int alpha_s_2a_0;
-static int alpha_s_2a_4;
-static int alpha_s_2a_8;
-
-static int alpha_s_2b_0;
-static int alpha_s_2b_4;
-static int alpha_s_2b_8;
-
-static int alpha_s_3a_0;
-static int alpha_s_3a_1;
-static int alpha_s_3a_2;
-
-static int alpha_s_3b_0;
-static int alpha_s_3b_1;
-static int alpha_s_3b_2;
-
-static UINT32 dval;
-static UINT8 pval;
-static UINT8 tval;
-static UINT8 pdest_2a = 0x10;
-static UINT8 pdest_2b = 0x20;
-static int tr_2a = 0;
-static int tr_2b = 1;
-static UINT8 pdest_3a = 0x40;
-static UINT8 pdest_3b = 0x80;
-static int tr_3a = 0;
-static int tr_3b = 1;
-
-static int (*dpix_n[8][16])(UINT32 s_pix);
-static int (**dpix_lp[5])(UINT32 s_pix);
-static int (**dpix_sp[9])(UINT32 s_pix);
-
/*============================================================================*/
#define SET_ALPHA_LEVEL(d,s) \
@@ -2213,7 +2236,6 @@ static void scanline_draw(running_machine *machine, bitmap_t *bitmap, const rect
while(1)
{
- static int alpha_level_last=-1;
int pos;
int pri[5],alpha_mode[5],alpha_mode_flag[5],alpha_level;
UINT16 sprite_alpha;
diff --git a/src/mame/video/tubep.c b/src/mame/video/tubep.c
index 36b7a1d49fc..6cc679d5837 100644
--- a/src/mame/video/tubep.c
+++ b/src/mame/video/tubep.c
@@ -38,8 +38,8 @@ static UINT32 romHI_addr_msb = 0;
static UINT8 DISP = 0;
static UINT8 background_romsel = 0;
static UINT8 color_A4 = 0;
-static UINT8 ls175_b7 = 0x0f | 0xf0;
-static UINT8 ls175_e8 = 0x0f;
+static UINT8 ls175_b7;
+static UINT8 ls175_e8;
static UINT8 ls377_data = 0;
static UINT32 page = 0;
@@ -368,7 +368,6 @@ PALETTE_INIT( tubep )
VIDEO_START( tubep )
{
spritemap = auto_malloc(256*256*2);
- memset(spritemap,0,256*256*2);
/* Set up save state */
state_save_register_global(romD_addr);
@@ -395,6 +394,34 @@ VIDEO_START( tubep )
}
+VIDEO_RESET( tubep )
+{
+ memset(spritemap,0,256*256*2);
+
+ romD_addr = 0;
+ romEF_addr = 0;
+ E16_add_b = 0;
+ HINV = 0;
+ VINV = 0;
+ XSize = 0;
+ YSize = 0;
+ mark_1 = 0;
+ mark_2 = 0;
+ colorram_addr_hi = 0;
+ ls273_g6 = 0;
+ ls273_j6 = 0;
+ romHI_addr_mid = 0;
+ romHI_addr_msb = 0;
+ DISP = 0;
+ background_romsel = 0;
+ color_A4 = 0;
+ ls175_b7 = 0x0f | 0xf0;
+ ls175_e8 = 0x0f;
+ ls377_data = 0;
+ page = 0;
+}
+
+
WRITE8_HANDLER( tubep_textram_w )
{
tubep_textram[offset] = data;
diff --git a/src/mame/video/vigilant.c b/src/mame/video/vigilant.c
index ebc222d6257..9b80cf4bae8 100644
--- a/src/mame/video/vigilant.c
+++ b/src/mame/video/vigilant.c
@@ -31,9 +31,9 @@ static int horiz_scroll_high=0;
static int rear_horiz_scroll_low=0;
static int rear_horiz_scroll_high=0;
static int rear_color=0;
-static int rear_disable=1;
+static int rear_disable;
-static int rear_refresh=1;
+static int rear_refresh;
static bitmap_t *bg_bitmap;
@@ -44,6 +44,17 @@ VIDEO_START( vigilant )
}
+VIDEO_RESET( vigilant )
+{
+ horiz_scroll_low = 0;
+ horiz_scroll_high = 0;
+ rear_horiz_scroll_low = 0;
+ rear_horiz_scroll_high = 0;
+ rear_color = 0;
+ rear_disable = 1;
+ rear_refresh = 1;
+}
+
/***************************************************************************
update_background