From b723f83edcd7467302cbe0dd76983c6bfc919c0a Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sun, 4 Jan 2009 22:33:11 +0000 Subject: [PATCH] Added savestate support to the following devices: [MooglyGuy] - TTL74148, TTL74153 Removed anonymous timers from gridlee and added savestate support [MooglyGuy] Added savestate support to all games in 40love.c, 88games.c, 1943.c, carpolo.c, circus.c and exidy.c: [MooglyGuy] - 40love, fieldday, undoukai, 88games, konami88, hypsptsp, 1943, 1943j, 1943kai, carpolo, circus, circusse, robotbwl, crash, ripcord, sidetrac, targ, targc, spectar, spectar1, rallys, phantoma, mtrap, mtrap3, mtrap4, venture, venture2, venture4, teetert, pepper2, hardhat, fax, fax2 --- src/emu/machine/74148.c | 37 ++++++++++++-------- src/emu/machine/74148.h | 2 +- src/emu/machine/74153.c | 45 +++++++++++++++--------- src/emu/machine/7474.c | 36 +++++++++----------- src/mame/audio/exidy.c | 70 ++++++++++++++++++++++++++++++++++++++ src/mame/drivers/1943.c | 6 ++-- src/mame/drivers/40love.c | 29 ++++++++++++++-- src/mame/drivers/88games.c | 16 ++++++--- src/mame/drivers/carpolo.c | 2 +- src/mame/drivers/circus.c | 10 +++--- src/mame/drivers/exidy.c | 50 +++++++++++++++++---------- src/mame/drivers/gridlee.c | 49 +++++++++++++++++--------- src/mame/machine/carpolo.c | 12 ++++++- src/mame/machine/vertigo.c | 2 +- src/mame/video/1943.c | 5 +++ src/mame/video/40love.c | 26 ++++++++++++-- src/mame/video/88games.c | 5 +++ src/mame/video/carpolo.c | 6 ++++ src/mame/video/circus.c | 4 +++ src/mame/video/exidy.c | 9 +++++ src/mame/video/gridlee.c | 23 +++++++++++++ 21 files changed, 339 insertions(+), 105 deletions(-) diff --git a/src/emu/machine/74148.c b/src/emu/machine/74148.c index c4f91dc31de..8d508706f65 100644 --- a/src/emu/machine/74148.c +++ b/src/emu/machine/74148.c @@ -167,7 +167,7 @@ int TTL74148_enable_output_r(int which) -void TTL74148_config(int which, const struct TTL74148_interface *intf) +void TTL74148_config(running_machine *machine, int which, const struct TTL74148_interface *intf) { if (which >= MAX_TTL74148) { @@ -176,18 +176,27 @@ void TTL74148_config(int which, const struct TTL74148_interface *intf) } - chips[which].output_cb = (intf ? intf->output_cb : 0); - chips[which].enable_input = 1; - chips[which].input_lines[0] = 1; - chips[which].input_lines[1] = 1; - chips[which].input_lines[2] = 1; - chips[which].input_lines[3] = 1; - chips[which].input_lines[4] = 1; - chips[which].input_lines[5] = 1; - chips[which].input_lines[6] = 1; - chips[which].input_lines[7] = 1; + chips[which].output_cb = (intf ? intf->output_cb : 0); + chips[which].enable_input = 1; + chips[which].input_lines[0] = 1; + chips[which].input_lines[1] = 1; + chips[which].input_lines[2] = 1; + chips[which].input_lines[3] = 1; + chips[which].input_lines[4] = 1; + chips[which].input_lines[5] = 1; + chips[which].input_lines[6] = 1; + chips[which].input_lines[7] = 1; - chips[which].last_output = -1; - chips[which].last_output_valid = -1; - chips[which].last_enable_output = -1; + chips[which].last_output = -1; + chips[which].last_output_valid = -1; + chips[which].last_enable_output = -1; + + state_save_register_item_array(machine, "ttl74148", NULL, which, chips[which].input_lines); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].enable_input); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].output); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].output_valid); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].enable_output); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].last_output); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].last_output_valid); + state_save_register_item(machine, "ttl74148", NULL, which, chips[which].last_enable_output); } diff --git a/src/emu/machine/74148.h b/src/emu/machine/74148.h index e7262a93212..30cead0d9f4 100644 --- a/src/emu/machine/74148.h +++ b/src/emu/machine/74148.h @@ -49,7 +49,7 @@ struct TTL74148_interface }; -void TTL74148_config(int which, const struct TTL74148_interface *intf); +void TTL74148_config(running_machine *machine, int which, const struct TTL74148_interface *intf); /* must call TTL74148_update() after setting the inputs */ void TTL74148_update(running_machine *machine, int which); diff --git a/src/emu/machine/74153.c b/src/emu/machine/74153.c index 4cc3fb046cd..8ca40cffd12 100644 --- a/src/emu/machine/74153.c +++ b/src/emu/machine/74153.c @@ -134,21 +134,34 @@ void TTL74153_config(running_machine *machine, int which, const struct TTL74153_ } - chips[which].machine = machine; - chips[which].output_cb = (intf ? intf->output_cb : 0); - chips[which].a = 1; - chips[which].b = 1; - chips[which].enable[0] = 1; - chips[which].enable[1] = 1; - chips[which].input_lines[0][0] = 1; - chips[which].input_lines[0][1] = 1; - chips[which].input_lines[0][2] = 1; - chips[which].input_lines[0][3] = 1; - chips[which].input_lines[1][0] = 1; - chips[which].input_lines[1][1] = 1; - chips[which].input_lines[1][2] = 1; - chips[which].input_lines[1][3] = 1; + chips[which].machine = machine; + chips[which].output_cb = (intf ? intf->output_cb : 0); + chips[which].a = 1; + chips[which].b = 1; + chips[which].enable[0] = 1; + chips[which].enable[1] = 1; + chips[which].input_lines[0][0] = 1; + chips[which].input_lines[0][1] = 1; + chips[which].input_lines[0][2] = 1; + chips[which].input_lines[0][3] = 1; + chips[which].input_lines[1][0] = 1; + chips[which].input_lines[1][1] = 1; + chips[which].input_lines[1][2] = 1; + chips[which].input_lines[1][3] = 1; - chips[which].last_output[0] = -1; - chips[which].last_output[1] = -1; + chips[which].last_output[0] = -1; + chips[which].last_output[1] = -1; + + state_save_register_item_array(machine, "ttl74153", NULL, which, chips[which].enable); + state_save_register_item_array(machine, "ttl74153", NULL, which, chips[which].last_output); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[0][0]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[0][1]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[0][2]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[0][3]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[1][0]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[1][1]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[1][2]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].input_lines[1][3]); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].a); + state_save_register_item(machine, "ttl74153", NULL, which, chips[which].b); } diff --git a/src/emu/machine/7474.c b/src/emu/machine/7474.c index 297e9389c42..dd083932d29 100644 --- a/src/emu/machine/7474.c +++ b/src/emu/machine/7474.c @@ -140,8 +140,6 @@ int TTL7474_output_comp_r(int which) void TTL7474_config(running_machine *machine, int which, const struct TTL7474_interface *intf) { - struct TTL7474 *chip = &chips[which]; - if (which >= MAX_TTL7474) { logerror("Only %d 7474's are supported at this time.\n", MAX_TTL7474); @@ -149,25 +147,25 @@ void TTL7474_config(running_machine *machine, int which, const struct TTL7474_in } - chip->output_cb = (intf ? intf->output_cb : 0); + chips[which].output_cb = (intf ? intf->output_cb : 0); /* all inputs are open first */ - chip->clear = 1; - chip->preset = 1; - chip->clock = 1; - chip->d = 1; + chips[which].clear = 1; + chips[which].preset = 1; + chips[which].clock = 1; + chips[which].d = 1; - chip->last_clock = 1; - chip->last_output = -1; - chip->last_output_comp = -1; + chips[which].last_clock = 1; + chips[which].last_output = -1; + chips[which].last_output_comp = -1; - state_save_register_item(machine, "ttl7474", NULL, which, chip->clear); - state_save_register_item(machine, "ttl7474", NULL, which, chip->preset); - state_save_register_item(machine, "ttl7474", NULL, which, chip->clock); - state_save_register_item(machine, "ttl7474", NULL, which, chip->d); - state_save_register_item(machine, "ttl7474", NULL, which, chip->output); - state_save_register_item(machine, "ttl7474", NULL, which, chip->output_comp); - state_save_register_item(machine, "ttl7474", NULL, which, chip->last_clock); - state_save_register_item(machine, "ttl7474", NULL, which, chip->last_output); - state_save_register_item(machine, "ttl7474", NULL, which, chip->last_output_comp); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].clear); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].preset); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].clock); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].d); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].output); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].output_comp); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].last_clock); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].last_output); + state_save_register_item(machine, "ttl7474", NULL, which, chips[which].last_output_comp); } diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c index 801497ce2a9..ddd4de6890b 100644 --- a/src/mame/audio/exidy.c +++ b/src/mame/audio/exidy.c @@ -216,6 +216,45 @@ INLINE int sh6840_update_noise(int clocks) +/************************************* + * + * 6840 state saving + * + *************************************/ + +static void sh6840_register_state_globals(running_machine *machine) +{ + state_save_register_global_array(machine, sh6840_volume); + state_save_register_global(machine, sh6840_MSB); + state_save_register_global(machine, sh6840_LFSR_oldxor); + state_save_register_global(machine, sh6840_LFSR_0); + state_save_register_global(machine, sh6840_LFSR_1); + state_save_register_global(machine, sh6840_LFSR_2); + state_save_register_global(machine, sh6840_LFSR_3); + state_save_register_global(machine, sh6840_clock_count); + state_save_register_global(machine, exidy_sfxctrl); + state_save_register_global(machine, sh6840_timer[0].cr); + state_save_register_global(machine, sh6840_timer[0].state); + state_save_register_global(machine, sh6840_timer[0].leftovers); + state_save_register_global(machine, sh6840_timer[0].timer); + state_save_register_global(machine, sh6840_timer[0].clocks); + state_save_register_global(machine, sh6840_timer[0].counter.w); + state_save_register_global(machine, sh6840_timer[1].cr); + state_save_register_global(machine, sh6840_timer[1].state); + state_save_register_global(machine, sh6840_timer[1].leftovers); + state_save_register_global(machine, sh6840_timer[1].timer); + state_save_register_global(machine, sh6840_timer[1].clocks); + state_save_register_global(machine, sh6840_timer[1].counter.w); + state_save_register_global(machine, sh6840_timer[2].cr); + state_save_register_global(machine, sh6840_timer[2].state); + state_save_register_global(machine, sh6840_timer[2].leftovers); + state_save_register_global(machine, sh6840_timer[2].timer); + state_save_register_global(machine, sh6840_timer[2].clocks); + state_save_register_global(machine, sh6840_timer[2].counter.w); +} + + + /************************************* * * Core sound generation @@ -347,6 +386,8 @@ static void *common_sh_start(const device_config *device, int clock, const custo /* allocate the stream */ exidy_stream = stream_create(device, 0, 1, sample_rate, NULL, exidy_stream_update); + sh6840_register_state_globals(device->machine); + return auto_malloc(1); } @@ -376,6 +417,7 @@ static void common_sh_reset(void *token) sh6840_volume[0] = 0; sh6840_volume[1] = 0; sh6840_volume[2] = 0; + sh6840_clock_count = 0; exidy_sfxctrl = 0; /* LFSR */ @@ -456,6 +498,31 @@ static const riot6532_interface r6532_interface = +/************************************* + * + * 8253 state saving + * + *************************************/ + + +static void sh8253_register_state_globals(running_machine *machine) +{ + state_save_register_global(machine, sh8253_timer[0].clstate); + state_save_register_global(machine, sh8253_timer[0].enable); + state_save_register_global(machine, sh8253_timer[0].count); + state_save_register_global(machine, sh8253_timer[0].step); + state_save_register_global(machine, sh8253_timer[0].fraction); + state_save_register_global(machine, sh8253_timer[1].clstate); + state_save_register_global(machine, sh8253_timer[1].enable); + state_save_register_global(machine, sh8253_timer[1].count); + state_save_register_global(machine, sh8253_timer[1].step); + state_save_register_global(machine, sh8253_timer[1].fraction); + state_save_register_global(machine, sh8253_timer[2].clstate); + state_save_register_global(machine, sh8253_timer[2].enable); + state_save_register_global(machine, sh8253_timer[2].count); + state_save_register_global(machine, sh8253_timer[2].step); + state_save_register_global(machine, sh8253_timer[2].fraction); +} /************************************* * @@ -659,6 +726,9 @@ static void *venture_common_sh_start(const device_config *device, int clock, con /* 8253 */ freq_to_step = (double)(1 << 24) / (double)SH8253_CLOCK; + state_save_register_global(machine, riot_irq_state); + sh8253_register_state_globals(device->machine); + return ret; } diff --git a/src/mame/drivers/1943.c b/src/mame/drivers/1943.c index bc245e79787..c129fd08ad0 100644 --- a/src/mame/drivers/1943.c +++ b/src/mame/drivers/1943.c @@ -458,6 +458,6 @@ ROM_END /* Game Drivers */ -GAME( 1987, 1943, 0, 1943, 1943, 0, ROT270, "Capcom", "1943: The Battle of Midway (US)", 0 ) -GAME( 1987, 1943j, 1943, 1943, 1943, 0, ROT270, "Capcom", "1943: Midway Kaisen (Japan)", 0 ) -GAME( 1987, 1943kai, 0, 1943, 1943, 0, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", 0 ) +GAME( 1987, 1943, 0, 1943, 1943, 0, ROT270, "Capcom", "1943: The Battle of Midway (US)", GAME_SUPPORTS_SAVE ) +GAME( 1987, 1943j, 1943, 1943, 1943, 0, ROT270, "Capcom", "1943: Midway Kaisen (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1987, 1943kai, 0, 1943, 1943, 0, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/40love.c b/src/mame/drivers/40love.c index 195bd8ec805..88fa6b53919 100644 --- a/src/mame/drivers/40love.c +++ b/src/mame/drivers/40love.c @@ -1020,6 +1020,25 @@ static const msm5232_interface msm5232_config = /*******************************************************************************/ +static MACHINE_START( 40love ) +{ + state_save_register_global(machine, pix1); + state_save_register_global_array(machine, pix2); + state_save_register_global(machine, from_mcu); + state_save_register_global(machine, mcu_cmd); + state_save_register_global_array(machine, mcu_in[0]); + state_save_register_global_array(machine, mcu_in[1]); + state_save_register_global_array(machine, mcu_out[0]); + state_save_register_global_array(machine, mcu_out[1]); + state_save_register_global(machine, snd_data); + state_save_register_global(machine, snd_flag); + state_save_register_global_array(machine, vol_ctrl); + state_save_register_global(machine, snd_ctrl0); + state_save_register_global(machine, snd_ctrl1); + state_save_register_global(machine, snd_ctrl2); + state_save_register_global(machine, snd_ctrl3); +} + static MACHINE_DRIVER_START( 40love ) /* basic machine hardware */ @@ -1051,6 +1070,8 @@ static MACHINE_DRIVER_START( 40love ) MDRV_VIDEO_START(fortyl) MDRV_VIDEO_UPDATE(fortyl) + MDRV_MACHINE_START(40love) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -1106,6 +1127,8 @@ static MACHINE_DRIVER_START( undoukai ) MDRV_VIDEO_START(fortyl) MDRV_VIDEO_UPDATE(fortyl) + MDRV_MACHINE_START(40love) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -1247,6 +1270,6 @@ ROM_START( undoukai ) ROM_LOAD( "a17-18.23v", 0x0c00, 0x0400, CRC(3023a1da) SHA1(08ce4c6e99d04b358d66f0588852311d07183619) ) /* ??? */ ROM_END -GAME( 1984, 40love, 0, 40love, 40love, 40love, ROT0, "Taito Corporation", "Forty-Love", GAME_IMPERFECT_GRAPHICS ) -GAME( 1984, fieldday, 0, undoukai, undoukai, undoukai, ROT0, "Taito Corporation", "Field Day", 0 ) -GAME( 1984, undoukai, fieldday, undoukai, undoukai, undoukai, ROT0, "Taito Corporation", "The Undoukai (Japan)", 0 ) +GAME( 1984, 40love, 0, 40love, 40love, 40love, ROT0, "Taito Corporation", "Forty-Love", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) +GAME( 1984, fieldday, 0, undoukai, undoukai, undoukai, ROT0, "Taito Corporation", "Field Day", GAME_SUPPORTS_SAVE ) +GAME( 1984, undoukai, fieldday, undoukai, undoukai, undoukai, ROT0, "Taito Corporation", "The Undoukai (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/88games.c b/src/mame/drivers/88games.c index 90bab2799a4..a3222190488 100644 --- a/src/mame/drivers/88games.c +++ b/src/mame/drivers/88games.c @@ -13,6 +13,7 @@ static MACHINE_RESET( 88games ); +static MACHINE_START( 88games ); static KONAMI_SETLINES_CALLBACK( k88games_banking ); static UINT8 *ram; @@ -282,6 +283,8 @@ static MACHINE_DRIVER_START( 88games ) MDRV_VIDEO_START(88games) MDRV_VIDEO_UPDATE(88games) + MDRV_MACHINE_START(88games) + /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -514,7 +517,12 @@ static MACHINE_RESET( 88games ) paletteram = &memory_region(machine, "main")[0x20000]; } - +static MACHINE_START( 88games ) +{ + state_save_register_global(machine, videobank); + state_save_register_global(machine, zoomreadroms); + state_save_register_global(machine, speech_chip); +} static DRIVER_INIT( 88games ) { @@ -524,6 +532,6 @@ static DRIVER_INIT( 88games ) -GAME( 1988, 88games, 0, 88games, 88games, 88games, ROT0, "Konami", "'88 Games", 0 ) -GAME( 1988, konami88, 88games, 88games, 88games, 88games, ROT0, "Konami", "Konami '88", 0 ) -GAME( 1988, hypsptsp, 88games, 88games, 88games, 88games, ROT0, "Konami", "Hyper Sports Special (Japan)", 0 ) +GAME( 1988, 88games, 0, 88games, 88games, 88games, ROT0, "Konami", "'88 Games", GAME_SUPPORTS_SAVE ) +GAME( 1988, konami88, 88games, 88games, 88games, 88games, ROT0, "Konami", "Konami '88", GAME_SUPPORTS_SAVE ) +GAME( 1988, hypsptsp, 88games, 88games, 88games, 88games, ROT0, "Konami", "Hyper Sports Special (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/carpolo.c b/src/mame/drivers/carpolo.c index af7eefd29ae..3939a7b5162 100644 --- a/src/mame/drivers/carpolo.c +++ b/src/mame/drivers/carpolo.c @@ -323,4 +323,4 @@ static DRIVER_INIT( carpolo ) ROM[i] ^= 0x0f; } -GAME( 1977, carpolo, 0, carpolo, carpolo, carpolo, ROT0, "Exidy", "Car Polo", GAME_NO_SOUND) +GAME( 1977, carpolo, 0, carpolo, carpolo, carpolo, ROT0, "Exidy", "Car Polo", GAME_SUPPORTS_SAVE | GAME_NO_SOUND ) diff --git a/src/mame/drivers/circus.c b/src/mame/drivers/circus.c index 5961f8df77c..fae7e657155 100644 --- a/src/mame/drivers/circus.c +++ b/src/mame/drivers/circus.c @@ -541,8 +541,8 @@ static DRIVER_INIT( ripcord ) } -GAMEL(1977, circus, 0, circus, circus, circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV", 0, layout_circus ) -GAMEL(1977, circusse, circus, circus, circus, circus, ROT0, "[Exidy] (Sub-Electro bootleg)", "Circus (Sub-Electro bootleg)", 0, layout_circus ) // looks like a text hack, but we've seen 2 identical copies so it's worth supporting -GAME( 1977, robotbwl, 0, robotbwl, robotbwl, robotbwl, ROT0, "Exidy", "Robot Bowl", GAME_IMPERFECT_SOUND ) -GAMEL(1979, crash, 0, crash, crash, crash, ROT0, "Exidy", "Crash", GAME_IMPERFECT_SOUND, layout_crash ) -GAME( 1979, ripcord, 0, ripcord, ripcord, ripcord, ROT0, "Exidy", "Rip Cord", GAME_IMPERFECT_SOUND ) +GAMEL(1977, circus, 0, circus, circus, circus, ROT0, "Exidy / Taito", "Circus / Acrobat TV", GAME_SUPPORTS_SAVE, layout_circus ) +GAMEL(1977, circusse, circus, circus, circus, circus, ROT0, "[Exidy] (Sub-Electro bootleg)", "Circus (Sub-Electro bootleg)", GAME_SUPPORTS_SAVE, layout_circus ) // looks like a text hack, but we've seen 2 identical copies so it's worth supporting +GAME( 1977, robotbwl, 0, robotbwl, robotbwl, robotbwl, ROT0, "Exidy", "Robot Bowl", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) +GAMEL(1979, crash, 0, crash, crash, crash, ROT0, "Exidy", "Crash", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND, layout_crash ) +GAME( 1979, ripcord, 0, ripcord, ripcord, ripcord, ROT0, "Exidy", "Rip Cord", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index cfc95503cef..f77ce1a482a 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -766,6 +766,17 @@ GFXDECODE_END +/************************************* + * + * Machine init + * + *************************************/ + +static MACHINE_START( teetert ) +{ + state_save_register_global(machine, last_dial); +} + /************************************* * * Machine drivers @@ -857,6 +868,9 @@ static MACHINE_DRIVER_START( teetert ) MDRV_IMPORT_FROM(venture) MDRV_CPU_MODIFY("main") MDRV_CPU_VBLANK_INT_HACK(teetert_vblank_interrupt,10) + + MDRV_MACHINE_START( teetert ) + MACHINE_DRIVER_END @@ -1419,22 +1433,22 @@ static DRIVER_INIT( fax ) * *************************************/ -GAME( 1979, sidetrac, 0, sidetrac, sidetrac, sidetrac, ROT0, "Exidy", "Side Track", 0 ) -GAME( 1980, targ, 0, targ, targ, targ, ROT0, "Exidy", "Targ", 0 ) -GAME( 1980, targc, targ, targ, targ, targ, ROT0, "Exidy", "Targ (cocktail?)", 0 ) -GAME( 1980, spectar, 0, spectar, spectar, spectar, ROT0, "Exidy", "Spectar (revision 3)", 0 ) -GAME( 1980, spectar1, spectar, spectar, spectar, spectar, ROT0, "Exidy", "Spectar (revision 1?)", 0 ) -GAME( 1980, rallys, spectar, rallys, rallys, rallys, ROT0, "Novar", "Rallys (bootleg?)", 0 ) -GAME( 1980, phantoma, spectar, rallys, phantoma, phantoma, ROT0, "Jeutel","Phantomas", 0 ) +GAME( 1979, sidetrac, 0, sidetrac, sidetrac, sidetrac, ROT0, "Exidy", "Side Track", GAME_SUPPORTS_SAVE ) +GAME( 1980, targ, 0, targ, targ, targ, ROT0, "Exidy", "Targ", GAME_SUPPORTS_SAVE ) +GAME( 1980, targc, targ, targ, targ, targ, ROT0, "Exidy", "Targ (cocktail?)", GAME_SUPPORTS_SAVE ) +GAME( 1980, spectar, 0, spectar, spectar, spectar, ROT0, "Exidy", "Spectar (revision 3)", GAME_SUPPORTS_SAVE ) +GAME( 1980, spectar1, spectar, spectar, spectar, spectar, ROT0, "Exidy", "Spectar (revision 1?)", GAME_SUPPORTS_SAVE ) +GAME( 1980, rallys, spectar, rallys, rallys, rallys, ROT0, "Novar", "Rallys (bootleg?)", GAME_SUPPORTS_SAVE ) +GAME( 1980, phantoma, spectar, rallys, phantoma, phantoma, ROT0, "Jeutel","Phantomas", GAME_SUPPORTS_SAVE ) -GAME( 1981, mtrap, 0, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 5)", 0 ) -GAME( 1981, mtrap3, mtrap, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 3)", 0 ) -GAME( 1981, mtrap4, mtrap, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 4)", 0 ) -GAME( 1981, venture, 0, venture, venture, venture, ROT0, "Exidy", "Venture (version 5 set 1)", 0 ) -GAME( 1981, venture2, venture, venture, venture, venture, ROT0, "Exidy", "Venture (version 5 set 2)", 0 ) -GAME( 1981, venture4, venture, venture, venture, venture, ROT0, "Exidy", "Venture (version 4)", 0 ) -GAME( 1982, teetert, 0, teetert, teetert, teetert, ROT0, "Exidy", "Teeter Torture (prototype)", 0 ) -GAME( 1982, pepper2, 0, pepper2, pepper2, pepper2, ROT0, "Exidy", "Pepper II", 0 ) -GAME( 1982, hardhat, 0, pepper2, pepper2, pepper2, ROT0, "Exidy", "Hard Hat", 0 ) -GAME( 1983, fax, 0, fax, fax, fax, ROT0, "Exidy", "FAX", 0 ) -GAME( 1983, fax2, fax, fax, fax, fax, ROT0, "Exidy", "FAX 2", 0 ) +GAME( 1981, mtrap, 0, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 5)", GAME_SUPPORTS_SAVE ) +GAME( 1981, mtrap3, mtrap, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 3)", GAME_SUPPORTS_SAVE ) +GAME( 1981, mtrap4, mtrap, mtrap, mtrap, mtrap, ROT0, "Exidy", "Mouse Trap (version 4)", GAME_SUPPORTS_SAVE ) +GAME( 1981, venture, 0, venture, venture, venture, ROT0, "Exidy", "Venture (version 5 set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1981, venture2, venture, venture, venture, venture, ROT0, "Exidy", "Venture (version 5 set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1981, venture4, venture, venture, venture, venture, ROT0, "Exidy", "Venture (version 4)", GAME_SUPPORTS_SAVE ) +GAME( 1982, teetert, 0, teetert, teetert, teetert, ROT0, "Exidy", "Teeter Torture (prototype)", GAME_SUPPORTS_SAVE ) +GAME( 1982, pepper2, 0, pepper2, pepper2, pepper2, ROT0, "Exidy", "Pepper II", GAME_SUPPORTS_SAVE ) +GAME( 1982, hardhat, 0, pepper2, pepper2, pepper2, ROT0, "Exidy", "Hard Hat", GAME_SUPPORTS_SAVE ) +GAME( 1983, fax, 0, fax, fax, fax, ROT0, "Exidy", "FAX", GAME_SUPPORTS_SAVE ) +GAME( 1983, fax2, fax, fax, fax, fax, ROT0, "Exidy", "FAX 2", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c index feea27830a2..051ef5149a8 100644 --- a/src/mame/drivers/gridlee.c +++ b/src/mame/drivers/gridlee.c @@ -97,11 +97,14 @@ static UINT8 last_analog_output[2]; static UINT8 *poly17 = NULL; static UINT8 *rand17 = NULL; - - /* local prototypes */ static void poly17_init(void); +/* local timers */ +static emu_timer *irq_off; +static emu_timer *irq_timer; +static emu_timer *firq_off; +static emu_timer *firq_timer; /************************************* * @@ -109,55 +112,66 @@ static void poly17_init(void); * *************************************/ -static TIMER_CALLBACK( irq_off ) +static TIMER_CALLBACK( irq_off_tick ) { cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE); } -static TIMER_CALLBACK( irq_timer ) +static TIMER_CALLBACK( irq_timer_tick ) { /* next interrupt after scanline 256 is scanline 64 */ if (param == 256) - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), NULL, 64, irq_timer); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, 64, 0), 64); else - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, param + 64, 0), NULL, param + 64, irq_timer); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, param + 64, 0), param + 64); /* IRQ starts on scanline 0, 64, 128, etc. */ cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); /* it will turn off on the next HBLANK */ - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, param, BALSENTE_HBSTART), NULL, 0, irq_off); + timer_adjust_oneshot(irq_off, video_screen_get_time_until_pos(machine->primary_screen, param, BALSENTE_HBSTART), 0); } -static TIMER_CALLBACK( firq_off ) +static TIMER_CALLBACK( firq_off_tick ) { cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE); } -static TIMER_CALLBACK( firq_timer ) +static TIMER_CALLBACK( firq_timer_tick ) { /* same time next frame */ - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); + timer_adjust_oneshot(firq_timer, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), 0); /* IRQ starts on scanline FIRQ_SCANLINE? */ cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); /* it will turn off on the next HBLANK */ - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, BALSENTE_HBSTART), NULL, 0, firq_off); + timer_adjust_oneshot(firq_off, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, BALSENTE_HBSTART), 0); +} + +static MACHINE_START( gridlee ) +{ + /* create the polynomial tables */ + poly17_init(); + + state_save_register_global_array(machine, last_analog_input); + state_save_register_global_array(machine, last_analog_output); + + irq_off = timer_alloc(machine, irq_off_tick, 0); + irq_timer = timer_alloc(machine, irq_timer_tick, 0); + firq_off = timer_alloc(machine, firq_off_tick, 0); + firq_timer = timer_alloc(machine, firq_timer_tick, 0); } static MACHINE_RESET( gridlee ) { /* start timers to generate interrupts */ - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, irq_timer); - timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), NULL, 0, firq_timer); - - /* create the polynomial tables */ - poly17_init(); + timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); + timer_adjust_oneshot(firq_timer, video_screen_get_time_until_pos(machine->primary_screen, FIRQ_SCANLINE, 0), 0); } @@ -437,6 +451,7 @@ static MACHINE_DRIVER_START( gridlee ) MDRV_CPU_ADD("main", M6809, BALSENTE_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(readmem_cpu1,writemem_cpu1) + MDRV_MACHINE_START(gridlee) MDRV_MACHINE_RESET(gridlee) MDRV_NVRAM_HANDLER(generic_0fill) @@ -500,4 +515,4 @@ ROM_END * *************************************/ -GAME( 1983, gridlee, 0, gridlee, gridlee, 0, ROT0, "Videa", "Gridlee", GAME_IMPERFECT_SOUND ) +GAME( 1983, gridlee, 0, gridlee, gridlee, 0, ROT0, "Videa", "Gridlee", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) diff --git a/src/mame/machine/carpolo.c b/src/mame/machine/carpolo.c index 640c23e7348..ded72e4779e 100644 --- a/src/mame/machine/carpolo.c +++ b/src/mame/machine/carpolo.c @@ -514,12 +514,22 @@ MACHINE_START( carpolo ) /* set up the PIA's */ pia_config(machine, 0, &pia_0_intf); pia_config(machine, 1, &pia_1_intf); + + state_save_register_global(machine, ball_screen_collision_cause); + state_save_register_global(machine, car_ball_collision_x); + state_save_register_global(machine, car_ball_collision_y); + state_save_register_global(machine, car_car_collision_cause); + state_save_register_global(machine, car_goal_collision_cause); + state_save_register_global(machine, car_ball_collision_cause); + state_save_register_global(machine, car_border_collision_cause); + state_save_register_global(machine, priority_0_extension); + state_save_register_global_array(machine, last_wheel_value); } MACHINE_RESET( carpolo ) { /* set up the priority encoder */ - TTL74148_config(TTL74148_3S, &TTL74148_3S_intf); + TTL74148_config(machine, TTL74148_3S, &TTL74148_3S_intf); TTL74148_enable_input_w(TTL74148_3S, 0); /* always enabled */ diff --git a/src/mame/machine/vertigo.c b/src/mame/machine/vertigo.c index e9c3af38c50..f6cf32d2f60 100644 --- a/src/mame/machine/vertigo.c +++ b/src/mame/machine/vertigo.c @@ -211,7 +211,7 @@ MACHINE_RESET( vertigo ) { int i; - TTL74148_config(0, &irq_encoder); + TTL74148_config(machine, 0, &irq_encoder); TTL74148_enable_input_w(0, 0); for (i = 0; i < 8; i++) diff --git a/src/mame/video/1943.c b/src/mame/video/1943.c index 4f2f88d1745..31d980ae9f7 100644 --- a/src/mame/video/1943.c +++ b/src/mame/video/1943.c @@ -220,6 +220,11 @@ VIDEO_START( 1943 ) colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[1], 0x0f); tilemap_set_transparent_pen(fg_tilemap, 0); + + state_save_register_global(machine, chon); + state_save_register_global(machine, objon); + state_save_register_global(machine, sc1on); + state_save_register_global(machine, sc2on); } static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) diff --git a/src/mame/video/40love.c b/src/mame/video/40love.c index 6dc17537d76..b4a72e88ef0 100644 --- a/src/mame/video/40love.c +++ b/src/mame/video/40love.c @@ -23,6 +23,8 @@ static tilemap *background; int fortyl_pix_color[4]; +static int pixram_sel; + /* * color prom decoding */ @@ -96,6 +98,19 @@ static TILE_GET_INFO( get_bg_tile_info ) 0); } +/*************************************************************************** + + State-related callbacks + +***************************************************************************/ + +static STATE_POSTLOAD( redraw_pixels ) +{ + fortyl_pix_redraw = 1; + tilemap_mark_all_tiles_dirty(background); +} + + /*************************************************************************** Start the video hardware emulation. @@ -116,6 +131,15 @@ VIDEO_START( fortyl ) tilemap_set_scroll_rows(background,32); tilemap_set_transparent_pen(background,0); + + state_save_register_global(machine, fortyl_flipscreen); + state_save_register_global_array(machine, fortyl_pix_color); + state_save_register_global_pointer(machine, fortyl_pixram1, 0x4000); + state_save_register_global_pointer(machine, fortyl_pixram2, 0x4000); + state_save_register_global_bitmap(machine, pixel_bitmap1); + state_save_register_global_bitmap(machine, pixel_bitmap2); + state_save_register_global(machine, pixram_sel); + state_save_register_postload(machine, redraw_pixels, NULL); } @@ -125,8 +149,6 @@ VIDEO_START( fortyl ) ***************************************************************************/ -static int pixram_sel; - static void fortyl_set_scroll_x(int offset) { int i = offset & ~1; diff --git a/src/mame/video/88games.c b/src/mame/video/88games.c index 9f955b6b8fe..0c53123184f 100644 --- a/src/mame/video/88games.c +++ b/src/mame/video/88games.c @@ -64,6 +64,11 @@ VIDEO_START( 88games ) K052109_vh_start(machine,"gfx1",NORMAL_PLANE_ORDER,tile_callback); K051960_vh_start(machine,"gfx2",NORMAL_PLANE_ORDER,sprite_callback); K051316_vh_start_0(machine,"gfx3",4,FALSE,0,zoom_callback); + + state_save_register_global_array(machine, layer_colorbase); + state_save_register_global(machine, k88games_priority); + state_save_register_global(machine, sprite_colorbase); + state_save_register_global(machine, zoom_colorbase); } diff --git a/src/mame/video/carpolo.c b/src/mame/video/carpolo.c index 597f617fe78..ccb2a538e18 100644 --- a/src/mame/video/carpolo.c +++ b/src/mame/video/carpolo.c @@ -169,6 +169,12 @@ VIDEO_START( carpolo ) sprite_goal_collision_bitmap2 = auto_bitmap_alloc(SPRITE_WIDTH+GOAL_WIDTH, SPRITE_HEIGHT+GOAL_HEIGHT, format); sprite_border_collision_bitmap = auto_bitmap_alloc(SPRITE_WIDTH, SPRITE_HEIGHT, format); + + state_save_register_global_bitmap(machine, sprite_sprite_collision_bitmap1); + state_save_register_global_bitmap(machine, sprite_sprite_collision_bitmap2); + state_save_register_global_bitmap(machine, sprite_goal_collision_bitmap1); + state_save_register_global_bitmap(machine, sprite_goal_collision_bitmap2); + state_save_register_global_bitmap(machine, sprite_border_collision_bitmap); } diff --git a/src/mame/video/circus.c b/src/mame/video/circus.c index fed010835f5..96166e94a75 100644 --- a/src/mame/video/circus.c +++ b/src/mame/video/circus.c @@ -49,6 +49,10 @@ VIDEO_START( circus ) { bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32); + + state_save_register_global(machine, clown_x); + state_save_register_global(machine, clown_y); + state_save_register_global(machine, clown_z); } static void draw_line(bitmap_t *bitmap, const rectangle *cliprect, int x1, int y1, int x2, int y2, int dotted) diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index c017d8828d6..b6cf0b9c0bd 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -60,6 +60,15 @@ VIDEO_START( exidy ) motion_object_1_vid = auto_bitmap_alloc(16, 16, format); motion_object_2_vid = auto_bitmap_alloc(16, 16, format); motion_object_2_clip = auto_bitmap_alloc(16, 16, format); + + state_save_register_global(machine, collision_mask); + state_save_register_global(machine, collision_invert); + state_save_register_global(machine, is_2bpp); + state_save_register_global(machine, int_condition); + state_save_register_global_bitmap(machine, background_bitmap); + state_save_register_global_bitmap(machine, motion_object_1_vid); + state_save_register_global_bitmap(machine, motion_object_2_vid); + state_save_register_global_bitmap(machine, motion_object_2_clip); } diff --git a/src/mame/video/gridlee.c b/src/mame/video/gridlee.c index 698e5a657b2..bb79ada1dad 100644 --- a/src/mame/video/gridlee.c +++ b/src/mame/video/gridlee.c @@ -54,6 +54,25 @@ PALETTE_INIT( gridlee ) +/************************************* + * + * Video system restart + * + *************************************/ + +static STATE_POSTLOAD( expand_pixels ) +{ + int offset = 0; + + for(offset = 0; offset < 0x77ff; offset++) + { + local_videoram[offset * 2 + 0] = videoram[offset] >> 4; + local_videoram[offset * 2 + 1] = videoram[offset] & 15; + } +} + + + /************************************* * * Video system start @@ -68,6 +87,10 @@ VIDEO_START( gridlee ) /* reset the palette */ palettebank_vis = 0; + + state_save_register_global(machine, gridlee_cocktail_flip); + state_save_register_global(machine, palettebank_vis); + state_save_register_postload(machine, expand_pixels, NULL); }