From e426f9e0b62f8c9ec57ad18c4e8db07788583e7e Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 13 Mar 2008 15:10:56 +0000 Subject: [PATCH] From: Mike Haaland mame/drivers/superqix.c mame/video/superqix.c Changed vblank interrupts to 3 to fix screen drawing issues. Use memory_configure_bank() to configure memory. Added save states. --- src/mame/drivers/superqix.c | 61 +++++++++++++++++++++++++++++++------ src/mame/video/superqix.c | 34 +++++++++++++-------- 2 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index cfbaac81b46..2b0c3076c83 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -489,6 +489,39 @@ static READ8_HANDLER(pbillian_ay_port_a_r) } +static void machine_init_common(void) +{ + state_save_register_global(invert_coin_lockout); + state_save_register_global(from_mcu_pending); + state_save_register_global(from_z80_pending); + state_save_register_global(port1); + state_save_register_global(port3); + state_save_register_global(port3_latch); + state_save_register_global(from_mcu); + state_save_register_global(from_z80); + state_save_register_global(portb); + + // hotsmash ??? + state_save_register_global(portA_in); + state_save_register_global(portB_out); + state_save_register_global(portC); +} + +static MACHINE_START( superqix ) +{ + /* configure the banks */ + memory_configure_bank(1, 0, 4, memory_region(REGION_CPU1) + 0x10000, 0x4000); + + machine_init_common(); +} + +static MACHINE_START( pbillian ) +{ + /* configure the banks */ + memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000); + + machine_init_common(); +} static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -932,6 +965,8 @@ static MACHINE_DRIVER_START( pbillian ) MDRV_CPU_IO_MAP(pbillian_port_map,0) MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) + MDRV_MACHINE_START(pbillian) + /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -966,6 +1001,8 @@ static MACHINE_DRIVER_START( hotsmash ) MDRV_CPU_ADD(M68705, 4000000) /* ???? */ MDRV_CPU_PROGRAM_MAP(m68705_map,0) + MDRV_MACHINE_START(pbillian) + /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -997,7 +1034,7 @@ static MACHINE_DRIVER_START( sqix ) MDRV_CPU_ADD(Z80, 12000000/2) /* 6 MHz */ MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_IO_MAP(sqix_port_map,0) - MDRV_CPU_VBLANK_INT_HACK(sqix_interrupt,6) /* ??? */ + MDRV_CPU_VBLANK_INT_HACK(sqix_interrupt,3) /* ??? */ MDRV_CPU_ADD(I8751, 12000000/3) /* ??? */ MDRV_CPU_PROGRAM_MAP(mcu_map,0) @@ -1005,6 +1042,8 @@ static MACHINE_DRIVER_START( sqix ) MDRV_INTERLEAVE(500) + MDRV_MACHINE_START(superqix) + /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) @@ -1038,7 +1077,9 @@ static MACHINE_DRIVER_START( sqixbl ) MDRV_CPU_ADD(Z80, 12000000/2) /* 6 MHz */ MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_IO_MAP(bootleg_port_map,0) - MDRV_CPU_VBLANK_INT_HACK(bootleg_interrupt,6) /* ??? */ + MDRV_CPU_VBLANK_INT_HACK(bootleg_interrupt,3) /* ??? */ + + MDRV_MACHINE_START(superqix) /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) @@ -1297,11 +1338,11 @@ static DRIVER_INIT( perestro ) -GAME( 1986, pbillian, 0, pbillian, pbillian, pbillian, ROT0, "Taito", "Prebillian", 0 ) -GAME( 1987, hotsmash, 0, hotsmash, hotsmash, hotsmash, ROT90, "Taito", "Vs. Hot Smash", 0 ) -GAME( 1987, sqix, 0, sqix, superqix, sqix, ROT90, "Taito", "Super Qix (set 1)", 0 ) -GAME( 1987, sqixa, sqix, sqix, superqix, sqixa, ROT90, "Taito", "Super Qix (set 2)", 0 ) -GAME( 1987, sqixu, sqix, sqix, superqix, sqix, ROT90, "Taito (Romstar License)", "Super Qix (US)", GAME_NOT_WORKING ) // different MCU? -GAME( 1987, sqixbl, sqix, sqixbl, superqix, 0, ROT90, "bootleg", "Super Qix (bootleg)", 0 ) -GAME( 1994, perestro, 0, sqixbl, superqix, perestro, ROT90, "Promat", "Perestroika Girls", 0 ) -GAME( 1993, perestrf, perestro, sqixbl, superqix, perestro, ROT90, "Promat (Fuuki license)", "Perestroika Girls (Fuuki license)", 0 ) +GAME( 1986, pbillian, 0, pbillian, pbillian, pbillian, ROT0, "Taito", "Prebillian", GAME_SUPPORTS_SAVE ) +GAME( 1987, hotsmash, 0, hotsmash, hotsmash, hotsmash, ROT90, "Taito", "Vs. Hot Smash", GAME_SUPPORTS_SAVE ) +GAME( 1987, sqix, 0, sqix, superqix, sqix, ROT90, "Taito", "Super Qix (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1987, sqixa, sqix, sqix, superqix, sqixa, ROT90, "Taito", "Super Qix (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1987, sqixu, sqix, sqix, superqix, sqix, ROT90, "Taito (Romstar License)", "Super Qix (US)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) // different MCU? +GAME( 1987, sqixbl, sqix, sqixbl, superqix, 0, ROT90, "bootleg", "Super Qix (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1994, perestro, 0, sqixbl, superqix, perestro, ROT90, "Promat", "Perestroika Girls", GAME_SUPPORTS_SAVE ) +GAME( 1993, perestrf, perestro, sqixbl, superqix, perestro, ROT90, "Promat (Fuuki license)", "Perestroika Girls (Fuuki license)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/video/superqix.c b/src/mame/video/superqix.c index c75b9f3e4ea..f291539d668 100644 --- a/src/mame/video/superqix.c +++ b/src/mame/video/superqix.c @@ -16,6 +16,7 @@ static int gfxbank; static bitmap_t *fg_bitmap[2]; static int show_bitmap; static tilemap *bg_tilemap; +static int last_power[2]; /*************************************************************************** @@ -56,6 +57,16 @@ static TILE_GET_INFO( sqix_get_bg_tile_info ) VIDEO_START( pbillian ) { bg_tilemap = tilemap_create(pb_get_bg_tile_info, tilemap_scan_rows, 8, 8,32,32); + + /* Need to do save state here */ + state_save_register_global(last_power[0]); + state_save_register_global(last_power[1]); + state_save_register_global(pbillian_show_power); +} + +static void superqix_postload(void) +{ + tilemap_mark_all_tiles_dirty(bg_tilemap); } VIDEO_START( superqix ) @@ -66,6 +77,12 @@ VIDEO_START( superqix ) tilemap_set_transmask(bg_tilemap,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ tilemap_set_transmask(bg_tilemap,1,0x0001,0xfffe); /* split type 1 has pen 0 transparent in front half */ + + state_save_register_global(gfxbank); + state_save_register_global(show_bitmap); + state_save_register_global_bitmap(fg_bitmap[0]); + state_save_register_global_bitmap(fg_bitmap[1]); + state_save_register_func_postload(superqix_postload); } @@ -91,7 +108,7 @@ WRITE8_HANDLER( superqix_bitmapram_w ) superqix_bitmapram[offset] = data; - *BITMAP_ADDR16(fg_bitmap[0], y, x + 0) = data >> 4; + *BITMAP_ADDR16(fg_bitmap[0], y, x) = data >> 4; *BITMAP_ADDR16(fg_bitmap[0], y, x + 1) = data & 0x0f; } } @@ -105,16 +122,13 @@ WRITE8_HANDLER( superqix_bitmapram2_w ) superqix_bitmapram2[offset] = data; - *BITMAP_ADDR16(fg_bitmap[1], y, x + 0) = data >> 4; + *BITMAP_ADDR16(fg_bitmap[1], y, x) = data >> 4; *BITMAP_ADDR16(fg_bitmap[1], y, x + 1) = data & 0x0f; } } WRITE8_HANDLER( pbillian_0410_w ) { - int bankaddress; - UINT8 *rom = memory_region(REGION_CPU1); - /* -------0 ? [not used] ------1- coin counter 1 @@ -127,8 +141,7 @@ WRITE8_HANDLER( pbillian_0410_w ) coin_counter_w(0,data & 0x02); coin_counter_w(1,data & 0x04); - bankaddress = 0x10000 + ((data & 0x08) >> 3) * 0x4000; - memory_set_bankptr(1,&rom[bankaddress]); + memory_set_bank(1, (data & 0x08) >> 3); interrupt_enable_w(machine,0,data & 0x10); flip_screen_set(data & 0x20); @@ -136,9 +149,6 @@ WRITE8_HANDLER( pbillian_0410_w ) WRITE8_HANDLER( superqix_0410_w ) { - int bankaddress; - UINT8 *rom = memory_region(REGION_CPU1); - /* bits 0-1 select the tile bank */ if (gfxbank != (data & 0x03)) { @@ -153,8 +163,7 @@ WRITE8_HANDLER( superqix_0410_w ) interrupt_enable_w(machine,offset,data & 0x08); /* bits 4-5 control ROM bank */ - bankaddress = 0x10000 + ((data & 0x30) >> 4) * 0x4000; - memory_set_bankptr(1,&rom[bankaddress]); + memory_set_bank(1, (data & 0x30) >> 4); } @@ -230,7 +239,6 @@ VIDEO_UPDATE( pbillian ) if (pbillian_show_power) { - static int last_power[2]; int curr_power; curr_power = ((readinputport(4)&0x3f)*100)/0x3f;