UNIF DRAGONFIGHTER - new board for the new dump (PCB BMW8544)

DEBUG: finally rid out of parasite handler triggering while reading data from debugger, hope it didn't broke something
INES: some quirks to be able to run UNIF files in iNES format (there are a lot of them in the NET marked as BAD because of that), need more extra mapper numbers, probably a new range, more crc lists of roms
This commit is contained in:
CaH4e3 2015-06-23 11:43:42 +00:00
parent 0c4cb43739
commit 3be370f776
12 changed files with 126 additions and 17 deletions

View File

@ -67,5 +67,5 @@ void UNL158B_Init(CartInfo *info) {
GenMMC3_Init(info, 128, 128, 0, 0);
pwrap = UNL158BPW;
info->Power = UNL158BPower;
AddExState(EXPREGS, 6, 0, "EXPR");
AddExState(EXPREGS, 8, 0, "EXPR");
}

View File

@ -0,0 +1,79 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2015 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* "Dragon Fighter" protected MMC3 based custom mapper board
* mostly hacky implementation, I can't verify if this mapper can read a RAM of the
* console or watches the bus writes somehow.
*
*/
#include "mapinc.h"
#include "mmc3.h"
static void UNLBMW8544PW(uint32 A, uint8 V) {
if(A == 0x8000)
setprg8(A,EXPREGS[0] & 0x1F); // the real hardware has this bank overrided with it's own register,
else // but MMC3 prg swap still works and you can actually change bank C000 at the same time if use 0x46 cmd
setprg8(A,V);
}
static void UNLBMW8544CW(uint32 A, uint8 V) {
if(A == 0x0000)
setchr2(0x0000,(V >> 1) ^ EXPREGS[1]);
else if (A == 0x0800)
setchr2(0x0800,(V >> 1) | ((EXPREGS[2] & 0x40) << 1));
else if (A == 0x1000)
setchr4(0x1000, EXPREGS[2] & 0x3F);
}
static DECLFW(UNLBMW8544ProtWrite) {
if(!(A & 1)) {
EXPREGS[0] = V;
FixMMC3PRG(MMC3_cmd);
}
}
static DECLFR(UNLBMW8544ProtRead) {
if(!fceuindbg) {
if(!(A & 1)) {
if((EXPREGS[0] & 0xE0) == 0xC0) {
EXPREGS[1] = ARead[0x6a](0x6a); // program can latch some data from the BUS, but I can't say how exactly,
} else { // without more euipment and skills ;) probably here we can try to get any write
EXPREGS[2] = ARead[0xff](0xff); // before the read operation
}
FixMMC3CHR(MMC3_cmd & 0x7F); // there are more different behaviour of the board isn't used by game itself, so unimplemented here and
} // actually will break the current logic ;)
}
return 0;
}
static void UNLBMW8544Power(void) {
GenMMC3Power();
SetWriteHandler(0x6000, 0x6FFF, UNLBMW8544ProtWrite);
SetReadHandler(0x6000, 0x6FFF, UNLBMW8544ProtRead);
}
void UNLBMW8544_Init(CartInfo *info) {
GenMMC3_Init(info, 128, 256, 0, 0);
pwrap = UNLBMW8544PW;
cwrap = UNLBMW8544CW;
info->Power = UNLBMW8544Power;
AddExState(EXPREGS, 3, 0, "EXPR");
}

View File

