From 60d3cac5c83315de41d5556aacda098238217f35 Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Sun, 12 Aug 2007 15:02:32 +0000 Subject: [PATCH] fixed SRAM initial state added vdptiming autodetect allowed TIME register read modified HBlank end --- changelog.txt | 15 ++++++++------- source/eeprom.c | 26 -------------------------- source/mem68k.c | 2 ++ source/ngc/loadrom.c | 6 ++++++ source/sram.c | 1 + source/system.c | 3 ++- source/vdp.c | 5 ++--- 7 files changed, 21 insertions(+), 37 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4127aac..1694179 100644 --- a/changelog.txt +++ b/changelog.txt @@ -11,15 +11,16 @@ used in a few games (now use game database) as backup RAM. This should fix SRAM . NHLPA Hockey 93, Rings of Power (EA mapper) . Micromachines games (Codemasters mapper) -- modified WRITE_xxx & READ_xxx macros for multiple endianness support -- rewrote BIG ENDIAN support in render.c and vdp.c: should be a little faster by now (avoid useless swaping) +- SRAM data is now initialized with 0xFF: fix Micromachines 2, Dino Dini Soccer and maybe more +- corrected 16-bits SRAM read/write: fix some Sega Sports and EA Sports games (NFL95, NBA Action 95, NL97, NHL98,...) +- modified WRITE_xxx & READ_xxx macros for better multiple endianness support +- rewrote BIG ENDIAN support in render.c and vdp.c: should be a little faster (no more useless word swapping) - fixed leftmost Window/PlaneA column render and implemented window bug (see gen-vdp.txt) -- corrected pixel sprite limit emulation -- corrected sprite collision detection -- added 9bits (RGB333) pixelcolor extrapolation to support fullcolor range (0-65535) when using 16bits rendering (RGB 565) +- sprite limit emulation and sprite collision detection should be now a little more accurate +- added 9bits (RGB333) pixel color extrapolation to support fullcolor range (0-65535) when using 16bits rendering (RGB 565) - completely rewrote interrupt (VINT/HINT) handling: Sesame's Street Counting Cafe now works without any hacks, -no other timing sensitive game seems to be broken -- corrected Hcounter table: Road Rash games (I,II,III) don't need any timing hacks anymore +other timing sensitive games seem to be ok +- modified Hcounter tables: Road Rash games (I,II,III) don't need any timing hacks anymore - corrected VDP latency so it does not interfere with DMA timings anymore diff --git a/source/eeprom.c b/source/eeprom.c index 7038605..303cd62 100644 --- a/source/eeprom.c +++ b/source/eeprom.c @@ -75,32 +75,6 @@ void EEPROM_Init() sram.on = 1; sram.write = 1; memcpy(&eeprom.type, &database[i].type, sizeof(T_EEPROM_TYPE)); - - /* Micromachines II need initialized values in RAM */ - if (i == 16) - { - int j=0; - while (j<0x400) - { - /* memory array is filled with "PETETEST01234567" */ - sram.sram[j++] = 0x50; - sram.sram[j++] = 0x45; - sram.sram[j++] = 0x54; - sram.sram[j++] = 0x45; - sram.sram[j++] = 0x54; - sram.sram[j++] = 0x45; - sram.sram[j++] = 0x53; - sram.sram[j++] = 0x54; - sram.sram[j++] = 0x30; - sram.sram[j++] = 0x31; - sram.sram[j++] = 0x32; - sram.sram[j++] = 0x33; - sram.sram[j++] = 0x34; - sram.sram[j++] = 0x35; - sram.sram[j++] = 0x36; - sram.sram[j++] = 0x37; - } - } } } i++; diff --git a/source/mem68k.c b/source/mem68k.c index f90780a..1105177 100644 --- a/source/mem68k.c +++ b/source/mem68k.c @@ -147,6 +147,7 @@ unsigned int m68k_read_memory_8 (unsigned int address) case 0x40: /* TMSS */ case 0x41: /* BOOTROM */ case 0x50: /* SVP REGISTERS */ + case 0x30: /* TIME */ return (m68k_read_bus_8 (address)); default: /* Unused */ @@ -319,6 +320,7 @@ unsigned int m68k_read_memory_16 (unsigned int address) case 0x40: /* TMSS */ case 0x41: /* BOOTROM */ case 0x50: /* SVP REGISTERS */ + case 0x30: /* TIME */ return (m68k_read_bus_16 (address)); default: /* Unused */ diff --git a/source/ngc/loadrom.c b/source/ngc/loadrom.c index 1ebdc44..50163bf 100644 --- a/source/ngc/loadrom.c +++ b/source/ngc/loadrom.c @@ -87,9 +87,15 @@ void genesis_set_region () void detect_game() { + /* Lotus 2 RECS */ if (strstr(rominfo.product,"T-50746") != NULL) alttiming = 1; else alttiming = 0; + /* Chaos Engine / Soldier of Fortune */ + if ((strstr(rominfo.product,"T-104066") != NULL) || + (strstr(rominfo.product,"T-124016") != NULL)) vdptiming = 1; + else vdptiming = 0; + /* Menacer 6-in-1 Pack */ if (strstr(rominfo.product,"MK-1658") != NULL) { diff --git a/source/sram.c b/source/sram.c index 8d17de9..0dfdfd2 100644 --- a/source/sram.c +++ b/source/sram.c @@ -39,6 +39,7 @@ T_SRAM sram; void SRAM_Init () { memset (&sram, 0, sizeof (T_SRAM)); + memset (&sram.sram[0], 0xFF, 0x10000); sram.crc = crc32 (0, &sram.sram[0], 0x10000); if ((cart_rom[0x1b0] == 0x52) && (cart_rom[0x1b1] == 0x41)) diff --git a/source/system.c b/source/system.c index 955db3d..e3a2e3b 100644 --- a/source/system.c +++ b/source/system.c @@ -262,7 +262,6 @@ int system_frame (int do_skip) /* H retrace */ status |= 0x0004; // HBlank = 1 m68k_run(aim_m68k - 404); - status &= 0xFFFB; // HBlank = 0 if (!alttiming && !do_skip) { @@ -290,6 +289,8 @@ int system_frame (int do_skip) } } + status &= 0xFFFB; // HBlank = 0 + /* Process end of line */ m68k_run(aim_m68k); if (zreset == 1 && zbusreq == 0) z80_run(aim_z80); diff --git a/source/vdp.c b/source/vdp.c index 7860d4a..ff65e0e 100644 --- a/source/vdp.c +++ b/source/vdp.c @@ -87,7 +87,7 @@ uint8 vdp_rate = 60; /* CPU speed (60Hz by default)*/ void (*color_update) (int index, uint16 data); uint8 dmatiming = 1; -uint8 vdptiming = 1; +uint8 vdptiming = 0; /*--------------------------------------------------------------------------*/ /* Init, reset, shutdown functions */ @@ -130,7 +130,7 @@ void vdp_reset (void) frame_end = 0xE0; dma_endCycles = 0; - status = 0x200; /* fifo empty - all other flags clear */ + status = 0x3600; /* fifo empty */ /* Initialize viewport */ bitmap.viewport.x = 0x20; @@ -473,7 +473,6 @@ void vdp_reg_w (uint8 r, uint8 d) break; case 0x01: /* CTRL #2 */ - /* Change the frame timing */ frame_end = (d & 8) ? 0xF0 : 0xE0;