the only thing missing in my driver is the byte version of the bankswitch handler i removed because i assumed the game only using word access here (and actually, it do use byte access)
so, here is the driver as it should have remained (the fbaxxx one without commentaries)
// The King of Fighters 10th Anniversary (hack/bootleg)
static struct BurnRomInfo kof10thRomDesc[] = {
{ "kof10-p1.bin", 0x800000, 0xB1FD0C43, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "kof10-c1a.bin", 0x400000, 0x3BBC0364, 3 | BRF_GRA }, // 1 Sprite data
{ "kof10-c2a.bin", 0x400000, 0x91230075, 3 | BRF_GRA }, // 2
{ "kof10-c1b.bin", 0x400000, 0xB5ABFC28, 3 | BRF_GRA }, // 3
{ "kof10-c2b.bin", 0x400000, 0x6CC4C6E1, 3 | BRF_GRA }, // 4
{ "kof10-c3a.bin", 0x400000, 0x5B3D4A16, 3 | BRF_GRA }, // 5
{ "kof10-c4a.bin", 0x400000, 0xC6F3419B, 3 | BRF_GRA }, // 6
{ "kof10-c3b.bin", 0x400000, 0x9D2BBA19, 3 | BRF_GRA }, // 7
{ "kof10-c4b.bin", 0x400000, 0x5A4050CB, 3 | BRF_GRA }, // 8
{ "kof10-c5a.bin", 0x400000, 0xA289D1E1, 3 | BRF_GRA }, // 9
{ "kof10-c6a.bin", 0x400000, 0xE6494B5D, 3 | BRF_GRA }, // 10
{ "kof10-c5b.bin", 0x400000, 0x404FFF02, 3 | BRF_GRA }, // 11
{ "kof10-c6b.bin", 0x400000, 0xF2CCFC9E, 3 | BRF_GRA }, // 12
{ "kof10-c7a.bin", 0x400000, 0xBE79C5A8, 3 | BRF_GRA }, // 13
{ "kof10-c8a.bin", 0x400000, 0xA5952CA4, 3 | BRF_GRA }, // 14
{ "kof10-c7b.bin", 0x400000, 0x3FDB3542, 3 | BRF_GRA }, // 15
{ "kof10-c8b.bin", 0x400000, 0x661B7A52, 3 | BRF_GRA }, // 16
{ "kf10-m1.bin", 0x020000, 0xF6FAB859, 4 | BRF_ESS | BRF_PRG }, // 17 Z80 code
{ "kf10-v1.bin", 0x800000, 0x0FC9A58D, 5 | BRF_SND }, // 18 Sound data
{ "kf10-v2.bin", 0x800000, 0xB8C475A4, 5 | BRF_SND }, // 19
};
STDROMPICKEXT(kof10th, kof10th, neogeo);
STD_ROM_FN(kof10th);
static unsigned char *kof10thExtraRAMA = NULL;
static unsigned char *kof10thExtraRAMB = NULL;
static void kof10thCallback()
{
UINT8*src = Neo68KROM;
UINT8*dst = (UINT8*)malloc(0x800000);
int i, j;
if (dst) {
memcpy(dst, src, 0x800000);
memcpy(src, dst + 0x700000, 0x100000);
memcpy(src + 0x100000, dst, 0x600000);
memcpy(dst, src, 0x800000);
for (i = 0; i < 0x800000; i++) {
j = BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 2, 9, 8, 7, 1, 5, 4, 3, 10, 6, 0);
src[j] = dst[i];
}
free(dst);
}
((unsigned short*)Neo68KROM)[ 0x000124 / 2] = 0x000d; // Run code that gives XOR for RAM moves and forces SoftDIPs
((unsigned short*)Neo68KROM)[ 0x000126 / 2] = 0xf7a8;
((unsigned short*)Neo68KROM)[ 0x700124 / 2] = 0x000d;
((unsigned short*)Neo68KROM)[ 0x700126 / 2] = 0xf7a8;
((unsigned short*)Neo68KROM)[ 0x008bf4 / 2] = 0x4ef9; // Run code to change 8x8 tiles (needed for neogeo logo tiles)
((unsigned short*)Neo68KROM)[ 0x008bf6 / 2] = 0x000d;
((unsigned short*)Neo68KROM)[ 0x008bf8 / 2] = 0xf980;
((unsigned short*)Neo68KROM)[ 0x708bf4 / 2] = 0x4ef9;
((unsigned short*)Neo68KROM)[ 0x708bf6 / 2] = 0x000d;
((unsigned short*)Neo68KROM)[ 0x708bf8 / 2] = 0xf980;
}
static void kof10thMapBank()
{
SekMapMemory(Neo68KROM + nNeo68KROMBank, 0x200000, 0x2FDFFF, SM_ROM);
}
static void kof10thBankswitch(unsigned int nBank)
{
nBank = 0x100000 + ((nBank & 7) << 20);
if (nBank >= 0x700000) {
nBank = 0x100000;
}
if (nBank != nNeo68KROMBank) {
nNeo68KROMBank = nBank;
kof10thMapBank();
}
}
static void __fastcall kof10thWriteWordCustom(unsigned int sekAddress, unsigned short wordValue)
{
if (kof10thExtraRAMB[ 0x1FFC]) {
NeoUpdateTextOne(0x20000 + ((sekAddress >> 1) & 0x1FFFF), BITSWAP08(wordValue, 7, 6, 0, 4, 3, 2, 1, 5));
} else {
*(unsigned short*)(kof10thExtraRAMA + (sekAddress & 0x01FFFF)) = wordValue;
}
}
static void __fastcall kof10thWriteByteBankswitch(unsigned int sekAddress, unsigned char byteValue)
{
if (sekAddress >= 0x2FE000) {
sekAddress ^= 1;
kof10thExtraRAMB[ sekAddress & 0x1FFF] = byteValue;
if (sekAddress == 0x2FFFF0)
kof10thBankswitch(byteValue);
else if (sekAddress == 0x2FFFF8 && kof10thExtraRAMB[ sekAddress & 0x1FFE] != byteValue) {
SekMapMemory(Neo68KROM + ((byteValue & 1) ? 0x700400 : 0x000400) , 0x000400, 0x0DFFFF, SM_ROM);
}
}
}
static void __fastcall kof10thWriteWordBankswitch(unsigned int sekAddress, unsigned short wordValue)
{
if (sekAddress >= 0x2FE000) {
*(unsigned short*)(kof10thExtraRAMB + (sekAddress & 0x01FFE)) = wordValue;
if (sekAddress == 0x2FFFF0)
kof10thBankswitch(wordValue);
else if (sekAddress == 0x2FFFF8 && *(unsigned short*)(kof10thExtraRAMB + (sekAddress & 0x1FFE)) != wordValue) {
SekMapMemory(Neo68KROM + ((wordValue & 1) ? 0x700400 : 0x000400) , 0x000400, 0x0DFFFF, SM_ROM);
}
}
}
int kof10thScan(int nAction, int* /*pnMin*/)
{
struct BurnArea ba;
if (nAction & ACB_MEMORY_RAM) {
ba.Data = kof10thExtraRAMA;
ba.nLen = 0x00020000;
ba.nAddress = 0;
ba.szName = "Extra RAM A";
BurnAcb(&ba);
ba.Data = kof10thExtraRAMB;
ba.nLen = 0x00002000;
ba.nAddress = 0;
ba.szName = "Extra RAM B";
BurnAcb(&ba);
ba.Data = NeoTextROM + 0x00020000;
ba.nLen = nNeoTextROMSize;
ba.nAddress = 0;
ba.szName = "8x8 Text Tile RAM";
BurnAcb(&ba);
}
return 0;
}
static int kof10thInit()
{
int nRet;
//nNeoTextRAMSize = 0x20000; // Extra RAM A
pNeoInitCallback = kof10thCallback;
pNeoBankswitchCallback = kof10thMapBank;
pNeoScanCallback = kof10thScan;
nRet = NeoInit();
if (nRet == 0) {
kof10thExtraRAMA = Neo68KROM + 0x7E0000;
kof10thExtraRAMB = Neo68KROM + 0x1FE000;
memset(kof10thExtraRAMA, 0, 0x20000);
memset(kof10thExtraRAMB, 0, 0x2000);
SekOpen(0);
kof10thMapBank();
SekMapMemory(kof10thExtraRAMB, 0x2FE000, 0x2FFFFF, SM_ROM);
SekMapHandler(4, 0x240000, 0x2FFFFF, SM_WRITE); // 68K bankswitch
SekSetWriteWordHandler(4, kof10thWriteWordBankswitch);
SekSetWriteByteHandler(4, kof10thWriteByteBankswitch);
SekMapHandler(5, 0x200000, 0x23FFFF, SM_WRITE);
SekSetWriteWordHandler(5, kof10thWriteWordCustom);
// Memory maps
SekMapMemory(kof10thExtraRAMA, 0x0E0000, 0x0FFFFF, SM_ROM);
nNeo68KROMBank = 1;
kof10thBankswitch(0);
SekClose();
}
return nRet;
}
struct BurnDriver BurnDrvKof10th = {
"kof10th", NULL, "neogeo", "2004",
"The King of Fighters 10th Anniversary\0", "Bootleg/Hack", "SNK / Playmore", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_BOOTLEG | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO,
NULL, kof10thRomInfo, kof10thRomName, neogeoInputInfo, neogeoDIPInfo,
kof10thInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};