@ -45,12 +45,9 @@ static void COOLBOYCW(uint32 A, uint8 V) {
}
static void COOLBOYPW(uint32 A, uint8 V) {
uint32 mask;
uint32 mask = 0x3F;
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
switch(EXPREGS[0] & 0xC0) {
case 0x00:
mask = 0x3F;
break;
case 0x80:
mask = 0x1F;
break;

View File

@ -931,12 +931,14 @@ void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2)
int FCEU_CheatGetByte(uint32 A)
{
// if(CheatRPtrs[A>>10])
// return CheatRPtrs[A>>10][A]; //adelikat-commenting this stuff out so that lua can see frozen addresses, I hope this doesn't bork stuff.
/*else*/ if(A < 0x10000)
return ARead[A](A);
else
return 0;
if(A < 0x10000) {
uint32 ret;
fceuindbg=1;
ret = ARead[A](A);
fceuindbg=0;
return ret;
} else
return 0;
}
void FCEU_CheatSetByte(uint32 A, uint8 V)

View File

@ -290,9 +290,13 @@ uint8 GetMem(uint16 A) {
}
else if ((A >= 0x4018) && (A < 0x5000)) // AnS: changed the range, so MMC5 ExRAM can be watched in the Hexeditor
return 0xFF;
if (GameInfo) //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
return ARead[A](A);
else return 0;
if (GameInfo) { //adelikat: 11/17/09: Prevent crash if this is called with no game loaded.
uint32 ret;
fceuindbg=1;
ret = ARead[A](A);
fceuindbg=0;
return ret;
} else return 0;
}
uint8 GetPPUMem(uint8 A) {

View File

@ -892,6 +892,13 @@ void FCEU_printf(char *format, ...) {
vsnprintf(temp, sizeof(temp), format, ap);
FCEUD_Message(temp);
#if 0
FILE *ofile;
ofile = fopen("stdout.txt", "ab");
fwrite(temp, 1, strlen(temp), ofile);
fclose(ofile);
#endif
va_end(ap);
}

View File

@ -257,6 +257,8 @@
{0x345ee51a, 245, -1}, /* DQ4c */
{0x57514c6c, 245, -1}, /* Yong Zhe Dou E Long - Dragon Quest VI (Ch) */
// added a new mask bit to define these mappers as a dupes of the UNIF format boards
{0x1d75fd35, 256|0x1000,-1}, /* 2-in-1 - Street Dance + Hit Mouse (Unl) [!] */
{0x6eef8bb7, 257|0x1000,-1}, /* PEC-586 Chinese */
{0xac7e98fb, 257|0x1000,-1}, /* PEC-586 Chinese No Tape Out */

View File

@ -323,7 +323,7 @@ static void CheckHInfo(void) {
{
#include "ines-correct.h"
};
int32 tofix = 0, x;
int32 tofix = 0, x, mask;
uint64 partialmd5 = 0;
for (x = 0; x < 8; x++)
@ -357,9 +357,13 @@ static void CheckHInfo(void) {
VROM = NULL;
tofix |= 8;
}
if (MapperNo != (moo[x].mapper & 0xFF)) {
if (moo[x].mapper & 0x1000)
mask = 0xFFF;
else
mask = 0xFF;
if (MapperNo != (moo[x].mapper & mask)) {
tofix |= 1;
MapperNo = moo[x].mapper & 0xFF;
MapperNo = moo[x].mapper & mask;
}
}
if (moo[x].mirror >= 0) {
@ -707,6 +711,14 @@ static BMAPPINGLocal bmap[] = {
//-------- Mappers 512-767 is the Supplementary Ideographic Plane -----------
//-------- Mappers 3840-4095 are for rom dumps not publicly released --------
// An attempt to make working the UNIF BOARD ROMs in INES FORMAT
// I don't know if there a complete ines 2.0 mapper list exist, so if it does,
// just redefine these numbers to any others which isn't used before
// see the ines-correct.h files for the ROMs CHR list
{"", 256, UNLOneBus_Init},
{"", 257, UNLPEC586Init},
{"", 0, NULL}
};

View File

@ -459,6 +459,7 @@ static BMAPPING bmap[] = {
{ "SB-2000", UNLSB2000_Init, 0 },
{ "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR },
{ "158B", UNL158B_Init, 0 },
{ "DRAGONFIGHTER", UNLBMW8544_Init, 0 },
{ 0, 0, 0 }
};

View File

@ -147,6 +147,7 @@ void UNLSB2000_Init(CartInfo *info);
void UNLKS7010_Init(CartInfo *info);
void COOLBOY_Init(CartInfo *info);
void UNL158B_Init(CartInfo *info);
void UNLBMW8544_Init(CartInfo *info);
extern uint8 *UNIFchrrama; // Meh. So I can stop CHR RAM
// bank switcherooing with certain boards...

View File

@ -311,6 +311,7 @@
<ClCompile Include="..\src\boards\99.cpp" />
<ClCompile Include="..\src\boards\ac-08.cpp" />
<ClCompile Include="..\src\boards\bb.cpp" />
<ClCompile Include="..\src\boards\BMW8544.cpp" />
<ClCompile Include="..\src\boards\cityfighter.cpp" />
<ClCompile Include="..\src\boards\coolboy.cpp" />
<ClCompile Include="..\src\boards\dance2000.cpp" />

View File

@ -1051,6 +1051,9 @@
<ClCompile Include="..\src\boards\158B.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\BMW8544.cpp">
<Filter>boards</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\drivers\common\args.h">