From 3df44083f8d0d74b9c7b7b269976997e0472da27 Mon Sep 17 00:00:00 2001 From: Tomasz Slanina Date: Wed, 8 Oct 2008 18:35:22 +0000 Subject: [PATCH] snes.c - Fixed problem with OAM address reset at start of vblank. New games added or promoted from NOT_WORKING status --------------------------------------------------- Sonic Blast Man 2 Special Turbo (SNES bootleg) [Andreas Naive, Tomasz Slanina] --- src/mame/drivers/snesb.c | 4 ++-- src/mame/includes/snes.h | 2 ++ src/mame/machine/snes.c | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index 28387e0381a..3bfc6aa66c0 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -7,7 +7,7 @@ Supported games: - Killer Instinct - Final Fight 2 - - Sonic Blast Man 2 - not working due to bugs in SNES ppu emulation + - Sonic Blast Man 2 Not dumped: - Final Fight 3 @@ -775,4 +775,4 @@ ROM_END GAME( 199?, kinstb, 0, kinstb, kinstb, kinstb, ROT0, "bootleg", "Killer Instinct (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) GAME( 1996, ffight2b, 0, kinstb, ffight2b, ffight2b, ROT0, "bootleg", "Final Fight 2 (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) -GAME( 1997, sblast2b, 0, kinstb, sblast2b, sblast2b, ROT0, "bootleg", "Sonic Blast Man 2 Special Turbo (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING) +GAME( 1997, sblast2b, 0, kinstb, sblast2b, sblast2b, ROT0, "bootleg", "Sonic Blast Man 2 Special Turbo (SNES bootleg)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS) diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index c73048ca514..61489dbc785 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -414,6 +414,8 @@ struct SNES_PPU_STRUCT { UINT8 address_low; UINT8 address_high; + UINT8 saved_address_low; + UINT8 saved_address_high; UINT16 address; UINT16 priority_rotation; UINT8 size[2]; diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 2a7f1aaa7b1..602b966828e 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -156,8 +156,11 @@ static TIMER_CALLBACK( snes_scanline_tick ) /* Start of VBlank */ if( snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line ) { - program_write_byte(OAMADDL, snes_ppu.oam.address_low ); /* Reset oam address */ - program_write_byte(OAMADDH, snes_ppu.oam.address_high ); + if(!(snes_ram[INIDISP]&0x80)) + { + program_write_byte(OAMADDL, snes_ppu.oam.saved_address_low ); /* Reset oam address */ + program_write_byte(OAMADDH, snes_ppu.oam.saved_address_high ); + } snes_ram[HVBJOY] |= 0x81; /* Set vblank bit to on & indicate controllers being read */ snes_ram[RDNMI] |= 0x80; /* Set NMI occured bit */ @@ -639,11 +642,13 @@ WRITE8_HANDLER( snes_w_io ) break; case OAMADDL: /* Address for accessing OAM (low) */ snes_ppu.oam.address_low = data; + snes_ppu.oam.saved_address_low = data; snes_ppu.oam.address = ((snes_ppu.oam.address_high & 0x1) << 8) + data; snes_ram[OAMDATA] = 0; break; case OAMADDH: /* Address for accessing OAM (high) */ snes_ppu.oam.address_high = data & 0x1; + snes_ppu.oam.saved_address_high = data; snes_ppu.oam.address = ((data & 0x1) << 8) + snes_ppu.oam.address_low; snes_ppu.oam.priority_rotation = (data & 0x80) ? 1 : 0; snes_ram[OAMDATA] = 0;