finish with mapper to boards conversion
This commit is contained in:
parent
f3d6e617d5
commit
13d63e5af2
2
doxygen
2
doxygen
|
@ -459,7 +459,7 @@ WARN_LOGFILE =
|
||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = src src/mappers src/boards src/drivers/common src/drivers/win src/drivers/sdl src/input src/utils
|
INPUT = src src/boards src/drivers/common src/drivers/win src/drivers/sdl src/input src/utils
|
||||||
|
|
||||||
# If the value of the INPUT tag contains directories, you can use the
|
# If the value of the INPUT tag contains directories, you can use the
|
||||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||||
|
|
|
@ -8,7 +8,6 @@ drivers/common
|
||||||
fir
|
fir
|
||||||
input
|
input
|
||||||
utils
|
utils
|
||||||
mappers
|
|
||||||
""")
|
""")
|
||||||
#palettes
|
#palettes
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* Actually, all this may be the same mapper with different switcheable banking modes, maybe it's just an subtypes
|
* It seems that 162/163/164 mappers are the same mapper with just different
|
||||||
* of the same one board with various modes locked just like SuperGame boards, based on 215 mapper
|
* mapper modes enabled or disabled in software or hardware, need more nanjing
|
||||||
*
|
* carts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
@ -29,6 +29,8 @@ static uint8 reg[8];
|
||||||
static uint8 *WRAM = NULL;
|
static uint8 *WRAM = NULL;
|
||||||
static uint32 WRAMSIZE;
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static writefunc pcmwrite;
|
||||||
|
|
||||||
static void (*WSync)(void);
|
static void (*WSync)(void);
|
||||||
|
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
|
@ -39,24 +41,19 @@ static SFORMAT StateRegs[]=
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void)
|
static void Sync(void) {
|
||||||
{
|
|
||||||
setprg8r(0x10, 0x6000, 0);
|
setprg8r(0x10, 0x6000, 0);
|
||||||
setprg32(0x8000, (reg[0] << 4) | (reg[1] & 0xF));
|
setprg32(0x8000, (reg[0] << 4) | (reg[1] & 0xF));
|
||||||
setchr8(0);
|
setchr8(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StateRestore(int version)
|
static void StateRestore(int version) {
|
||||||
{
|
|
||||||
WSync();
|
WSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(ReadLow)
|
static DECLFR(ReadLow) {
|
||||||
{
|
switch (A & 0x7700) {
|
||||||
switch (A&0x7700)
|
case 0x5100: return reg[2] | reg[0] | reg[1] | reg[3] ^ 0xff; break;
|
||||||
{
|
|
||||||
case 0x5100:
|
|
||||||
return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break;
|
|
||||||
case 0x5500:
|
case 0x5500:
|
||||||
if (trigger)
|
if (trigger)
|
||||||
return reg[2] | reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
|
return reg[2] | reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
|
||||||
|
@ -66,17 +63,12 @@ static DECLFR(ReadLow)
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M163HB(void)
|
static void M163HB(void) {
|
||||||
{
|
if (reg[1] & 0x80) {
|
||||||
if(reg[1]&0x80)
|
if (scanline == 239) {
|
||||||
{
|
|
||||||
if(scanline==239)
|
|
||||||
{
|
|
||||||
setchr4(0x0000, 0);
|
setchr4(0x0000, 0);
|
||||||
setchr4(0x1000, 0);
|
setchr4(0x1000, 0);
|
||||||
}
|
} else if (scanline == 127) {
|
||||||
else if(scanline==127)
|
|
||||||
{
|
|
||||||
setchr4(0x0000, 1);
|
setchr4(0x0000, 1);
|
||||||
setchr4(0x1000, 1);
|
setchr4(0x1000, 1);
|
||||||
}
|
}
|
||||||
|
@ -95,10 +87,8 @@ static void M163HB(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(Write)
|
static DECLFW(Write) {
|
||||||
{
|
switch (A & 0x7300) {
|
||||||
switch (A&0x7300)
|
|
||||||
{
|
|
||||||
case 0x5100: reg[0] = V; WSync(); break;
|
case 0x5100: reg[0] = V; WSync(); break;
|
||||||
case 0x5000: reg[1] = V; WSync(); break;
|
case 0x5000: reg[1] = V; WSync(); break;
|
||||||
case 0x5300: reg[2] = V; break;
|
case 0x5300: reg[2] = V; break;
|
||||||
|
@ -106,8 +96,7 @@ static DECLFW(Write)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Power(void)
|
static void Power(void) {
|
||||||
{
|
|
||||||
memset(reg, 0, 8);
|
memset(reg, 0, 8);
|
||||||
reg[1] = 0xFF;
|
reg[1] = 0xFF;
|
||||||
SetWriteHandler(0x5000, 0x5FFF, Write);
|
SetWriteHandler(0x5000, 0x5FFF, Write);
|
||||||
|
@ -116,15 +105,13 @@ static void Power(void)
|
||||||
WSync();
|
WSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Close(void)
|
static void Close(void) {
|
||||||
{
|
|
||||||
if (WRAM)
|
if (WRAM)
|
||||||
FCEU_gfree(WRAM);
|
FCEU_gfree(WRAM);
|
||||||
WRAM = NULL;
|
WRAM = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper164_Init(CartInfo *info)
|
void Mapper164_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = Power;
|
info->Power = Power;
|
||||||
info->Close = Close;
|
info->Close = Close;
|
||||||
WSync = Sync;
|
WSync = Sync;
|
||||||
|
@ -134,8 +121,7 @@ void Mapper164_Init(CartInfo *info)
|
||||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
if(info->battery)
|
if (info->battery) {
|
||||||
{
|
|
||||||
info->SaveGame[0] = WRAM;
|
info->SaveGame[0] = WRAM;
|
||||||
info->SaveGameLen[0] = WRAMSIZE;
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
}
|
}
|
||||||
|
@ -144,18 +130,16 @@ void Mapper164_Init(CartInfo *info)
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(Write2)
|
static DECLFW(Write2) {
|
||||||
{
|
if (A == 0x5101) {
|
||||||
if(A==0x5101)
|
if (laststrobe && !V) {
|
||||||
{
|
|
||||||
if(laststrobe&&!V)
|
|
||||||
trigger ^= 1;
|
trigger ^= 1;
|
||||||
|
}
|
||||||
laststrobe = V;
|
laststrobe = V;
|
||||||
} else if (A == 0x5100 && V == 6) //damn thoose protected games
|
} else if (A == 0x5100 && V == 6) //damn thoose protected games
|
||||||
setprg32(0x8000, 3);
|
setprg32(0x8000, 3);
|
||||||
else
|
else
|
||||||
switch (A&0x7300)
|
switch (A & 0x7300) {
|
||||||
{
|
|
||||||
case 0x5200: reg[0] = V; WSync(); break;
|
case 0x5200: reg[0] = V; WSync(); break;
|
||||||
case 0x5000: reg[1] = V; WSync(); if (!(reg[1] & 0x80) && (scanline < 128)) setchr8(0); /* setchr8(0); */ break;
|
case 0x5000: reg[1] = V; WSync(); if (!(reg[1] & 0x80) && (scanline < 128)) setchr8(0); /* setchr8(0); */ break;
|
||||||
case 0x5300: reg[2] = V; break;
|
case 0x5300: reg[2] = V; break;
|
||||||
|
@ -163,10 +147,10 @@ static DECLFW(Write2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Power2(void)
|
static void Power2(void) {
|
||||||
{
|
|
||||||
memset(reg, 0, 8);
|
memset(reg, 0, 8);
|
||||||
laststrobe = 1;
|
laststrobe = 1;
|
||||||
|
pcmwrite = GetWriteHandler(0x4011);
|
||||||
SetReadHandler(0x5000, 0x5FFF, ReadLow);
|
SetReadHandler(0x5000, 0x5FFF, ReadLow);
|
||||||
SetWriteHandler(0x5000, 0x5FFF, Write2);
|
SetWriteHandler(0x5000, 0x5FFF, Write2);
|
||||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
@ -174,8 +158,7 @@ static void Power2(void)
|
||||||
WSync();
|
WSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper163_Init(CartInfo *info)
|
void Mapper163_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = Power2;
|
info->Power = Power2;
|
||||||
info->Close = Close;
|
info->Close = Close;
|
||||||
WSync = Sync;
|
WSync = Sync;
|
||||||
|
@ -186,8 +169,7 @@ void Mapper163_Init(CartInfo *info)
|
||||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
if(info->battery)
|
if (info->battery) {
|
||||||
{
|
|
||||||
info->SaveGame[0] = WRAM;
|
info->SaveGame[0] = WRAM;
|
||||||
info->SaveGameLen[0] = WRAMSIZE;
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +177,7 @@ void Mapper163_Init(CartInfo *info)
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Sync3(void)
|
static void Sync3(void) {
|
||||||
{
|
|
||||||
setchr8(0);
|
setchr8(0);
|
||||||
setprg8r(0x10, 0x6000, 0);
|
setprg8r(0x10, 0x6000, 0);
|
||||||
switch (reg[3] & 7) {
|
switch (reg[3] & 7) {
|
||||||
|
@ -211,14 +192,13 @@ static void Sync3(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(Write3)
|
static DECLFW(Write3) {
|
||||||
{
|
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||||
reg[(A >> 8) & 3] = V;
|
reg[(A >> 8) & 3] = V;
|
||||||
WSync();
|
WSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Power3(void)
|
static void Power3(void) {
|
||||||
{
|
|
||||||
reg[0] = 3;
|
reg[0] = 3;
|
||||||
reg[1] = 0;
|
reg[1] = 0;
|
||||||
reg[2] = 0;
|
reg[2] = 0;
|
||||||
|
@ -229,8 +209,7 @@ static void Power3(void)
|
||||||
WSync();
|
WSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UNLFS304_Init(CartInfo *info)
|
void UNLFS304_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = Power3;
|
info->Power = Power3;
|
||||||
info->Close = Close;
|
info->Close = Close;
|
||||||
WSync = Sync3;
|
WSync = Sync3;
|
||||||
|
@ -240,8 +219,7 @@ void UNLFS304_Init(CartInfo *info)
|
||||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
if(info->battery)
|
if (info->battery) {
|
||||||
{
|
|
||||||
info->SaveGame[0] = WRAM;
|
info->SaveGame[0] = WRAM;
|
||||||
info->SaveGameLen[0] = WRAMSIZE;
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,119 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2012 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
static uint8 preg[4], creg[8];
|
|
||||||
static uint8 IRQa, mirr;
|
|
||||||
static int32 IRQCount, IRQLatch;
|
|
||||||
|
|
||||||
static SFORMAT StateRegs[]=
|
|
||||||
{
|
|
||||||
{preg, 4, "PREG"},
|
|
||||||
{creg, 8, "CREG"},
|
|
||||||
{&mirr, 1, "MIRR"},
|
|
||||||
{&IRQa, 1, "IRQA"},
|
|
||||||
{&IRQCount, 4, "IRQC"},
|
|
||||||
{&IRQLatch, 4, "IRQL"},
|
|
||||||
{0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void Sync(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i=0; i<8; i++) setchr1(i<<10,creg[i]);
|
|
||||||
setprg8(0x8000,preg[0]);
|
|
||||||
setprg8(0xA000,preg[1]);
|
|
||||||
setprg8(0xC000,preg[2]);
|
|
||||||
setprg8(0xE000,preg[3]);
|
|
||||||
switch(mirr) {
|
|
||||||
case 0: setmirror(MI_0); break;
|
|
||||||
case 1: setmirror(MI_1); break;
|
|
||||||
case 2: setmirror(MI_H); break;
|
|
||||||
case 3: setmirror(MI_V); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(M17WriteMirr)
|
|
||||||
{
|
|
||||||
mirr = ((A << 1) & 2)|((V >> 4) & 1);
|
|
||||||
Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(M17WriteIRQ)
|
|
||||||
{
|
|
||||||
switch(A) {
|
|
||||||
case 0x4501: IRQa=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
|
||||||
case 0x4502: IRQCount&=0xFF00; IRQCount|=V; break;
|
|
||||||
case 0x4503: IRQCount&=0x00FF; IRQCount|=V<<8; IRQa=1; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(M17WritePrg)
|
|
||||||
{
|
|
||||||
preg[A & 3] = V;
|
|
||||||
Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(M17WriteChr)
|
|
||||||
{
|
|
||||||
creg[A & 7] = V;
|
|
||||||
Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void M17Power(void)
|
|
||||||
{
|
|
||||||
preg[3] = ~0;
|
|
||||||
Sync();
|
|
||||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
|
||||||
SetWriteHandler(0x42FE,0x42FF,M17WriteMirr);
|
|
||||||
SetWriteHandler(0x4500,0x4503,M17WriteIRQ);
|
|
||||||
SetWriteHandler(0x4504,0x4507,M17WritePrg);
|
|
||||||
SetWriteHandler(0x4510,0x4517,M17WriteChr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void M17IRQHook(int a)
|
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount+=a;
|
|
||||||
if(IRQCount>=0x10000)
|
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQa=0;
|
|
||||||
IRQCount=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void StateRestore(int version)
|
|
||||||
{
|
|
||||||
Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper17_Init(CartInfo *info)
|
|
||||||
{
|
|
||||||
info->Power=M17Power;
|
|
||||||
MapIRQHook=M17IRQHook;
|
|
||||||
GameStateRestore=StateRestore;
|
|
||||||
|
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[3], creg[8], mirr;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(mirr);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setchr1(0x0000, creg[0]);
|
||||||
|
setchr1(0x0400, creg[1]);
|
||||||
|
setchr1(0x0800, creg[2]);
|
||||||
|
setchr1(0x0C00, creg[3]);
|
||||||
|
setchr1(0x1000, creg[4]);
|
||||||
|
setchr1(0x1400, creg[5]);
|
||||||
|
setchr1(0x1800, creg[6]);
|
||||||
|
setchr1(0x1C00, creg[7]);
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M65Write) {
|
||||||
|
switch (A) {
|
||||||
|
case 0x8000: preg[0] = V; Sync(); break;
|
||||||
|
case 0xA000: preg[1] = V; Sync(); break;
|
||||||
|
case 0xC000: preg[2] = V; Sync(); break;
|
||||||
|
case 0x9001: mirr = ((V >> 7) & 1) ^ 1; Sync(); break;
|
||||||
|
case 0x9003: IRQa = V & 0x80; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0x9004: IRQCount = IRQLatch; break;
|
||||||
|
case 0x9005: IRQLatch &= 0x00FF; IRQLatch |= V << 8; break;
|
||||||
|
case 0x9006: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||||
|
case 0xB000: creg[0] = V; Sync(); break;
|
||||||
|
case 0xB001: creg[1] = V; Sync(); break;
|
||||||
|
case 0xB002: creg[2] = V; Sync(); break;
|
||||||
|
case 0xB003: creg[3] = V; Sync(); break;
|
||||||
|
case 0xB004: creg[4] = V; Sync(); break;
|
||||||
|
case 0xB005: creg[5] = V; Sync(); break;
|
||||||
|
case 0xB006: creg[6] = V; Sync(); break;
|
||||||
|
case 0xB007: creg[7] = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M65Power(void) {
|
||||||
|
preg[2] = ~1;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M65Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void M65IRQ(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount < -4) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper65_Init(CartInfo *info) {
|
||||||
|
info->Power = M65Power;
|
||||||
|
MapIRQHook = M65IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, creg[4], mirr, suntoggle = 0;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &suntoggle, 1, "STOG" },
|
||||||
|
{ creg, 4, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(mirr);
|
||||||
|
setprg16(0x8000, preg);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
setchr2(0x0000, creg[0]);
|
||||||
|
setchr2(0x0800, creg[1]);
|
||||||
|
setchr2(0x1000, creg[2]);
|
||||||
|
setchr2(0x1800, creg[3]);
|
||||||
|
switch (mirr) {
|
||||||
|
case 0: setmirror(MI_V); break;
|
||||||
|
case 1: setmirror(MI_H); break;
|
||||||
|
case 2: setmirror(MI_0); break;
|
||||||
|
case 3: setmirror(MI_1); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M67Write) {
|
||||||
|
switch (A & 0xF800) {
|
||||||
|
case 0x8800: creg[0] = V; Sync(); break;
|
||||||
|
case 0x9800: creg[1] = V; Sync(); break;
|
||||||
|
case 0xA800: creg[2] = V; Sync(); break;
|
||||||
|
case 0xB800: creg[3] = V; Sync(); break;
|
||||||
|
case 0xC000:
|
||||||
|
case 0xC800:
|
||||||
|
IRQCount &= 0xFF << (suntoggle << 3);
|
||||||
|
IRQCount |= V << ((suntoggle ^ 1) << 3);
|
||||||
|
suntoggle ^= 1;
|
||||||
|
break;
|
||||||
|
case 0xD800:
|
||||||
|
suntoggle = 0;
|
||||||
|
IRQa = V & 0x10;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
case 0xE800: mirr = V & 3; Sync(); break;
|
||||||
|
case 0xF800: preg = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M67Power(void) {
|
||||||
|
suntoggle = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M67Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void M67IRQ(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount <= 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper67_Init(CartInfo *info) {
|
||||||
|
info->Power = M67Power;
|
||||||
|
MapIRQHook = M67IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,278 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 cmdreg, preg[4], creg[8], mirr;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int32 IRQCount;
|
||||||
|
static uint8 *WRAM=NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &cmdreg, 1, "CMDR" },
|
||||||
|
{ preg, 4, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 i;
|
||||||
|
if ((preg[3] & 0xC0) == 0xC0)
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
else
|
||||||
|
setprg8(0x6000, preg[3] & 0x3F);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, creg[i]);
|
||||||
|
switch (mirr & 3) {
|
||||||
|
case 0: setmirror(MI_V); break;
|
||||||
|
case 1: setmirror(MI_H); break;
|
||||||
|
case 2: setmirror(MI_0); break;
|
||||||
|
case 3: setmirror(MI_1); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69WRAMWrite) {
|
||||||
|
if ((preg[3] & 0xC0) == 0xC0)
|
||||||
|
CartBW(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M69WRAMRead) {
|
||||||
|
if ((preg[3] & 0xC0) == 0x40)
|
||||||
|
return X.DB;
|
||||||
|
else
|
||||||
|
return CartBR(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69Write0) {
|
||||||
|
cmdreg = V & 0xF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69Write1) {
|
||||||
|
switch(cmdreg) {
|
||||||
|
case 0x0: creg[0] = V; Sync(); break;
|
||||||
|
case 0x1: creg[1] = V; Sync(); break;
|
||||||
|
case 0x2: creg[2] = V; Sync(); break;
|
||||||
|
case 0x3: creg[3] = V; Sync(); break;
|
||||||
|
case 0x4: creg[4] = V; Sync(); break;
|
||||||
|
case 0x5: creg[5] = V; Sync(); break;
|
||||||
|
case 0x6: creg[6] = V; Sync(); break;
|
||||||
|
case 0x7: creg[7] = V; Sync(); break;
|
||||||
|
case 0x8: preg[3] = V; Sync(); break;
|
||||||
|
case 0x9: preg[0] = V; Sync(); break;
|
||||||
|
case 0xA: preg[1] = V; Sync(); break;
|
||||||
|
case 0xB: preg[2] = V; Sync(); break;
|
||||||
|
case 0xC: mirr = V & 3; Sync(); break;
|
||||||
|
case 0xD: IRQa = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xE: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xF: IRQCount &= 0x00FF; IRQCount |= V << 8; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SUNSOFT-5/FME-7 Sound
|
||||||
|
|
||||||
|
static void AYSound(int Count);
|
||||||
|
static void AYSoundHQ(void);
|
||||||
|
static void DoAYSQ(int x);
|
||||||
|
static void DoAYSQHQ(int x);
|
||||||
|
|
||||||
|
static uint8 sndcmd, sreg[14];
|
||||||
|
static int32 vcount[3];
|
||||||
|
static int32 dcount[3];
|
||||||
|
static int CAYBC[3];
|
||||||
|
|
||||||
|
static SFORMAT SStateRegs[] =
|
||||||
|
{
|
||||||
|
{ &sndcmd, 1, "SCMD" },
|
||||||
|
{ sreg, 14, "SREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static DECLFW(M69SWrite0) {
|
||||||
|
sndcmd = V % 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69SWrite1) {
|
||||||
|
int x;
|
||||||
|
GameExpSound.Fill = AYSound;
|
||||||
|
GameExpSound.HiFill = AYSoundHQ;
|
||||||
|
if (FSettings.SndRate)
|
||||||
|
switch (sndcmd) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 8: if (FSettings.soundq >= 1) DoAYSQHQ(0); else DoAYSQ(0); break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 9: if (FSettings.soundq >= 1) DoAYSQHQ(1); else DoAYSQ(1); break;
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 10: if (FSettings.soundq >= 1) DoAYSQHQ(2); else DoAYSQ(2); break;
|
||||||
|
case 7:
|
||||||
|
for (x = 0; x < 2; x++)
|
||||||
|
if (FSettings.soundq >= 1) DoAYSQHQ(x); else DoAYSQ(x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sreg[sndcmd] = V;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoAYSQ(int x) {
|
||||||
|
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17);
|
||||||
|
int32 amp = (sreg[0x8 + x] & 15) << 2;
|
||||||
|
int32 start, end;
|
||||||
|
int V;
|
||||||
|
|
||||||
|
amp += amp >> 1;
|
||||||
|
|
||||||
|
start = CAYBC[x];
|
||||||
|
end = (SOUNDTS << 16) / soundtsinc;
|
||||||
|
if (end <= start) return;
|
||||||
|
CAYBC[x] = end;
|
||||||
|
|
||||||
|
if (amp)
|
||||||
|
for (V = start; V < end; V++) {
|
||||||
|
if (dcount[x])
|
||||||
|
Wave[V >> 4] += amp;
|
||||||
|
vcount[x] -= nesincsize;
|
||||||
|
while (vcount[x] <= 0) {
|
||||||
|
dcount[x] ^= 1;
|
||||||
|
vcount[x] += freq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoAYSQHQ(int x) {
|
||||||
|
int32 V;
|
||||||
|
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4;
|
||||||
|
int32 amp = (sreg[0x8 + x] & 15) << 6;
|
||||||
|
|
||||||
|
amp += amp >> 1;
|
||||||
|
|
||||||
|
if (!(sreg[0x7] & (1 << x))) {
|
||||||
|
for (V = CAYBC[x]; V < SOUNDTS; V++) {
|
||||||
|
if (dcount[x])
|
||||||
|
WaveHi[V] += amp;
|
||||||
|
vcount[x]--;
|
||||||
|
if (vcount[x] <= 0) {
|
||||||
|
dcount[x] ^= 1;
|
||||||
|
vcount[x] = freq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CAYBC[x] = SOUNDTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYSound(int Count) {
|
||||||
|
int x;
|
||||||
|
DoAYSQ(0);
|
||||||
|
DoAYSQ(1);
|
||||||
|
DoAYSQ(2);
|
||||||
|
for (x = 0; x < 3; x++)
|
||||||
|
CAYBC[x] = Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYSoundHQ(void) {
|
||||||
|
DoAYSQHQ(0);
|
||||||
|
DoAYSQHQ(1);
|
||||||
|
DoAYSQHQ(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYHiSync(int32 ts) {
|
||||||
|
int x;
|
||||||
|
|
||||||
|
for (x = 0; x < 3; x++)
|
||||||
|
CAYBC[x] = ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper69_ESI(void) {
|
||||||
|
GameExpSound.RChange = Mapper69_ESI;
|
||||||
|
GameExpSound.HiSync = AYHiSync;
|
||||||
|
memset(dcount, 0, sizeof(dcount));
|
||||||
|
memset(vcount, 0, sizeof(vcount));
|
||||||
|
memset(CAYBC, 0, sizeof(CAYBC));
|
||||||
|
AddExState(&SStateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SUNSOFT-5/FME-7 Sound
|
||||||
|
|
||||||
|
static void M69Power(void) {
|
||||||
|
cmdreg = sndcmd = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
IRQa = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, M69WRAMRead);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, M69WRAMWrite);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0x9FFF, M69Write0);
|
||||||
|
SetWriteHandler(0xA000, 0xBFFF, M69Write1);
|
||||||
|
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||||
|
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M69Close(void)
|
||||||
|
{
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M69IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount <= 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT); IRQa = 0; IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper69_Init(CartInfo *info) {
|
||||||
|
info->Power = M69Power;
|
||||||
|
info->Close = M69Close;
|
||||||
|
MapIRQHook = M69IRQHook;
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
if (info->battery) {
|
||||||
|
info->SaveGame[0] = WRAM;
|
||||||
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
|
}
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
Mapper69_ESI();
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NSFAY_Init(void) {
|
||||||
|
sndcmd = 0;
|
||||||
|
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||||
|
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||||
|
Mapper69_ESI();
|
||||||
|
}
|
|
@ -16,6 +16,9 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Taito X1-017 board, battery backed
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
@ -31,8 +34,7 @@ static SFORMAT StateRegs[]=
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void)
|
static void Sync(void) {
|
||||||
{
|
|
||||||
uint32 swap = ((ctrl & 2) << 11);
|
uint32 swap = ((ctrl & 2) << 11);
|
||||||
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
||||||
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
||||||
|
@ -48,13 +50,11 @@ static void Sync(void)
|
||||||
setmirror(ctrl & 1);
|
setmirror(ctrl & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(M82Write)
|
static DECLFW(M82Write) {
|
||||||
{
|
|
||||||
if (A <= 0x7ef5)
|
if (A <= 0x7ef5)
|
||||||
regs[A & 7] = V;
|
regs[A & 7] = V;
|
||||||
else
|
else
|
||||||
switch(A)
|
switch (A) {
|
||||||
{
|
|
||||||
case 0x7ef6: ctrl = V & 3; break;
|
case 0x7ef6: ctrl = V & 3; break;
|
||||||
case 0x7efa: regs[6] = V >> 2; break;
|
case 0x7efa: regs[6] = V >> 2; break;
|
||||||
case 0x7efb: regs[7] = V >> 2; break;
|
case 0x7efb: regs[7] = V >> 2; break;
|
||||||
|
@ -63,37 +63,32 @@ static DECLFW(M82Write)
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M82Power(void)
|
static void M82Power(void) {
|
||||||
{
|
|
||||||
Sync();
|
Sync();
|
||||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||||
SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF
|
SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M82Close(void)
|
static void M82Close(void) {
|
||||||
{
|
|
||||||
if (WRAM)
|
if (WRAM)
|
||||||
FCEU_gfree(WRAM);
|
FCEU_gfree(WRAM);
|
||||||
WRAM = NULL;
|
WRAM = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StateRestore(int version)
|
static void StateRestore(int version) {
|
||||||
{
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper82_Init(CartInfo *info)
|
void Mapper82_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = M82Power;
|
info->Power = M82Power;
|
||||||
info->Power=M82Close;
|
info->Close = M82Close;
|
||||||
|
|
||||||
WRAMSIZE = 8192;
|
WRAMSIZE = 8192;
|
||||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
if(info->battery)
|
if (info->battery) {
|
||||||
{
|
|
||||||
info->SaveGame[0] = WRAM;
|
info->SaveGame[0] = WRAM;
|
||||||
info->SaveGameLen[0] = WRAMSIZE;
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,7 +820,7 @@ static INLINE int16 calc(OPLL * opll) {
|
||||||
return (int16)out;
|
return (int16)out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moocow(OPLL* opll, int32 *buf, int32 len, int shift) {
|
void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift) {
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
*buf += (calc(opll) + 32768) << shift;
|
*buf += (calc(opll) + 32768) << shift;
|
||||||
buf++;
|
buf++;
|
|
@ -130,7 +130,7 @@ uint32 OPLL_setMask(OPLL *, uint32 mask);
|
||||||
uint32 OPLL_toggleMask(OPLL *, uint32 mask);
|
uint32 OPLL_toggleMask(OPLL *, uint32 mask);
|
||||||
|
|
||||||
|
|
||||||
void moocow(OPLL* opll, int32 *buf, int32 len, int shift);
|
void OPLL_fillbuf(OPLL* opll, int32 *buf, int32 len, int shift);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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
|
||||||
|
*
|
||||||
|
* FFE Copier Mappers
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[4], creg[8], latch, ffemode;
|
||||||
|
static uint8 IRQa, mirr;
|
||||||
|
static int32 IRQCount, IRQLatch;
|
||||||
|
static uint8 *WRAM=NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ preg, 4, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQLatch, 4, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
if (ffemode) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, preg[3]);
|
||||||
|
} else {
|
||||||
|
setchr8(latch & 3);
|
||||||
|
setprg16(0x8000, (latch >> 2) & 0x3F);
|
||||||
|
setprg16(0xc000, 0x7);
|
||||||
|
}
|
||||||
|
switch (mirr) {
|
||||||
|
case 0: setmirror(MI_0); break;
|
||||||
|
case 1: setmirror(MI_1); break;
|
||||||
|
case 2: setmirror(MI_V); break;
|
||||||
|
case 3: setmirror(MI_H); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(FFEWriteMirr) {
|
||||||
|
mirr = ((A << 1) & 2) | ((V >> 4) & 1);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(FFEWriteIRQ) {
|
||||||
|
switch (A) {
|
||||||
|
case 0x4501: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0x4502: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0x4503: IRQCount &= 0x00FF; IRQCount |= V << 8; IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(FFEWritePrg) {
|
||||||
|
preg[A & 3] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(FFEWriteChr) {
|
||||||
|
creg[A & 7] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(FFEWriteLatch) {
|
||||||
|
latch = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FFEPower(void) {
|
||||||
|
preg[3] = ~0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x42FE, 0x42FF, FFEWriteMirr);
|
||||||
|
SetWriteHandler(0x4500, 0x4503, FFEWriteIRQ);
|
||||||
|
SetWriteHandler(0x4504, 0x4507, FFEWritePrg);
|
||||||
|
SetWriteHandler(0x4510, 0x4517, FFEWriteChr);
|
||||||
|
SetWriteHandler(0x4510, 0x4517, FFEWriteChr);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, FFEWriteLatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FFEIRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount += a;
|
||||||
|
if (IRQCount >= 0x10000) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FFEClose(void)
|
||||||
|
{
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper6_Init(CartInfo *info) {
|
||||||
|
ffemode = 0;
|
||||||
|
mirr = ((info->mirror & 1) ^ 1) | 2;
|
||||||
|
|
||||||
|
info->Power = FFEPower;
|
||||||
|
info->Close = FFEClose;
|
||||||
|
MapIRQHook = FFEIRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
if (info->battery) {
|
||||||
|
info->SaveGame[0] = WRAM;
|
||||||
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper17_Init(CartInfo *info) {
|
||||||
|
ffemode = 1;
|
||||||
|
Mapper6_Init(info);
|
||||||
|
}
|
|
@ -0,0 +1,136 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 is10;
|
||||||
|
static uint8 creg[4], latch0, latch1, preg, mirr;
|
||||||
|
static uint8 *WRAM=NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ creg, 4, "CREG" },
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &latch0, 1, "LAT0" },
|
||||||
|
{ &latch1, 1, "LAT1" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
if (is10) {
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg16(0x8000, preg);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
} else {
|
||||||
|
setprg8(0x8000, preg);
|
||||||
|
setprg8(0xA000, ~2);
|
||||||
|
setprg8(0xC000, ~1);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
}
|
||||||
|
setchr4(0x0000, creg[latch0]);
|
||||||
|
setchr4(0x1000, creg[latch1 + 2]);
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLFW(MMC2and4Write) {
|
||||||
|
switch (A & 0xF000) {
|
||||||
|
case 0xA000: preg = V; Sync(); break;
|
||||||
|
case 0xB000: creg[0] = V; Sync(); break;
|
||||||
|
case 0xC000: creg[1] = V; Sync(); break;
|
||||||
|
case 0xD000: creg[2] = V; Sync(); break;
|
||||||
|
case 0xE000: creg[3] = V; Sync(); break;
|
||||||
|
case 0xF000: mirr = (V & 1) ^ 1; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MMC2and4PPUHook(uint32 A) {
|
||||||
|
uint8 l, h = A >> 8;
|
||||||
|
if (h >= 0x20 || ((h & 0xF) != 0xF))
|
||||||
|
return;
|
||||||
|
l = A & 0xF0;
|
||||||
|
if (h < 0x10) {
|
||||||
|
if (l == 0xD0) {
|
||||||
|
latch0 = 0;
|
||||||
|
setchr4(0x0000, creg[0]);
|
||||||
|
} else if (l == 0xE0) {
|
||||||
|
latch0 = 1;
|
||||||
|
setchr4(0x0000, creg[1]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (l == 0xD0) {
|
||||||
|
latch1 = 0;
|
||||||
|
setchr4(0x1000, creg[2]);
|
||||||
|
} else if (l == 0xE0) {
|
||||||
|
latch1 = 1;
|
||||||
|
setchr4(0x1000, creg[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MMC2and4Power(void) {
|
||||||
|
preg = 0;
|
||||||
|
latch0 = latch1 = 1;
|
||||||
|
Sync();
|
||||||
|
if (is10) {
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
}
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0xA000, 0xFFFF, MMC2and4Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MMC2and4Close(void)
|
||||||
|
{
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper9_Init(CartInfo *info) {
|
||||||
|
is10 = 0;
|
||||||
|
info->Power = MMC2and4Power;
|
||||||
|
PPU_hook = MMC2and4PPUHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper10_Init(CartInfo *info) {
|
||||||
|
is10 = 1;
|
||||||
|
info->Power = MMC2and4Power;
|
||||||
|
info->Close = MMC2and4Close;
|
||||||
|
PPU_hook = MMC2and4PPUHook;
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
if (info->battery) {
|
||||||
|
info->SaveGame[0] = WRAM;
|
||||||
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
|
}
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
|
@ -20,80 +20,69 @@
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 mode;
|
static uint8 is167, regs[4];
|
||||||
static uint8 DRegs[4];
|
|
||||||
|
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
{
|
{
|
||||||
{DRegs, 4, "DREG"},
|
{ regs, 4, "DREG" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void)
|
static void Sync(void) {
|
||||||
{
|
|
||||||
int base, bank;
|
int base, bank;
|
||||||
base = ((DRegs[0]^DRegs[1])&0x10)<<1;
|
base = ((regs[0] ^ regs[1]) & 0x10) << 1;
|
||||||
bank = (DRegs[2]^DRegs[3])&0x1f;
|
bank = (regs[2] ^ regs[3]) & 0x1f;
|
||||||
|
|
||||||
if(DRegs[1]&0x08)
|
if (regs[1] & 0x08) {
|
||||||
{
|
bank &= 0xFE;
|
||||||
bank &= 0xfe;
|
if (is167) {
|
||||||
if(mode==0)
|
|
||||||
{
|
|
||||||
setprg16(0x8000, base + bank + 1);
|
setprg16(0x8000, base + bank + 1);
|
||||||
setprg16(0xC000, base + bank + 0);
|
setprg16(0xC000, base + bank + 0);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setprg16(0x8000, base + bank + 0);
|
setprg16(0x8000, base + bank + 0);
|
||||||
setprg16(0xC000, base + bank + 1);
|
setprg16(0xC000, base + bank + 1);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (regs[1] & 0x04) {
|
||||||
{
|
setprg16(0x8000, 0x1F);
|
||||||
if(DRegs[1]&0x04)
|
|
||||||
{
|
|
||||||
setprg16(0x8000,0x1f);
|
|
||||||
setprg16(0xC000, base + bank);
|
setprg16(0xC000, base + bank);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setprg16(0x8000, base + bank);
|
setprg16(0x8000, base + bank);
|
||||||
if(mode==0)
|
if (is167)
|
||||||
setprg16(0xC000, 0x20);
|
setprg16(0xC000, 0x20);
|
||||||
else
|
else
|
||||||
setprg16(0xC000, 0x07);
|
setprg16(0xC000, 0x07);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setchr8(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(Mapper167_write)
|
static DECLFW(M166Write) {
|
||||||
{
|
regs[(A >> 13) & 0x03] = V;
|
||||||
DRegs[(A>>13)&0x03]=V;
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StateRestore(int version)
|
static void M166Power(void) {
|
||||||
{
|
regs[0] = regs[1] = regs[2] = regs[3] = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M166Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper166_init(void)
|
void Mapper166_Init(CartInfo *info) {
|
||||||
{
|
is167 = 0;
|
||||||
mode=1;
|
info->Power = M166Power;
|
||||||
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
|
|
||||||
Sync();
|
|
||||||
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
|
|
||||||
GameStateRestore = StateRestore;
|
GameStateRestore = StateRestore;
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper167_init(void)
|
void Mapper167_Init(CartInfo *info) {
|
||||||
{
|
is167 = 1;
|
||||||
mode=0;
|
info->Power = M166Power;
|
||||||
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
|
|
||||||
Sync();
|
|
||||||
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
|
|
||||||
GameStateRestore = StateRestore;
|
GameStateRestore = StateRestore;
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,63 +20,50 @@
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint16 addrreg;
|
static uint8 bank, base, lock, mirr;
|
||||||
static uint8 datareg;
|
|
||||||
static uint8 busy;
|
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
{
|
{
|
||||||
{&addrreg, 2, "AREG"},
|
{ &bank, 1, "BANK" },
|
||||||
{&datareg, 1, "DREG"},
|
{ &base, 1, "BASE" },
|
||||||
{&busy, 1, "BUSY"},
|
{ &lock, 1, "LOCK" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void)
|
static void Sync(void) {
|
||||||
{
|
setchr8(0);
|
||||||
uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3);
|
setprg16(0x8000, base | bank);
|
||||||
setprg16(0x8000,(datareg&7)|base);
|
setprg16(0xC000, base | 7);
|
||||||
setprg16(0xC000,7|base);
|
setmirror(mirr);
|
||||||
setmirror(((addrreg&2)>>1)^1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(BMCT262Write)
|
static DECLFW(BMCT262Write) {
|
||||||
{
|
if (!lock) {
|
||||||
if(busy||(A==0x8000))
|
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
|
||||||
datareg=V;
|
mirr = ((A & 2) >> 1) ^ 1;
|
||||||
else
|
lock = (A & 0x2000) >> 13;
|
||||||
{
|
|
||||||
addrreg=A;
|
|
||||||
busy=1;
|
|
||||||
}
|
}
|
||||||
|
bank = V & 7;
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMCT262Power(void)
|
static void BMCT262Power(void) {
|
||||||
{
|
lock = bank = base = 0;
|
||||||
setchr8(0);
|
Sync();
|
||||||
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
|
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
|
||||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
busy=0;
|
}
|
||||||
addrreg=0;
|
|
||||||
datareg=0xff;
|
static void BMCT262Reset(void) {
|
||||||
|
lock = bank = base = 0;
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMCT262Reset(void)
|
static void BMCT262Restore(int version) {
|
||||||
{
|
|
||||||
busy=0;
|
|
||||||
addrreg=0;
|
|
||||||
datareg=0;
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BMCT262Restore(int version)
|
void BMCT262_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BMCT262_Init(CartInfo *info)
|
|
||||||
{
|
|
||||||
info->Power = BMCT262Power;
|
info->Power = BMCT262Power;
|
||||||
info->Reset = BMCT262Reset;
|
info->Reset = BMCT262Reset;
|
||||||
GameStateRestore = BMCT262Restore;
|
GameStateRestore = BMCT262Restore;
|
||||||
|
|
|
@ -20,181 +20,120 @@
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 cmd,mir,rmode,IRQmode;
|
static uint8 cmd, mirr, regs[11];
|
||||||
static uint8 DRegs[11];
|
static uint8 rmode, IRQmode, IRQCount, IRQa, IRQLatch;
|
||||||
static uint8 IRQCount,IRQa,IRQLatch;
|
|
||||||
|
|
||||||
static SFORMAT Rambo_StateRegs[]={
|
static SFORMAT StateRegs[] = {
|
||||||
{&cmd, 1, "CMD"},
|
{ regs, 11, "REGS" },
|
||||||
{&mir, 1, "MIR"},
|
{ &cmd, 1, "CMDR" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
{ &rmode, 1, "RMOD" },
|
{ &rmode, 1, "RMOD" },
|
||||||
{ &IRQmode, 1, "IRQM" },
|
{ &IRQmode, 1, "IRQM" },
|
||||||
{ &IRQCount, 1, "IRQC" },
|
{ &IRQCount, 1, "IRQC" },
|
||||||
{ &IRQa, 1, "IRQA" },
|
{ &IRQa, 1, "IRQA" },
|
||||||
{ &IRQLatch, 1, "IRQL" },
|
{ &IRQLatch, 1, "IRQL" },
|
||||||
{DRegs, 11, "DREG"},
|
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*setchr1wrap)(unsigned int A, unsigned int V);
|
static void M64IRQHook(int a) {
|
||||||
//static int nomirror;
|
static int32 smallcount;
|
||||||
|
if (IRQmode) {
|
||||||
static void RAMBO1_IRQHook(int a)
|
|
||||||
{
|
|
||||||
static int smallcount;
|
|
||||||
if(!IRQmode) return;
|
|
||||||
|
|
||||||
smallcount += a;
|
smallcount += a;
|
||||||
while(smallcount>=4)
|
while (smallcount >= 4) {
|
||||||
{
|
|
||||||
smallcount -= 4;
|
smallcount -= 4;
|
||||||
IRQCount--;
|
IRQCount--;
|
||||||
if (IRQCount == 0xFF)
|
if (IRQCount == 0xFF)
|
||||||
if (IRQa) X6502_IRQBegin(FCEU_IQEXT);
|
if (IRQa) X6502_IRQBegin(FCEU_IQEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void RAMBO1_hb(void)
|
static void M64HBHook(void) {
|
||||||
{
|
if ((!IRQmode) && (scanline != 240)) {
|
||||||
if(IRQmode) return;
|
|
||||||
if(scanline==240) return; /* hmm. Maybe that should be an mmc3-only call in fce.c. */
|
|
||||||
rmode = 0;
|
rmode = 0;
|
||||||
IRQCount--;
|
IRQCount--;
|
||||||
if(IRQCount==0xFF)
|
if (IRQCount == 0xFF) {
|
||||||
{
|
if (IRQa) {
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
rmode = 1;
|
rmode = 1;
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Synco(void)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
if(cmd&0x20)
|
|
||||||
{
|
|
||||||
setchr1wrap(0x0000,DRegs[0]);
|
|
||||||
setchr1wrap(0x0800,DRegs[1]);
|
|
||||||
setchr1wrap(0x0400,DRegs[8]);
|
|
||||||
setchr1wrap(0x0c00,DRegs[9]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setchr1wrap(0x0000,(DRegs[0]&0xFE));
|
|
||||||
setchr1wrap(0x0400,(DRegs[0]&0xFE)|1);
|
|
||||||
setchr1wrap(0x0800,(DRegs[1]&0xFE));
|
|
||||||
setchr1wrap(0x0C00,(DRegs[1]&0xFE)|1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(x=0;x<4;x++)
|
static void Sync(void) {
|
||||||
setchr1wrap(0x1000+x*0x400,DRegs[2+x]);
|
if (cmd & 0x20) {
|
||||||
|
setchr1(0x0000, regs[0]);
|
||||||
setprg8(0x8000,DRegs[6]);
|
setchr1(0x0400, regs[8]);
|
||||||
setprg8(0xA000,DRegs[7]);
|
setchr1(0x0800, regs[1]);
|
||||||
|
setchr1(0x0C00, regs[9]);
|
||||||
setprg8(0xC000,DRegs[10]);
|
} else {
|
||||||
|
setchr2(0x0000, regs[0] >> 1);
|
||||||
|
setchr2(0x0800, regs[1] >> 1);
|
||||||
|
}
|
||||||
|
setchr1(0x1000, regs[2]);
|
||||||
|
setchr1(0x1400, regs[3]);
|
||||||
|
setchr1(0x1800, regs[4]);
|
||||||
|
setchr1(0x1C00, regs[5]);
|
||||||
|
setprg8(0x8000, regs[6]);
|
||||||
|
setprg8(0xA000, regs[7]);
|
||||||
|
setprg8(0xC000, regs[10]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setmirror(mirr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DECLFW(M64Write) {
|
||||||
static DECLFW(RAMBO1_write)
|
switch (A & 0xF001) {
|
||||||
{
|
case 0xA000: mirr = (V & 1) ^ 1; Sync(); break;\
|
||||||
switch(A&0xF001)
|
case 0x8000: cmd = V; break;
|
||||||
{
|
case 0x8001:
|
||||||
case 0xa000: mir=V&1;
|
if ((cmd & 0xF) < 10)
|
||||||
// if(!nomirror)
|
regs[cmd & 0xF] = V;
|
||||||
setmirror(mir^1);
|
|
||||||
break;
|
|
||||||
case 0x8000: cmd = V;
|
|
||||||
break;
|
|
||||||
case 0x8001: if((cmd&0xF)<10)
|
|
||||||
DRegs[cmd&0xF]=V;
|
|
||||||
else if ((cmd & 0xF) == 0xF)
|
else if ((cmd & 0xF) == 0xF)
|
||||||
DRegs[10]=V;
|
regs[10] = V;
|
||||||
Synco();
|
Sync();
|
||||||
break;
|
break;
|
||||||
case 0xc000: IRQLatch=V;
|
case 0xC000:
|
||||||
|
IRQLatch = V;
|
||||||
if (rmode == 1)
|
if (rmode == 1)
|
||||||
IRQCount = IRQLatch;
|
IRQCount = IRQLatch;
|
||||||
break;
|
break;
|
||||||
case 0xc001: rmode=1;
|
case 0xC001:
|
||||||
|
rmode = 1;
|
||||||
IRQCount = IRQLatch;
|
IRQCount = IRQLatch;
|
||||||
IRQmode = V & 1;
|
IRQmode = V & 1;
|
||||||
break;
|
break;
|
||||||
case 0xE000: IRQa=0;
|
case 0xE000:
|
||||||
|
IRQa = 0;
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
if (rmode == 1)
|
if (rmode == 1)
|
||||||
IRQCount = IRQLatch;
|
IRQCount = IRQLatch;
|
||||||
break;
|
break;
|
||||||
case 0xE001: IRQa=1;
|
case 0xE001:
|
||||||
|
IRQa = 1;
|
||||||
if (rmode == 1)
|
if (rmode == 1)
|
||||||
IRQCount = IRQLatch;
|
IRQCount = IRQLatch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RAMBO1_Restore(int version)
|
static void M64Power(void) {
|
||||||
{
|
cmd = mirr = 0;
|
||||||
Synco();
|
regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = ~0;
|
||||||
// if(!nomirror)
|
regs[6] = regs[7] = regs[8] = regs[9] = regs[10] = ~0;
|
||||||
setmirror(mir^1);
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M64Write);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RAMBO1_init(void)
|
static void StateRestore(int version) {
|
||||||
{
|
Sync();
|
||||||
int x;
|
|
||||||
for(x=0;x<11;x++)
|
|
||||||
DRegs[x]=~0;
|
|
||||||
cmd=mir=0;
|
|
||||||
// if(!nomirror)
|
|
||||||
setmirror(1);
|
|
||||||
Synco();
|
|
||||||
GameHBIRQHook=RAMBO1_hb;
|
|
||||||
MapIRQHook=RAMBO1_IRQHook;
|
|
||||||
GameStateRestore=RAMBO1_Restore;
|
|
||||||
SetWriteHandler(0x8000,0xffff,RAMBO1_write);
|
|
||||||
AddExState(Rambo_StateRegs, ~0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CHRWrap(unsigned int A, unsigned int V)
|
void Mapper64_Init(CartInfo *info) {
|
||||||
{
|
info->Power = M64Power;
|
||||||
setchr1(A,V);
|
GameHBIRQHook = M64HBHook;
|
||||||
|
MapIRQHook = M64IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper64_init(void)
|
|
||||||
{
|
|
||||||
setchr1wrap=CHRWrap;
|
|
||||||
// nomirror=0;
|
|
||||||
RAMBO1_init();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
static int MirCache[8];
|
|
||||||
static unsigned int PPUCHRBus;
|
|
||||||
|
|
||||||
static void MirWrap(unsigned int A, unsigned int V)
|
|
||||||
{
|
|
||||||
MirCache[A>>10]=(V>>7)&1;
|
|
||||||
if(PPUCHRBus==(A>>10))
|
|
||||||
setmirror(MI_0+((V>>7)&1));
|
|
||||||
setchr1(A,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MirrorFear(uint32 A)
|
|
||||||
{
|
|
||||||
A&=0x1FFF;
|
|
||||||
A>>=10;
|
|
||||||
PPUCHRBus=A;
|
|
||||||
setmirror(MI_0+MirCache[A]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper158_init(void)
|
|
||||||
{
|
|
||||||
setchr1wrap=MirWrap;
|
|
||||||
PPU_hook=MirrorFear;
|
|
||||||
nomirror=1;
|
|
||||||
RAMBO1_init();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,357 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2009 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
|
||||||
|
*
|
||||||
|
* VRC-6
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 is26;
|
||||||
|
static uint8 prg[2], chr[8], mirr;
|
||||||
|
static uint8 IRQLatch, IRQa, IRQd;
|
||||||
|
static uint32 IRQCount, CycleCount;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ prg, 2, "PRG" },
|
||||||
|
{ chr, 8, "CHR" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQd, 1, "IRQD" },
|
||||||
|
{ &IRQLatch, 1, "IRQL" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &CycleCount, 4, "CYCC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void(*sfun[3]) (void);
|
||||||
|
static uint8 vpsg2[4];
|
||||||
|
static uint8 vpsg1[4];
|
||||||
|
static int32 cvbc[3];
|
||||||
|
static int32 vcount[3];
|
||||||
|
static int32 dcount[2];
|
||||||
|
|
||||||
|
static SFORMAT SStateRegs[] =
|
||||||
|
{
|
||||||
|
{ vpsg1, 4, "PSG1" },
|
||||||
|
{ vpsg2, 4, "PSG2" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 i;
|
||||||
|
setprg16(0x8000, prg[0]);
|
||||||
|
setprg8(0xc000, prg[1]);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, chr[i]);
|
||||||
|
switch (mirr & 3) {
|
||||||
|
case 0: setmirror(MI_V); break;
|
||||||
|
case 1: setmirror(MI_H); break;
|
||||||
|
case 2: setmirror(MI_0); break;
|
||||||
|
case 3: setmirror(MI_1); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(VRC6SW) {
|
||||||
|
A &= 0xF003;
|
||||||
|
if (A >= 0x9000 && A <= 0x9002) {
|
||||||
|
vpsg1[A & 3] = V;
|
||||||
|
if (sfun[0]) sfun[0]();
|
||||||
|
} else if (A >= 0xA000 && A <= 0xA002) {
|
||||||
|
vpsg1[4 | (A & 3)] = V;
|
||||||
|
if (sfun[1]) sfun[1]();
|
||||||
|
} else if (A >= 0xB000 && A <= 0xB002) {
|
||||||
|
vpsg2[A & 3] = V;
|
||||||
|
if (sfun[2]) sfun[2]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(VRC6Write) {
|
||||||
|
if (is26)
|
||||||
|
A = (A & 0xFFFC) | ((A >> 1) & 1) | ((A << 1) & 2);
|
||||||
|
if (A >= 0x9000 && A <= 0xB002) {
|
||||||
|
VRC6SW(A, V);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (A & 0xF003) {
|
||||||
|
case 0x8000: prg[0] = V; Sync(); break;
|
||||||
|
case 0xB003: mirr = (V >> 2) & 3; Sync(); break;
|
||||||
|
case 0xC000: prg[1] = V; Sync(); break;
|
||||||
|
case 0xD000: chr[0] = V; Sync(); break;
|
||||||
|
case 0xD001: chr[1] = V; Sync(); break;
|
||||||
|
case 0xD002: chr[2] = V; Sync(); break;
|
||||||
|
case 0xD003: chr[3] = V; Sync(); break;
|
||||||
|
case 0xE000: chr[4] = V; Sync(); break;
|
||||||
|
case 0xE001: chr[5] = V; Sync(); break;
|
||||||
|
case 0xE002: chr[6] = V; Sync(); break;
|
||||||
|
case 0xE003: chr[7] = V; Sync(); break;
|
||||||
|
case 0xF000: IRQLatch = V; break;
|
||||||
|
case 0xF001:
|
||||||
|
IRQa = V & 2;
|
||||||
|
IRQd = V & 1;
|
||||||
|
if (V & 2) {
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
CycleCount = 0;
|
||||||
|
}
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
case 0xF002:
|
||||||
|
IRQa = IRQd;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC6Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, VRC6Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC6IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
CycleCount += a * 3;
|
||||||
|
if (CycleCount >= 341) {
|
||||||
|
while(CycleCount >= 341) {
|
||||||
|
CycleCount -= 341;
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount == 0x100) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// VRC6 Sound
|
||||||
|
|
||||||
|
static void DoSQV1(void);
|
||||||
|
static void DoSQV2(void);
|
||||||
|
static void DoSawV(void);
|
||||||
|
|
||||||
|
static INLINE void DoSQV(int x) {
|
||||||
|
int32 V;
|
||||||
|
int32 amp = (((vpsg1[x << 2] & 15) << 8) * 6 / 8) >> 4;
|
||||||
|
int32 start, end;
|
||||||
|
|
||||||
|
start = cvbc[x];
|
||||||
|
end = (SOUNDTS << 16) / soundtsinc;
|
||||||
|
if (end <= start) return;
|
||||||
|
cvbc[x] = end;
|
||||||
|
|
||||||
|
if (vpsg1[(x << 2) | 0x2] & 0x80) {
|
||||||
|
if (vpsg1[x << 2] & 0x80) {
|
||||||
|
for (V = start; V < end; V++)
|
||||||
|
Wave[V >> 4] += amp;
|
||||||
|
} else {
|
||||||
|
int32 thresh = (vpsg1[x << 2] >> 4) & 7;
|
||||||
|
int32 freq = ((vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1) << 17;
|
||||||
|
for (V = start; V < end; V++) {
|
||||||
|
if (dcount[x] > thresh)
|
||||||
|
Wave[V >> 4] += amp;
|
||||||
|
vcount[x] -= nesincsize;
|
||||||
|
while (vcount[x] <= 0) {
|
||||||
|
vcount[x] += freq;
|
||||||
|
dcount[x] = (dcount[x] + 1) & 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSQV1(void) {
|
||||||
|
DoSQV(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSQV2(void) {
|
||||||
|
DoSQV(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSawV(void) {
|
||||||
|
int V;
|
||||||
|
int32 start, end;
|
||||||
|
|
||||||
|
start = cvbc[2];
|
||||||
|
end = (SOUNDTS << 16) / soundtsinc;
|
||||||
|
if (end <= start) return;
|
||||||
|
cvbc[2] = end;
|
||||||
|
|
||||||
|
if (vpsg2[2] & 0x80) {
|
||||||
|
static int32 saw1phaseacc = 0;
|
||||||
|
uint32 freq3;
|
||||||
|
static uint8 b3 = 0;
|
||||||
|
static int32 phaseacc = 0;
|
||||||
|
static uint32 duff = 0;
|
||||||
|
|
||||||
|
freq3 = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1);
|
||||||
|
|
||||||
|
for (V = start; V < end; V++) {
|
||||||
|
saw1phaseacc -= nesincsize;
|
||||||
|
if (saw1phaseacc <= 0) {
|
||||||
|
int32 t;
|
||||||
|
rea:
|
||||||
|
t = freq3;
|
||||||
|
t <<= 18;
|
||||||
|
saw1phaseacc += t;
|
||||||
|
phaseacc += vpsg2[0] & 0x3f;
|
||||||
|
b3++;
|
||||||
|
if (b3 == 7) {
|
||||||
|
b3 = 0;
|
||||||
|
phaseacc = 0;
|
||||||
|
}
|
||||||
|
if (saw1phaseacc <= 0)
|
||||||
|
goto rea;
|
||||||
|
duff = (((phaseacc >> 3) & 0x1f) << 4) * 6 / 8;
|
||||||
|
}
|
||||||
|
Wave[V >> 4] += duff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static INLINE void DoSQVHQ(int x) {
|
||||||
|
int32 V;
|
||||||
|
int32 amp = ((vpsg1[x << 2] & 15) << 8) * 6 / 8;
|
||||||
|
|
||||||
|
if (vpsg1[(x << 2) | 0x2] & 0x80) {
|
||||||
|
if (vpsg1[x << 2] & 0x80) {
|
||||||
|
for (V = cvbc[x]; V < SOUNDTS; V++)
|
||||||
|
WaveHi[V] += amp;
|
||||||
|
} else {
|
||||||
|
int32 thresh = (vpsg1[x << 2] >> 4) & 7;
|
||||||
|
for (V = cvbc[x]; V < SOUNDTS; V++) {
|
||||||
|
if (dcount[x] > thresh)
|
||||||
|
WaveHi[V] += amp;
|
||||||
|
vcount[x]--;
|
||||||
|
if (vcount[x] <= 0) {
|
||||||
|
vcount[x] = (vpsg1[(x << 2) | 0x1] | ((vpsg1[(x << 2) | 0x2] & 15) << 8)) + 1;
|
||||||
|
dcount[x] = (dcount[x] + 1) & 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cvbc[x] = SOUNDTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSQV1HQ(void) {
|
||||||
|
DoSQVHQ(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSQV2HQ(void) {
|
||||||
|
DoSQVHQ(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoSawVHQ(void) {
|
||||||
|
static uint8 b3 = 0;
|
||||||
|
static int32 phaseacc = 0;
|
||||||
|
int32 V;
|
||||||
|
|
||||||
|
if (vpsg2[2] & 0x80) {
|
||||||
|
for (V = cvbc[2]; V < SOUNDTS; V++) {
|
||||||
|
WaveHi[V] += (((phaseacc >> 3) & 0x1f) << 8) * 6 / 8;
|
||||||
|
vcount[2]--;
|
||||||
|
if (vcount[2] <= 0) {
|
||||||
|
vcount[2] = (vpsg2[1] + ((vpsg2[2] & 15) << 8) + 1) << 1;
|
||||||
|
phaseacc += vpsg2[0] & 0x3f;
|
||||||
|
b3++;
|
||||||
|
if (b3 == 7) {
|
||||||
|
b3 = 0;
|
||||||
|
phaseacc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cvbc[2] = SOUNDTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VRC6Sound(int Count) {
|
||||||
|
int x;
|
||||||
|
|
||||||
|
DoSQV1();
|
||||||
|
DoSQV2();
|
||||||
|
DoSawV();
|
||||||
|
for (x = 0; x < 3; x++)
|
||||||
|
cvbc[x] = Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VRC6SoundHQ(void) {
|
||||||
|
DoSQV1HQ();
|
||||||
|
DoSQV2HQ();
|
||||||
|
DoSawVHQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VRC6SyncHQ(int32 ts) {
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < 3; x++) cvbc[x] = ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC6_ESI(void) {
|
||||||
|
GameExpSound.RChange = VRC6_ESI;
|
||||||
|
GameExpSound.Fill = VRC6Sound;
|
||||||
|
GameExpSound.HiFill = VRC6SoundHQ;
|
||||||
|
GameExpSound.HiSync = VRC6SyncHQ;
|
||||||
|
|
||||||
|
memset(cvbc, 0, sizeof(cvbc));
|
||||||
|
memset(vcount, 0, sizeof(vcount));
|
||||||
|
memset(dcount, 0, sizeof(dcount));
|
||||||
|
if (FSettings.SndRate) {
|
||||||
|
if (FSettings.soundq >= 1) {
|
||||||
|
sfun[0] = DoSQV1HQ;
|
||||||
|
sfun[1] = DoSQV2HQ;
|
||||||
|
sfun[2] = DoSawVHQ;
|
||||||
|
} else {
|
||||||
|
sfun[0] = DoSQV1;
|
||||||
|
sfun[1] = DoSQV2;
|
||||||
|
sfun[2] = DoSawV;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
memset(sfun, 0, sizeof(sfun));
|
||||||
|
AddExState(&SStateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// VRC6 Sound
|
||||||
|
|
||||||
|
void Mapper24_Init(CartInfo *info) {
|
||||||
|
is26 = 0;
|
||||||
|
info->Power = VRC6Power;
|
||||||
|
MapIRQHook = VRC6IRQHook;
|
||||||
|
VRC6_ESI();
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper26_Init(CartInfo *info) {
|
||||||
|
is26 = 1;
|
||||||
|
info->Power = VRC6Power;
|
||||||
|
MapIRQHook = VRC6IRQHook;
|
||||||
|
VRC6_ESI();
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NSFVRC6_Init(void) {
|
||||||
|
VRC6_ESI();
|
||||||
|
SetWriteHandler(0x8000, 0xbfff, VRC6SW);
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
*
|
*
|
||||||
* Copyright notice for this file:
|
* Copyright notice for this file:
|
||||||
* Copyright (C) 2009 CaH4e3
|
* Copyright (C) 2012 CaH4e3
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,34 +20,87 @@
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
|
||||||
static uint8 prg[3], chr[8], mirr;
|
static uint8 vrc7idx, preg[3], creg[8], mirr;
|
||||||
static uint8 IRQLatch, IRQa, IRQd;
|
static uint8 IRQLatch, IRQa, IRQd;
|
||||||
static uint32 IRQCount, CycleCount;
|
static uint32 IRQCount, CycleCount;
|
||||||
|
static uint8 *WRAM=NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
static SFORMAT StateRegs[] =
|
static SFORMAT StateRegs[] =
|
||||||
{
|
{
|
||||||
{prg, 3, "PRG"},
|
{ &vrc7idx, 1, "VRCI" },
|
||||||
{chr, 8, "CHR"},
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
{ &mirr, 1, "MIRR" },
|
{ &mirr, 1, "MIRR" },
|
||||||
{ &IRQa, 1, "IRQA" },
|
{ &IRQa, 1, "IRQA" },
|
||||||
{ &IRQd, 1, "IRQD" },
|
{ &IRQd, 1, "IRQD" },
|
||||||
{&IRQLatch, 1, "IRQC"},
|
{ &IRQLatch, 1, "IRQL" },
|
||||||
{ &IRQCount, 4, "IRQC" },
|
{ &IRQCount, 4, "IRQC" },
|
||||||
{ &CycleCount, 4, "CYCC" },
|
{ &CycleCount, 4, "CYCC" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Sync(void)
|
// VRC7 Sound
|
||||||
{
|
|
||||||
|
#include "emu2413.h"
|
||||||
|
|
||||||
|
static int32 dwave = 0;
|
||||||
|
static OPLL *VRC7Sound = NULL;
|
||||||
|
|
||||||
|
void DoVRC7Sound(void) {
|
||||||
|
int32 z, a;
|
||||||
|
if (FSettings.soundq >= 1)
|
||||||
|
return;
|
||||||
|
z = ((SOUNDTS << 16) / soundtsinc) >> 4;
|
||||||
|
a = z - dwave;
|
||||||
|
OPLL_fillbuf(VRC7Sound, &Wave[dwave], a, 1);
|
||||||
|
dwave += a;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateOPLNEO(int32 *Wave, int Count) {
|
||||||
|
OPLL_fillbuf(VRC7Sound, Wave, Count, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateOPL(int Count) {
|
||||||
|
int32 z, a;
|
||||||
|
z = ((SOUNDTS << 16) / soundtsinc) >> 4;
|
||||||
|
a = z - dwave;
|
||||||
|
if (VRC7Sound && a)
|
||||||
|
OPLL_fillbuf(VRC7Sound, &Wave[dwave], a, 1);
|
||||||
|
dwave = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC7SC(void) {
|
||||||
|
if (VRC7Sound)
|
||||||
|
OPLL_set_rate(VRC7Sound, FSettings.SndRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC7SKill(void) {
|
||||||
|
if (VRC7Sound)
|
||||||
|
OPLL_delete(VRC7Sound);
|
||||||
|
VRC7Sound = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC7_ESI(void) {
|
||||||
|
GameExpSound.RChange = VRC7SC;
|
||||||
|
GameExpSound.Kill = VRC7SKill;
|
||||||
|
VRC7Sound = OPLL_new(3579545, FSettings.SndRate ? FSettings.SndRate : 44100);
|
||||||
|
OPLL_reset(VRC7Sound);
|
||||||
|
OPLL_reset(VRC7Sound);
|
||||||
|
}
|
||||||
|
|
||||||
|
// VRC7 Sound
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
uint8 i;
|
uint8 i;
|
||||||
setprg8(0x8000,prg[0]);
|
setprg8r(0x10, 0x6000, 0);
|
||||||
setprg8(0xa000,prg[1]);
|
setprg8(0x8000, preg[0]);
|
||||||
setprg8(0xc000,prg[2]);
|
setprg8(0xA000, preg[1]);
|
||||||
setprg8(0xe000,~0);
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
setchr1(i<<10,chr[i]);
|
setchr1(i << 10, creg[i]);
|
||||||
switch(mirr&3)
|
switch (mirr & 3) {
|
||||||
{
|
|
||||||
case 0: setmirror(MI_V); break;
|
case 0: setmirror(MI_V); break;
|
||||||
case 1: setmirror(MI_H); break;
|
case 1: setmirror(MI_H); break;
|
||||||
case 2: setmirror(MI_0); break;
|
case 2: setmirror(MI_0); break;
|
||||||
|
@ -55,27 +108,30 @@ static void Sync(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(UNLVRC7Write)
|
static DECLFW(VRC7SW) {
|
||||||
{
|
if (FSettings.SndRate) {
|
||||||
switch(A&0xF008)
|
OPLL_writeReg(VRC7Sound, vrc7idx, V);
|
||||||
{
|
GameExpSound.Fill = UpdateOPL;
|
||||||
case 0x8000: prg[0]=V; Sync(); break;
|
GameExpSound.NeoFill = UpdateOPLNEO;
|
||||||
case 0x8008: prg[1]=V; Sync(); break;
|
}
|
||||||
case 0x9000: prg[2]=V; Sync(); break;
|
}
|
||||||
case 0xa000: chr[0]=V; Sync(); break;
|
|
||||||
case 0xa008: chr[1]=V; Sync(); break;
|
static DECLFW(VRC7Write) {
|
||||||
case 0xb000: chr[2]=V; Sync(); break;
|
A |= (A & 8) << 1; // another two-in-oooone
|
||||||
case 0xb008: chr[3]=V; Sync(); break;
|
if (A >= 0xA000 && A <= 0xDFFF) {
|
||||||
case 0xc000: chr[4]=V; Sync(); break;
|
A &= 0xF010;
|
||||||
case 0xc008: chr[5]=V; Sync(); break;
|
creg[((A >> 4) & 1) | ((A - 0xA000) >> 11)] = V;
|
||||||
case 0xd000: chr[6]=V; Sync(); break;
|
Sync();
|
||||||
case 0xd008: chr[7]=V; Sync(); break;
|
} else if (A == 0x9030) {
|
||||||
case 0xe000: mirr=V; Sync(); break;
|
VRC7SW(A, V);
|
||||||
case 0xe008:
|
} else switch (A & 0xF010) {
|
||||||
IRQLatch=V;
|
case 0x8000: preg[0] = V; Sync(); break;
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
case 0x8010: preg[1] = V; Sync(); break;
|
||||||
break;
|
case 0x9000: preg[2] = V; Sync(); break;
|
||||||
case 0xf000:
|
case 0x9010: vrc7idx = V; break;
|
||||||
|
case 0xE000: mirr = V & 3; Sync(); break;
|
||||||
|
case 0xE010: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xF000:
|
||||||
IRQa = V & 2;
|
IRQa = V & 2;
|
||||||
IRQd = V & 1;
|
IRQd = V & 1;
|
||||||
if (V & 2)
|
if (V & 2)
|
||||||
|
@ -83,50 +139,66 @@ static DECLFW(UNLVRC7Write)
|
||||||
CycleCount = 0;
|
CycleCount = 0;
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
break;
|
break;
|
||||||
case 0xf008:
|
case 0xF010:
|
||||||
if(IRQd)
|
IRQa = IRQd;
|
||||||
IRQa=1;
|
|
||||||
else
|
|
||||||
IRQa=0;
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLVRC7Power(void)
|
static void VRC7Power(void) {
|
||||||
{
|
|
||||||
Sync();
|
Sync();
|
||||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
SetWriteHandler(0x8000,0xFFFF,UNLVRC7Write);
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, VRC7Write);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLVRC7IRQHook(int a)
|
static void VRC7Close(void)
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
{
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VRC7IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
CycleCount += a * 3;
|
CycleCount += a * 3;
|
||||||
while(CycleCount>=341)
|
if (CycleCount >= 341) {
|
||||||
{
|
while(CycleCount >= 341) {
|
||||||
CycleCount -= 341;
|
CycleCount -= 341;
|
||||||
IRQCount++;
|
IRQCount++;
|
||||||
if(IRQCount==248)
|
if (IRQCount & 0x100) {
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQCount = IRQLatch;
|
IRQCount = IRQLatch;
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StateRestore(int version)
|
static void StateRestore(int version) {
|
||||||
{
|
|
||||||
Sync();
|
Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UNLVRC7_Init(CartInfo *info)
|
void Mapper85_Init(CartInfo *info) {
|
||||||
{
|
info->Power = VRC7Power;
|
||||||
info->Power=UNLVRC7Power;
|
info->Close = VRC7Close;
|
||||||
MapIRQHook=UNLVRC7IRQHook;
|
MapIRQHook = VRC7IRQHook;
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
if (info->battery) {
|
||||||
|
info->SaveGame[0] = WRAM;
|
||||||
|
info->SaveGameLen[0] = WRAMSIZE;
|
||||||
|
}
|
||||||
GameStateRestore = StateRestore;
|
GameStateRestore = StateRestore;
|
||||||
|
VRC7_ESI();
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NSFVRC7_Init(void) {
|
||||||
|
SetWriteHandler(0x9010, 0x901F, VRC7Write);
|
||||||
|
SetWriteHandler(0x9030, 0x903F, VRC7Write);
|
||||||
|
VRC7_ESI();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2009 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
|
||||||
|
*
|
||||||
|
* YOKO Mortal Kombat V Pro, VRC7 pirate clone
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 prg[3], chr[8], mirr;
|
||||||
|
static uint8 IRQLatch, IRQa, IRQd;
|
||||||
|
static uint32 IRQCount, CycleCount;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ prg, 3, "PRG" },
|
||||||
|
{ chr, 8, "CHR" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQd, 1, "IRQD" },
|
||||||
|
{ &IRQLatch, 1, "IRQL" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &CycleCount, 4, "CYCC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 i;
|
||||||
|
setprg8(0x8000, prg[0]);
|
||||||
|
setprg8(0xa000, prg[1]);
|
||||||
|
setprg8(0xc000, prg[2]);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, chr[i]);
|
||||||
|
switch (mirr & 3) {
|
||||||
|
case 0: setmirror(MI_V); break;
|
||||||
|
case 1: setmirror(MI_H); break;
|
||||||
|
case 2: setmirror(MI_0); break;
|
||||||
|
case 3: setmirror(MI_1); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLVRC7Write) {
|
||||||
|
switch (A & 0xF008) {
|
||||||
|
case 0x8000: prg[0] = V; Sync(); break;
|
||||||
|
case 0x8008: prg[1] = V; Sync(); break;
|
||||||
|
case 0x9000: prg[2] = V; Sync(); break;
|
||||||
|
case 0xa000: chr[0] = V; Sync(); break;
|
||||||
|
case 0xa008: chr[1] = V; Sync(); break;
|
||||||
|
case 0xb000: chr[2] = V; Sync(); break;
|
||||||
|
case 0xb008: chr[3] = V; Sync(); break;
|
||||||
|
case 0xc000: chr[4] = V; Sync(); break;
|
||||||
|
case 0xc008: chr[5] = V; Sync(); break;
|
||||||
|
case 0xd000: chr[6] = V; Sync(); break;
|
||||||
|
case 0xd008: chr[7] = V; Sync(); break;
|
||||||
|
case 0xe000: mirr = V; Sync(); break;
|
||||||
|
case 0xe008:
|
||||||
|
IRQLatch = V;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
case 0xf000:
|
||||||
|
IRQa = V & 2;
|
||||||
|
IRQd = V & 1;
|
||||||
|
if (V & 2)
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
CycleCount = 0;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
case 0xf008:
|
||||||
|
if (IRQd)
|
||||||
|
IRQa = 1;
|
||||||
|
else
|
||||||
|
IRQa = 0;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLVRC7Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, UNLVRC7Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLVRC7IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
CycleCount += a * 3;
|
||||||
|
while (CycleCount >= 341) {
|
||||||
|
CycleCount -= 341;
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount == 248) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLVRC7_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLVRC7Power;
|
||||||
|
MapIRQHook = UNLVRC7IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
|
@ -16,6 +16,14 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* YOKO mapper, almost the same as 83, TODO: figure out difference
|
||||||
|
* Mapper 83 - 30-in-1 mapper, two modes for single game carts, one mode for
|
||||||
|
* multigame Dragon Ball Z Party
|
||||||
|
*
|
||||||
|
* Mortal Kombat 2 YOKO
|
||||||
|
* N-CXX(M), XX - PRG+CHR, 12 - 128+256, 22 - 256+256, 14 - 128+512
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mapinc.h"
|
#include "mapinc.h"
|
||||||
|
@ -40,63 +48,50 @@ static SFORMAT StateRegs[]=
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void UNLYOKOSync(void)
|
static void UNLYOKOSync(void) {
|
||||||
{
|
|
||||||
setmirror((mode & 1) ^ 1);
|
setmirror((mode & 1) ^ 1);
|
||||||
setchr2(0x0000, reg[3]);
|
setchr2(0x0000, reg[3]);
|
||||||
setchr2(0x0800, reg[4]);
|
setchr2(0x0800, reg[4]);
|
||||||
setchr2(0x1000, reg[5]);
|
setchr2(0x1000, reg[5]);
|
||||||
setchr2(0x1800, reg[6]);
|
setchr2(0x1800, reg[6]);
|
||||||
if(mode & 0x10)
|
if (mode & 0x10) {
|
||||||
{
|
|
||||||
uint32 base = (bank & 8) << 1;
|
uint32 base = (bank & 8) << 1;
|
||||||
setprg8(0x8000, (reg[0] & 0x0f) | base);
|
setprg8(0x8000, (reg[0] & 0x0f) | base);
|
||||||
setprg8(0xA000, (reg[1] & 0x0f) | base);
|
setprg8(0xA000, (reg[1] & 0x0f) | base);
|
||||||
setprg8(0xC000, (reg[2] & 0x0f) | base);
|
setprg8(0xC000, (reg[2] & 0x0f) | base);
|
||||||
setprg8(0xE000, 0x0f | base);
|
setprg8(0xE000, 0x0f | base);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mode & 8)
|
if (mode & 8)
|
||||||
setprg32(0x8000, bank >> 1);
|
setprg32(0x8000, bank >> 1);
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
setprg16(0x8000, bank);
|
setprg16(0x8000, bank);
|
||||||
setprg16(0xC000, ~0);
|
setprg16(0xC000, ~0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M83Sync(void)
|
static void M83Sync(void) {
|
||||||
{
|
switch (mode & 3) { // check if it is truth
|
||||||
switch(mode & 3) // check if it is truth
|
|
||||||
{
|
|
||||||
case 0: setmirror(MI_V); break;
|
case 0: setmirror(MI_V); break;
|
||||||
case 1: setmirror(MI_H); break;
|
case 1: setmirror(MI_H); break;
|
||||||
case 2: setmirror(MI_0); break;
|
case 2: setmirror(MI_0); break;
|
||||||
case 3: setmirror(MI_1); break;
|
case 3: setmirror(MI_1); break;
|
||||||
}
|
}
|
||||||
if(is2kbank&&!isnot2kbank)
|
if (is2kbank && !isnot2kbank) {
|
||||||
{
|
|
||||||
setchr2(0x0000, reg[0]);
|
setchr2(0x0000, reg[0]);
|
||||||
setchr2(0x0800, reg[1]);
|
setchr2(0x0800, reg[1]);
|
||||||
setchr2(0x1000, reg[6]);
|
setchr2(0x1000, reg[6]);
|
||||||
setchr2(0x1800, reg[7]);
|
setchr2(0x1800, reg[7]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < 8; x++)
|
for (x = 0; x < 8; x++)
|
||||||
setchr1(x << 10, reg[x] | ((bank & 0x30) << 4));
|
setchr1(x << 10, reg[x] | ((bank & 0x30) << 4));
|
||||||
}
|
}
|
||||||
setprg8r(0x10, 0x6000, 0);
|
setprg8r(0x10, 0x6000, 0);
|
||||||
if(mode & 0x40)
|
if (mode & 0x40) {
|
||||||
{
|
|
||||||
setprg16(0x8000, (bank & 0x3F)); // DBZ Party [p1]
|
setprg16(0x8000, (bank & 0x3F)); // DBZ Party [p1]
|
||||||
setprg16(0xC000, (bank & 0x30) | 0xF);
|
setprg16(0xC000, (bank & 0x30) | 0xF);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setprg8(0x8000, reg[8]);
|
setprg8(0x8000, reg[8]);
|
||||||
setprg8(0xA000, reg[9]);
|
setprg8(0xA000, reg[9]);
|
||||||
setprg8(0xC000, reg[10]);
|
setprg8(0xC000, reg[10]);
|
||||||
|
@ -104,10 +99,8 @@ static void M83Sync(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(UNLYOKOWrite)
|
static DECLFW(UNLYOKOWrite) {
|
||||||
{
|
switch (A & 0x8C17) {
|
||||||
switch(A & 0x8C17)
|
|
||||||
{
|
|
||||||
case 0x8000: bank = V; UNLYOKOSync(); break;
|
case 0x8000: bank = V; UNLYOKOSync(); break;
|
||||||
case 0x8400: mode = V; UNLYOKOSync(); break;
|
case 0x8400: mode = V; UNLYOKOSync(); break;
|
||||||
case 0x8800: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
case 0x8800: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
@ -122,10 +115,8 @@ static DECLFW(UNLYOKOWrite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(M83Write)
|
static DECLFW(M83Write) {
|
||||||
{
|
switch (A) {
|
||||||
switch(A)
|
|
||||||
{
|
|
||||||
case 0x8000: is2kbank = 1;
|
case 0x8000: is2kbank = 1;
|
||||||
case 0xB000: // Dragon Ball Z Party [p1] BMC
|
case 0xB000: // Dragon Ball Z Party [p1] BMC
|
||||||
case 0xB0FF: // Dragon Ball Z Party [p1] BMC
|
case 0xB0FF: // Dragon Ball Z Party [p1] BMC
|
||||||
|
@ -147,23 +138,19 @@ static DECLFW(M83Write)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(UNLYOKOReadDip)
|
static DECLFR(UNLYOKOReadDip) {
|
||||||
{
|
|
||||||
return (X.DB & 0xFC) | dip;
|
return (X.DB & 0xFC) | dip;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(UNLYOKOReadLow)
|
static DECLFR(UNLYOKOReadLow) {
|
||||||
{
|
|
||||||
return low[A & 3];
|
return low[A & 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFW(UNLYOKOWriteLow)
|
static DECLFW(UNLYOKOWriteLow) {
|
||||||
{
|
|
||||||
low[A & 3] = V;
|
low[A & 3] = V;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLYOKOPower(void)
|
static void UNLYOKOPower(void) {
|
||||||
{
|
|
||||||
mode = bank = 0;
|
mode = bank = 0;
|
||||||
dip = 3;
|
dip = 3;
|
||||||
UNLYOKOSync();
|
UNLYOKOSync();
|
||||||
|
@ -174,8 +161,7 @@ static void UNLYOKOPower(void)
|
||||||
SetWriteHandler(0x8000, 0xFFFF, UNLYOKOWrite);
|
SetWriteHandler(0x8000, 0xFFFF, UNLYOKOWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M83Power(void)
|
static void M83Power(void) {
|
||||||
{
|
|
||||||
is2kbank = 0;
|
is2kbank = 0;
|
||||||
isnot2kbank = 0;
|
isnot2kbank = 0;
|
||||||
mode = bank = 0;
|
mode = bank = 0;
|
||||||
|
@ -190,33 +176,27 @@ static void M83Power(void)
|
||||||
SetWriteHandler(0x8000, 0xffff, M83Write);
|
SetWriteHandler(0x8000, 0xffff, M83Write);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLYOKOReset(void)
|
static void UNLYOKOReset(void) {
|
||||||
{
|
|
||||||
dip = (dip + 1) & 3;
|
dip = (dip + 1) & 3;
|
||||||
mode = bank = 0;
|
mode = bank = 0;
|
||||||
UNLYOKOSync();
|
UNLYOKOSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M83Reset(void)
|
static void M83Reset(void) {
|
||||||
{
|
|
||||||
dip ^= 1;
|
dip ^= 1;
|
||||||
M83Sync();
|
M83Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M83Close(void)
|
static void M83Close(void) {
|
||||||
{
|
|
||||||
if (WRAM)
|
if (WRAM)
|
||||||
FCEU_gfree(WRAM);
|
FCEU_gfree(WRAM);
|
||||||
WRAM = NULL;
|
WRAM = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLYOKOIRQHook(int a)
|
static void UNLYOKOIRQHook(int a) {
|
||||||
{
|
if (IRQa) {
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount -= a;
|
IRQCount -= a;
|
||||||
if(IRQCount<0)
|
if (IRQCount < 0) {
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
IRQa = 0;
|
IRQa = 0;
|
||||||
IRQCount = 0xFFFF;
|
IRQCount = 0xFFFF;
|
||||||
|
@ -224,18 +204,15 @@ static void UNLYOKOIRQHook(int a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNLYOKOStateRestore(int version)
|
static void UNLYOKOStateRestore(int version) {
|
||||||
{
|
|
||||||
UNLYOKOSync();
|
UNLYOKOSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M83StateRestore(int version)
|
static void M83StateRestore(int version) {
|
||||||
{
|
|
||||||
M83Sync();
|
M83Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UNLYOKO_Init(CartInfo *info)
|
void UNLYOKO_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = UNLYOKOPower;
|
info->Power = UNLYOKOPower;
|
||||||
info->Reset = UNLYOKOReset;
|
info->Reset = UNLYOKOReset;
|
||||||
MapIRQHook = UNLYOKOIRQHook;
|
MapIRQHook = UNLYOKOIRQHook;
|
||||||
|
@ -243,8 +220,7 @@ void UNLYOKO_Init(CartInfo *info)
|
||||||
AddExState(&StateRegs, ~0, 0, 0);
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mapper83_Init(CartInfo *info)
|
void Mapper83_Init(CartInfo *info) {
|
||||||
{
|
|
||||||
info->Power = M83Power;
|
info->Power = M83Power;
|
||||||
info->Reset = M83Reset;
|
info->Reset = M83Reset;
|
||||||
info->Close = M83Close;
|
info->Close = M83Close;
|
||||||
|
|
392
src/ines.cpp
392
src/ines.cpp
|
@ -68,7 +68,6 @@ static int CHRRAMSize = -1;
|
||||||
static void iNESPower(void);
|
static void iNESPower(void);
|
||||||
static int NewiNES_Init(int num);
|
static int NewiNES_Init(int num);
|
||||||
|
|
||||||
void (*MapClose)(void);
|
|
||||||
void (*MapperReset)(void);
|
void (*MapperReset)(void);
|
||||||
|
|
||||||
static int MapperNo = 0;
|
static int MapperNo = 0;
|
||||||
|
@ -77,28 +76,22 @@ static int MapperNo=0;
|
||||||
Mapperxxx_init is called when the NES has been powered on.
|
Mapperxxx_init is called when the NES has been powered on.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static DECLFR(TrainerRead) {
|
||||||
static DECLFR(TrainerRead)
|
|
||||||
{
|
|
||||||
return(trainerpoo[A & 0x1FF]);
|
return(trainerpoo[A & 0x1FF]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iNES_ExecPower()
|
static void iNES_ExecPower() {
|
||||||
{
|
|
||||||
if (CHRRAMSize != -1)
|
if (CHRRAMSize != -1)
|
||||||
FCEU_MemoryRand(VROM, CHRRAMSize);
|
FCEU_MemoryRand(VROM, CHRRAMSize);
|
||||||
|
|
||||||
if (iNESCart.Power)
|
if (iNESCart.Power)
|
||||||
iNESCart.Power();
|
iNESCart.Power();
|
||||||
|
|
||||||
if(trainerpoo)
|
if (trainerpoo) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
for(x=0;x<512;x++)
|
for (x = 0; x < 512; x++) {
|
||||||
{
|
|
||||||
X6502_DMW(0x7000 + x, trainerpoo[x]);
|
X6502_DMW(0x7000 + x, trainerpoo[x]);
|
||||||
if(X6502_DMR(0x7000+x)!=trainerpoo[x])
|
if (X6502_DMR(0x7000 + x) != trainerpoo[x]) {
|
||||||
{
|
|
||||||
SetReadHandler(0x7000, 0x71FF, TrainerRead);
|
SetReadHandler(0x7000, 0x71FF, TrainerRead);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -106,10 +99,8 @@ static void iNES_ExecPower()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void iNESGI(GI h) //bbit edited: removed static keyword
|
void iNESGI(GI h) { //bbit edited: removed static keyword
|
||||||
{
|
switch (h) {
|
||||||
switch(h)
|
|
||||||
{
|
|
||||||
case GI_RESETSAVE:
|
case GI_RESETSAVE:
|
||||||
FCEU_ClearGameSave(&iNESCart);
|
FCEU_ClearGameSave(&iNESCart);
|
||||||
break;
|
break;
|
||||||
|
@ -122,17 +113,21 @@ void iNESGI(GI h) //bbit edited: removed static keyword
|
||||||
break;
|
break;
|
||||||
case GI_POWER:
|
case GI_POWER:
|
||||||
iNES_ExecPower();
|
iNES_ExecPower();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GI_CLOSE:
|
case GI_CLOSE:
|
||||||
{
|
{
|
||||||
FCEU_SaveGameSave(&iNESCart);
|
FCEU_SaveGameSave(&iNESCart);
|
||||||
|
|
||||||
if (iNESCart.Close) iNESCart.Close();
|
if (iNESCart.Close) iNESCart.Close();
|
||||||
if(ROM) {free(ROM); ROM = NULL;}
|
if (ROM) {
|
||||||
if(VROM) {free(VROM); VROM = NULL;}
|
free(ROM); ROM = NULL;
|
||||||
if(MapClose) MapClose();
|
}
|
||||||
if(trainerpoo) {FCEU_gfree(trainerpoo);trainerpoo=0;}
|
if (VROM) {
|
||||||
|
free(VROM); VROM = NULL;
|
||||||
|
}
|
||||||
|
if (trainerpoo) {
|
||||||
|
FCEU_gfree(trainerpoo); trainerpoo = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,10 +147,10 @@ struct INPSEL {
|
||||||
ESIFC inputfc;
|
ESIFC inputfc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void SetInput(void)
|
static void SetInput(void) {
|
||||||
{
|
|
||||||
static struct INPSEL moo[] =
|
static struct INPSEL moo[] =
|
||||||
{
|
{
|
||||||
|
{0x19b0a9f1, SI_GAMEPAD, SI_ZAPPER, SIFC_NONE }, // 6-in-1 (MGC-023)(Unl)[!]
|
||||||
{0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Aerobics Studio
|
{0x29de87af, SI_GAMEPAD, SI_GAMEPAD, SIFC_FTRAINERB }, // Aerobics Studio
|
||||||
{0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid (J)
|
{0xd89e5a67, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid (J)
|
||||||
{0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid 2(J)
|
{0x0f141525, SI_UNSET, SI_UNSET, SIFC_ARKANOID }, // Arkanoid 2(J)
|
||||||
|
@ -226,10 +221,8 @@ static void SetInput(void)
|
||||||
};
|
};
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
while(moo[x].input1>=0 || moo[x].input2>=0 || moo[x].inputfc>=0)
|
while (moo[x].input1 >= 0 || moo[x].input2 >= 0 || moo[x].inputfc >= 0) {
|
||||||
{
|
if (moo[x].crc32 == iNESGameCRC32) {
|
||||||
if(moo[x].crc32==iNESGameCRC32)
|
|
||||||
{
|
|
||||||
GameInfo->input[0] = moo[x].input1;
|
GameInfo->input[0] = moo[x].input1;
|
||||||
GameInfo->input[1] = moo[x].input2;
|
GameInfo->input[1] = moo[x].input2;
|
||||||
GameInfo->inputfc = moo[x].inputfc;
|
GameInfo->inputfc = moo[x].inputfc;
|
||||||
|
@ -238,6 +231,7 @@ static void SetInput(void)
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INESB_INCOMPLETE 1
|
#define INESB_INCOMPLETE 1
|
||||||
#define INESB_CORRUPT 2
|
#define INESB_CORRUPT 2
|
||||||
#define INESB_HACKED 4
|
#define INESB_HACKED 4
|
||||||
|
@ -254,22 +248,18 @@ static struct BADINF BadROMImages[]=
|
||||||
#include "ines-bad.h"
|
#include "ines-bad.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
void CheckBad(uint64 md5partial)
|
void CheckBad(uint64 md5partial) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
//printf("0x%llx\n",md5partial);
|
//printf("0x%llx\n",md5partial);
|
||||||
while(BadROMImages[x].name)
|
while (BadROMImages[x].name) {
|
||||||
{
|
if (BadROMImages[x].md5partial == md5partial) {
|
||||||
if(BadROMImages[x].md5partial == md5partial)
|
|
||||||
{
|
|
||||||
FCEU_PrintError("The copy game you have loaded, \"%s\", is bad, and will not work properly in FCEUX.", BadROMImages[x].name);
|
FCEU_PrintError("The copy game you have loaded, \"%s\", is bad, and will not work properly in FCEUX.", BadROMImages[x].name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,17 +270,12 @@ struct CHINF {
|
||||||
const char* params;
|
const char* params;
|
||||||
};
|
};
|
||||||
|
|
||||||
void MapperInit()
|
void MapperInit() {
|
||||||
{
|
if (NewiNES_Init(MapperNo)) {
|
||||||
if(NewiNES_Init(MapperNo))
|
} else {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iNESCart.Power = iNESPower;
|
iNESCart.Power = iNESPower;
|
||||||
if(head.ROM_type&2)
|
SetupCartPRGMapping(1, WRAM, 8192, 1);
|
||||||
{
|
if (head.ROM_type & 2) {
|
||||||
iNESCart.SaveGame[0] = WRAM;
|
iNESCart.SaveGame[0] = WRAM;
|
||||||
iNESCart.SaveGameLen[0] = 8192;
|
iNESCart.SaveGameLen[0] = 8192;
|
||||||
}
|
}
|
||||||
|
@ -311,8 +296,7 @@ static const TMasterRomInfo sMasterRomInfo[] = {
|
||||||
const TMasterRomInfo* MasterRomInfo;
|
const TMasterRomInfo* MasterRomInfo;
|
||||||
TMasterRomInfoParams MasterRomInfoParams;
|
TMasterRomInfoParams MasterRomInfoParams;
|
||||||
|
|
||||||
static void CheckHInfo(void)
|
static void CheckHInfo(void) {
|
||||||
{
|
|
||||||
/* ROM images that have the battery-backed bit set in the header that really
|
/* ROM images that have the battery-backed bit set in the header that really
|
||||||
don't have battery-backed RAM is not that big of a problem, so I'll
|
don't have battery-backed RAM is not that big of a problem, so I'll
|
||||||
treat this differently by only listing games that should have battery-backed RAM.
|
treat this differently by only listing games that should have battery-backed RAM.
|
||||||
|
@ -365,16 +349,14 @@ static void CheckHInfo(void)
|
||||||
int x;
|
int x;
|
||||||
uint64 partialmd5 = 0;
|
uint64 partialmd5 = 0;
|
||||||
|
|
||||||
for(x=0;x<8;x++)
|
for (x = 0; x < 8; x++) {
|
||||||
{
|
|
||||||
partialmd5 |= (uint64)iNESCart.MD5[15 - x] << (x * 8);
|
partialmd5 |= (uint64)iNESCart.MD5[15 - x] << (x * 8);
|
||||||
//printf("%16llx\n",partialmd5);
|
//printf("%16llx\n",partialmd5);
|
||||||
}
|
}
|
||||||
CheckBad(partialmd5);
|
CheckBad(partialmd5);
|
||||||
|
|
||||||
MasterRomInfo = NULL;
|
MasterRomInfo = NULL;
|
||||||
for(int i=0;i<ARRAY_SIZE(sMasterRomInfo);i++)
|
for (int i = 0; i < ARRAY_SIZE(sMasterRomInfo); i++) {
|
||||||
{
|
|
||||||
const TMasterRomInfo& info = sMasterRomInfo[i];
|
const TMasterRomInfo& info = sMasterRomInfo[i];
|
||||||
if (info.md5lower != partialmd5)
|
if (info.md5lower != partialmd5)
|
||||||
continue;
|
continue;
|
||||||
|
@ -383,8 +365,7 @@ static void CheckHInfo(void)
|
||||||
if (!info.params) break;
|
if (!info.params) break;
|
||||||
|
|
||||||
std::vector<std::string> toks = tokenize_str(info.params, ",");
|
std::vector<std::string> toks = tokenize_str(info.params, ",");
|
||||||
for(int j=0;j<(int)toks.size();j++)
|
for (int j = 0; j < (int)toks.size(); j++) {
|
||||||
{
|
|
||||||
std::vector<std::string> parts = tokenize_str(toks[j], "=");
|
std::vector<std::string> parts = tokenize_str(toks[j], "=");
|
||||||
MasterRomInfoParams[parts[0]] = parts[1];
|
MasterRomInfoParams[parts[0]] = parts[1];
|
||||||
}
|
}
|
||||||
|
@ -393,37 +374,27 @@ static void CheckHInfo(void)
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (moo[x].crc32 == iNESGameCRC32) {
|
||||||
if(moo[x].crc32==iNESGameCRC32)
|
if (moo[x].mapper >= 0) {
|
||||||
{
|
if (moo[x].mapper & 0x800 && VROM_size) {
|
||||||
if(moo[x].mapper>=0)
|
|
||||||
{
|
|
||||||
if(moo[x].mapper&0x800 && VROM_size)
|
|
||||||
{
|
|
||||||
VROM_size = 0;
|
VROM_size = 0;
|
||||||
free(VROM);
|
free(VROM);
|
||||||
VROM = NULL;
|
VROM = NULL;
|
||||||
tofix |= 8;
|
tofix |= 8;
|
||||||
}
|
}
|
||||||
if(MapperNo!=(moo[x].mapper&0xFF))
|
if (MapperNo != (moo[x].mapper & 0xFF)) {
|
||||||
{
|
|
||||||
tofix |= 1;
|
tofix |= 1;
|
||||||
MapperNo = moo[x].mapper & 0xFF;
|
MapperNo = moo[x].mapper & 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(moo[x].mirror>=0)
|
if (moo[x].mirror >= 0) {
|
||||||
{
|
if (moo[x].mirror == 8) {
|
||||||
if(moo[x].mirror==8)
|
if (Mirroring == 2) { /* Anything but hard-wired(four screen). */
|
||||||
{
|
|
||||||
if(Mirroring==2) /* Anything but hard-wired(four screen). */
|
|
||||||
{
|
|
||||||
tofix |= 2;
|
tofix |= 2;
|
||||||
Mirroring = 0;
|
Mirroring = 0;
|
||||||
}
|
}
|
||||||
}
|
} else if (Mirroring != moo[x].mirror) {
|
||||||
else if(Mirroring!=moo[x].mirror)
|
|
||||||
{
|
|
||||||
if (Mirroring != (moo[x].mirror & ~4))
|
if (Mirroring != (moo[x].mirror & ~4))
|
||||||
if ((moo[x].mirror & ~4) <= 2) /* Don't complain if one-screen mirroring
|
if ((moo[x].mirror & ~4) <= 2) /* Don't complain if one-screen mirroring
|
||||||
needs to be set(the iNES header can't
|
needs to be set(the iNES header can't
|
||||||
|
@ -439,12 +410,9 @@ static void CheckHInfo(void)
|
||||||
} while (moo[x].mirror >= 0 || moo[x].mapper >= 0);
|
} while (moo[x].mirror >= 0 || moo[x].mapper >= 0);
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
while(savie[x] != 0)
|
while (savie[x] != 0) {
|
||||||
{
|
if (savie[x] == partialmd5) {
|
||||||
if(savie[x] == partialmd5)
|
if (!(head.ROM_type & 2)) {
|
||||||
{
|
|
||||||
if(!(head.ROM_type&2))
|
|
||||||
{
|
|
||||||
tofix |= 4;
|
tofix |= 4;
|
||||||
head.ROM_type |= 2;
|
head.ROM_type |= 2;
|
||||||
}
|
}
|
||||||
|
@ -455,8 +423,7 @@ static void CheckHInfo(void)
|
||||||
/* Games that use these iNES mappers tend to have the four-screen bit set
|
/* Games that use these iNES mappers tend to have the four-screen bit set
|
||||||
when it should not be.
|
when it should not be.
|
||||||
*/
|
*/
|
||||||
if((MapperNo==118 || MapperNo==24 || MapperNo==26) && (Mirroring==2))
|
if ((MapperNo == 118 || MapperNo == 24 || MapperNo == 26) && (Mirroring == 2)) {
|
||||||
{
|
|
||||||
Mirroring = 0;
|
Mirroring = 0;
|
||||||
tofix |= 2;
|
tofix |= 2;
|
||||||
}
|
}
|
||||||
|
@ -465,14 +432,12 @@ static void CheckHInfo(void)
|
||||||
if (MapperNo == 99)
|
if (MapperNo == 99)
|
||||||
Mirroring = 2;
|
Mirroring = 2;
|
||||||
|
|
||||||
if(tofix)
|
if (tofix) {
|
||||||
{
|
|
||||||
char gigastr[768];
|
char gigastr[768];
|
||||||
strcpy(gigastr, "The iNES header contains incorrect information. For now, the information will be corrected in RAM. ");
|
strcpy(gigastr, "The iNES header contains incorrect information. For now, the information will be corrected in RAM. ");
|
||||||
if (tofix & 1)
|
if (tofix & 1)
|
||||||
sprintf(gigastr + strlen(gigastr), "The mapper number should be set to %d. ", MapperNo);
|
sprintf(gigastr + strlen(gigastr), "The mapper number should be set to %d. ", MapperNo);
|
||||||
if(tofix&2)
|
if (tofix & 2) {
|
||||||
{
|
|
||||||
char *mstr[3] = { "Horizontal", "Vertical", "Four-screen" };
|
char *mstr[3] = { "Horizontal", "Vertical", "Four-screen" };
|
||||||
sprintf(gigastr + strlen(gigastr), "Mirroring should be set to \"%s\". ", mstr[Mirroring & 3]);
|
sprintf(gigastr + strlen(gigastr), "Mirroring should be set to \"%s\". ", mstr[Mirroring & 3]);
|
||||||
}
|
}
|
||||||
|
@ -513,11 +478,11 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"CNROM", 3, CNROM_Init},
|
{"CNROM", 3, CNROM_Init},
|
||||||
{"MMC3", 4, Mapper4_Init},
|
{"MMC3", 4, Mapper4_Init},
|
||||||
{"MMC5", 5, Mapper5_Init},
|
{"MMC5", 5, Mapper5_Init},
|
||||||
// {"", 6, Mapper6_Init},
|
{"FFE", 6, Mapper6_Init},
|
||||||
{"ANROM", 7, ANROM_Init},
|
{"ANROM", 7, ANROM_Init},
|
||||||
{"", 8, Mapper8_Init}, // Nogaems, it's worthless
|
{"", 8, Mapper8_Init}, // Nogaems, it's worthless
|
||||||
// {"", 9, Mapper9_Init},
|
{"MMC2", 9, Mapper9_Init},
|
||||||
// {"", 10, Mapper10_Init},
|
{"MMC4", 10, Mapper10_Init},
|
||||||
{"Color Dreams", 11, Mapper11_Init},
|
{"Color Dreams", 11, Mapper11_Init},
|
||||||
{"", 12, Mapper12_Init},
|
{"", 12, Mapper12_Init},
|
||||||
{"CPROM", 13, CPROM_Init},
|
{"CPROM", 13, CPROM_Init},
|
||||||
|
@ -528,12 +493,12 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 18, Mapper18_Init},
|
{"", 18, Mapper18_Init},
|
||||||
{"Namcot 106", 19, Mapper19_Init},
|
{"Namcot 106", 19, Mapper19_Init},
|
||||||
// {"", 20, Mapper20_Init},
|
// {"", 20, Mapper20_Init},
|
||||||
{"Konami VRC2/VRC4", 21, Mapper21_Init},
|
{"Konami VRC2/VRC4 A", 21, Mapper21_Init},
|
||||||
{"Konami VRC2/VRC4", 22, Mapper22_Init},
|
{"Konami VRC2/VRC4 B", 22, Mapper22_Init},
|
||||||
{"Konami VRC2/VRC4", 23, Mapper23_Init},
|
{"Konami VRC2/VRC4 C", 23, Mapper23_Init},
|
||||||
// {"", 24, Mapper24_Init},
|
{"Konami VRC6 Rev. A", 24, Mapper24_Init},
|
||||||
{"Konami VRC2/VRC4", 25, Mapper25_Init},
|
{"Konami VRC2/VRC4 D", 25, Mapper25_Init},
|
||||||
// {"", 26, Mapper26_Init},
|
{"Konami VRC6 Rev. B", 26, Mapper26_Init},
|
||||||
// {"", 27, Mapper27_Init}, // Deprecated, dupe for VRC2/VRC4 mapper
|
// {"", 27, Mapper27_Init}, // Deprecated, dupe for VRC2/VRC4 mapper
|
||||||
// {"", 28, Mapper28_Init},
|
// {"", 28, Mapper28_Init},
|
||||||
// {"", 29, Mapper29_Init},
|
// {"", 29, Mapper29_Init},
|
||||||
|
@ -571,17 +536,17 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"20-in-1 KAISER REV A", 61, Mapper61_Init},
|
{"20-in-1 KAISER REV A", 61, Mapper61_Init},
|
||||||
{"700-in-1", 62, Mapper62_Init},
|
{"700-in-1", 62, Mapper62_Init},
|
||||||
// {"", 63, Mapper63_Init},
|
// {"", 63, Mapper63_Init},
|
||||||
// {"", 64, Mapper64_Init},
|
{"TENGEN RAMBO1", 64, Mapper64_Init},
|
||||||
// {"", 65, Mapper65_Init},
|
{"IREM-H3001", 65, Mapper65_Init},
|
||||||
{"MHOM", 66, MHROM_Init},
|
{"MHOM", 66, MHROM_Init},
|
||||||
// {"", 67, Mapper67_Init},
|
{"SUNSOFT-FZII", 67, Mapper67_Init},
|
||||||
{"Sunsoft Mapper #4", 68, Mapper68_Init},
|
{"Sunsoft Mapper #4", 68, Mapper68_Init},
|
||||||
// {"", 69, Mapper69_Init},
|
{"SUNSOFT-5/FME-7", 69, Mapper69_Init},
|
||||||
{"", 70, Mapper70_Init},
|
{"BA KAMEN DISCRETE", 70, Mapper70_Init},
|
||||||
{"CAMERICA BF9093", 71, Mapper71_Init},
|
{"CAMERICA BF9093", 71, Mapper71_Init},
|
||||||
{"JALECO JF-17", 72, Mapper72_Init},
|
{"JALECO JF-17", 72, Mapper72_Init},
|
||||||
{"KONAMI VRC3", 73, Mapper73_Init},
|
{"KONAMI VRC3", 73, Mapper73_Init},
|
||||||
{"", 74, Mapper74_Init},
|
{"TW MMC3+VRAM VER. A", 74, Mapper74_Init},
|
||||||
{"KONAMI VRC1", 75, Mapper75_Init},
|
{"KONAMI VRC1", 75, Mapper75_Init},
|
||||||
{"NAMCOT 108 VER. A", 76, Mapper76_Init},
|
{"NAMCOT 108 VER. A", 76, Mapper76_Init},
|
||||||
{"IREM LROG017", 77, Mapper77_Init},
|
{"IREM LROG017", 77, Mapper77_Init},
|
||||||
|
@ -592,15 +557,15 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 82, Mapper82_Init},
|
{"", 82, Mapper82_Init},
|
||||||
{"", 83, Mapper83_Init},
|
{"", 83, Mapper83_Init},
|
||||||
// {"", 84, Mapper84_Init},
|
// {"", 84, Mapper84_Init},
|
||||||
// {"", 85, Mapper85_Init},
|
{"KONAMI VRC7", 85, Mapper85_Init},
|
||||||
{"", 86, Mapper86_Init},
|
{"", 86, Mapper86_Init},
|
||||||
{"", 87, Mapper87_Init},
|
{"", 87, Mapper87_Init},
|
||||||
{"", 88, Mapper88_Init},
|
{"", 88, Mapper88_Init},
|
||||||
{"", 89, Mapper89_Init},
|
{"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper
|
||||||
{"", 90, Mapper90_Init},
|
{"", 90, Mapper90_Init},
|
||||||
{"", 91, Mapper91_Init},
|
{"", 91, Mapper91_Init},
|
||||||
{"", 92, Mapper92_Init},
|
{"", 92, Mapper92_Init},
|
||||||
{"Sunsoft UNROM", 93, SUNSOFT_UNROM_Init},
|
{"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init}, // SUNSOFT-2 mapper with VRAM, different wiring
|
||||||
{"", 94, Mapper94_Init},
|
{"", 94, Mapper94_Init},
|
||||||
{"NAMCOT 108 VER. B", 95, Mapper95_Init},
|
{"NAMCOT 108 VER. B", 95, Mapper95_Init},
|
||||||
{"", 96, Mapper96_Init},
|
{"", 96, Mapper96_Init},
|
||||||
|
@ -673,8 +638,8 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 163, Mapper163_Init},
|
{"", 163, Mapper163_Init},
|
||||||
{"", 164, Mapper164_Init},
|
{"", 164, Mapper164_Init},
|
||||||
{"", 165, Mapper165_Init},
|
{"", 165, Mapper165_Init},
|
||||||
// {"", 166, Mapper166_Init},
|
{"SUBOR Rev. A", 166, Mapper166_Init},
|
||||||
// {"", 167, Mapper167_Init},
|
{"SUBOR Rev. B", 167, Mapper167_Init},
|
||||||
{"", 168, Mapper168_Init},
|
{"", 168, Mapper168_Init},
|
||||||
// {"", 169, Mapper169_Init},
|
// {"", 169, Mapper169_Init},
|
||||||
{"", 170, Mapper170_Init},
|
{"", 170, Mapper170_Init},
|
||||||
|
@ -699,10 +664,10 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 189, Mapper189_Init},
|
{"", 189, Mapper189_Init},
|
||||||
// {"", 190, Mapper190_Init},
|
// {"", 190, Mapper190_Init},
|
||||||
{"", 191, Mapper191_Init},
|
{"", 191, Mapper191_Init},
|
||||||
{"", 192, Mapper192_Init},
|
{"TW MMC3+VRAM VER. B", 192, Mapper192_Init},
|
||||||
{"", 193, Mapper193_Init},
|
{"NTDEC TC-112", 193, Mapper193_Init}, // War in the Gulf
|
||||||
{"", 194, Mapper194_Init},
|
{"TW MMC3+VRAM VER. C", 194, Mapper194_Init},
|
||||||
{"", 195, Mapper195_Init},
|
{"TW MMC3+VRAM VER. D", 195, Mapper195_Init},
|
||||||
{"", 196, Mapper196_Init},
|
{"", 196, Mapper196_Init},
|
||||||
{"", 197, Mapper197_Init},
|
{"", 197, Mapper197_Init},
|
||||||
{"", 198, Mapper198_Init},
|
{"", 198, Mapper198_Init},
|
||||||
|
@ -737,7 +702,7 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 227, Mapper227_Init},
|
{"", 227, Mapper227_Init},
|
||||||
{"", 228, Mapper228_Init},
|
{"", 228, Mapper228_Init},
|
||||||
{"", 229, Mapper229_Init},
|
{"", 229, Mapper229_Init},
|
||||||
{"BMC 22-in-1+Contra", 230, Mapper230_Init},
|
{"BMC Contra+22-in-1", 230, Mapper230_Init},
|
||||||
{"", 231, Mapper231_Init},
|
{"", 231, Mapper231_Init},
|
||||||
{"BMC QUATTRO", 232, Mapper232_Init},
|
{"BMC QUATTRO", 232, Mapper232_Init},
|
||||||
{"BMC 22+20-in-1 RST", 233, Mapper233_Init},
|
{"BMC 22+20-in-1 RST", 233, Mapper233_Init},
|
||||||
|
@ -766,9 +731,7 @@ static BMAPPINGLocal bmap[] = {
|
||||||
{"", 0, NULL}
|
{"", 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
|
||||||
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
|
||||||
{
|
|
||||||
struct md5_context md5;
|
struct md5_context md5;
|
||||||
|
|
||||||
if (FCEU_fread(&head, 1, 16, fp) != 16)
|
if (FCEU_fread(&head, 1, 16, fp) != 16)
|
||||||
|
@ -785,48 +748,33 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
MapperNo |= (head.ROM_type2 & 0xF0);
|
MapperNo |= (head.ROM_type2 & 0xF0);
|
||||||
Mirroring = (head.ROM_type & 1);
|
Mirroring = (head.ROM_type & 1);
|
||||||
|
|
||||||
|
|
||||||
// int ROM_size=0;
|
|
||||||
if (!head.ROM_size)
|
if (!head.ROM_size)
|
||||||
{
|
|
||||||
// FCEU_PrintError("No PRG ROM!");
|
|
||||||
// return(0);
|
|
||||||
ROM_size = 256;
|
ROM_size = 256;
|
||||||
//head.ROM_size++;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
ROM_size = uppow2(head.ROM_size);
|
ROM_size = uppow2(head.ROM_size);
|
||||||
|
|
||||||
// ROM_size = head.ROM_size;
|
VROM_size = uppow2(head.VROM_size);
|
||||||
VROM_size = head.VROM_size;
|
|
||||||
|
|
||||||
int round = true;
|
int round = true;
|
||||||
for (int i = 0; i != sizeof(not_power2)/sizeof(not_power2[0]); ++i)
|
for (int i = 0; i != sizeof(not_power2) / sizeof(not_power2[0]); ++i) {
|
||||||
{
|
|
||||||
//for games not to the power of 2, so we just read enough
|
//for games not to the power of 2, so we just read enough
|
||||||
//prg rom from it, but we have to keep ROM_size to the power of 2
|
//prg rom from it, but we have to keep ROM_size to the power of 2
|
||||||
//since PRGCartMapping wants ROM_size to be to the power of 2
|
//since PRGCartMapping wants ROM_size to be to the power of 2
|
||||||
//so instead if not to power of 2, we just use head.ROM_size when
|
//so instead if not to power of 2, we just use head.ROM_size when
|
||||||
//we use FCEU_read
|
//we use FCEU_read
|
||||||
if (not_power2[i] == MapperNo)
|
if (not_power2[i] == MapperNo) {
|
||||||
{
|
|
||||||
round = false;
|
round = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(VROM_size)
|
|
||||||
VROM_size=uppow2(VROM_size);
|
|
||||||
|
|
||||||
|
|
||||||
if (head.ROM_type & 8) Mirroring = 2;
|
if (head.ROM_type & 8) Mirroring = 2;
|
||||||
|
|
||||||
if((ROM = (uint8 *)FCEU_malloc(ROM_size<<14)) == NULL) return 0;
|
if ((ROM = (uint8*)FCEU_malloc(ROM_size << 14)) == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if(VROM_size)
|
if (VROM_size) {
|
||||||
{
|
if ((VROM = (uint8*)FCEU_malloc(VROM_size << 13)) == NULL) {
|
||||||
if((VROM = (uint8 *)FCEU_malloc(VROM_size<<13)) == NULL)
|
|
||||||
{
|
|
||||||
free(ROM);
|
free(ROM);
|
||||||
ROM = NULL;
|
ROM = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -834,8 +782,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
}
|
}
|
||||||
memset(ROM, 0xFF, ROM_size << 14);
|
memset(ROM, 0xFF, ROM_size << 14);
|
||||||
if (VROM_size) memset(VROM, 0xFF, VROM_size << 13);
|
if (VROM_size) memset(VROM, 0xFF, VROM_size << 13);
|
||||||
if(head.ROM_type&4) /* Trainer */
|
if (head.ROM_type & 4) { /* Trainer */
|
||||||
{
|
|
||||||
trainerpoo = (uint8*)FCEU_gmalloc(512);
|
trainerpoo = (uint8*)FCEU_gmalloc(512);
|
||||||
FCEU_fread(trainerpoo, 512, 1, fp);
|
FCEU_fread(trainerpoo, 512, 1, fp);
|
||||||
}
|
}
|
||||||
|
@ -844,7 +791,6 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
ResetExState(0, 0);
|
ResetExState(0, 0);
|
||||||
|
|
||||||
SetupCartPRGMapping(0, ROM, ROM_size * 0x4000, 0);
|
SetupCartPRGMapping(0, ROM, ROM_size * 0x4000, 0);
|
||||||
// SetupCartPRGMapping(1,WRAM,8192,1);
|
|
||||||
|
|
||||||
FCEU_fread(ROM, 0x4000, (round) ? ROM_size : head.ROM_size, fp);
|
FCEU_fread(ROM, 0x4000, (round) ? ROM_size : head.ROM_size, fp);
|
||||||
|
|
||||||
|
@ -856,8 +802,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
|
|
||||||
iNESGameCRC32 = CalcCRC32(0, ROM, ROM_size << 14);
|
iNESGameCRC32 = CalcCRC32(0, ROM, ROM_size << 14);
|
||||||
|
|
||||||
if(VROM_size)
|
if (VROM_size) {
|
||||||
{
|
|
||||||
iNESGameCRC32 = CalcCRC32(iNESGameCRC32, VROM, VROM_size << 13);
|
iNESGameCRC32 = CalcCRC32(iNESGameCRC32, VROM, VROM_size << 13);
|
||||||
md5_update(&md5, VROM, VROM_size << 13);
|
md5_update(&md5, VROM, VROM_size << 13);
|
||||||
}
|
}
|
||||||
|
@ -866,9 +811,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
|
|
||||||
iNESCart.CRC32 = iNESGameCRC32;
|
iNESCart.CRC32 = iNESGameCRC32;
|
||||||
|
|
||||||
FCEU_printf(" PRG ROM: %3d x 16KiB\n CHR ROM: %3d x 8KiB\n ROM CRC32: 0x%08lx\n",
|
FCEU_printf(" PRG ROM: %3d x 16KiB\n", (round) ? ROM_size: head.ROM_size);
|
||||||
(round) ? ROM_size : head.ROM_size, head.VROM_size,iNESGameCRC32);
|
FCEU_printf(" CHR ROM: %3d x 8KiB\n", head.VROM_size);
|
||||||
|
FCEU_printf(" ROM CRC32: 0x%08lx\n", iNESGameCRC32);
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
FCEU_printf(" ROM MD5: 0x");
|
FCEU_printf(" ROM MD5: 0x");
|
||||||
|
@ -879,20 +824,18 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
|
|
||||||
char* mappername = "Not Listed";
|
char* mappername = "Not Listed";
|
||||||
|
|
||||||
for(int mappertest=0;mappertest< (sizeof bmap / sizeof bmap[0]) - 1;mappertest++)
|
for (int mappertest = 0; mappertest < (sizeof bmap / sizeof bmap[0]) - 1; mappertest++) {
|
||||||
{
|
|
||||||
if (bmap[mappertest].number == MapperNo) {
|
if (bmap[mappertest].number == MapperNo) {
|
||||||
mappername = bmap[mappertest].name;
|
mappername = bmap[mappertest].name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FCEU_printf(" Mapper #: %d\n Mapper name: %s\n Mirroring: %s\n",
|
FCEU_printf(" Mapper #: %d\n", MapperNo);
|
||||||
MapperNo, mappername, Mirroring==2?"None (Four-screen)":Mirroring?"Vertical":"Horizontal");
|
FCEU_printf(" Mapper name: %s\n", mappername);
|
||||||
|
FCEU_printf(" Mirroring: %s\n", Mirroring == 2 ? "None (Four-screen)" : Mirroring ? "Vertical" : "Horizontal");
|
||||||
FCEU_printf(" Battery-backed: %s\n", (head.ROM_type & 2) ? "Yes" : "No");
|
FCEU_printf(" Battery-backed: %s\n", (head.ROM_type & 2) ? "Yes" : "No");
|
||||||
FCEU_printf(" Trained: %s\n", (head.ROM_type & 4) ? "Yes" : "No");
|
FCEU_printf(" Trained: %s\n", (head.ROM_type & 4) ? "Yes" : "No");
|
||||||
// (head.ROM_type&8) = Mirroring: None(Four-screen)
|
|
||||||
|
|
||||||
SetInput();
|
SetInput();
|
||||||
CheckHInfo();
|
CheckHInfo();
|
||||||
|
@ -900,8 +843,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
int x;
|
int x;
|
||||||
uint64 partialmd5 = 0;
|
uint64 partialmd5 = 0;
|
||||||
|
|
||||||
for(x=0;x<8;x++)
|
for (x = 0; x < 8; x++) {
|
||||||
{
|
|
||||||
partialmd5 |= (uint64)iNESCart.MD5[7 - x] << (x * 8);
|
partialmd5 |= (uint64)iNESCart.MD5[7 - x] << (x * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,13 +865,6 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
iNESCart.battery = (head.ROM_type & 2) ? 1 : 0;
|
iNESCart.battery = (head.ROM_type & 2) ? 1 : 0;
|
||||||
iNESCart.mirror = Mirroring;
|
iNESCart.mirror = Mirroring;
|
||||||
|
|
||||||
// if(MapperNo != 18) {
|
|
||||||
// if(ROM) free(ROM);
|
|
||||||
// if(VROM) free(VROM);
|
|
||||||
// ROM=VROM=0;
|
|
||||||
// return(0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
GameInfo->mappernum = MapperNo;
|
GameInfo->mappernum = MapperNo;
|
||||||
MapperInit();
|
MapperInit();
|
||||||
|
@ -950,8 +885,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
// since apparently the iNES format doesn't store this information,
|
// since apparently the iNES format doesn't store this information,
|
||||||
// guess if the settings should be PAL or NTSC from the ROM name
|
// guess if the settings should be PAL or NTSC from the ROM name
|
||||||
// TODO: MD5 check against a list of all known PAL games instead?
|
// TODO: MD5 check against a list of all known PAL games instead?
|
||||||
if(OverwriteVidMode)
|
if (OverwriteVidMode) {
|
||||||
{
|
|
||||||
if (strstr(name, "(E)") || strstr(name, "(e)")
|
if (strstr(name, "(E)") || strstr(name, "(e)")
|
||||||
|| strstr(name, "(Europe)") || strstr(name, "(PAL)")
|
|| strstr(name, "(Europe)") || strstr(name, "(PAL)")
|
||||||
|| strstr(name, "(F)") || strstr(name, "(f)")
|
|| strstr(name, "(F)") || strstr(name, "(f)")
|
||||||
|
@ -964,7 +898,6 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// bbit edited: the whole function below was added
|
// bbit edited: the whole function below was added
|
||||||
int iNesSave() {
|
int iNesSave() {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -980,14 +913,12 @@ int iNesSave(){
|
||||||
|
|
||||||
fp = fopen(name, "wb");
|
fp = fopen(name, "wb");
|
||||||
|
|
||||||
if(fwrite(&head,1,16,fp)!=16)
|
if (fwrite(&head, 1, 16, fp) != 16) {
|
||||||
{
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(head.ROM_type&4) /* Trainer */
|
if (head.ROM_type & 4) { /* Trainer */
|
||||||
{
|
|
||||||
fwrite(trainerpoo, 512, 1, fp);
|
fwrite(trainerpoo, 512, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,8 +930,7 @@ int iNesSave(){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iNesSaveAs(char* name)
|
int iNesSaveAs(char* name) {
|
||||||
{
|
|
||||||
//adelikat: TODO: iNesSave() and this have pretty much the same code, outsource the common code to a single function
|
//adelikat: TODO: iNesSave() and this have pretty much the same code, outsource the common code to a single function
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
@ -1009,14 +939,12 @@ int iNesSaveAs(char* name)
|
||||||
|
|
||||||
fp = fopen(name, "wb");
|
fp = fopen(name, "wb");
|
||||||
|
|
||||||
if(fwrite(&head,1,16,fp)!=16)
|
if (fwrite(&head, 1, 16, fp) != 16) {
|
||||||
{
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(head.ROM_type&4) /* Trainer */
|
if (head.ROM_type & 4) { /* Trainer */
|
||||||
{
|
|
||||||
fwrite(trainerpoo, 512, 1, fp);
|
fwrite(trainerpoo, 512, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,16 +966,14 @@ char *iNesShortFName() {
|
||||||
return ret + 1;
|
return ret + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRAM_BANK1(uint32 A, uint8 V)
|
void VRAM_BANK1(uint32 A, uint8 V) {
|
||||||
{
|
|
||||||
V &= 7;
|
V &= 7;
|
||||||
PPUCHRRAM |= (1 << (A >> 10));
|
PPUCHRRAM |= (1 << (A >> 10));
|
||||||
CHRBankList[(A) >> 10] = V;
|
CHRBankList[(A) >> 10] = V;
|
||||||
VPage[(A) >> 10] = &CHRRAM[V << 10] - (A);
|
VPage[(A) >> 10] = &CHRRAM[V << 10] - (A);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRAM_BANK4(uint32 A, uint32 V)
|
void VRAM_BANK4(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
V &= 1;
|
V &= 1;
|
||||||
PPUCHRRAM |= (0xF << (A >> 10));
|
PPUCHRRAM |= (0xF << (A >> 10));
|
||||||
CHRBankList[(A) >> 10] = (V << 2);
|
CHRBankList[(A) >> 10] = (V << 2);
|
||||||
|
@ -1056,21 +982,18 @@ void VRAM_BANK4(uint32 A, uint32 V)
|
||||||
CHRBankList[((A) >> 10) + 3] = (V << 2) + 3;
|
CHRBankList[((A) >> 10) + 3] = (V << 2) + 3;
|
||||||
VPage[(A) >> 10] = &CHRRAM[V << 10] - (A);
|
VPage[(A) >> 10] = &CHRRAM[V << 10] - (A);
|
||||||
}
|
}
|
||||||
void VROM_BANK1(uint32 A,uint32 V)
|
void VROM_BANK1(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
setchr1(A, V);
|
setchr1(A, V);
|
||||||
CHRBankList[(A) >> 10] = V;
|
CHRBankList[(A) >> 10] = V;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VROM_BANK2(uint32 A,uint32 V)
|
void VROM_BANK2(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
setchr2(A, V);
|
setchr2(A, V);
|
||||||
CHRBankList[(A) >> 10] = (V << 1);
|
CHRBankList[(A) >> 10] = (V << 1);
|
||||||
CHRBankList[((A) >> 10) + 1] = (V << 1) + 1;
|
CHRBankList[((A) >> 10) + 1] = (V << 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VROM_BANK4(uint32 A, uint32 V)
|
void VROM_BANK4(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
setchr4(A, V);
|
setchr4(A, V);
|
||||||
CHRBankList[(A) >> 10] = (V << 2);
|
CHRBankList[(A) >> 10] = (V << 2);
|
||||||
CHRBankList[((A) >> 10) + 1] = (V << 2) + 1;
|
CHRBankList[((A) >> 10) + 1] = (V << 2) + 1;
|
||||||
|
@ -1078,8 +1001,7 @@ void VROM_BANK4(uint32 A, uint32 V)
|
||||||
CHRBankList[((A) >> 10) + 3] = (V << 2) + 3;
|
CHRBankList[((A) >> 10) + 3] = (V << 2) + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VROM_BANK8(uint32 V)
|
void VROM_BANK8(uint32 V) {
|
||||||
{
|
|
||||||
setchr8(V);
|
setchr8(V);
|
||||||
CHRBankList[0] = (V << 3);
|
CHRBankList[0] = (V << 3);
|
||||||
CHRBankList[1] = (V << 3) + 1;
|
CHRBankList[1] = (V << 3) + 1;
|
||||||
|
@ -1091,25 +1013,21 @@ void VROM_BANK8(uint32 V)
|
||||||
CHRBankList[7] = (V << 3) + 7;
|
CHRBankList[7] = (V << 3) + 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ROM_BANK8(uint32 A, uint32 V)
|
void ROM_BANK8(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
setprg8(A, V);
|
setprg8(A, V);
|
||||||
if (A >= 0x8000)
|
if (A >= 0x8000)
|
||||||
PRGBankList[((A - 0x8000) >> 13)] = V;
|
PRGBankList[((A - 0x8000) >> 13)] = V;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ROM_BANK16(uint32 A, uint32 V)
|
void ROM_BANK16(uint32 A, uint32 V) {
|
||||||
{
|
|
||||||
setprg16(A, V);
|
setprg16(A, V);
|
||||||
if(A>=0x8000)
|
if (A >= 0x8000) {
|
||||||
{
|
|
||||||
PRGBankList[((A - 0x8000) >> 13)] = V << 1;
|
PRGBankList[((A - 0x8000) >> 13)] = V << 1;
|
||||||
PRGBankList[((A - 0x8000) >> 13) + 1] = (V << 1) + 1;
|
PRGBankList[((A - 0x8000) >> 13) + 1] = (V << 1) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ROM_BANK32(uint32 V)
|
void ROM_BANK32(uint32 V) {
|
||||||
{
|
|
||||||
setprg32(0x8000, V);
|
setprg32(0x8000, V);
|
||||||
PRGBankList[0] = V << 2;
|
PRGBankList[0] = V << 2;
|
||||||
PRGBankList[1] = (V << 2) + 1;
|
PRGBankList[1] = (V << 2) + 1;
|
||||||
|
@ -1117,8 +1035,7 @@ void ROM_BANK32(uint32 V)
|
||||||
PRGBankList[3] = (V << 2) + 3;
|
PRGBankList[3] = (V << 2) + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onemir(uint8 V)
|
void onemir(uint8 V) {
|
||||||
{
|
|
||||||
if (Mirroring == 2) return;
|
if (Mirroring == 2) return;
|
||||||
if (V > 1)
|
if (V > 1)
|
||||||
V = 1;
|
V = 1;
|
||||||
|
@ -1126,23 +1043,20 @@ void onemir(uint8 V)
|
||||||
setmirror(MI_0 + V);
|
setmirror(MI_0 + V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIRROR_SET2(uint8 V)
|
void MIRROR_SET2(uint8 V) {
|
||||||
{
|
|
||||||
if (Mirroring == 2) return;
|
if (Mirroring == 2) return;
|
||||||
Mirroring = V;
|
Mirroring = V;
|
||||||
setmirror(V);
|
setmirror(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIRROR_SET(uint8 V)
|
void MIRROR_SET(uint8 V) {
|
||||||
{
|
|
||||||
if (Mirroring == 2) return;
|
if (Mirroring == 2) return;
|
||||||
V ^= 1;
|
V ^= 1;
|
||||||
Mirroring = V;
|
Mirroring = V;
|
||||||
setmirror(V);
|
setmirror(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NONE_init(void)
|
static void NONE_init(void) {
|
||||||
{
|
|
||||||
ROM_BANK16(0x8000, 0);
|
ROM_BANK16(0x8000, 0);
|
||||||
ROM_BANK16(0xC000, ~0);
|
ROM_BANK16(0xC000, ~0);
|
||||||
|
|
||||||
|
@ -1160,11 +1074,11 @@ void (*MapInitTab[256])(void)=
|
||||||
0, //Mapper3_init,
|
0, //Mapper3_init,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
Mapper6_init,
|
0, //Mapper6_init,
|
||||||
0, //Mapper7_init,
|
0, //Mapper7_init,
|
||||||
0, //Mapper8_init,
|
0, //Mapper8_init,
|
||||||
Mapper9_init,
|
0, //Mapper9_init,
|
||||||
Mapper10_init,
|
0, //Mapper10_init,
|
||||||
0, //Mapper11_init,
|
0, //Mapper11_init,
|
||||||
0,
|
0,
|
||||||
0, //Mapper13_init,
|
0, //Mapper13_init,
|
||||||
|
@ -1178,9 +1092,9 @@ void (*MapInitTab[256])(void)=
|
||||||
0, //Mapper21_init,
|
0, //Mapper21_init,
|
||||||
0, //Mapper22_init,
|
0, //Mapper22_init,
|
||||||
0, //Mapper23_init,
|
0, //Mapper23_init,
|
||||||
Mapper24_init,
|
0, //Mapper24_init,
|
||||||
0, //Mapper25_init,
|
0, //Mapper25_init,
|
||||||
Mapper26_init,
|
0, //Mapper26_init,
|
||||||
0, //Mapper27_init,
|
0, //Mapper27_init,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -1218,12 +1132,12 @@ void (*MapInitTab[256])(void)=
|
||||||
0, //Mapper61_init,
|
0, //Mapper61_init,
|
||||||
0, //Mapper62_init,
|
0, //Mapper62_init,
|
||||||
0,
|
0,
|
||||||
Mapper64_init,
|
0, //Mapper64_init,
|
||||||
Mapper65_init,
|
0, //Mapper65_init,
|
||||||
0, //Mapper66_init,
|
0, //Mapper66_init,
|
||||||
Mapper67_init,
|
0, //Mapper67_init,
|
||||||
0, //Mapper68_init,
|
0, //Mapper68_init,
|
||||||
Mapper69_init,
|
0, //Mapper69_init,
|
||||||
0, //Mapper70_init,
|
0, //Mapper70_init,
|
||||||
0, //Mapper71_init,
|
0, //Mapper71_init,
|
||||||
0, //Mapper72_init,
|
0, //Mapper72_init,
|
||||||
|
@ -1239,7 +1153,7 @@ void (*MapInitTab[256])(void)=
|
||||||
0, //Mapper82_init,
|
0, //Mapper82_init,
|
||||||
0, //Mapper83_init,
|
0, //Mapper83_init,
|
||||||
0,
|
0,
|
||||||
Mapper85_init,
|
0, //Mapper85_init,
|
||||||
0, //Mapper86_init,
|
0, //Mapper86_init,
|
||||||
0, //Mapper87_init,
|
0, //Mapper87_init,
|
||||||
0, //Mapper88_init,
|
0, //Mapper88_init,
|
||||||
|
@ -1320,8 +1234,8 @@ void (*MapInitTab[256])(void)=
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
Mapper166_init,
|
0, //Mapper166_init,
|
||||||
Mapper167_init,
|
0, //Mapper167_init,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -1412,20 +1326,17 @@ void (*MapInitTab[256])(void)=
|
||||||
0, //Mapper255_init
|
0, //Mapper255_init
|
||||||
};
|
};
|
||||||
|
|
||||||
static DECLFW(BWRAM)
|
static DECLFW(BWRAM) {
|
||||||
{
|
|
||||||
WRAM[A - 0x6000] = V;
|
WRAM[A - 0x6000] = V;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(AWRAM)
|
static DECLFR(AWRAM) {
|
||||||
{
|
|
||||||
return WRAM[A - 0x6000];
|
return WRAM[A - 0x6000];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void (*MapStateRestore)(int version);
|
void (*MapStateRestore)(int version);
|
||||||
void iNESStateRestore(int version)
|
void iNESStateRestore(int version) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
if (!MapperNo) return;
|
if (!MapperNo) return;
|
||||||
|
@ -1437,8 +1348,7 @@ void iNESStateRestore(int version)
|
||||||
for (x = 0; x < 8; x++)
|
for (x = 0; x < 8; x++)
|
||||||
setchr1(0x400 * x, CHRBankList[x]);
|
setchr1(0x400 * x, CHRBankList[x]);
|
||||||
|
|
||||||
if(0) switch(Mirroring)
|
if (0) switch (Mirroring) {
|
||||||
{
|
|
||||||
case 0: setmirror(MI_H); break;
|
case 0: setmirror(MI_H); break;
|
||||||
case 1: setmirror(MI_V); break;
|
case 1: setmirror(MI_V); break;
|
||||||
case 0x12:
|
case 0x12:
|
||||||
|
@ -1449,14 +1359,12 @@ void iNESStateRestore(int version)
|
||||||
if (MapStateRestore) MapStateRestore(version);
|
if (MapStateRestore) MapStateRestore(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iNESPower(void)
|
static void iNESPower(void) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
int type = MapperNo;
|
int type = MapperNo;
|
||||||
|
|
||||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
GameStateRestore = iNESStateRestore;
|
GameStateRestore = iNESStateRestore;
|
||||||
MapClose=0;
|
|
||||||
MapperReset = 0;
|
MapperReset = 0;
|
||||||
MapStateRestore = 0;
|
MapStateRestore = 0;
|
||||||
|
|
||||||
|
@ -1481,40 +1389,38 @@ static void iNESPower(void)
|
||||||
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
||||||
|
|
||||||
AddExState(WRAM, 8192, 0, "WRAM");
|
AddExState(WRAM, 8192, 0, "WRAM");
|
||||||
if(type==19 || type==6 || type==69 || type==85 || type==96)
|
if (type == 85)
|
||||||
AddExState(MapperExRAM, 32768, 0, "MEXR");
|
AddExState(MapperExRAM, 32768, 0, "MEXR");
|
||||||
if((!VROM_size || type==6 || type==19) && (type!=13 && type!=96))
|
if ((!VROM_size || type == 6 || type == 19) && (type != 13))
|
||||||
AddExState(CHRRAM, 8192, 0, "CHRR");
|
AddExState(CHRRAM, 8192 * 4, 0, "CHRR");
|
||||||
if (head.ROM_type & 8)
|
if (head.ROM_type & 8)
|
||||||
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
|
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
|
||||||
|
|
||||||
/* Exclude some mappers whose emulation code handle save state stuff
|
/* Exclude some mappers whose emulation code handle save state stuff
|
||||||
themselves. */
|
themselves. */
|
||||||
if(type && type!=13 && type!=96)
|
if (type && type != 13) {
|
||||||
{
|
|
||||||
AddExState(mapbyte1, 32, 0, "MPBY");
|
AddExState(mapbyte1, 32, 0, "MPBY");
|
||||||
AddExState(&Mirroring, 1, 0, "MIRR");
|
AddExState(&Mirroring, 1, 0, "MIRR");
|
||||||
AddExState(&IRQCount, 4, 1, "IRQC");
|
AddExState(&IRQCount, 4, 1, "IRQC");
|
||||||
AddExState(&IRQLatch, 4, 1, "IQL1");
|
AddExState(&IRQLatch, 4, 1, "IQL1");
|
||||||
AddExState(&IRQa, 1, 0, "IRQA");
|
AddExState(&IRQa, 1, 0, "IRQA");
|
||||||
AddExState(PRGBankList, 4, 0, "PBL");
|
AddExState(PRGBankList, 4, 0, "PBL");
|
||||||
for(x=0;x<8;x++)
|
for (x = 0; x < 8; x++) {
|
||||||
{
|
|
||||||
char tak[8];
|
char tak[8];
|
||||||
sprintf(tak, "CBL%d", x);
|
sprintf(tak, "CBL%d", x);
|
||||||
AddExState(&CHRBankList[x], 2, 1, tak);
|
AddExState(&CHRBankList[x], 2, 1, tak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(MapInitTab[type]) MapInitTab[type]();
|
if (MapInitTab[type])
|
||||||
else if(type)
|
MapInitTab[type]();
|
||||||
{
|
else
|
||||||
|
if (type) {
|
||||||
FCEU_PrintError("iNES mapper #%d is not supported at all.", type);
|
FCEU_PrintError("iNES mapper #%d is not supported at all.", type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int NewiNES_Init(int num)
|
static int NewiNES_Init(int num) {
|
||||||
{
|
|
||||||
BMAPPINGLocal *tmp = bmap;
|
BMAPPINGLocal *tmp = bmap;
|
||||||
|
|
||||||
CHRRAMSize = -1;
|
CHRRAMSize = -1;
|
||||||
|
@ -1522,20 +1428,16 @@ static int NewiNES_Init(int num)
|
||||||
if (GameInfo->type == GIT_VSUNI)
|
if (GameInfo->type == GIT_VSUNI)
|
||||||
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
||||||
|
|
||||||
while(tmp->init)
|
while (tmp->init) {
|
||||||
{
|
if (num == tmp->number) {
|
||||||
if(num==tmp->number)
|
|
||||||
{
|
|
||||||
UNIFchrrama = 0; // need here for compatibility with UNIF mapper code
|
UNIFchrrama = 0; // need here for compatibility with UNIF mapper code
|
||||||
if(!VROM_size)
|
if (!VROM_size) {
|
||||||
{
|
switch (num) { // FIXME, mapper or game data base with the board parameters and ROM/RAM sizes
|
||||||
if(num==13)
|
case 13: CHRRAMSize = 16 * 1024; break;
|
||||||
{
|
case 6:
|
||||||
CHRRAMSize=16384;
|
case 96: CHRRAMSize = 32 * 1024; break;
|
||||||
}
|
case 176: CHRRAMSize = 128 * 1024; break;
|
||||||
else
|
default: CHRRAMSize = 8 * 1024; break;
|
||||||
{
|
|
||||||
CHRRAMSize=8192;
|
|
||||||
}
|
}
|
||||||
if ((VROM = (uint8*)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
|
if ((VROM = (uint8*)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
|
||||||
FCEU_MemoryRand(VROM, CHRRAMSize);
|
FCEU_MemoryRand(VROM, CHRRAMSize);
|
||||||
|
|
43
src/ines.h
43
src/ines.h
|
@ -147,15 +147,15 @@ void onemir(uint8 V);
|
||||||
void MIRROR_SET2(uint8 V);
|
void MIRROR_SET2(uint8 V);
|
||||||
void MIRROR_SET(uint8 V);
|
void MIRROR_SET(uint8 V);
|
||||||
|
|
||||||
void Mapper0_init(void);
|
//void Mapper0_init(void);
|
||||||
void Mapper1_init(void);
|
//void Mapper1_init(void);
|
||||||
//void Mapper2_init(void);
|
//void Mapper2_init(void);
|
||||||
//void Mapper3_init(void);
|
//void Mapper3_init(void);
|
||||||
void Mapper6_init(void);
|
//void Mapper6_init(void);
|
||||||
//void Mapper7_init(void);
|
//void Mapper7_init(void);
|
||||||
//void Mapper8_init(void);
|
//void Mapper8_init(void);
|
||||||
void Mapper9_init(void);
|
//void Mapper9_init(void);
|
||||||
void Mapper10_init(void);
|
//void Mapper10_init(void);
|
||||||
//void Mapper11_init(void);
|
//void Mapper11_init(void);
|
||||||
void Mapper12_init(void);
|
void Mapper12_init(void);
|
||||||
//void Mapper13_init(void);
|
//void Mapper13_init(void);
|
||||||
|
@ -169,9 +169,9 @@ void Mapper20_init(void);
|
||||||
//void Mapper21_init(void);
|
//void Mapper21_init(void);
|
||||||
//void Mapper22_init(void);
|
//void Mapper22_init(void);
|
||||||
//void Mapper23_init(void);
|
//void Mapper23_init(void);
|
||||||
void Mapper24_init(void);
|
//void Mapper24_init(void);
|
||||||
//void Mapper25_init(void);
|
//void Mapper25_init(void);
|
||||||
void Mapper26_init(void);
|
//void Mapper26_init(void);
|
||||||
//void Mapper27_init(void);
|
//void Mapper27_init(void);
|
||||||
void Mapper28_init(void);
|
void Mapper28_init(void);
|
||||||
void Mapper29_init(void);
|
void Mapper29_init(void);
|
||||||
|
@ -206,12 +206,12 @@ void Mapper60_init(void);
|
||||||
//void Mapper61_init(void);
|
//void Mapper61_init(void);
|
||||||
//void Mapper62_init(void);
|
//void Mapper62_init(void);
|
||||||
void Mapper63_init(void);
|
void Mapper63_init(void);
|
||||||
void Mapper64_init(void);
|
//void Mapper64_init(void);
|
||||||
void Mapper65_init(void);
|
//void Mapper65_init(void);
|
||||||
//void Mapper66_init(void);
|
//void Mapper66_init(void);
|
||||||
void Mapper67_init(void);
|
//void Mapper67_init(void);
|
||||||
//void Mapper68_init(void);
|
//void Mapper68_init(void);
|
||||||
void Mapper69_init(void);
|
//void Mapper69_init(void);
|
||||||
//void Mapper70_init(void);
|
//void Mapper70_init(void);
|
||||||
//void Mapper71_init(void);
|
//void Mapper71_init(void);
|
||||||
//void Mapper72_init(void);
|
//void Mapper72_init(void);
|
||||||
|
@ -227,7 +227,7 @@ void Mapper81_init(void);
|
||||||
//void Mapper82_init(void);
|
//void Mapper82_init(void);
|
||||||
void Mapper83_init(void);
|
void Mapper83_init(void);
|
||||||
void Mapper84_init(void);
|
void Mapper84_init(void);
|
||||||
void Mapper85_init(void);
|
//void Mapper85_init(void);
|
||||||
//void Mapper86_init(void);
|
//void Mapper86_init(void);
|
||||||
//void Mapper87_init(void);
|
//void Mapper87_init(void);
|
||||||
void Mapper88_init(void);
|
void Mapper88_init(void);
|
||||||
|
@ -288,8 +288,8 @@ void Mapper154_init(void);
|
||||||
void Mapper160_init(void);
|
void Mapper160_init(void);
|
||||||
void Mapper161_init(void);
|
void Mapper161_init(void);
|
||||||
void Mapper162_init(void);
|
void Mapper162_init(void);
|
||||||
void Mapper166_init(void);
|
//void Mapper166_init(void);
|
||||||
void Mapper167_init(void);
|
//void Mapper167_init(void);
|
||||||
void Mapper168_init(void);
|
void Mapper168_init(void);
|
||||||
//void Mapper169_init(void);
|
//void Mapper169_init(void);
|
||||||
void Mapper170_init(void);
|
void Mapper170_init(void);
|
||||||
|
@ -328,7 +328,7 @@ void Mapper199_init(void);
|
||||||
//void Mapper218_init(void);
|
//void Mapper218_init(void);
|
||||||
void Mapper219_init(void);
|
void Mapper219_init(void);
|
||||||
//void Mapper220_init(void);
|
//void Mapper220_init(void);
|
||||||
void Mapper221_init(void);
|
//void Mapper221_init(void);
|
||||||
//void Mapper222_init(void);
|
//void Mapper222_init(void);
|
||||||
void Mapper223_init(void);
|
void Mapper223_init(void);
|
||||||
void Mapper224_init(void);
|
void Mapper224_init(void);
|
||||||
|
@ -370,7 +370,10 @@ void Mapper19_ESI(void);
|
||||||
void Mapper1_Init(CartInfo *);
|
void Mapper1_Init(CartInfo *);
|
||||||
void Mapper4_Init(CartInfo *);
|
void Mapper4_Init(CartInfo *);
|
||||||
void Mapper5_Init(CartInfo *);
|
void Mapper5_Init(CartInfo *);
|
||||||
|
void Mapper6_Init(CartInfo *);
|
||||||
void Mapper8_Init(CartInfo *);
|
void Mapper8_Init(CartInfo *);
|
||||||
|
void Mapper9_Init(CartInfo *);
|
||||||
|
void Mapper10_Init(CartInfo *);
|
||||||
void Mapper11_Init(CartInfo *);
|
void Mapper11_Init(CartInfo *);
|
||||||
void Mapper12_Init(CartInfo *);
|
void Mapper12_Init(CartInfo *);
|
||||||
void Mapper15_Init(CartInfo *);
|
void Mapper15_Init(CartInfo *);
|
||||||
|
@ -381,8 +384,9 @@ void Mapper19_Init(CartInfo *);
|
||||||
void Mapper21_Init(CartInfo *);
|
void Mapper21_Init(CartInfo *);
|
||||||
void Mapper22_Init(CartInfo *);
|
void Mapper22_Init(CartInfo *);
|
||||||
void Mapper23_Init(CartInfo *);
|
void Mapper23_Init(CartInfo *);
|
||||||
|
void Mapper24_Init(CartInfo *);
|
||||||
void Mapper25_Init(CartInfo *);
|
void Mapper25_Init(CartInfo *);
|
||||||
void Mapper28_Init(CartInfo *);
|
void Mapper26_Init(CartInfo *);
|
||||||
void Mapper32_Init(CartInfo *);
|
void Mapper32_Init(CartInfo *);
|
||||||
void Mapper33_Init(CartInfo *);
|
void Mapper33_Init(CartInfo *);
|
||||||
void Mapper34_Init(CartInfo *);
|
void Mapper34_Init(CartInfo *);
|
||||||
|
@ -406,7 +410,11 @@ void Mapper57_Init(CartInfo *);
|
||||||
void Mapper59_Init(CartInfo *);
|
void Mapper59_Init(CartInfo *);
|
||||||
void Mapper61_Init(CartInfo *);
|
void Mapper61_Init(CartInfo *);
|
||||||
void Mapper62_Init(CartInfo *);
|
void Mapper62_Init(CartInfo *);
|
||||||
|
void Mapper64_Init(CartInfo *);
|
||||||
|
void Mapper65_Init(CartInfo *);
|
||||||
|
void Mapper67_Init(CartInfo *);
|
||||||
void Mapper68_Init(CartInfo *);
|
void Mapper68_Init(CartInfo *);
|
||||||
|
void Mapper69_Init(CartInfo *);
|
||||||
void Mapper70_Init(CartInfo *);
|
void Mapper70_Init(CartInfo *);
|
||||||
void Mapper71_Init(CartInfo *);
|
void Mapper71_Init(CartInfo *);
|
||||||
void Mapper72_Init(CartInfo *);
|
void Mapper72_Init(CartInfo *);
|
||||||
|
@ -420,6 +428,7 @@ void Mapper79_Init(CartInfo *);
|
||||||
void Mapper80_Init(CartInfo *);
|
void Mapper80_Init(CartInfo *);
|
||||||
void Mapper82_Init(CartInfo *);
|
void Mapper82_Init(CartInfo *);
|
||||||
void Mapper83_Init(CartInfo *);
|
void Mapper83_Init(CartInfo *);
|
||||||
|
void Mapper85_Init(CartInfo *);
|
||||||
void Mapper86_Init(CartInfo *);
|
void Mapper86_Init(CartInfo *);
|
||||||
void Mapper87_Init(CartInfo *);
|
void Mapper87_Init(CartInfo *);
|
||||||
void Mapper88_Init(CartInfo *);
|
void Mapper88_Init(CartInfo *);
|
||||||
|
@ -461,6 +470,8 @@ void Mapper157_Init(CartInfo *);
|
||||||
void Mapper163_Init(CartInfo *);
|
void Mapper163_Init(CartInfo *);
|
||||||
void Mapper164_Init(CartInfo *);
|
void Mapper164_Init(CartInfo *);
|
||||||
void Mapper165_Init(CartInfo *);
|
void Mapper165_Init(CartInfo *);
|
||||||
|
void Mapper166_Init(CartInfo *);
|
||||||
|
void Mapper167_Init(CartInfo *);
|
||||||
void Mapper168_Init(CartInfo *);
|
void Mapper168_Init(CartInfo *);
|
||||||
void Mapper170_Init(CartInfo *);
|
void Mapper170_Init(CartInfo *);
|
||||||
void Mapper171_Init(CartInfo *);
|
void Mapper171_Init(CartInfo *);
|
||||||
|
|
|
@ -1,369 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
static void (*sfun[3])(void);
|
|
||||||
|
|
||||||
#define vrctemp mapbyte1[0]
|
|
||||||
#define VPSG2 mapbyte3
|
|
||||||
#define VPSG mapbyte2
|
|
||||||
|
|
||||||
static void DoSQV1(void);
|
|
||||||
static void DoSQV2(void);
|
|
||||||
static void DoSawV(void);
|
|
||||||
|
|
||||||
static int swaparoo;
|
|
||||||
|
|
||||||
static int acount=0;
|
|
||||||
|
|
||||||
static void KonamiIRQHook(int a)
|
|
||||||
{
|
|
||||||
#define LCYCS 341
|
|
||||||
// #define LCYCS ((227*2)+1)
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
acount+=a*3;
|
|
||||||
if(acount>=LCYCS)
|
|
||||||
{
|
|
||||||
doagainbub:acount-=LCYCS;IRQCount++;
|
|
||||||
if(IRQCount==0x100)
|
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQCount=IRQLatch;
|
|
||||||
}
|
|
||||||
if(acount>=LCYCS) goto doagainbub;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(VRC6SW)
|
|
||||||
{
|
|
||||||
A&=0xF003;
|
|
||||||
if(A>=0x9000 && A<=0x9002)
|
|
||||||
{
|
|
||||||
VPSG[A&3]=V;
|
|
||||||
if(sfun[0]) sfun[0]();
|
|
||||||
}
|
|
||||||
else if(A>=0xa000 && A<=0xa002)
|
|
||||||
{
|
|
||||||
VPSG[4|(A&3)]=V;
|
|
||||||
if(sfun[1]) sfun[1]();
|
|
||||||
}
|
|
||||||
else if(A>=0xb000 && A<=0xb002)
|
|
||||||
{
|
|
||||||
VPSG2[A&3]=V;
|
|
||||||
if(sfun[2]) sfun[2]();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(Mapper24_write)
|
|
||||||
{
|
|
||||||
if(swaparoo)
|
|
||||||
A=(A&0xFFFC)|((A>>1)&1)|((A<<1)&2);
|
|
||||||
if(A>=0x9000 && A<=0xb002)
|
|
||||||
{
|
|
||||||
VRC6SW(A,V);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
A&=0xF003;
|
|
||||||
// if(A>=0xF000) printf("%d, %d, $%04x:$%02x\n",scanline,timestamp,A,V);
|
|
||||||
switch(A&0xF003)
|
|
||||||
{
|
|
||||||
case 0x8000:ROM_BANK16(0x8000,V);break;
|
|
||||||
case 0xB003:
|
|
||||||
switch(V&0xF)
|
|
||||||
{
|
|
||||||
case 0x0:MIRROR_SET2(1);break;
|
|
||||||
case 0x4:MIRROR_SET2(0);break;
|
|
||||||
case 0x8:onemir(0);break;
|
|
||||||
case 0xC:onemir(1);break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0xC000:ROM_BANK8(0xC000,V);break;
|
|
||||||
case 0xD000:VROM_BANK1(0x0000,V);break;
|
|
||||||
case 0xD001:VROM_BANK1(0x0400,V);break;
|
|
||||||
case 0xD002:VROM_BANK1(0x0800,V);break;
|
|
||||||
case 0xD003:VROM_BANK1(0x0c00,V);break;
|
|
||||||
case 0xE000:VROM_BANK1(0x1000,V);break;
|
|
||||||
case 0xE001:VROM_BANK1(0x1400,V);break;
|
|
||||||
case 0xE002:VROM_BANK1(0x1800,V);break;
|
|
||||||
case 0xE003:VROM_BANK1(0x1c00,V);break;
|
|
||||||
case 0xF000:IRQLatch=V;
|
|
||||||
//acount=0;
|
|
||||||
break;
|
|
||||||
case 0xF001:IRQa=V&2;
|
|
||||||
vrctemp=V&1;
|
|
||||||
if(V&2)
|
|
||||||
{
|
|
||||||
IRQCount=IRQLatch;
|
|
||||||
acount=0;
|
|
||||||
}
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
|
||||||
break;
|
|
||||||
case 0xf002:IRQa=vrctemp;
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
case 0xF003:break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32 CVBC[3];
|
|
||||||
static int32 vcount[3];
|
|
||||||
static int32 dcount[2];
|
|
||||||
|
|
||||||
static INLINE void DoSQV(int x)
|
|
||||||
{
|
|
||||||
int32 V;
|
|
||||||
int32 amp=(((VPSG[x<<2]&15)<<8)*6/8)>>4;
|
|
||||||
int32 start,end;
|
|
||||||
|
|
||||||
start=CVBC[x];
|
|
||||||
end=(SOUNDTS<<16)/soundtsinc;
|
|
||||||
if(end<=start) return;
|
|
||||||
CVBC[x]=end;
|
|
||||||
|
|
||||||
if(VPSG[(x<<2)|0x2]&0x80)
|
|
||||||
{
|
|
||||||
if(VPSG[x<<2]&0x80)
|
|
||||||
{
|
|
||||||
for(V=start;V<end;V++)
|
|
||||||
Wave[V>>4]+=amp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int32 thresh=(VPSG[x<<2]>>4)&7;
|
|
||||||
int32 freq=((VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1)<<17;
|
|
||||||
for(V=start;V<end;V++)
|
|
||||||
{
|
|
||||||
if(dcount[x]>thresh) /* Greater than, not >=. Important. */
|
|
||||||
Wave[V>>4]+=amp;
|
|
||||||
vcount[x]-=nesincsize;
|
|
||||||
while(vcount[x]<=0) /* Should only be <0 in a few circumstances. */
|
|
||||||
{
|
|
||||||
vcount[x]+=freq;
|
|
||||||
dcount[x]=(dcount[x]+1)&15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSQV1(void)
|
|
||||||
{
|
|
||||||
DoSQV(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSQV2(void)
|
|
||||||
{
|
|
||||||
DoSQV(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSawV(void)
|
|
||||||
{
|
|
||||||
int V;
|
|
||||||
int32 start,end;
|
|
||||||
|
|
||||||
start=CVBC[2];
|
|
||||||
end=(SOUNDTS<<16)/soundtsinc;
|
|
||||||
if(end<=start) return;
|
|
||||||
CVBC[2]=end;
|
|
||||||
|
|
||||||
if(VPSG2[2]&0x80)
|
|
||||||
{
|
|
||||||
static int32 saw1phaseacc=0;
|
|
||||||
uint32 freq3;
|
|
||||||
static uint8 b3=0;
|
|
||||||
static int32 phaseacc=0;
|
|
||||||
static uint32 duff=0;
|
|
||||||
|
|
||||||
freq3=(VPSG2[1]+((VPSG2[2]&15)<<8)+1);
|
|
||||||
|
|
||||||
for(V=start;V<end;V++)
|
|
||||||
{
|
|
||||||
saw1phaseacc-=nesincsize;
|
|
||||||
if(saw1phaseacc<=0)
|
|
||||||
{
|
|
||||||
int32 t;
|
|
||||||
rea:
|
|
||||||
t=freq3;
|
|
||||||
t<<=18;
|
|
||||||
saw1phaseacc+=t;
|
|
||||||
phaseacc+=VPSG2[0]&0x3f;
|
|
||||||
b3++;
|
|
||||||
if(b3==7)
|
|
||||||
{
|
|
||||||
b3=0;
|
|
||||||
phaseacc=0;
|
|
||||||
}
|
|
||||||
if(saw1phaseacc<=0)
|
|
||||||
goto rea;
|
|
||||||
duff=(((phaseacc>>3)&0x1f)<<4)*6/8;
|
|
||||||
}
|
|
||||||
Wave[V>>4]+=duff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE void DoSQVHQ(int x)
|
|
||||||
{
|
|
||||||
uint32 V; //mbg merge 7/17/06 made uint
|
|
||||||
int32 amp=((VPSG[x<<2]&15)<<8)*6/8;
|
|
||||||
|
|
||||||
if(VPSG[(x<<2)|0x2]&0x80)
|
|
||||||
{
|
|
||||||
if(VPSG[x<<2]&0x80)
|
|
||||||
{
|
|
||||||
for(V=CVBC[x];V<SOUNDTS;V++)
|
|
||||||
WaveHi[V]+=amp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int32 thresh=(VPSG[x<<2]>>4)&7;
|
|
||||||
for(V=CVBC[x];V<SOUNDTS;V++)
|
|
||||||
{
|
|
||||||
if(dcount[x]>thresh) /* Greater than, not >=. Important. */
|
|
||||||
WaveHi[V]+=amp;
|
|
||||||
vcount[x]--;
|
|
||||||
if(vcount[x]<=0) /* Should only be <0 in a few circumstances. */
|
|
||||||
{
|
|
||||||
vcount[x]=(VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1;
|
|
||||||
dcount[x]=(dcount[x]+1)&15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CVBC[x]=SOUNDTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSQV1HQ(void)
|
|
||||||
{
|
|
||||||
DoSQVHQ(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSQV2HQ(void)
|
|
||||||
{
|
|
||||||
DoSQVHQ(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoSawVHQ(void)
|
|
||||||
{
|
|
||||||
static uint8 b3=0;
|
|
||||||
static int32 phaseacc=0;
|
|
||||||
uint32 V; //mbg merge 7/17/06 made uint32
|
|
||||||
|
|
||||||
if(VPSG2[2]&0x80)
|
|
||||||
{
|
|
||||||
for(V=CVBC[2];V<SOUNDTS;V++)
|
|
||||||
{
|
|
||||||
WaveHi[V]+=(((phaseacc>>3)&0x1f)<<8)*6/8;
|
|
||||||
vcount[2]--;
|
|
||||||
if(vcount[2]<=0)
|
|
||||||
{
|
|
||||||
vcount[2]=(VPSG2[1]+((VPSG2[2]&15)<<8)+1)<<1;
|
|
||||||
phaseacc+=VPSG2[0]&0x3f;
|
|
||||||
b3++;
|
|
||||||
if(b3==7)
|
|
||||||
{
|
|
||||||
b3=0;
|
|
||||||
phaseacc=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CVBC[2]=SOUNDTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void VRC6Sound(int Count)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
DoSQV1();
|
|
||||||
DoSQV2();
|
|
||||||
DoSawV();
|
|
||||||
for(x=0;x<3;x++)
|
|
||||||
CVBC[x]=Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VRC6SoundHQ(void)
|
|
||||||
{
|
|
||||||
DoSQV1HQ();
|
|
||||||
DoSQV2HQ();
|
|
||||||
DoSawVHQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VRC6SyncHQ(int32 ts)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
for(x=0;x<3;x++) CVBC[x]=ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void VRC6_ESI(void)
|
|
||||||
{
|
|
||||||
GameExpSound.RChange=VRC6_ESI;
|
|
||||||
GameExpSound.Fill=VRC6Sound;
|
|
||||||
GameExpSound.HiFill=VRC6SoundHQ;
|
|
||||||
GameExpSound.HiSync=VRC6SyncHQ;
|
|
||||||
|
|
||||||
memset(CVBC,0,sizeof(CVBC));
|
|
||||||
memset(vcount,0,sizeof(vcount));
|
|
||||||
memset(dcount,0,sizeof(dcount));
|
|
||||||
if(FSettings.SndRate)
|
|
||||||
{
|
|
||||||
if(FSettings.soundq>=1)
|
|
||||||
{
|
|
||||||
sfun[0]=DoSQV1HQ;
|
|
||||||
sfun[1]=DoSQV2HQ;
|
|
||||||
sfun[2]=DoSawVHQ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sfun[0]=DoSQV1;
|
|
||||||
sfun[1]=DoSQV2;
|
|
||||||
sfun[2]=DoSawV;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
memset(sfun,0,sizeof(sfun));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper24_init(void)
|
|
||||||
{
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper24_write);
|
|
||||||
VRC6_ESI();
|
|
||||||
MapIRQHook=KonamiIRQHook;
|
|
||||||
swaparoo=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper26_init(void)
|
|
||||||
{
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper24_write);
|
|
||||||
VRC6_ESI();
|
|
||||||
MapIRQHook=KonamiIRQHook;
|
|
||||||
swaparoo=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NSFVRC6_Init(void)
|
|
||||||
{
|
|
||||||
VRC6_ESI();
|
|
||||||
SetWriteHandler(0x8000,0xbfff,VRC6SW);
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
static uint8 FFEmode;
|
|
||||||
|
|
||||||
#define FVRAM_BANK8(A,V) {VPage[0]=VPage[1]=VPage[2]=VPage[3]=VPage[4]=VPage[5]=VPage[6]=VPage[7]=V?&MapperExRAM[(V)<<13]-(A):&CHRRAM[(V)<<13]-(A);CHRBankList[0]=((V)<<3);CHRBankList[1]=((V)<<3)+1;CHRBankList[2]=((V)<<3)+2;CHRBankList[3]=((V)<<3)+3;CHRBankList[4]=((V)<<3)+4;CHRBankList[5]=((V)<<3)+5;CHRBankList[6]=((V)<<3)+6;CHRBankList[7]=((V)<<3)+7;PPUCHRRAM=0xFF;}
|
|
||||||
|
|
||||||
static void FFEIRQHook(int a)
|
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount+=a;
|
|
||||||
if(IRQCount>=0x10000)
|
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQa=0;
|
|
||||||
IRQCount=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLFW(Mapper6_write)
|
|
||||||
{
|
|
||||||
if(A<0x8000)
|
|
||||||
{
|
|
||||||
switch(A){
|
|
||||||
case 0x42FF:MIRROR_SET((V>>4)&1);break;
|
|
||||||
case 0x42FE:onemir((V>>3)&2); FFEmode=V&0x80;break;
|
|
||||||
case 0x4501:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
case 0x4502:IRQCount&=0xFF00;IRQCount|=V;break;
|
|
||||||
case 0x4503:IRQCount&=0xFF;IRQCount|=V<<8;IRQa=1;break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (FFEmode)
|
|
||||||
{
|
|
||||||
case 0x80: setchr8(V); break;
|
|
||||||
default: ROM_BANK16(0x8000,V>>2);
|
|
||||||
FVRAM_BANK8(0x0000,V&3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Mapper6_StateRestore(int version)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
for(x=0;x<8;x++)
|
|
||||||
if(PPUCHRRAM&(1<<x))
|
|
||||||
{
|
|
||||||
if(CHRBankList[x]>7)
|
|
||||||
VPage[x]=&MapperExRAM[(CHRBankList[x]&31)*0x400]-(x*0x400);
|
|
||||||
else VPage[x]=&CHRRAM[(CHRBankList[x]&7)*0x400]-(x*0x400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Mapper6_init(void)
|
|
||||||
{
|
|
||||||
MapIRQHook=FFEIRQHook;
|
|
||||||
ROM_BANK16(0xc000,7);
|
|
||||||
|
|
||||||
SetWriteHandler(0x4020,0x5fff,Mapper6_write);
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper6_write);
|
|
||||||
MapStateRestore=Mapper6_StateRestore;
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
|
|
||||||
void IREMIRQHook(int a)
|
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount-=a;
|
|
||||||
if(IRQCount<-4)
|
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQa=0;
|
|
||||||
IRQCount=0xFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(Mapper65_write)
|
|
||||||
{
|
|
||||||
//if(A>=0x9000 && A<=0x9006)
|
|
||||||
// printf("$%04x:$%02x, %d\n",A,V,scanline);
|
|
||||||
switch(A)
|
|
||||||
{
|
|
||||||
//default: printf("$%04x:$%02x\n",A,V);
|
|
||||||
// break;
|
|
||||||
case 0x8000:ROM_BANK8(0x8000,V);break;
|
|
||||||
// case 0x9000:printf("$%04x:$%02x\n",A,V);MIRROR_SET2((V>>6)&1);break;
|
|
||||||
case 0x9001:MIRROR_SET(V>>7);break;
|
|
||||||
case 0x9003:IRQa=V&0x80;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
case 0x9004:IRQCount=IRQLatch;break;
|
|
||||||
case 0x9005: IRQLatch&=0x00FF;
|
|
||||||
IRQLatch|=V<<8;
|
|
||||||
break;
|
|
||||||
case 0x9006: IRQLatch&=0xFF00;IRQLatch|=V;
|
|
||||||
break;
|
|
||||||
case 0xB000:VROM_BANK1(0x0000,V);break;
|
|
||||||
case 0xB001:VROM_BANK1(0x0400,V);break;
|
|
||||||
case 0xB002:VROM_BANK1(0x0800,V);break;
|
|
||||||
case 0xB003:VROM_BANK1(0x0C00,V);break;
|
|
||||||
case 0xB004:VROM_BANK1(0x1000,V);break;
|
|
||||||
case 0xB005:VROM_BANK1(0x1400,V);break;
|
|
||||||
case 0xB006:VROM_BANK1(0x1800,V);break;
|
|
||||||
case 0xB007:VROM_BANK1(0x1C00,V);break;
|
|
||||||
case 0xa000:ROM_BANK8(0xA000,V);break;
|
|
||||||
case 0xC000:ROM_BANK8(0xC000,V);break;
|
|
||||||
}
|
|
||||||
//MIRROR_SET2(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper65_init(void)
|
|
||||||
{
|
|
||||||
MapIRQHook=IREMIRQHook;
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper65_write);
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define suntoggle mapbyte1[0]
|
|
||||||
|
|
||||||
static DECLFW(Mapper67_write)
|
|
||||||
{
|
|
||||||
A&=0xF800;
|
|
||||||
if((A&0x800) && A<=0xb800)
|
|
||||||
{
|
|
||||||
VROM_BANK2((A-0x8800)>>1,V);
|
|
||||||
}
|
|
||||||
else switch(A)
|
|
||||||
{
|
|
||||||
case 0xc800:
|
|
||||||
case 0xc000:if(!suntoggle)
|
|
||||||
{
|
|
||||||
IRQCount&=0xFF;
|
|
||||||
IRQCount|=V<<8;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IRQCount&=0xFF00;
|
|
||||||
IRQCount|=V;
|
|
||||||
}
|
|
||||||
suntoggle^=1;
|
|
||||||
break;
|
|
||||||
case 0xd800:suntoggle=0;IRQa=V&0x10;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
|
|
||||||
case 0xe800:switch(V&3)
|
|
||||||
{
|
|
||||||
case 0:MIRROR_SET2(1);break;
|
|
||||||
case 1:MIRROR_SET2(0);break;
|
|
||||||
case 2:onemir(0);break;
|
|
||||||
case 3:onemir(1);break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0xf800:ROM_BANK16(0x8000,V);break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void SunIRQHook(int a)
|
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount-=a;
|
|
||||||
if(IRQCount<=0)
|
|
||||||
{
|
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
|
||||||
IRQa=0;
|
|
||||||
IRQCount=0xFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Mapper67_init(void)
|
|
||||||
{
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper67_write);
|
|
||||||
MapIRQHook=SunIRQHook;
|
|
||||||
}
|
|
|
@ -1,252 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
static void AYSound(int Count);
|
|
||||||
static void AYSoundHQ(void);
|
|
||||||
static void DoAYSQ(int x);
|
|
||||||
static void DoAYSQHQ(int x);
|
|
||||||
|
|
||||||
#define sunselect mapbyte1[0]
|
|
||||||
#define sungah mapbyte1[1]
|
|
||||||
static uint8 sunindex;
|
|
||||||
|
|
||||||
static DECLFW(SUN5BWRAM)
|
|
||||||
{
|
|
||||||
if((sungah&0xC0)==0xC0)
|
|
||||||
(WRAM-0x6000)[A]=V;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFR(SUN5AWRAM)
|
|
||||||
{
|
|
||||||
if((sungah&0xC0)==0x40)
|
|
||||||
return X.DB;
|
|
||||||
return CartBROB(A);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(Mapper69_SWL)
|
|
||||||
{
|
|
||||||
sunindex=V%14;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(Mapper69_SWH)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
GameExpSound.Fill=AYSound;
|
|
||||||
GameExpSound.HiFill=AYSoundHQ;
|
|
||||||
if(FSettings.SndRate)
|
|
||||||
switch(sunindex)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
case 8:if(FSettings.soundq>=1) DoAYSQHQ(0); else DoAYSQ(0);break;
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
case 9:if(FSettings.soundq>=1) DoAYSQHQ(1); else DoAYSQ(1);break;
|
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 10:if(FSettings.soundq>=1) DoAYSQHQ(2); else DoAYSQ(2);break;
|
|
||||||
case 7:
|
|
||||||
for(x=0;x<2;x++)
|
|
||||||
if(FSettings.soundq>=1) DoAYSQHQ(x); else DoAYSQ(x);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MapperExRAM[sunindex]=V;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DECLFW(Mapper69_write)
|
|
||||||
{
|
|
||||||
switch(A&0xE000)
|
|
||||||
{
|
|
||||||
case 0x8000:sunselect=V;break;
|
|
||||||
case 0xa000:
|
|
||||||
sunselect&=0xF;
|
|
||||||
if(sunselect<=7)
|
|
||||||
VROM_BANK1(sunselect<<10,V);
|
|
||||||
else
|
|
||||||
switch(sunselect&0x0f)
|
|
||||||
{
|
|
||||||
case 8:
|
|
||||||
sungah=V;
|
|
||||||
if(V&0x40)
|
|
||||||
{
|
|
||||||
if(V&0x80) // Select WRAM
|
|
||||||
setprg8r(0x10,0x6000,0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
setprg8(0x6000,V);
|
|
||||||
break;
|
|
||||||
case 9:ROM_BANK8(0x8000,V);break;
|
|
||||||
case 0xa:ROM_BANK8(0xa000,V);break;
|
|
||||||
case 0xb:ROM_BANK8(0xc000,V);break;
|
|
||||||
case 0xc:
|
|
||||||
switch(V&3)
|
|
||||||
{
|
|
||||||
case 0:MIRROR_SET2(1);break;
|
|
||||||
case 1:MIRROR_SET2(0);break;
|
|
||||||
case 2:onemir(0);break;
|
|
||||||
case 3:onemir(1);break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0xd:IRQa=V;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
case 0xe:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
case 0xf:IRQCount&=0x00FF;IRQCount|=V<<8;X6502_IRQEnd(FCEU_IQEXT);break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32 vcount[3];
|
|
||||||
static int32 dcount[3];
|
|
||||||
static int CAYBC[3];
|
|
||||||
|
|
||||||
static void DoAYSQ(int x)
|
|
||||||
{
|
|
||||||
int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<(4+17);
|
|
||||||
int32 amp=(MapperExRAM[0x8+x]&15)<<2;
|
|
||||||
int32 start,end;
|
|
||||||
int V;
|
|
||||||
|
|
||||||
amp+=amp>>1;
|
|
||||||
|
|
||||||
start=CAYBC[x];
|
|
||||||
end=(SOUNDTS<<16)/soundtsinc;
|
|
||||||
if(end<=start) return;
|
|
||||||
CAYBC[x]=end;
|
|
||||||
|
|
||||||
if(amp)
|
|
||||||
for(V=start;V<end;V++)
|
|
||||||
{
|
|
||||||
if(dcount[x])
|
|
||||||
Wave[V>>4]+=amp;
|
|
||||||
vcount[x]-=nesincsize;
|
|
||||||
while(vcount[x]<=0)
|
|
||||||
{
|
|
||||||
dcount[x]^=1;
|
|
||||||
vcount[x]+=freq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoAYSQHQ(int x)
|
|
||||||
{
|
|
||||||
uint32 V; //mbg merge 7/17/06 made uitn32
|
|
||||||
int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<4;
|
|
||||||
int32 amp=(MapperExRAM[0x8+x]&15)<<6;
|
|
||||||
|
|
||||||
amp+=amp>>1;
|
|
||||||
|
|
||||||
if(!(MapperExRAM[0x7]&(1<<x)))
|
|
||||||
{
|
|
||||||
for(V=CAYBC[x];V<SOUNDTS;V++)
|
|
||||||
{
|
|
||||||
if(dcount[x])
|
|
||||||
WaveHi[V]+=amp;
|
|
||||||
vcount[x]--;
|
|
||||||
if(vcount[x]<=0)
|
|
||||||
{
|
|
||||||
dcount[x]^=1;
|
|
||||||
vcount[x]=freq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CAYBC[x]=SOUNDTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AYSound(int Count)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
DoAYSQ(0);
|
|
||||||
DoAYSQ(1);
|
|
||||||
DoAYSQ(2);
|
|
||||||
for(x=0;x<3;x++)
|
|
||||||
CAYBC[x]=Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AYSoundHQ(void)
|
|
||||||
{
|
|
||||||
DoAYSQHQ(0);
|
|
||||||
DoAYSQHQ(1);
|
|
||||||
DoAYSQHQ(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void AYHiSync(int32 ts)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
for(x=0;x<3;x++)
|
|
||||||
CAYBC[x]=ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SunIRQHook(int a)
|
|
||||||
{
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
IRQCount-=a;
|
|
||||||
if(IRQCount<=0)
|
|
||||||
{X6502_IRQBegin(FCEU_IQEXT);IRQa=0;IRQCount=0xFFFF;}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper69_StateRestore(int version)
|
|
||||||
{
|
|
||||||
if(mapbyte1[1]&0x40)
|
|
||||||
{
|
|
||||||
if(mapbyte1[1]&0x80) // Select WRAM
|
|
||||||
setprg8r(0x10,0x6000,0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
setprg8(0x6000,mapbyte1[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper69_ESI(void)
|
|
||||||
{
|
|
||||||
GameExpSound.RChange=Mapper69_ESI;
|
|
||||||
GameExpSound.HiSync=AYHiSync;
|
|
||||||
memset(dcount,0,sizeof(dcount));
|
|
||||||
memset(vcount,0,sizeof(vcount));
|
|
||||||
memset(CAYBC,0,sizeof(CAYBC));
|
|
||||||
}
|
|
||||||
|
|
||||||
void NSFAY_Init(void)
|
|
||||||
{
|
|
||||||
sunindex=0;
|
|
||||||
SetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
|
|
||||||
SetWriteHandler(0xe000,0xffff,Mapper69_SWH);
|
|
||||||
Mapper69_ESI();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper69_init(void)
|
|
||||||
{
|
|
||||||
sunindex=0;
|
|
||||||
|
|
||||||
SetupCartPRGMapping(0x10,WRAM,8192,1);
|
|
||||||
|
|
||||||
SetWriteHandler(0x8000,0xbfff,Mapper69_write);
|
|
||||||
SetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
|
|
||||||
SetWriteHandler(0xe000,0xffff,Mapper69_SWH);
|
|
||||||
SetWriteHandler(0x6000,0x7fff,SUN5BWRAM);
|
|
||||||
SetReadHandler(0x6000,0x7fff,SUN5AWRAM);
|
|
||||||
Mapper69_ESI();
|
|
||||||
MapIRQHook=SunIRQHook;
|
|
||||||
MapStateRestore=Mapper69_StateRestore;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,195 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
#define vrctemp mapbyte1[0]
|
|
||||||
static uint8 indox;
|
|
||||||
|
|
||||||
#include "emu2413.h"
|
|
||||||
|
|
||||||
static int acount=0;
|
|
||||||
|
|
||||||
static OPLL *VRC7Sound=NULL;
|
|
||||||
static int dwave=0;
|
|
||||||
|
|
||||||
void DoVRC7Sound(void)
|
|
||||||
{
|
|
||||||
int32 z,a;
|
|
||||||
|
|
||||||
if(FSettings.soundq>=1) return;
|
|
||||||
z=((SOUNDTS<<16)/soundtsinc)>>4;
|
|
||||||
a=z-dwave;
|
|
||||||
|
|
||||||
moocow(VRC7Sound, &Wave[dwave], a, 1);
|
|
||||||
|
|
||||||
dwave+=a;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateOPLNEO(int32 *Wave, int Count)
|
|
||||||
{
|
|
||||||
moocow(VRC7Sound, Wave, Count, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateOPL(int Count)
|
|
||||||
{
|
|
||||||
int32 z,a;
|
|
||||||
|
|
||||||
z=((SOUNDTS<<16)/soundtsinc)>>4;
|
|
||||||
a=z-dwave;
|
|
||||||
|
|
||||||
if(VRC7Sound && a)
|
|
||||||
moocow(VRC7Sound, &Wave[dwave], a, 1);
|
|
||||||
|
|
||||||
dwave=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE void DaMirror(int V)
|
|
||||||
{
|
|
||||||
int salpo[4]={MI_V,MI_H,MI_0,MI_1};
|
|
||||||
setmirror(salpo[V&3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLFW(Mapper85_write)
|
|
||||||
{
|
|
||||||
A|=(A&8)<<1;
|
|
||||||
|
|
||||||
if(A>=0xa000 && A<=0xDFFF)
|
|
||||||
{
|
|
||||||
// printf("$%04x, $%04x\n",X.PC,A);
|
|
||||||
A&=0xF010;
|
|
||||||
{
|
|
||||||
int x=((A>>4)&1)|((A-0xA000)>>11);
|
|
||||||
mapbyte3[x]=V;
|
|
||||||
setchr1(x<<10,V);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(A==0x9030)
|
|
||||||
{
|
|
||||||
if(FSettings.SndRate)
|
|
||||||
{
|
|
||||||
OPLL_writeReg(VRC7Sound, indox, V);
|
|
||||||
GameExpSound.Fill=UpdateOPL;
|
|
||||||
GameExpSound.NeoFill=UpdateOPLNEO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else switch(A&0xF010)
|
|
||||||
{
|
|
||||||
case 0x8000:mapbyte2[0]=V;setprg8(0x8000,V);break;
|
|
||||||
case 0x8010:mapbyte2[1]=V;setprg8(0xa000,V);break;
|
|
||||||
case 0x9000:mapbyte2[2]=V;setprg8(0xc000,V);break;
|
|
||||||
case 0x9010:indox=V;break;
|
|
||||||
case 0xe000:mapbyte2[3]=V;DaMirror(V);break;
|
|
||||||
case 0xE010:IRQLatch=V;
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
|
||||||
break;
|
|
||||||
case 0xF000:IRQa=V&2;
|
|
||||||
vrctemp=V&1;
|
|
||||||
if(V&2) {IRQCount=IRQLatch;}
|
|
||||||
acount=0;
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
|
||||||
break;
|
|
||||||
case 0xf010:if(vrctemp) IRQa=1;
|
|
||||||
else IRQa=0;
|
|
||||||
X6502_IRQEnd(FCEU_IQEXT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void KonamiIRQHook(int a)
|
|
||||||
{
|
|
||||||
#define ACBOO 341
|
|
||||||
// #define ACBOO ((227*2)+1)
|
|
||||||
if(IRQa)
|
|
||||||
{
|
|
||||||
acount+=a*3;
|
|
||||||
|
|
||||||
if(acount>=ACBOO)
|
|
||||||
{
|
|
||||||
doagainbub:acount-=ACBOO;
|
|
||||||
IRQCount++;
|
|
||||||
if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;}
|
|
||||||
if(acount>=ACBOO) goto doagainbub;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper85_StateRestore(int version)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
if(version<7200)
|
|
||||||
{
|
|
||||||
for(x=0;x<8;x++)
|
|
||||||
mapbyte3[x]=CHRBankList[x];
|
|
||||||
for(x=0;x<3;x++)
|
|
||||||
mapbyte2[x]=PRGBankList[x];
|
|
||||||
mapbyte2[3]=(Mirroring<0x10)?Mirroring:Mirroring-0xE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(x=0;x<8;x++)
|
|
||||||
setchr1(x*0x400,mapbyte3[x]);
|
|
||||||
for(x=0;x<3;x++)
|
|
||||||
setprg8(0x8000+x*8192,mapbyte2[x]);
|
|
||||||
DaMirror(mapbyte2[3]);
|
|
||||||
//LoadOPL();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void M85SC(void)
|
|
||||||
{
|
|
||||||
if(VRC7Sound)
|
|
||||||
OPLL_set_rate(VRC7Sound, FSettings.SndRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void M85SKill(void)
|
|
||||||
{
|
|
||||||
if(VRC7Sound)
|
|
||||||
OPLL_delete(VRC7Sound);
|
|
||||||
VRC7Sound=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void VRC7SI(void)
|
|
||||||
{
|
|
||||||
GameExpSound.RChange=M85SC;
|
|
||||||
GameExpSound.Kill=M85SKill;
|
|
||||||
|
|
||||||
VRC7Sound=OPLL_new(3579545, FSettings.SndRate?FSettings.SndRate:44100);
|
|
||||||
OPLL_reset(VRC7Sound);
|
|
||||||
OPLL_reset(VRC7Sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NSFVRC7_Init(void)
|
|
||||||
{
|
|
||||||
SetWriteHandler(0x9010,0x901F,Mapper85_write);
|
|
||||||
SetWriteHandler(0x9030,0x903F,Mapper85_write);
|
|
||||||
VRC7SI();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper85_init(void)
|
|
||||||
{
|
|
||||||
MapIRQHook=KonamiIRQHook;
|
|
||||||
SetWriteHandler(0x8000,0xffff,Mapper85_write);
|
|
||||||
GameStateRestore=Mapper85_StateRestore;
|
|
||||||
if(!VROM_size)
|
|
||||||
SetupCartCHRMapping(0, CHRRAM, 8192, 1);
|
|
||||||
//AddExState(VRC7Instrument, 16, 0, "VC7I");
|
|
||||||
//AddExState(VRC7Chan, sizeof(VRC7Chan), 0, "V7CH");
|
|
||||||
VRC7SI();
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
import glob
|
|
||||||
source_list = glob.glob('*.cpp') + glob.glob('*.c')
|
|
||||||
|
|
||||||
for x in range(len(source_list)):
|
|
||||||
source_list[x] = 'mappers/' + source_list[x]
|
|
||||||
Return('source_list')
|
|
|
@ -1,11 +0,0 @@
|
||||||
#include "../types.h"
|
|
||||||
#include "../x6502.h"
|
|
||||||
#include "../fceu.h"
|
|
||||||
#include "../ppu.h"
|
|
||||||
#define INESPRIV
|
|
||||||
#include "../cart.h"
|
|
||||||
#include "../ines.h"
|
|
||||||
#include "../utils/memory.h"
|
|
||||||
#include "../sound.h"
|
|
||||||
#include "../state.h"
|
|
||||||
|
|
|
@ -1,121 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mapinc.h"
|
|
||||||
|
|
||||||
#define MMC4reg mapbyte1
|
|
||||||
#define latcha1 mapbyte2[0]
|
|
||||||
#define latcha2 mapbyte2[1]
|
|
||||||
|
|
||||||
|
|
||||||
static void latchcheck(uint32 VAddr)
|
|
||||||
{
|
|
||||||
uint8 l,h;
|
|
||||||
|
|
||||||
h=VAddr>>8;
|
|
||||||
|
|
||||||
if(h>=0x20 || ((h&0xF)!=0xF))
|
|
||||||
return;
|
|
||||||
|
|
||||||
l=VAddr&0xF0;
|
|
||||||
|
|
||||||
if(h<0x10)
|
|
||||||
{
|
|
||||||
if(l==0xD0)
|
|
||||||
{
|
|
||||||
VROM_BANK4(0x0000,MMC4reg[0]);
|
|
||||||
latcha1=0xFD;
|
|
||||||
}
|
|
||||||
else if(l==0xE0)
|
|
||||||
{
|
|
||||||
VROM_BANK4(0x0000,MMC4reg[1]);
|
|
||||||
latcha1=0xFE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(l==0xD0)
|
|
||||||
{
|
|
||||||
VROM_BANK4(0x1000,MMC4reg[2]);
|
|
||||||
latcha2=0xFD;
|
|
||||||
}
|
|
||||||
else if(l==0xE0)
|
|
||||||
{
|
|
||||||
VROM_BANK4(0x1000,MMC4reg[3]);
|
|
||||||
latcha2=0xFE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLFW(Mapper9_write) // $Axxx
|
|
||||||
{
|
|
||||||
ROM_BANK8(0x8000,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLFW(Mapper10_write)
|
|
||||||
{
|
|
||||||
ROM_BANK16(0x8000,V);
|
|
||||||
}
|
|
||||||
|
|
||||||
DECLFW(Mapper9and10_write)
|
|
||||||
{
|
|
||||||
switch(A&0xF000)
|
|
||||||
{
|
|
||||||
case 0xB000:
|
|
||||||
if(latcha1==0xFD) { VROM_BANK4(0x0000,V);}
|
|
||||||
MMC4reg[0]=V;
|
|
||||||
break;
|
|
||||||
case 0xC000:
|
|
||||||
if(latcha1==0xFE) {VROM_BANK4(0x0000,V);}
|
|
||||||
MMC4reg[1]=V;
|
|
||||||
break;
|
|
||||||
case 0xD000:
|
|
||||||
if(latcha2==0xFD) {VROM_BANK4(0x1000,V);}
|
|
||||||
MMC4reg[2]=V;
|
|
||||||
break;
|
|
||||||
case 0xE000:
|
|
||||||
if(latcha2==0xFE) {VROM_BANK4(0x1000,V);}
|
|
||||||
MMC4reg[3]=V;
|
|
||||||
break;
|
|
||||||
case 0xF000:
|
|
||||||
MIRROR_SET(V&1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper9_init(void)
|
|
||||||
{
|
|
||||||
latcha1=0xFE;
|
|
||||||
latcha2=0xFE;
|
|
||||||
ROM_BANK8(0xA000,~2);
|
|
||||||
ROM_BANK8(0x8000,0);
|
|
||||||
SetWriteHandler(0xA000,0xAFFF,Mapper9_write);
|
|
||||||
SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);
|
|
||||||
PPU_hook=latchcheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mapper10_init(void)
|
|
||||||
{
|
|
||||||
latcha1=latcha2=0xFE;
|
|
||||||
SetWriteHandler(0xA000,0xAFFF,Mapper10_write);
|
|
||||||
SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);
|
|
||||||
PPU_hook=latchcheck;
|
|
||||||
}
|
|
||||||
|
|
148
src/unif.cpp
148
src/unif.cpp
|
@ -73,8 +73,7 @@ static UNIF_HEADER uchead;
|
||||||
static uint8 *malloced[32];
|
static uint8 *malloced[32];
|
||||||
static uint32 mallocedsizes[32];
|
static uint32 mallocedsizes[32];
|
||||||
|
|
||||||
static int FixRomSize(uint32 size, uint32 minimum)
|
static int FixRomSize(uint32 size, uint32 minimum) {
|
||||||
{
|
|
||||||
uint32 x = 1; //mbg merge 7/17/06 made uint
|
uint32 x = 1; //mbg merge 7/17/06 made uint
|
||||||
|
|
||||||
if (size < minimum)
|
if (size < minimum)
|
||||||
|
@ -84,22 +83,22 @@ static int FixRomSize(uint32 size, uint32 minimum)
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreeUNIF(void)
|
static void FreeUNIF(void) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
if(UNIFchrrama)
|
if (UNIFchrrama) {
|
||||||
{free(UNIFchrrama);UNIFchrrama=0;}
|
free(UNIFchrrama); UNIFchrrama = 0;
|
||||||
if(boardname)
|
}
|
||||||
{free(boardname);boardname=0;}
|
if (boardname) {
|
||||||
for(x=0;x<32;x++)
|
free(boardname); boardname = 0;
|
||||||
{
|
}
|
||||||
if(malloced[x])
|
for (x = 0; x < 32; x++) {
|
||||||
{free(malloced[x]);malloced[x]=0;}
|
if (malloced[x]) {
|
||||||
|
free(malloced[x]); malloced[x] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetUNIF(void)
|
static void ResetUNIF(void) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < 32; x++)
|
for (x = 0; x < 32; x++)
|
||||||
malloced[x] = 0;
|
malloced[x] = 0;
|
||||||
|
@ -112,21 +111,17 @@ static void ResetUNIF(void)
|
||||||
|
|
||||||
static uint8 exntar[2048];
|
static uint8 exntar[2048];
|
||||||
|
|
||||||
static void MooMirroring(void)
|
static void MooMirroring(void) {
|
||||||
{
|
|
||||||
if (mirrortodo < 0x4)
|
if (mirrortodo < 0x4)
|
||||||
SetupCartMirroring(mirrortodo, 1, 0);
|
SetupCartMirroring(mirrortodo, 1, 0);
|
||||||
else if(mirrortodo==0x4)
|
else if (mirrortodo == 0x4) {
|
||||||
{
|
|
||||||
SetupCartMirroring(4, 1, exntar);
|
SetupCartMirroring(4, 1, exntar);
|
||||||
AddExState(exntar, 2048, 0, "EXNR");
|
AddExState(exntar, 2048, 0, "EXNR");
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
SetupCartMirroring(0, 0, 0);
|
SetupCartMirroring(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DoMirroring(FCEUFILE *fp)
|
static int DoMirroring(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
uint8 t;
|
uint8 t;
|
||||||
t = FCEU_fgetc(fp);
|
t = FCEU_fgetc(fp);
|
||||||
mirrortodo = t;
|
mirrortodo = t;
|
||||||
|
@ -139,8 +134,7 @@ static int DoMirroring(FCEUFILE *fp)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int NAME(FCEUFILE *fp)
|
static int NAME(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
char namebuf[100];
|
char namebuf[100];
|
||||||
int index;
|
int index;
|
||||||
int t;
|
int t;
|
||||||
|
@ -155,15 +149,14 @@ static int NAME(FCEUFILE *fp)
|
||||||
namebuf[index] = 0;
|
namebuf[index] = 0;
|
||||||
FCEU_printf("%s\n", namebuf);
|
FCEU_printf("%s\n", namebuf);
|
||||||
|
|
||||||
if(!GameInfo->name)
|
if (!GameInfo->name) {
|
||||||
{
|
|
||||||
GameInfo->name = (uint8*)malloc(strlen(namebuf) + 1); //mbg merge 7/17/06 added cast
|
GameInfo->name = (uint8*)malloc(strlen(namebuf) + 1); //mbg merge 7/17/06 added cast
|
||||||
strcpy((char*)GameInfo->name, namebuf); //mbg merge 7/17/06 added cast
|
strcpy((char*)GameInfo->name, namebuf); //mbg merge 7/17/06 added cast
|
||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
static int DINF(FCEUFILE *fp)
|
|
||||||
{
|
static int DINF(FCEUFILE *fp) {
|
||||||
char name[100], method[100];
|
char name[100], method[100];
|
||||||
uint8 d, m;
|
uint8 d, m;
|
||||||
uint16 y;
|
uint16 y;
|
||||||
|
@ -185,15 +178,16 @@ static int DINF(FCEUFILE *fp)
|
||||||
FCEU_printf(" Dumped by: %s\n", name);
|
FCEU_printf(" Dumped by: %s\n", name);
|
||||||
FCEU_printf(" Dumped with: %s\n", method);
|
FCEU_printf(" Dumped with: %s\n", method);
|
||||||
{
|
{
|
||||||
char *months[12]={"January","February","March","April","May","June","July",
|
char *months[12] = {
|
||||||
"August","September","October","November","December"};
|
"January", "February", "March", "April", "May", "June", "July",
|
||||||
|
"August", "September", "October", "November", "December"
|
||||||
|
};
|
||||||
FCEU_printf(" Dumped on: %s %d, %d\n", months[(m - 1) % 12], d, y);
|
FCEU_printf(" Dumped on: %s %d, %d\n", months[(m - 1) % 12], d, y);
|
||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CTRL(FCEUFILE *fp)
|
static int CTRL(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
if ((t = FCEU_fgetc(fp)) == EOF)
|
if ((t = FCEU_fgetc(fp)) == EOF)
|
||||||
|
@ -206,26 +200,20 @@ static int CTRL(FCEUFILE *fp)
|
||||||
else GameInfo->input[0] = GameInfo->input[1] = SI_NONE;
|
else GameInfo->input[0] = GameInfo->input[1] = SI_NONE;
|
||||||
|
|
||||||
if (t & 2) GameInfo->input[1] = SI_ZAPPER;
|
if (t & 2) GameInfo->input[1] = SI_ZAPPER;
|
||||||
//else if(t&0x10) GameInfo->input[1]=SI_POWERPAD;
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int TVCI(FCEUFILE *fp)
|
static int TVCI(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
int t;
|
int t;
|
||||||
if ((t = FCEU_fgetc(fp)) == EOF)
|
if ((t = FCEU_fgetc(fp)) == EOF)
|
||||||
return(0);
|
return(0);
|
||||||
if(t<=2)
|
if (t <= 2) {
|
||||||
{
|
|
||||||
char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" };
|
char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" };
|
||||||
if(t==0)
|
if (t == 0) {
|
||||||
{
|
|
||||||
GameInfo->vidsys = GIV_NTSC;
|
GameInfo->vidsys = GIV_NTSC;
|
||||||
FCEUI_SetVidSystem(0);
|
FCEUI_SetVidSystem(0);
|
||||||
}
|
} else if (t == 1) {
|
||||||
else if(t==1)
|
|
||||||
{
|
|
||||||
GameInfo->vidsys = GIV_PAL;
|
GameInfo->vidsys = GIV_PAL;
|
||||||
FCEUI_SetVidSystem(1);
|
FCEUI_SetVidSystem(1);
|
||||||
}
|
}
|
||||||
|
@ -234,8 +222,7 @@ static int TVCI(FCEUFILE *fp)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int EnableBattery(FCEUFILE *fp)
|
static int EnableBattery(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
FCEU_printf(" Battery-backed.\n");
|
FCEU_printf(" Battery-backed.\n");
|
||||||
if (FCEU_fgetc(fp) == EOF)
|
if (FCEU_fgetc(fp) == EOF)
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -243,8 +230,7 @@ static int EnableBattery(FCEUFILE *fp)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int LoadPRG(FCEUFILE *fp)
|
static int LoadPRG(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
int z, t;
|
int z, t;
|
||||||
z = uchead.ID[3] - '0';
|
z = uchead.ID[3] - '0';
|
||||||
|
|
||||||
|
@ -258,20 +244,17 @@ static int LoadPRG(FCEUFILE *fp)
|
||||||
return(0);
|
return(0);
|
||||||
mallocedsizes[z] = t;
|
mallocedsizes[z] = t;
|
||||||
memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);
|
memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);
|
||||||
if(FCEU_fread(malloced[z],1,uchead.info,fp)!=uchead.info)
|
if (FCEU_fread(malloced[z], 1, uchead.info, fp) != uchead.info) {
|
||||||
{
|
|
||||||
FCEU_printf("Read Error!\n");
|
FCEU_printf("Read Error!\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
FCEU_printf("\n");
|
FCEU_printf("\n");
|
||||||
|
|
||||||
SetupCartPRGMapping(z, malloced[z], t, 0);
|
SetupCartPRGMapping(z, malloced[z], t, 0);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SetBoardName(FCEUFILE *fp)
|
static int SetBoardName(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1)))
|
if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1)))
|
||||||
return(0);
|
return(0);
|
||||||
FCEU_fread(boardname, 1, uchead.info, fp);
|
FCEU_fread(boardname, 1, uchead.info, fp);
|
||||||
|
@ -283,8 +266,7 @@ static int SetBoardName(FCEUFILE *fp)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int LoadCHR(FCEUFILE *fp)
|
static int LoadCHR(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
int z, t;
|
int z, t;
|
||||||
z = uchead.ID[3] - '0';
|
z = uchead.ID[3] - '0';
|
||||||
if (z < 0 || z > 15)
|
if (z < 0 || z > 15)
|
||||||
|
@ -297,26 +279,22 @@ static int LoadCHR(FCEUFILE *fp)
|
||||||
return(0);
|
return(0);
|
||||||
mallocedsizes[16 + z] = t;
|
mallocedsizes[16 + z] = t;
|
||||||
memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info);
|
memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info);
|
||||||
if(FCEU_fread(malloced[16+z],1,uchead.info,fp)!=uchead.info)
|
if (FCEU_fread(malloced[16 + z], 1, uchead.info, fp) != uchead.info) {
|
||||||
{
|
|
||||||
FCEU_printf("Read Error!\n");
|
FCEU_printf("Read Error!\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
FCEU_printf("\n");
|
FCEU_printf("\n");
|
||||||
|
|
||||||
SetupCartCHRMapping(z, malloced[16 + z], t, 0);
|
SetupCartCHRMapping(z, malloced[16 + z], t, 0);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define BMCFLAG_FORCE4 1
|
#define BMCFLAG_FORCE4 1
|
||||||
#define BMCFLAG_16KCHRR 2
|
#define BMCFLAG_16KCHRR 2
|
||||||
#define BMCFLAG_32KCHRR 4
|
#define BMCFLAG_32KCHRR 4
|
||||||
#define BMCFLAG_EXPCHRR 8
|
#define BMCFLAG_EXPCHRR 8
|
||||||
|
|
||||||
static BMAPPING bmap[] = {
|
static BMAPPING bmap[] = {
|
||||||
|
|
||||||
{ "11160", BMC11160_Init, 0 },
|
{ "11160", BMC11160_Init, 0 },
|
||||||
{ "12-IN-1", BMC12IN1_Init, 0 },
|
{ "12-IN-1", BMC12IN1_Init, 0 },
|
||||||
{ "13in1JY110", BMC13in1JY110_Init, 0 },
|
{ "13in1JY110", BMC13in1JY110_Init, 0 },
|
||||||
|
@ -416,7 +394,7 @@ static BMAPPING bmap[] = {
|
||||||
{ "SNROM", SNROM_Init, 0 },
|
{ "SNROM", SNROM_Init, 0 },
|
||||||
{ "SOROM", SOROM_Init, 0 },
|
{ "SOROM", SOROM_Init, 0 },
|
||||||
{ "SSS-NROM-256", SSSNROM_Init, 0 },
|
{ "SSS-NROM-256", SSSNROM_Init, 0 },
|
||||||
{ "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 },
|
{ "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, // fix me, real pcb name, real pcb type
|
||||||
{ "Sachen-74LS374N", S74LS374N_Init, 0 },
|
{ "Sachen-74LS374N", S74LS374N_Init, 0 },
|
||||||
{ "Sachen-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper
|
{ "Sachen-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper
|
||||||
{ "Sachen-8259A", S8259A_Init, 0 },
|
{ "Sachen-8259A", S8259A_Init, 0 },
|
||||||
|
@ -463,18 +441,15 @@ static BFMAPPING bfunc[] = {
|
||||||
{ "NAME", NAME },
|
{ "NAME", NAME },
|
||||||
{ "MAPR", SetBoardName },
|
{ "MAPR", SetBoardName },
|
||||||
{ "DINF", DINF },
|
{ "DINF", DINF },
|
||||||
{ 0, 0 }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
int LoadUNIFChunks(FCEUFILE *fp)
|
int LoadUNIFChunks(FCEUFILE *fp) {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
int t;
|
int t;
|
||||||
for(;;)
|
for (;; ) {
|
||||||
{
|
|
||||||
t = FCEU_fread(&uchead, 1, 4, fp);
|
t = FCEU_fread(&uchead, 1, 4, fp);
|
||||||
if(t<4)
|
if (t < 4) {
|
||||||
{
|
|
||||||
if (t > 0)
|
if (t > 0)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -483,11 +458,8 @@ int LoadUNIFChunks(FCEUFILE *fp)
|
||||||
return 0;
|
return 0;
|
||||||
t = 0;
|
t = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
//printf("Funky: %s\n",((uint8 *)&uchead));
|
while (bfunc[x].name) {
|
||||||
while(bfunc[x].name)
|
if (!memcmp(&uchead, bfunc[x].name, strlen(bfunc[x].name))) {
|
||||||
{
|
|
||||||
if(!memcmp(&uchead,bfunc[x].name,strlen(bfunc[x].name)))
|
|
||||||
{
|
|
||||||
if (!bfunc[x].init(fp))
|
if (!bfunc[x].init(fp))
|
||||||
return 0;
|
return 0;
|
||||||
t = 1;
|
t = 1;
|
||||||
|
@ -501,18 +473,14 @@ int LoadUNIFChunks(FCEUFILE *fp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int InitializeBoard(void)
|
static int InitializeBoard(void) {
|
||||||
{
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
if (!sboardname) return(0);
|
if (!sboardname) return(0);
|
||||||
|
|
||||||
while(bmap[x].name)
|
while (bmap[x].name) {
|
||||||
{
|
if (!strcmp((char*)sboardname, (char*)bmap[x].name)) {
|
||||||
if(!strcmp((char *)sboardname,(char *)bmap[x].name))
|
if (!malloced[16]) {
|
||||||
{
|
|
||||||
if(!malloced[16])
|
|
||||||
{
|
|
||||||
if (bmap[x].flags & BMCFLAG_16KCHRR)
|
if (bmap[x].flags & BMCFLAG_16KCHRR)
|
||||||
CHRRAMSize = 16384;
|
CHRRAMSize = 16384;
|
||||||
else if (bmap[x].flags & BMCFLAG_32KCHRR)
|
else if (bmap[x].flags & BMCFLAG_32KCHRR)
|
||||||
|
@ -521,12 +489,10 @@ static int InitializeBoard(void)
|
||||||
CHRRAMSize = 128 * 1024;
|
CHRRAMSize = 128 * 1024;
|
||||||
else
|
else
|
||||||
CHRRAMSize = 8192;
|
CHRRAMSize = 8192;
|
||||||
if((UNIFchrrama=(uint8 *)FCEU_malloc(CHRRAMSize)))
|
if ((UNIFchrrama = (uint8*)FCEU_malloc(CHRRAMSize))) {
|
||||||
{
|
|
||||||
SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1);
|
SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1);
|
||||||
AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR");
|
AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR");
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if (bmap[x].flags & BMCFLAG_FORCE4)
|
if (bmap[x].flags & BMCFLAG_FORCE4)
|
||||||
|
@ -541,10 +507,8 @@ static int InitializeBoard(void)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UNIFGI(GI h)
|
static void UNIFGI(GI h) {
|
||||||
{
|
switch (h) {
|
||||||
switch(h)
|
|
||||||
{
|
|
||||||
case GI_RESETSAVE:
|
case GI_RESETSAVE:
|
||||||
FCEU_ClearGameSave(&UNIFCart);
|
FCEU_ClearGameSave(&UNIFCart);
|
||||||
break;
|
break;
|
||||||
|
@ -567,8 +531,7 @@ static void UNIFGI(GI h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UNIFLoad(const char *name, FCEUFILE *fp)
|
int UNIFLoad(const char *name, FCEUFILE *fp) {
|
||||||
{
|
|
||||||
FCEU_fseek(fp, 0, SEEK_SET);
|
FCEU_fseek(fp, 0, SEEK_SET);
|
||||||
FCEU_fread(&unhead, 1, 4, fp);
|
FCEU_fread(&unhead, 1, 4, fp);
|
||||||
if (memcmp(&unhead, "UNIF", 4))
|
if (memcmp(&unhead, "UNIF", 4))
|
||||||
|
@ -591,8 +554,7 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
|
||||||
md5_starts(&md5);
|
md5_starts(&md5);
|
||||||
|
|
||||||
for (x = 0; x < 32; x++)
|
for (x = 0; x < 32; x++)
|
||||||
if(malloced[x])
|
if (malloced[x]) {
|
||||||
{
|
|
||||||
md5_update(&md5, malloced[x], mallocedsizes[x]);
|
md5_update(&md5, malloced[x], mallocedsizes[x]);
|
||||||
}
|
}
|
||||||
md5_finish(&md5, UNIFCart.MD5);
|
md5_finish(&md5, UNIFCart.MD5);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/Release
|
/Release
|
||||||
/ipch
|
/ipch
|
||||||
/vc10_bin_Debug
|
/vc10_bin_Debug
|
||||||
|
/vc10_fceux.sdf
|
||||||
/vc10_fceux.vcxproj.user
|
/vc10_fceux.vcxproj.user
|
||||||
/vc10_obj_Debug
|
/vc10_obj_Debug
|
||||||
/vc10_obj_Release
|
/vc10_obj_Release
|
||||||
|
|
|
@ -243,7 +243,6 @@
|
||||||
<ClCompile Include="..\src\boards\156.cpp" />
|
<ClCompile Include="..\src\boards\156.cpp" />
|
||||||
<ClCompile Include="..\src\boards\164.cpp" />
|
<ClCompile Include="..\src\boards\164.cpp" />
|
||||||
<ClCompile Include="..\src\boards\168.cpp" />
|
<ClCompile Include="..\src\boards\168.cpp" />
|
||||||
<ClCompile Include="..\src\boards\17.cpp" />
|
|
||||||
<ClCompile Include="..\src\boards\170.cpp" />
|
<ClCompile Include="..\src\boards\170.cpp" />
|
||||||
<ClCompile Include="..\src\boards\175.cpp" />
|
<ClCompile Include="..\src\boards\175.cpp" />
|
||||||
<ClCompile Include="..\src\boards\176.cpp" />
|
<ClCompile Include="..\src\boards\176.cpp" />
|
||||||
|
@ -287,7 +286,10 @@
|
||||||
<ClCompile Include="..\src\boards\57.cpp" />
|
<ClCompile Include="..\src\boards\57.cpp" />
|
||||||
<ClCompile Include="..\src\boards\603-5052.cpp" />
|
<ClCompile Include="..\src\boards\603-5052.cpp" />
|
||||||
<ClCompile Include="..\src\boards\62.cpp" />
|
<ClCompile Include="..\src\boards\62.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\65.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\67.cpp" />
|
||||||
<ClCompile Include="..\src\boards\68.cpp" />
|
<ClCompile Include="..\src\boards\68.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\69.cpp" />
|
||||||
<ClCompile Include="..\src\boards\71.cpp" />
|
<ClCompile Include="..\src\boards\71.cpp" />
|
||||||
<ClCompile Include="..\src\boards\72.cpp" />
|
<ClCompile Include="..\src\boards\72.cpp" />
|
||||||
<ClCompile Include="..\src\boards\77.cpp" />
|
<ClCompile Include="..\src\boards\77.cpp" />
|
||||||
|
@ -307,6 +309,7 @@
|
||||||
<ClCompile Include="..\src\boards\cityfighter.cpp" />
|
<ClCompile Include="..\src\boards\cityfighter.cpp" />
|
||||||
<ClCompile Include="..\src\boards\dance2000.cpp" />
|
<ClCompile Include="..\src\boards\dance2000.cpp" />
|
||||||
<ClCompile Include="..\src\boards\famicombox.cpp" />
|
<ClCompile Include="..\src\boards\famicombox.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\ffe.cpp" />
|
||||||
<ClCompile Include="..\src\boards\ks7012.cpp" />
|
<ClCompile Include="..\src\boards\ks7012.cpp" />
|
||||||
<ClCompile Include="..\src\boards\ks7013.cpp" />
|
<ClCompile Include="..\src\boards\ks7013.cpp" />
|
||||||
<ClCompile Include="..\src\boards\ks7017.cpp" />
|
<ClCompile Include="..\src\boards\ks7017.cpp" />
|
||||||
|
@ -317,6 +320,7 @@
|
||||||
<ClCompile Include="..\src\boards\le05.cpp" />
|
<ClCompile Include="..\src\boards\le05.cpp" />
|
||||||
<ClCompile Include="..\src\boards\lh32.cpp" />
|
<ClCompile Include="..\src\boards\lh32.cpp" />
|
||||||
<ClCompile Include="..\src\boards\lh53.cpp" />
|
<ClCompile Include="..\src\boards\lh53.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\mmc2and4.cpp" />
|
||||||
<ClCompile Include="..\src\boards\onebus.cpp" />
|
<ClCompile Include="..\src\boards\onebus.cpp" />
|
||||||
<ClCompile Include="..\src\boards\pec-586.cpp" />
|
<ClCompile Include="..\src\boards\pec-586.cpp" />
|
||||||
<ClCompile Include="..\src\boards\sa-9602b.cpp" />
|
<ClCompile Include="..\src\boards\sa-9602b.cpp" />
|
||||||
|
@ -324,7 +328,9 @@
|
||||||
<ClCompile Include="..\src\boards\vrc1.cpp" />
|
<ClCompile Include="..\src\boards\vrc1.cpp" />
|
||||||
<ClCompile Include="..\src\boards\vrc2and4.cpp" />
|
<ClCompile Include="..\src\boards\vrc2and4.cpp" />
|
||||||
<ClCompile Include="..\src\boards\vrc3.cpp" />
|
<ClCompile Include="..\src\boards\vrc3.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\vrc6.cpp" />
|
||||||
<ClCompile Include="..\src\boards\vrc7.cpp" />
|
<ClCompile Include="..\src\boards\vrc7.cpp" />
|
||||||
|
<ClCompile Include="..\src\boards\vrc7p.cpp" />
|
||||||
<ClCompile Include="..\src\boards\yoko.cpp" />
|
<ClCompile Include="..\src\boards\yoko.cpp" />
|
||||||
<ClCompile Include="..\src\boards\__dummy_mapper.cpp">
|
<ClCompile Include="..\src\boards\__dummy_mapper.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
@ -593,13 +599,7 @@
|
||||||
<ClCompile Include="..\src\input\suborkb.cpp" />
|
<ClCompile Include="..\src\input\suborkb.cpp" />
|
||||||
<ClCompile Include="..\src\input\toprider.cpp" />
|
<ClCompile Include="..\src\input\toprider.cpp" />
|
||||||
<ClCompile Include="..\src\input\zapper.cpp" />
|
<ClCompile Include="..\src\input\zapper.cpp" />
|
||||||
<ClCompile Include="..\src\mappers\24and26.cpp" />
|
<ClCompile Include="..\src\boards\emu2413.c">
|
||||||
<ClCompile Include="..\src\mappers\6.cpp" />
|
|
||||||
<ClCompile Include="..\src\mappers\65.cpp" />
|
|
||||||
<ClCompile Include="..\src\mappers\67.cpp" />
|
|
||||||
<ClCompile Include="..\src\mappers\69.cpp" />
|
|
||||||
<ClCompile Include="..\src\mappers\85.cpp" />
|
|
||||||
<ClCompile Include="..\src\mappers\emu2413.c">
|
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
|
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
|
||||||
|
@ -611,7 +611,6 @@
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\mappers\mmc2and4.cpp" />
|
|
||||||
<ClCompile Include="..\src\utils\ConvertUTF.c" />
|
<ClCompile Include="..\src\utils\ConvertUTF.c" />
|
||||||
<ClCompile Include="..\src\utils\crc32.cpp">
|
<ClCompile Include="..\src\utils\crc32.cpp">
|
||||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||||
|
@ -826,8 +825,7 @@
|
||||||
<ClInclude Include="..\src\x6502struct.h" />
|
<ClInclude Include="..\src\x6502struct.h" />
|
||||||
<ClInclude Include="..\src\input\share.h" />
|
<ClInclude Include="..\src\input\share.h" />
|
||||||
<ClInclude Include="..\src\input\suborkb.h" />
|
<ClInclude Include="..\src\input\suborkb.h" />
|
||||||
<ClInclude Include="..\src\mappers\emu2413.h" />
|
<ClInclude Include="..\src\boards\emu2413.h" />
|
||||||
<ClInclude Include="..\src\mappers\mapinc.h" />
|
|
||||||
<ClInclude Include="..\src\utils\ConvertUTF.h" />
|
<ClInclude Include="..\src\utils\ConvertUTF.h" />
|
||||||
<ClInclude Include="..\src\utils\crc32.h" />
|
<ClInclude Include="..\src\utils\crc32.h" />
|
||||||
<ClInclude Include="..\src\utils\endian.h" />
|
<ClInclude Include="..\src\utils\endian.h" />
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
<Filter Include="input">
|
<Filter Include="input">
|
||||||
<UniqueIdentifier>{5f356733-cee3-4440-aa40-cf138dcfbd8c}</UniqueIdentifier>
|
<UniqueIdentifier>{5f356733-cee3-4440-aa40-cf138dcfbd8c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="mappers">
|
|
||||||
<UniqueIdentifier>{13cb7bca-c196-4896-b88a-581e99d86457}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="palettes">
|
<Filter Include="palettes">
|
||||||
<UniqueIdentifier>{2a047eb3-7b56-41d4-b228-5df54bc1809d}</UniqueIdentifier>
|
<UniqueIdentifier>{2a047eb3-7b56-41d4-b228-5df54bc1809d}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
@ -635,29 +632,8 @@
|
||||||
<ClCompile Include="..\src\lua\src\print.c">
|
<ClCompile Include="..\src\lua\src\print.c">
|
||||||
<Filter>drivers\win\lua</Filter>
|
<Filter>drivers\win\lua</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\mappers\24and26.cpp">
|
<ClCompile Include="..\src\boards\emu2413.c">
|
||||||
<Filter>mappers</Filter>
|
<Filter>boards</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\6.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\65.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\67.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\69.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\85.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\emu2413.c">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\mappers\mmc2and4.cpp">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\movie.cpp" />
|
<ClCompile Include="..\src\movie.cpp" />
|
||||||
<ClCompile Include="..\src\netplay.cpp" />
|
<ClCompile Include="..\src\netplay.cpp" />
|
||||||
|
@ -784,9 +760,6 @@
|
||||||
<ClCompile Include="..\src\boards\12in1.cpp">
|
<ClCompile Include="..\src\boards\12in1.cpp">
|
||||||
<Filter>boards</Filter>
|
<Filter>boards</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\boards\17.cpp">
|
|
||||||
<Filter>boards</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\src\boards\18.cpp">
|
<ClCompile Include="..\src\boards\18.cpp">
|
||||||
<Filter>boards</Filter>
|
<Filter>boards</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -961,6 +934,27 @@
|
||||||
<ClCompile Include="..\src\boards\09-034a.cpp">
|
<ClCompile Include="..\src\boards\09-034a.cpp">
|
||||||
<Filter>boards</Filter>
|
<Filter>boards</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\65.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\67.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\69.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\vrc7p.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\ffe.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\mmc2and4.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\boards\vrc6.cpp">
|
||||||
|
<Filter>boards</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\src\cart.h">
|
<ClInclude Include="..\src\cart.h">
|
||||||
|
@ -1281,12 +1275,6 @@
|
||||||
<ClInclude Include="..\src\lua\src\lzio.h">
|
<ClInclude Include="..\src\lua\src\lzio.h">
|
||||||
<Filter>drivers\win\lua</Filter>
|
<Filter>drivers\win\lua</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\src\mappers\emu2413.h">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\src\mappers\mapinc.h">
|
|
||||||
<Filter>mappers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\src\movie.h">
|
<ClInclude Include="..\src\movie.h">
|
||||||
<Filter>include files</Filter>
|
<Filter>include files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1456,6 +1444,9 @@
|
||||||
<ClInclude Include="..\src\drivers\win\taseditor\laglog.h">
|
<ClInclude Include="..\src\drivers\win\taseditor\laglog.h">
|
||||||
<Filter>drivers\win\taseditor</Filter>
|
<Filter>drivers\win\taseditor</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\boards\emu2413.h">
|
||||||
|
<Filter>include files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
||||||
|
|
Loading…
Reference in New Issue