finish with mapper to boards conversion
This commit is contained in:
parent
f3d6e617d5
commit
13d63e5af2
|
@ -8,7 +8,6 @@ drivers/common
|
|||
fir
|
||||
input
|
||||
utils
|
||||
mappers
|
||||
""")
|
||||
#palettes
|
||||
|
||||
|
|
|
@ -17,235 +17,213 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* of the same one board with various modes locked just like SuperGame boards, based on 215 mapper
|
||||
*
|
||||
* It seems that 162/163/164 mappers are the same mapper with just different
|
||||
* mapper modes enabled or disabled in software or hardware, need more nanjing
|
||||
* carts
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 laststrobe, trigger;
|
||||
static uint8 reg[8];
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static void(*WSync)(void);
|
||||
static writefunc pcmwrite;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static void (*WSync)(void);
|
||||
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&laststrobe, 1, "STB"},
|
||||
{&trigger, 1, "TRG"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
{ &laststrobe, 1, "STB" },
|
||||
{ &trigger, 1, "TRG" },
|
||||
{ reg, 8, "REGS" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8r(0x10,0x6000,0);
|
||||
setprg32(0x8000,(reg[0]<<4)|(reg[1]&0xF));
|
||||
static void Sync(void) {
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg32(0x8000, (reg[0] << 4) | (reg[1] & 0xF));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
static void StateRestore(int version) {
|
||||
WSync();
|
||||
}
|
||||
|
||||
static DECLFR(ReadLow)
|
||||
{
|
||||
switch (A&0x7700)
|
||||
{
|
||||
case 0x5100:
|
||||
return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break;
|
||||
case 0x5500:
|
||||
if(trigger)
|
||||
return reg[2]|reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
|
||||
else
|
||||
return 0;
|
||||
static DECLFR(ReadLow) {
|
||||
switch (A & 0x7700) {
|
||||
case 0x5100: return reg[2] | reg[0] | reg[1] | reg[3] ^ 0xff; break;
|
||||
case 0x5500:
|
||||
if (trigger)
|
||||
return reg[2] | reg[1]; // Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void M163HB(void)
|
||||
{
|
||||
if(reg[1]&0x80)
|
||||
{
|
||||
if(scanline==239)
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
else if(scanline==127)
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
static void M163HB(void) {
|
||||
if (reg[1] & 0x80) {
|
||||
if (scanline == 239) {
|
||||
setchr4(0x0000, 0);
|
||||
setchr4(0x1000, 0);
|
||||
} else if (scanline == 127) {
|
||||
setchr4(0x0000, 1);
|
||||
setchr4(0x1000, 1);
|
||||
}
|
||||
/*
|
||||
if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it
|
||||
{
|
||||
setchr4(0x0000,1);
|
||||
setchr4(0x1000,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
switch (A&0x7300)
|
||||
{
|
||||
case 0x5100: reg[0]=V; WSync(); break;
|
||||
case 0x5000: reg[1]=V; WSync(); break;
|
||||
case 0x5300: reg[2]=V; break;
|
||||
case 0x5200: reg[3]=V; WSync(); break;
|
||||
static DECLFW(Write) {
|
||||
switch (A & 0x7300) {
|
||||
case 0x5100: reg[0] = V; WSync(); break;
|
||||
case 0x5000: reg[1] = V; WSync(); break;
|
||||
case 0x5300: reg[2] = V; break;
|
||||
case 0x5200: reg[3] = V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
memset(reg,0,8);
|
||||
reg[1]=0xFF;
|
||||
SetWriteHandler(0x5000,0x5FFF,Write);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
static void Power(void) {
|
||||
memset(reg, 0, 8);
|
||||
reg[1] = 0xFF;
|
||||
SetWriteHandler(0x5000, 0x5FFF, Write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
static void Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
void Mapper164_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power;
|
||||
info->Close=Close;
|
||||
void Mapper164_Init(CartInfo *info) {
|
||||
info->Power = Power;
|
||||
info->Close = Close;
|
||||
WSync = Sync;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
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;
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore=StateRestore;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
static DECLFW(Write2)
|
||||
{
|
||||
if(A==0x5101)
|
||||
{
|
||||
if(laststrobe&&!V)
|
||||
trigger^=1;
|
||||
laststrobe=V;
|
||||
}else if(A==0x5100&&V==6) //damn thoose protected games
|
||||
setprg32(0x8000,3);
|
||||
static DECLFW(Write2) {
|
||||
if (A == 0x5101) {
|
||||
if (laststrobe && !V) {
|
||||
trigger ^= 1;
|
||||
}
|
||||
laststrobe = V;
|
||||
} else if (A == 0x5100 && V == 6) //damn thoose protected games
|
||||
setprg32(0x8000, 3);
|
||||
else
|
||||
switch (A&0x7300)
|
||||
{
|
||||
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 0x5300: reg[2]=V; break;
|
||||
case 0x5100: reg[3]=V; WSync(); break;
|
||||
}
|
||||
switch (A & 0x7300) {
|
||||
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 0x5300: reg[2] = V; break;
|
||||
case 0x5100: reg[3] = V; WSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power2(void)
|
||||
{
|
||||
memset(reg,0,8);
|
||||
laststrobe=1;
|
||||
SetReadHandler(0x5000,0x5FFF,ReadLow);
|
||||
SetWriteHandler(0x5000,0x5FFF,Write2);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
static void Power2(void) {
|
||||
memset(reg, 0, 8);
|
||||
laststrobe = 1;
|
||||
pcmwrite = GetWriteHandler(0x4011);
|
||||
SetReadHandler(0x5000, 0x5FFF, ReadLow);
|
||||
SetWriteHandler(0x5000, 0x5FFF, Write2);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
void Mapper163_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power2;
|
||||
info->Close=Close;
|
||||
void Mapper163_Init(CartInfo *info) {
|
||||
info->Power = Power2;
|
||||
info->Close = Close;
|
||||
WSync = Sync;
|
||||
GameHBIRQHook=M163HB;
|
||||
GameHBIRQHook = M163HB;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
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;
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
GameStateRestore=StateRestore;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
static void Sync3(void)
|
||||
{
|
||||
static void Sync3(void) {
|
||||
setchr8(0);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
switch(reg[3]&7){
|
||||
case 0:
|
||||
case 2: setprg32(0x8000,(reg[0]&0xc)|(reg[1]&2)|((reg[2]&0xf)<<4)); break;
|
||||
case 1:
|
||||
case 3: setprg32(0x8000,(reg[0]&0xc)|(reg[2]&0xf)<<4); break;
|
||||
case 4:
|
||||
case 6: setprg32(0x8000,(reg[0]&0xe)|((reg[1]>>1)&1)|((reg[2]&0xf)<<4)); break;
|
||||
case 5:
|
||||
case 7: setprg32(0x8000,(reg[0]&0xf)|((reg[2]&0xf)<<4)); break;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
switch (reg[3] & 7) {
|
||||
case 0:
|
||||
case 2: setprg32(0x8000, (reg[0] & 0xc) | (reg[1] & 2) | ((reg[2] & 0xf) << 4)); break;
|
||||
case 1:
|
||||
case 3: setprg32(0x8000, (reg[0] & 0xc) | (reg[2] & 0xf) << 4); break;
|
||||
case 4:
|
||||
case 6: setprg32(0x8000, (reg[0] & 0xe) | ((reg[1] >> 1) & 1) | ((reg[2] & 0xf) << 4)); break;
|
||||
case 5:
|
||||
case 7: setprg32(0x8000, (reg[0] & 0xf) | ((reg[2] & 0xf) << 4)); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Write3)
|
||||
{
|
||||
reg[(A>>8)&3]=V;
|
||||
static DECLFW(Write3) {
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
reg[(A >> 8) & 3] = V;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Power3(void)
|
||||
{
|
||||
reg[0]=3;
|
||||
reg[1]=0;
|
||||
reg[2]=0;
|
||||
reg[3]=7;
|
||||
SetWriteHandler(0x5000,0x5FFF,Write3);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
static void Power3(void) {
|
||||
reg[0] = 3;
|
||||
reg[1] = 0;
|
||||
reg[2] = 0;
|
||||
reg[3] = 7;
|
||||
SetWriteHandler(0x5000, 0x5FFF, Write3);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
WSync();
|
||||
}
|
||||
|
||||
void UNLFS304_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power3;
|
||||
info->Close=Close;
|
||||
void UNLFS304_Init(CartInfo *info) {
|
||||
info->Power = Power3;
|
||||
info->Close = Close;
|
||||
WSync = Sync3;
|
||||
|
||||
WRAMSIZE = 8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
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;
|
||||
if (info->battery) {
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = WRAMSIZE;
|
||||
}
|
||||
|
||||
GameStateRestore=StateRestore;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ static SFORMAT StateRegs[]=
|
|||
{
|
||||
{prg, 4, "PRG"},
|
||||
{&chr, 1, "CHR"},
|
||||
{&sbw, 1, "SBW"},
|
||||
{&sbw, 1, "SBW"},
|
||||
{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,87 +16,82 @@
|
|||
* 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
|
||||
*
|
||||
* Taito X1-017 board, battery backed
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[9], ctrl;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{regs, 9, "REGS"},
|
||||
{&ctrl, 1, "CTRL"},
|
||||
{0}
|
||||
{ regs, 9, "REGS" },
|
||||
{ &ctrl, 1, "CTRL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
uint32 swap = ((ctrl & 2) << 11);
|
||||
setchr2(0x0000^swap,regs[0]>>1);
|
||||
setchr2(0x0800^swap,regs[1]>>1);
|
||||
setchr1(0x1000^swap,regs[2]);
|
||||
setchr1(0x1400^swap,regs[3]);
|
||||
setchr1(0x1800^swap,regs[4]);
|
||||
setchr1(0x1c00^swap,regs[5]);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
setprg8(0x8000,regs[6]);
|
||||
setprg8(0xA000,regs[7]);
|
||||
setprg8(0xC000,regs[8]);
|
||||
setprg8(0xE000,~0);
|
||||
setmirror(ctrl & 1);
|
||||
static void Sync(void) {
|
||||
uint32 swap = ((ctrl & 2) << 11);
|
||||
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
||||
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
||||
setchr1(0x1000 ^ swap, regs[2]);
|
||||
setchr1(0x1400 ^ swap, regs[3]);
|
||||
setchr1(0x1800 ^ swap, regs[4]);
|
||||
setchr1(0x1c00 ^ swap, regs[5]);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg8(0x8000, regs[6]);
|
||||
setprg8(0xA000, regs[7]);
|
||||
setprg8(0xC000, regs[8]);
|
||||
setprg8(0xE000, ~0);
|
||||
setmirror(ctrl & 1);
|
||||
}
|
||||
|
||||
static DECLFW(M82Write)
|
||||
{
|
||||
if(A <= 0x7ef5)
|
||||
regs[A & 7] = V;
|
||||
else
|
||||
switch(A)
|
||||
{
|
||||
case 0x7ef6: ctrl = V & 3; break;
|
||||
case 0x7efa: regs[6] = V >> 2; break;
|
||||
case 0x7efb: regs[7] = V >> 2; break;
|
||||
case 0x7efc: regs[8] = V >> 2; break;
|
||||
}
|
||||
Sync();
|
||||
static DECLFW(M82Write) {
|
||||
if (A <= 0x7ef5)
|
||||
regs[A & 7] = V;
|
||||
else
|
||||
switch (A) {
|
||||
case 0x7ef6: ctrl = V & 3; break;
|
||||
case 0x7efa: regs[6] = V >> 2; break;
|
||||
case 0x7efb: regs[7] = V >> 2; break;
|
||||
case 0x7efc: regs[8] = V >> 2; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M82Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0xffff,CartBR);
|
||||
SetWriteHandler(0x6000,0x7fff,CartBW);
|
||||
SetWriteHandler(0x7ef0,0x7efc,M82Write); // external WRAM might end at $73FF
|
||||
static void M82Power(void) {
|
||||
Sync();
|
||||
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||
SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF
|
||||
}
|
||||
|
||||
static void M82Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
static void M82Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper82_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M82Power;
|
||||
info->Power=M82Close;
|
||||
void Mapper82_Init(CartInfo *info) {
|
||||
info->Power = M82Power;
|
||||
info->Close = M82Close;
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -820,7 +820,7 @@ static INLINE int16 calc(OPLL * opll) {
|
|||
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) {
|
||||
*buf += (calc(opll) + 32768) << shift;
|
||||
buf++;
|
|
@ -130,7 +130,7 @@ uint32 OPLL_setMask(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
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -17,83 +17,72 @@
|
|||
* 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 mode;
|
||||
static uint8 DRegs[4];
|
||||
static uint8 is167, regs[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{DRegs, 4, "DREG"},
|
||||
{0}
|
||||
{ regs, 4, "DREG" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int base, bank;
|
||||
base = ((DRegs[0]^DRegs[1])&0x10)<<1;
|
||||
bank = (DRegs[2]^DRegs[3])&0x1f;
|
||||
static void Sync(void) {
|
||||
int base, bank;
|
||||
base = ((regs[0] ^ regs[1]) & 0x10) << 1;
|
||||
bank = (regs[2] ^ regs[3]) & 0x1f;
|
||||
|
||||
if(DRegs[1]&0x08)
|
||||
{
|
||||
bank &= 0xfe;
|
||||
if(mode==0)
|
||||
{
|
||||
setprg16(0x8000,base+bank+1);
|
||||
setprg16(0xC000,base+bank+0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,base+bank+0);
|
||||
setprg16(0xC000,base+bank+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DRegs[1]&0x04)
|
||||
{
|
||||
setprg16(0x8000,0x1f);
|
||||
setprg16(0xC000,base+bank);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,base+bank);
|
||||
if(mode==0)
|
||||
setprg16(0xC000,0x20);
|
||||
else
|
||||
setprg16(0xC000,0x07);
|
||||
}
|
||||
}
|
||||
if (regs[1] & 0x08) {
|
||||
bank &= 0xFE;
|
||||
if (is167) {
|
||||
setprg16(0x8000, base + bank + 1);
|
||||
setprg16(0xC000, base + bank + 0);
|
||||
} else {
|
||||
setprg16(0x8000, base + bank + 0);
|
||||
setprg16(0xC000, base + bank + 1);
|
||||
}
|
||||
} else {
|
||||
if (regs[1] & 0x04) {
|
||||
setprg16(0x8000, 0x1F);
|
||||
setprg16(0xC000, base + bank);
|
||||
} else {
|
||||
setprg16(0x8000, base + bank);
|
||||
if (is167)
|
||||
setprg16(0xC000, 0x20);
|
||||
else
|
||||
setprg16(0xC000, 0x07);
|
||||
}
|
||||
}
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper167_write)
|
||||
{
|
||||
DRegs[(A>>13)&0x03]=V;
|
||||
Sync();
|
||||
static DECLFW(M166Write) {
|
||||
regs[(A >> 13) & 0x03] = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
static void M166Power(void) {
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M166Write);
|
||||
}
|
||||
|
||||
void Mapper166_init(void)
|
||||
{
|
||||
mode=1;
|
||||
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper167_init(void)
|
||||
{
|
||||
mode=0;
|
||||
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
void Mapper166_Init(CartInfo *info) {
|
||||
is167 = 0;
|
||||
info->Power = M166Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper167_Init(CartInfo *info) {
|
||||
is167 = 1;
|
||||
info->Power = M166Power;
|
||||
GameStateRestore = StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -20,65 +20,52 @@
|
|||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 addrreg;
|
||||
static uint8 datareg;
|
||||
static uint8 busy;
|
||||
static SFORMAT StateRegs[]=
|
||||
static uint8 bank, base, lock, mirr;
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&addrreg, 2, "AREG"},
|
||||
{&datareg, 1, "DREG"},
|
||||
{&busy, 1, "BUSY"},
|
||||
{0}
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &base, 1, "BASE" },
|
||||
{ &lock, 1, "LOCK" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3);
|
||||
setprg16(0x8000,(datareg&7)|base);
|
||||
setprg16(0xC000,7|base);
|
||||
setmirror(((addrreg&2)>>1)^1);
|
||||
static void Sync(void) {
|
||||
setchr8(0);
|
||||
setprg16(0x8000, base | bank);
|
||||
setprg16(0xC000, base | 7);
|
||||
setmirror(mirr);
|
||||
}
|
||||
|
||||
static DECLFW(BMCT262Write)
|
||||
{
|
||||
if(busy||(A==0x8000))
|
||||
datareg=V;
|
||||
else
|
||||
{
|
||||
addrreg=A;
|
||||
busy=1;
|
||||
}
|
||||
Sync();
|
||||
static DECLFW(BMCT262Write) {
|
||||
if (!lock) {
|
||||
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
|
||||
mirr = ((A & 2) >> 1) ^ 1;
|
||||
lock = (A & 0x2000) >> 13;
|
||||
}
|
||||
bank = V & 7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMCT262Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCT262Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
busy=0;
|
||||
addrreg=0;
|
||||
datareg=0xff;
|
||||
Sync();
|
||||
static void BMCT262Power(void) {
|
||||
lock = bank = base = 0;
|
||||
Sync();
|
||||
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
}
|
||||
|
||||
static void BMCT262Reset(void)
|
||||
{
|
||||
busy=0;
|
||||
addrreg=0;
|
||||
datareg=0;
|
||||
Sync();
|
||||
static void BMCT262Reset(void) {
|
||||
lock = bank = base = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMCT262Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
static void BMCT262Restore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMCT262_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMCT262Power;
|
||||
info->Reset=BMCT262Reset;
|
||||
GameStateRestore=BMCT262Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
void BMCT262_Init(CartInfo *info) {
|
||||
info->Power = BMCT262Power;
|
||||
info->Reset = BMCT262Reset;
|
||||
GameStateRestore = BMCT262Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -20,181 +20,120 @@
|
|||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd,mir,rmode,IRQmode;
|
||||
static uint8 DRegs[11];
|
||||
static uint8 IRQCount,IRQa,IRQLatch;
|
||||
static uint8 cmd, mirr, regs[11];
|
||||
static uint8 rmode, IRQmode, IRQCount, IRQa, IRQLatch;
|
||||
|
||||
static SFORMAT Rambo_StateRegs[]={
|
||||
{&cmd, 1, "CMD"},
|
||||
{&mir, 1, "MIR"},
|
||||
{&rmode, 1, "RMOD"},
|
||||
{&IRQmode, 1, "IRQM"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{&IRQLatch, 1, "IRQL"},
|
||||
{DRegs, 11, "DREG"},
|
||||
{0}
|
||||
static SFORMAT StateRegs[] = {
|
||||
{ regs, 11, "REGS" },
|
||||
{ &cmd, 1, "CMDR" },
|
||||
{ &mirr, 1, "MIRR" },
|
||||
{ &rmode, 1, "RMOD" },
|
||||
{ &IRQmode, 1, "IRQM" },
|
||||
{ &IRQCount, 1, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ &IRQLatch, 1, "IRQL" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void (*setchr1wrap)(unsigned int A, unsigned int V);
|
||||
//static int nomirror;
|
||||
|
||||
static void RAMBO1_IRQHook(int a)
|
||||
{
|
||||
static int smallcount;
|
||||
if(!IRQmode) return;
|
||||
|
||||
smallcount+=a;
|
||||
while(smallcount>=4)
|
||||
{
|
||||
smallcount-=4;
|
||||
IRQCount--;
|
||||
if(IRQCount==0xFF)
|
||||
if(IRQa) X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
static void M64IRQHook(int a) {
|
||||
static int32 smallcount;
|
||||
if (IRQmode) {
|
||||
smallcount += a;
|
||||
while (smallcount >= 4) {
|
||||
smallcount -= 4;
|
||||
IRQCount--;
|
||||
if (IRQCount == 0xFF)
|
||||
if (IRQa) X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void RAMBO1_hb(void)
|
||||
{
|
||||
if(IRQmode) return;
|
||||
if(scanline==240) return; /* hmm. Maybe that should be an mmc3-only call in fce.c. */
|
||||
rmode=0;
|
||||
IRQCount--;
|
||||
if(IRQCount==0xFF)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
rmode = 1;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
static void M64HBHook(void) {
|
||||
if ((!IRQmode) && (scanline != 240)) {
|
||||
rmode = 0;
|
||||
IRQCount--;
|
||||
if (IRQCount == 0xFF) {
|
||||
if (IRQa) {
|
||||
rmode = 1;
|
||||
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++)
|
||||
setchr1wrap(0x1000+x*0x400,DRegs[2+x]);
|
||||
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xA000,DRegs[7]);
|
||||
|
||||
setprg8(0xC000,DRegs[10]);
|
||||
static void Sync(void) {
|
||||
if (cmd & 0x20) {
|
||||
setchr1(0x0000, regs[0]);
|
||||
setchr1(0x0400, regs[8]);
|
||||
setchr1(0x0800, regs[1]);
|
||||
setchr1(0x0C00, regs[9]);
|
||||
} 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(RAMBO1_write)
|
||||
{
|
||||
switch(A&0xF001)
|
||||
{
|
||||
case 0xa000: mir=V&1;
|
||||
// if(!nomirror)
|
||||
setmirror(mir^1);
|
||||
break;
|
||||
case 0x8000: cmd = V;
|
||||
break;
|
||||
case 0x8001: if((cmd&0xF)<10)
|
||||
DRegs[cmd&0xF]=V;
|
||||
else if((cmd&0xF)==0xF)
|
||||
DRegs[10]=V;
|
||||
Synco();
|
||||
break;
|
||||
case 0xc000: IRQLatch=V;
|
||||
if(rmode==1)
|
||||
IRQCount=IRQLatch;
|
||||
break;
|
||||
case 0xc001: rmode=1;
|
||||
IRQCount=IRQLatch;
|
||||
IRQmode=V&1;
|
||||
break;
|
||||
case 0xE000: IRQa=0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
if(rmode==1)
|
||||
IRQCount=IRQLatch;
|
||||
break;
|
||||
case 0xE001: IRQa=1;
|
||||
if(rmode==1)
|
||||
IRQCount=IRQLatch;
|
||||
break;
|
||||
}
|
||||
static DECLFW(M64Write) {
|
||||
switch (A & 0xF001) {
|
||||
case 0xA000: mirr = (V & 1) ^ 1; Sync(); break;\
|
||||
case 0x8000: cmd = V; break;
|
||||
case 0x8001:
|
||||
if ((cmd & 0xF) < 10)
|
||||
regs[cmd & 0xF] = V;
|
||||
else if ((cmd & 0xF) == 0xF)
|
||||
regs[10] = V;
|
||||
Sync();
|
||||
break;
|
||||
case 0xC000:
|
||||
IRQLatch = V;
|
||||
if (rmode == 1)
|
||||
IRQCount = IRQLatch;
|
||||
break;
|
||||
case 0xC001:
|
||||
rmode = 1;
|
||||
IRQCount = IRQLatch;
|
||||
IRQmode = V & 1;
|
||||
break;
|
||||
case 0xE000:
|
||||
IRQa = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
if (rmode == 1)
|
||||
IRQCount = IRQLatch;
|
||||
break;
|
||||
case 0xE001:
|
||||
IRQa = 1;
|
||||
if (rmode == 1)
|
||||
IRQCount = IRQLatch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void RAMBO1_Restore(int version)
|
||||
{
|
||||
Synco();
|
||||
// if(!nomirror)
|
||||
setmirror(mir^1);
|
||||
static void M64Power(void) {
|
||||
cmd = mirr = 0;
|
||||
regs[0] = regs[1] = regs[2] = regs[3] = regs[4] = regs[5] = ~0;
|
||||
regs[6] = regs[7] = regs[8] = regs[9] = regs[10] = ~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, M64Write);
|
||||
}
|
||||
|
||||
static void RAMBO1_init(void)
|
||||
{
|
||||
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 StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void CHRWrap(unsigned int A, unsigned int V)
|
||||
{
|
||||
setchr1(A,V);
|
||||
void Mapper64_Init(CartInfo *info) {
|
||||
info->Power = M64Power;
|
||||
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
|
||||
*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,113 +20,185 @@
|
|||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg[3], chr[8], mirr;
|
||||
static uint8 vrc7idx, preg[3], creg[8], mirr;
|
||||
static uint8 IRQLatch, IRQa, IRQd;
|
||||
static uint32 IRQCount, CycleCount;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{prg, 3, "PRG"},
|
||||
{chr, 8, "CHR"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{&IRQd, 1, "IRQD"},
|
||||
{&IRQLatch, 1, "IRQC"},
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{&CycleCount, 4, "CYCC"},
|
||||
{0}
|
||||
{ &vrc7idx, 1, "VRCI" },
|
||||
{ preg, 3, "PREG" },
|
||||
{ creg, 8, "CREG" },
|
||||
{ &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;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
void UpdateOPLNEO(int32 *Wave, int Count) {
|
||||
OPLL_fillbuf(VRC7Sound, Wave, Count, 4);
|
||||
}
|
||||
|
||||
static void UNLVRC7Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNLVRC7Write);
|
||||
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 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 VRC7SC(void) {
|
||||
if (VRC7Sound)
|
||||
OPLL_set_rate(VRC7Sound, FSettings.SndRate);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
static void VRC7SKill(void) {
|
||||
if (VRC7Sound)
|
||||
OPLL_delete(VRC7Sound);
|
||||
VRC7Sound = NULL;
|
||||
}
|
||||
|
||||
void UNLVRC7_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNLVRC7Power;
|
||||
MapIRQHook=UNLVRC7IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
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;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
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(VRC7SW) {
|
||||
if (FSettings.SndRate) {
|
||||
OPLL_writeReg(VRC7Sound, vrc7idx, V);
|
||||
GameExpSound.Fill = UpdateOPL;
|
||||
GameExpSound.NeoFill = UpdateOPLNEO;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(VRC7Write) {
|
||||
A |= (A & 8) << 1; // another two-in-oooone
|
||||
if (A >= 0xA000 && A <= 0xDFFF) {
|
||||
A &= 0xF010;
|
||||
creg[((A >> 4) & 1) | ((A - 0xA000) >> 11)] = V;
|
||||
Sync();
|
||||
} else if (A == 0x9030) {
|
||||
VRC7SW(A, V);
|
||||
} else switch (A & 0xF010) {
|
||||
case 0x8000: preg[0] = V; Sync(); break;
|
||||
case 0x8010: preg[1] = V; Sync(); break;
|
||||
case 0x9000: preg[2] = V; Sync(); break;
|
||||
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;
|
||||
IRQd = V & 1;
|
||||
if (V & 2)
|
||||
IRQCount = IRQLatch;
|
||||
CycleCount = 0;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
case 0xF010:
|
||||
IRQa = IRQd;
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void VRC7Power(void) {
|
||||
Sync();
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, VRC7Write);
|
||||
}
|
||||
|
||||
static void VRC7Close(void)
|
||||
{
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void VRC7IRQHook(int a) {
|
||||
if (IRQa) {
|
||||
CycleCount += a * 3;
|
||||
if (CycleCount >= 341) {
|
||||
while(CycleCount >= 341) {
|
||||
CycleCount -= 341;
|
||||
IRQCount++;
|
||||
if (IRQCount & 0x100) {
|
||||
IRQCount = IRQLatch;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version) {
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper85_Init(CartInfo *info) {
|
||||
info->Power = VRC7Power;
|
||||
info->Close = VRC7Close;
|
||||
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;
|
||||
VRC7_ESI();
|
||||
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,245 +16,221 @@
|
|||
* 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 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"
|
||||
|
||||
static uint8 mode, bank, reg[11], low[4], dip, IRQa;
|
||||
static int32 IRQCount;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
|
||||
static uint8 is2kbank, isnot2kbank;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
static SFORMAT StateRegs[] =
|
||||
{
|
||||
{&mode, 1, "MODE"},
|
||||
{&bank, 1, "BANK"},
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{reg, 11, "REGS"},
|
||||
{low, 4, "LOWR"},
|
||||
{&is2kbank, 1, "IS2K"},
|
||||
{&isnot2kbank, 1, "NT2K"},
|
||||
{0}
|
||||
{ &mode, 1, "MODE" },
|
||||
{ &bank, 1, "BANK" },
|
||||
{ &IRQCount, 4, "IRQC" },
|
||||
{ &IRQa, 1, "IRQA" },
|
||||
{ reg, 11, "REGS" },
|
||||
{ low, 4, "LOWR" },
|
||||
{ &is2kbank, 1, "IS2K" },
|
||||
{ &isnot2kbank, 1, "NT2K" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void UNLYOKOSync(void)
|
||||
{
|
||||
setmirror((mode & 1)^1);
|
||||
setchr2(0x0000,reg[3]);
|
||||
setchr2(0x0800,reg[4]);
|
||||
setchr2(0x1000,reg[5]);
|
||||
setchr2(0x1800,reg[6]);
|
||||
if(mode & 0x10)
|
||||
{
|
||||
uint32 base = (bank & 8) << 1;
|
||||
setprg8(0x8000,(reg[0]&0x0f)|base);
|
||||
setprg8(0xA000,(reg[1]&0x0f)|base);
|
||||
setprg8(0xC000,(reg[2]&0x0f)|base);
|
||||
setprg8(0xE000,0x0f|base);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mode & 8)
|
||||
setprg32(0x8000,bank >> 1);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,bank);
|
||||
setprg16(0xC000,~0);
|
||||
}
|
||||
}
|
||||
static void UNLYOKOSync(void) {
|
||||
setmirror((mode & 1) ^ 1);
|
||||
setchr2(0x0000, reg[3]);
|
||||
setchr2(0x0800, reg[4]);
|
||||
setchr2(0x1000, reg[5]);
|
||||
setchr2(0x1800, reg[6]);
|
||||
if (mode & 0x10) {
|
||||
uint32 base = (bank & 8) << 1;
|
||||
setprg8(0x8000, (reg[0] & 0x0f) | base);
|
||||
setprg8(0xA000, (reg[1] & 0x0f) | base);
|
||||
setprg8(0xC000, (reg[2] & 0x0f) | base);
|
||||
setprg8(0xE000, 0x0f | base);
|
||||
} else {
|
||||
if (mode & 8)
|
||||
setprg32(0x8000, bank >> 1);
|
||||
else{
|
||||
setprg16(0x8000, bank);
|
||||
setprg16(0xC000, ~0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M83Sync(void)
|
||||
{
|
||||
switch(mode & 3) // check if it is truth
|
||||
{
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
if(is2kbank&&!isnot2kbank)
|
||||
{
|
||||
setchr2(0x0000,reg[0]);
|
||||
setchr2(0x0800,reg[1]);
|
||||
setchr2(0x1000,reg[6]);
|
||||
setchr2(0x1800,reg[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int x;
|
||||
for(x=0;x<8;x++)
|
||||
setchr1(x<<10, reg[x] | ((bank&0x30)<<4));
|
||||
}
|
||||
setprg8r(0x10,0x6000,0);
|
||||
if(mode & 0x40)
|
||||
{
|
||||
setprg16(0x8000,(bank&0x3F)); // DBZ Party [p1]
|
||||
setprg16(0xC000,(bank&0x30)|0xF);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,reg[8]);
|
||||
setprg8(0xA000,reg[9]);
|
||||
setprg8(0xC000,reg[10]);
|
||||
setprg8(0xE000,~0);
|
||||
}
|
||||
static void M83Sync(void) {
|
||||
switch (mode & 3) { // check if it is truth
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
if (is2kbank && !isnot2kbank) {
|
||||
setchr2(0x0000, reg[0]);
|
||||
setchr2(0x0800, reg[1]);
|
||||
setchr2(0x1000, reg[6]);
|
||||
setchr2(0x1800, reg[7]);
|
||||
} else {
|
||||
int x;
|
||||
for (x = 0; x < 8; x++)
|
||||
setchr1(x << 10, reg[x] | ((bank & 0x30) << 4));
|
||||
}
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
if (mode & 0x40) {
|
||||
setprg16(0x8000, (bank & 0x3F)); // DBZ Party [p1]
|
||||
setprg16(0xC000, (bank & 0x30) | 0xF);
|
||||
} else {
|
||||
setprg8(0x8000, reg[8]);
|
||||
setprg8(0xA000, reg[9]);
|
||||
setprg8(0xC000, reg[10]);
|
||||
setprg8(0xE000, ~0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNLYOKOWrite)
|
||||
{
|
||||
switch(A & 0x8C17)
|
||||
{
|
||||
case 0x8000: bank=V; UNLYOKOSync(); break;
|
||||
case 0x8400: mode=V; UNLYOKOSync(); break;
|
||||
case 0x8800: IRQCount&=0xFF00; IRQCount|=V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x8801: IRQa=mode&0x80; IRQCount&=0xFF; IRQCount|=V<<8; break;
|
||||
case 0x8c00: reg[0]=V; UNLYOKOSync(); break;
|
||||
case 0x8c01: reg[1]=V; UNLYOKOSync(); break;
|
||||
case 0x8c02: reg[2]=V; UNLYOKOSync(); break;
|
||||
case 0x8c10: reg[3]=V; UNLYOKOSync(); break;
|
||||
case 0x8c11: reg[4]=V; UNLYOKOSync(); break;
|
||||
case 0x8c16: reg[5]=V; UNLYOKOSync(); break;
|
||||
case 0x8c17: reg[6]=V; UNLYOKOSync(); break;
|
||||
}
|
||||
static DECLFW(UNLYOKOWrite) {
|
||||
switch (A & 0x8C17) {
|
||||
case 0x8000: bank = V; UNLYOKOSync(); break;
|
||||
case 0x8400: mode = V; UNLYOKOSync(); break;
|
||||
case 0x8800: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x8801: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
|
||||
case 0x8c00: reg[0] = V; UNLYOKOSync(); break;
|
||||
case 0x8c01: reg[1] = V; UNLYOKOSync(); break;
|
||||
case 0x8c02: reg[2] = V; UNLYOKOSync(); break;
|
||||
case 0x8c10: reg[3] = V; UNLYOKOSync(); break;
|
||||
case 0x8c11: reg[4] = V; UNLYOKOSync(); break;
|
||||
case 0x8c16: reg[5] = V; UNLYOKOSync(); break;
|
||||
case 0x8c17: reg[6] = V; UNLYOKOSync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M83Write)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x8000: is2kbank = 1;
|
||||
case 0xB000: // Dragon Ball Z Party [p1] BMC
|
||||
case 0xB0FF: // Dragon Ball Z Party [p1] BMC
|
||||
case 0xB1FF: bank=V; mode |= 0x40; M83Sync(); break; // Dragon Ball Z Party [p1] BMC
|
||||
case 0x8100: mode=V|(mode&0x40); M83Sync(); break;
|
||||
case 0x8200: IRQCount&=0xFF00; IRQCount|=V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x8201: IRQa=mode&0x80; IRQCount&=0xFF; IRQCount|=V<<8; break;
|
||||
case 0x8300: reg[8]=V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8301: reg[9]=V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8302: reg[10]=V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8310: reg[0]=V; M83Sync(); break;
|
||||
case 0x8311: reg[1]=V; M83Sync(); break;
|
||||
case 0x8312: reg[2]=V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8313: reg[3]=V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8314: reg[4]=V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8315: reg[5]=V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8316: reg[6]=V; M83Sync(); break;
|
||||
case 0x8317: reg[7]=V; M83Sync(); break;
|
||||
}
|
||||
static DECLFW(M83Write) {
|
||||
switch (A) {
|
||||
case 0x8000: is2kbank = 1;
|
||||
case 0xB000: // Dragon Ball Z Party [p1] BMC
|
||||
case 0xB0FF: // Dragon Ball Z Party [p1] BMC
|
||||
case 0xB1FF: bank = V; mode |= 0x40; M83Sync(); break; // Dragon Ball Z Party [p1] BMC
|
||||
case 0x8100: mode = V | (mode & 0x40); M83Sync(); break;
|
||||
case 0x8200: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0x8201: IRQa = mode & 0x80; IRQCount &= 0xFF; IRQCount |= V << 8; break;
|
||||
case 0x8300: reg[8] = V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8301: reg[9] = V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8302: reg[10] = V; mode &= 0xBF; M83Sync(); break;
|
||||
case 0x8310: reg[0] = V; M83Sync(); break;
|
||||
case 0x8311: reg[1] = V; M83Sync(); break;
|
||||
case 0x8312: reg[2] = V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8313: reg[3] = V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8314: reg[4] = V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8315: reg[5] = V; isnot2kbank = 1; M83Sync(); break;
|
||||
case 0x8316: reg[6] = V; M83Sync(); break;
|
||||
case 0x8317: reg[7] = V; M83Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(UNLYOKOReadDip)
|
||||
{
|
||||
return (X.DB&0xFC)|dip;
|
||||
static DECLFR(UNLYOKOReadDip) {
|
||||
return (X.DB & 0xFC) | dip;
|
||||
}
|
||||
|
||||
static DECLFR(UNLYOKOReadLow)
|
||||
{
|
||||
return low[A & 3];
|
||||
static DECLFR(UNLYOKOReadLow) {
|
||||
return low[A & 3];
|
||||
}
|
||||
|
||||
static DECLFW(UNLYOKOWriteLow)
|
||||
{
|
||||
low[A & 3] = V;
|
||||
static DECLFW(UNLYOKOWriteLow) {
|
||||
low[A & 3] = V;
|
||||
}
|
||||
|
||||
static void UNLYOKOPower(void)
|
||||
{
|
||||
mode = bank = 0;
|
||||
dip = 3;
|
||||
UNLYOKOSync();
|
||||
SetReadHandler(0x5000,0x53FF,UNLYOKOReadDip);
|
||||
SetReadHandler(0x5400,0x5FFF,UNLYOKOReadLow);
|
||||
SetWriteHandler(0x5400,0x5FFF,UNLYOKOWriteLow);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNLYOKOWrite);
|
||||
static void UNLYOKOPower(void) {
|
||||
mode = bank = 0;
|
||||
dip = 3;
|
||||
UNLYOKOSync();
|
||||
SetReadHandler(0x5000, 0x53FF, UNLYOKOReadDip);
|
||||
SetReadHandler(0x5400, 0x5FFF, UNLYOKOReadLow);
|
||||
SetWriteHandler(0x5400, 0x5FFF, UNLYOKOWriteLow);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, UNLYOKOWrite);
|
||||
}
|
||||
|
||||
static void M83Power(void)
|
||||
{
|
||||
is2kbank = 0;
|
||||
isnot2kbank = 0;
|
||||
mode = bank = 0;
|
||||
dip = 0;
|
||||
M83Sync();
|
||||
SetReadHandler(0x5000,0x5000,UNLYOKOReadDip);
|
||||
SetReadHandler(0x5100,0x5103,UNLYOKOReadLow);
|
||||
SetWriteHandler(0x5100,0x5103,UNLYOKOWriteLow);
|
||||
SetReadHandler(0x6000,0x7fff,CartBR);
|
||||
SetWriteHandler(0x6000,0x7fff,CartBW); // Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
SetWriteHandler(0x8000,0xffff,M83Write);
|
||||
static void M83Power(void) {
|
||||
is2kbank = 0;
|
||||
isnot2kbank = 0;
|
||||
mode = bank = 0;
|
||||
dip = 0;
|
||||
M83Sync();
|
||||
SetReadHandler(0x5000, 0x5000, UNLYOKOReadDip);
|
||||
SetReadHandler(0x5100, 0x5103, UNLYOKOReadLow);
|
||||
SetWriteHandler(0x5100, 0x5103, UNLYOKOWriteLow);
|
||||
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7fff, CartBW); // Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM
|
||||
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||
SetWriteHandler(0x8000, 0xffff, M83Write);
|
||||
}
|
||||
|
||||
static void UNLYOKOReset(void)
|
||||
{
|
||||
dip = (dip + 1) & 3;
|
||||
mode = bank = 0;
|
||||
UNLYOKOSync();
|
||||
static void UNLYOKOReset(void) {
|
||||
dip = (dip + 1) & 3;
|
||||
mode = bank = 0;
|
||||
UNLYOKOSync();
|
||||
}
|
||||
|
||||
static void M83Reset(void)
|
||||
{
|
||||
dip ^= 1;
|
||||
M83Sync();
|
||||
static void M83Reset(void) {
|
||||
dip ^= 1;
|
||||
M83Sync();
|
||||
}
|
||||
|
||||
static void M83Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
static void M83Close(void) {
|
||||
if (WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void UNLYOKOIRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount-=a;
|
||||
if(IRQCount<0)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa=0;
|
||||
IRQCount=0xFFFF;
|
||||
}
|
||||
}
|
||||
static void UNLYOKOIRQHook(int a) {
|
||||
if (IRQa) {
|
||||
IRQCount -= a;
|
||||
if (IRQCount < 0) {
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa = 0;
|
||||
IRQCount = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UNLYOKOStateRestore(int version)
|
||||
{
|
||||
UNLYOKOSync();
|
||||
static void UNLYOKOStateRestore(int version) {
|
||||
UNLYOKOSync();
|
||||
}
|
||||
|
||||
static void M83StateRestore(int version)
|
||||
{
|
||||
M83Sync();
|
||||
static void M83StateRestore(int version) {
|
||||
M83Sync();
|
||||
}
|
||||
|
||||
void UNLYOKO_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNLYOKOPower;
|
||||
info->Reset=UNLYOKOReset;
|
||||
MapIRQHook=UNLYOKOIRQHook;
|
||||
GameStateRestore=UNLYOKOStateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
void UNLYOKO_Init(CartInfo *info) {
|
||||
info->Power = UNLYOKOPower;
|
||||
info->Reset = UNLYOKOReset;
|
||||
MapIRQHook = UNLYOKOIRQHook;
|
||||
GameStateRestore = UNLYOKOStateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper83_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M83Power;
|
||||
info->Reset=M83Reset;
|
||||
info->Close=M83Close;
|
||||
MapIRQHook=UNLYOKOIRQHook;
|
||||
GameStateRestore=M83StateRestore;
|
||||
void Mapper83_Init(CartInfo *info) {
|
||||
info->Power = M83Power;
|
||||
info->Reset = M83Reset;
|
||||
info->Close = M83Close;
|
||||
MapIRQHook = UNLYOKOIRQHook;
|
||||
GameStateRestore = M83StateRestore;
|
||||
|
||||
WRAMSIZE=8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
WRAMSIZE = 8192;
|
||||
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
|
1964
src/ines.cpp
1964
src/ines.cpp
File diff suppressed because it is too large
Load Diff
43
src/ines.h
43
src/ines.h
|
@ -147,15 +147,15 @@ void onemir(uint8 V);
|
|||
void MIRROR_SET2(uint8 V);
|
||||
void MIRROR_SET(uint8 V);
|
||||
|
||||
void Mapper0_init(void);
|
||||
void Mapper1_init(void);
|
||||
//void Mapper0_init(void);
|
||||
//void Mapper1_init(void);
|
||||
//void Mapper2_init(void);
|
||||
//void Mapper3_init(void);
|
||||
void Mapper6_init(void);
|
||||
//void Mapper6_init(void);
|
||||
//void Mapper7_init(void);
|
||||
//void Mapper8_init(void);
|
||||
void Mapper9_init(void);
|
||||
void Mapper10_init(void);
|
||||
//void Mapper9_init(void);
|
||||
//void Mapper10_init(void);
|
||||
//void Mapper11_init(void);
|
||||
void Mapper12_init(void);
|
||||
//void Mapper13_init(void);
|
||||
|
@ -169,9 +169,9 @@ void Mapper20_init(void);
|
|||
//void Mapper21_init(void);
|
||||
//void Mapper22_init(void);
|
||||
//void Mapper23_init(void);
|
||||
void Mapper24_init(void);
|
||||
//void Mapper24_init(void);
|
||||
//void Mapper25_init(void);
|
||||
void Mapper26_init(void);
|
||||
//void Mapper26_init(void);
|
||||
//void Mapper27_init(void);
|
||||
void Mapper28_init(void);
|
||||
void Mapper29_init(void);
|
||||
|
@ -206,12 +206,12 @@ void Mapper60_init(void);
|
|||
//void Mapper61_init(void);
|
||||
//void Mapper62_init(void);
|
||||
void Mapper63_init(void);
|
||||
void Mapper64_init(void);
|
||||
void Mapper65_init(void);
|
||||
//void Mapper64_init(void);
|
||||
//void Mapper65_init(void);
|
||||
//void Mapper66_init(void);
|
||||
void Mapper67_init(void);
|
||||
//void Mapper67_init(void);
|
||||
//void Mapper68_init(void);
|
||||
void Mapper69_init(void);
|
||||
//void Mapper69_init(void);
|
||||
//void Mapper70_init(void);
|
||||
//void Mapper71_init(void);
|
||||
//void Mapper72_init(void);
|
||||
|
@ -227,7 +227,7 @@ void Mapper81_init(void);
|
|||
//void Mapper82_init(void);
|
||||
void Mapper83_init(void);
|
||||
void Mapper84_init(void);
|
||||
void Mapper85_init(void);
|
||||
//void Mapper85_init(void);
|
||||
//void Mapper86_init(void);
|
||||
//void Mapper87_init(void);
|
||||
void Mapper88_init(void);
|
||||
|
@ -288,8 +288,8 @@ void Mapper154_init(void);
|
|||
void Mapper160_init(void);
|
||||
void Mapper161_init(void);
|
||||
void Mapper162_init(void);
|
||||
void Mapper166_init(void);
|
||||
void Mapper167_init(void);
|
||||
//void Mapper166_init(void);
|
||||
//void Mapper167_init(void);
|
||||
void Mapper168_init(void);
|
||||
//void Mapper169_init(void);
|
||||
void Mapper170_init(void);
|
||||
|
@ -328,7 +328,7 @@ void Mapper199_init(void);
|
|||
//void Mapper218_init(void);
|
||||
void Mapper219_init(void);
|
||||
//void Mapper220_init(void);
|
||||
void Mapper221_init(void);
|
||||
//void Mapper221_init(void);
|
||||
//void Mapper222_init(void);
|
||||
void Mapper223_init(void);
|
||||
void Mapper224_init(void);
|
||||
|
@ -370,7 +370,10 @@ void Mapper19_ESI(void);
|
|||
void Mapper1_Init(CartInfo *);
|
||||
void Mapper4_Init(CartInfo *);
|
||||
void Mapper5_Init(CartInfo *);
|
||||
void Mapper6_Init(CartInfo *);
|
||||
void Mapper8_Init(CartInfo *);
|
||||
void Mapper9_Init(CartInfo *);
|
||||
void Mapper10_Init(CartInfo *);
|
||||
void Mapper11_Init(CartInfo *);
|
||||
void Mapper12_Init(CartInfo *);
|
||||
void Mapper15_Init(CartInfo *);
|
||||
|
@ -381,8 +384,9 @@ void Mapper19_Init(CartInfo *);
|
|||
void Mapper21_Init(CartInfo *);
|
||||
void Mapper22_Init(CartInfo *);
|
||||
void Mapper23_Init(CartInfo *);
|
||||
void Mapper24_Init(CartInfo *);
|
||||
void Mapper25_Init(CartInfo *);
|
||||
void Mapper28_Init(CartInfo *);
|
||||
void Mapper26_Init(CartInfo *);
|
||||
void Mapper32_Init(CartInfo *);
|
||||
void Mapper33_Init(CartInfo *);
|
||||
void Mapper34_Init(CartInfo *);
|
||||
|
@ -406,7 +410,11 @@ void Mapper57_Init(CartInfo *);
|
|||
void Mapper59_Init(CartInfo *);
|
||||
void Mapper61_Init(CartInfo *);
|
||||
void Mapper62_Init(CartInfo *);
|
||||
void Mapper64_Init(CartInfo *);
|
||||
void Mapper65_Init(CartInfo *);
|
||||
void Mapper67_Init(CartInfo *);
|
||||
void Mapper68_Init(CartInfo *);
|
||||
void Mapper69_Init(CartInfo *);
|
||||
void Mapper70_Init(CartInfo *);
|
||||
void Mapper71_Init(CartInfo *);
|
||||
void Mapper72_Init(CartInfo *);
|
||||
|
@ -420,6 +428,7 @@ void Mapper79_Init(CartInfo *);
|
|||
void Mapper80_Init(CartInfo *);
|
||||
void Mapper82_Init(CartInfo *);
|
||||
void Mapper83_Init(CartInfo *);
|
||||
void Mapper85_Init(CartInfo *);
|
||||
void Mapper86_Init(CartInfo *);
|
||||
void Mapper87_Init(CartInfo *);
|
||||
void Mapper88_Init(CartInfo *);
|
||||
|
@ -461,6 +470,8 @@ void Mapper157_Init(CartInfo *);
|
|||
void Mapper163_Init(CartInfo *);
|
||||
void Mapper164_Init(CartInfo *);
|
||||
void Mapper165_Init(CartInfo *);
|
||||
void Mapper166_Init(CartInfo *);
|
||||
void Mapper167_Init(CartInfo *);
|
||||
void Mapper168_Init(CartInfo *);
|
||||
void Mapper170_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;
|
||||
}
|
||||
|
450
src/unif.cpp
450
src/unif.cpp
|
@ -1,22 +1,22 @@
|
|||
/* 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
|
||||
*/
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* TODO: Battery backup file saving, mirror force */
|
||||
/* **INCOMPLETE** */
|
||||
|
@ -64,7 +64,7 @@ static uint8 *boardname;
|
|||
static uint8 *sboardname;
|
||||
|
||||
static uint32 CHRRAMSize;
|
||||
uint8 *UNIFchrrama=0;
|
||||
uint8 *UNIFchrrama = 0;
|
||||
|
||||
static UNIF_HEADER unhead;
|
||||
static UNIF_HEADER uchead;
|
||||
|
@ -73,250 +73,228 @@ static UNIF_HEADER uchead;
|
|||
static uint8 *malloced[32];
|
||||
static uint32 mallocedsizes[32];
|
||||
|
||||
static int FixRomSize(uint32 size, uint32 minimum)
|
||||
{
|
||||
uint32 x=1; //mbg merge 7/17/06 made uint
|
||||
static int FixRomSize(uint32 size, uint32 minimum) {
|
||||
uint32 x = 1; //mbg merge 7/17/06 made uint
|
||||
|
||||
if(size<minimum)
|
||||
if (size < minimum)
|
||||
return minimum;
|
||||
while(x<size)
|
||||
x<<=1;
|
||||
while (x < size)
|
||||
x <<= 1;
|
||||
return x;
|
||||
}
|
||||
|
||||
static void FreeUNIF(void)
|
||||
{
|
||||
static void FreeUNIF(void) {
|
||||
int x;
|
||||
if(UNIFchrrama)
|
||||
{free(UNIFchrrama);UNIFchrrama=0;}
|
||||
if(boardname)
|
||||
{free(boardname);boardname=0;}
|
||||
for(x=0;x<32;x++)
|
||||
{
|
||||
if(malloced[x])
|
||||
{free(malloced[x]);malloced[x]=0;}
|
||||
if (UNIFchrrama) {
|
||||
free(UNIFchrrama); UNIFchrrama = 0;
|
||||
}
|
||||
if (boardname) {
|
||||
free(boardname); boardname = 0;
|
||||
}
|
||||
for (x = 0; x < 32; x++) {
|
||||
if (malloced[x]) {
|
||||
free(malloced[x]); malloced[x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ResetUNIF(void)
|
||||
{
|
||||
static void ResetUNIF(void) {
|
||||
int x;
|
||||
for(x=0;x<32;x++)
|
||||
malloced[x]=0;
|
||||
vramo=0;
|
||||
boardname=0;
|
||||
mirrortodo=0;
|
||||
memset(&UNIFCart,0,sizeof(UNIFCart));
|
||||
UNIFchrrama=0;
|
||||
for (x = 0; x < 32; x++)
|
||||
malloced[x] = 0;
|
||||
vramo = 0;
|
||||
boardname = 0;
|
||||
mirrortodo = 0;
|
||||
memset(&UNIFCart, 0, sizeof(UNIFCart));
|
||||
UNIFchrrama = 0;
|
||||
}
|
||||
|
||||
static uint8 exntar[2048];
|
||||
|
||||
static void MooMirroring(void)
|
||||
{
|
||||
if(mirrortodo<0x4)
|
||||
SetupCartMirroring(mirrortodo,1,0);
|
||||
else if(mirrortodo==0x4)
|
||||
{
|
||||
SetupCartMirroring(4,1,exntar);
|
||||
AddExState(exntar, 2048, 0,"EXNR");
|
||||
}
|
||||
else
|
||||
SetupCartMirroring(0,0,0);
|
||||
static void MooMirroring(void) {
|
||||
if (mirrortodo < 0x4)
|
||||
SetupCartMirroring(mirrortodo, 1, 0);
|
||||
else if (mirrortodo == 0x4) {
|
||||
SetupCartMirroring(4, 1, exntar);
|
||||
AddExState(exntar, 2048, 0, "EXNR");
|
||||
} else
|
||||
SetupCartMirroring(0, 0, 0);
|
||||
}
|
||||
|
||||
static int DoMirroring(FCEUFILE *fp)
|
||||
{
|
||||
static int DoMirroring(FCEUFILE *fp) {
|
||||
uint8 t;
|
||||
t=FCEU_fgetc(fp);
|
||||
mirrortodo=t;
|
||||
t = FCEU_fgetc(fp);
|
||||
mirrortodo = t;
|
||||
|
||||
{
|
||||
static char *stuffo[6]={"Horizontal","Vertical","$2000","$2400","\"Four-screen\"","Controlled by Mapper Hardware"};
|
||||
if(t<6)
|
||||
FCEU_printf(" Name/Attribute Table Mirroring: %s\n",stuffo[t]);
|
||||
static char *stuffo[6] = { "Horizontal", "Vertical", "$2000", "$2400", "\"Four-screen\"", "Controlled by Mapper Hardware" };
|
||||
if (t < 6)
|
||||
FCEU_printf(" Name/Attribute Table Mirroring: %s\n", stuffo[t]);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int NAME(FCEUFILE *fp)
|
||||
{
|
||||
static int NAME(FCEUFILE *fp) {
|
||||
char namebuf[100];
|
||||
int index;
|
||||
int t;
|
||||
|
||||
FCEU_printf(" Name: ");
|
||||
index=0;
|
||||
index = 0;
|
||||
|
||||
while((t=FCEU_fgetc(fp))>0)
|
||||
if(index<99)
|
||||
namebuf[index++]=t;
|
||||
while ((t = FCEU_fgetc(fp)) > 0)
|
||||
if (index < 99)
|
||||
namebuf[index++] = t;
|
||||
|
||||
namebuf[index]=0;
|
||||
FCEU_printf("%s\n",namebuf);
|
||||
namebuf[index] = 0;
|
||||
FCEU_printf("%s\n", namebuf);
|
||||
|
||||
if(!GameInfo->name)
|
||||
{
|
||||
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
|
||||
if (!GameInfo->name) {
|
||||
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
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
static int DINF(FCEUFILE *fp)
|
||||
{
|
||||
|
||||
static int DINF(FCEUFILE *fp) {
|
||||
char name[100], method[100];
|
||||
uint8 d, m;
|
||||
uint16 y;
|
||||
int t;
|
||||
|
||||
if(FCEU_fread(name,1,100,fp)!=100)
|
||||
if (FCEU_fread(name, 1, 100, fp) != 100)
|
||||
return(0);
|
||||
if((t=FCEU_fgetc(fp))==EOF) return(0);
|
||||
d=t;
|
||||
if((t=FCEU_fgetc(fp))==EOF) return(0);
|
||||
m=t;
|
||||
if((t=FCEU_fgetc(fp))==EOF) return(0);
|
||||
y=t;
|
||||
if((t=FCEU_fgetc(fp))==EOF) return(0);
|
||||
y|=t<<8;
|
||||
if(FCEU_fread(method,1,100,fp)!=100)
|
||||
if ((t = FCEU_fgetc(fp)) == EOF) return(0);
|
||||
d = t;
|
||||
if ((t = FCEU_fgetc(fp)) == EOF) return(0);
|
||||
m = t;
|
||||
if ((t = FCEU_fgetc(fp)) == EOF) return(0);
|
||||
y = t;
|
||||
if ((t = FCEU_fgetc(fp)) == EOF) return(0);
|
||||
y |= t << 8;
|
||||
if (FCEU_fread(method, 1, 100, fp) != 100)
|
||||
return(0);
|
||||
name[99]=method[99]=0;
|
||||
FCEU_printf(" Dumped by: %s\n",name);
|
||||
FCEU_printf(" Dumped with: %s\n",method);
|
||||
name[99] = method[99] = 0;
|
||||
FCEU_printf(" Dumped by: %s\n", name);
|
||||
FCEU_printf(" Dumped with: %s\n", method);
|
||||
{
|
||||
char *months[12]={"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);
|
||||
char *months[12] = {
|
||||
"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);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int CTRL(FCEUFILE *fp)
|
||||
{
|
||||
static int CTRL(FCEUFILE *fp) {
|
||||
int t;
|
||||
|
||||
if((t=FCEU_fgetc(fp))==EOF)
|
||||
if ((t = FCEU_fgetc(fp)) == EOF)
|
||||
return(0);
|
||||
/* The information stored in this byte isn't very helpful, but it's
|
||||
better than nothing...maybe.
|
||||
*/
|
||||
|
||||
if(t&1) GameInfo->input[0]=GameInfo->input[1]=SI_GAMEPAD;
|
||||
else GameInfo->input[0]=GameInfo->input[1]=SI_NONE;
|
||||
if (t & 1) GameInfo->input[0] = GameInfo->input[1] = SI_GAMEPAD;
|
||||
else GameInfo->input[0] = GameInfo->input[1] = SI_NONE;
|
||||
|
||||
if(t&2) GameInfo->input[1]=SI_ZAPPER;
|
||||
//else if(t&0x10) GameInfo->input[1]=SI_POWERPAD;
|
||||
if (t & 2) GameInfo->input[1] = SI_ZAPPER;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int TVCI(FCEUFILE *fp)
|
||||
{
|
||||
static int TVCI(FCEUFILE *fp) {
|
||||
int t;
|
||||
if( (t=FCEU_fgetc(fp)) ==EOF)
|
||||
if ((t = FCEU_fgetc(fp)) == EOF)
|
||||
return(0);
|
||||
if(t<=2)
|
||||
{
|
||||
char *stuffo[3]={"NTSC","PAL","NTSC and PAL"};
|
||||
if(t==0)
|
||||
{
|
||||
GameInfo->vidsys=GIV_NTSC;
|
||||
if (t <= 2) {
|
||||
char *stuffo[3] = { "NTSC", "PAL", "NTSC and PAL" };
|
||||
if (t == 0) {
|
||||
GameInfo->vidsys = GIV_NTSC;
|
||||
FCEUI_SetVidSystem(0);
|
||||
}
|
||||
else if(t==1)
|
||||
{
|
||||
GameInfo->vidsys=GIV_PAL;
|
||||
} else if (t == 1) {
|
||||
GameInfo->vidsys = GIV_PAL;
|
||||
FCEUI_SetVidSystem(1);
|
||||
}
|
||||
FCEU_printf(" TV Standard Compatibility: %s\n",stuffo[t]);
|
||||
FCEU_printf(" TV Standard Compatibility: %s\n", stuffo[t]);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int EnableBattery(FCEUFILE *fp)
|
||||
{
|
||||
static int EnableBattery(FCEUFILE *fp) {
|
||||
FCEU_printf(" Battery-backed.\n");
|
||||
if(FCEU_fgetc(fp)==EOF)
|
||||
if (FCEU_fgetc(fp) == EOF)
|
||||
return(0);
|
||||
UNIFCart.battery=1;
|
||||
UNIFCart.battery = 1;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int LoadPRG(FCEUFILE *fp)
|
||||
{
|
||||
int z,t;
|
||||
z=uchead.ID[3]-'0';
|
||||
static int LoadPRG(FCEUFILE *fp) {
|
||||
int z, t;
|
||||
z = uchead.ID[3] - '0';
|
||||
|
||||
if(z<0 || z>15)
|
||||
if (z < 0 || z > 15)
|
||||
return(0);
|
||||
FCEU_printf(" PRG ROM %d size: %d",z,(int) uchead.info);
|
||||
if(malloced[z])
|
||||
FCEU_printf(" PRG ROM %d size: %d", z, (int)uchead.info);
|
||||
if (malloced[z])
|
||||
free(malloced[z]);
|
||||
t=FixRomSize(uchead.info,2048);
|
||||
if(!(malloced[z]=(uint8 *)FCEU_malloc(t)))
|
||||
t = FixRomSize(uchead.info, 2048);
|
||||
if (!(malloced[z] = (uint8*)FCEU_malloc(t)))
|
||||
return(0);
|
||||
mallocedsizes[z]=t;
|
||||
memset(malloced[z]+uchead.info,0xFF,t-uchead.info);
|
||||
if(FCEU_fread(malloced[z],1,uchead.info,fp)!=uchead.info)
|
||||
{
|
||||
mallocedsizes[z] = t;
|
||||
memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);
|
||||
if (FCEU_fread(malloced[z], 1, uchead.info, fp) != uchead.info) {
|
||||
FCEU_printf("Read Error!\n");
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
} else
|
||||
FCEU_printf("\n");
|
||||
|
||||
SetupCartPRGMapping(z,malloced[z],t,0);
|
||||
SetupCartPRGMapping(z, malloced[z], t, 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int SetBoardName(FCEUFILE *fp)
|
||||
{
|
||||
if(!(boardname=(uint8 *)FCEU_malloc(uchead.info+1)))
|
||||
static int SetBoardName(FCEUFILE *fp) {
|
||||
if (!(boardname = (uint8*)FCEU_malloc(uchead.info + 1)))
|
||||
return(0);
|
||||
FCEU_fread(boardname,1,uchead.info,fp);
|
||||
boardname[uchead.info]=0;
|
||||
FCEU_printf(" Board name: %s\n",boardname);
|
||||
sboardname=boardname;
|
||||
if(!memcmp(boardname,"NES-",4) || !memcmp(boardname,"UNL-",4) || !memcmp(boardname,"HVC-",4) || !memcmp(boardname,"BTL-",4) || !memcmp(boardname,"BMC-",4))
|
||||
sboardname+=4;
|
||||
FCEU_fread(boardname, 1, uchead.info, fp);
|
||||
boardname[uchead.info] = 0;
|
||||
FCEU_printf(" Board name: %s\n", boardname);
|
||||
sboardname = boardname;
|
||||
if (!memcmp(boardname, "NES-", 4) || !memcmp(boardname, "UNL-", 4) || !memcmp(boardname, "HVC-", 4) || !memcmp(boardname, "BTL-", 4) || !memcmp(boardname, "BMC-", 4))
|
||||
sboardname += 4;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int LoadCHR(FCEUFILE *fp)
|
||||
{
|
||||
int z,t;
|
||||
z=uchead.ID[3]-'0';
|
||||
if(z<0 || z>15)
|
||||
static int LoadCHR(FCEUFILE *fp) {
|
||||
int z, t;
|
||||
z = uchead.ID[3] - '0';
|
||||
if (z < 0 || z > 15)
|
||||
return(0);
|
||||
FCEU_printf(" CHR ROM %d size: %d",z,(int) uchead.info);
|
||||
if(malloced[16+z])
|
||||
free(malloced[16+z]);
|
||||
t=FixRomSize(uchead.info,8192);
|
||||
if(!(malloced[16+z]=(uint8 *)FCEU_malloc(t)))
|
||||
FCEU_printf(" CHR ROM %d size: %d", z, (int)uchead.info);
|
||||
if (malloced[16 + z])
|
||||
free(malloced[16 + z]);
|
||||
t = FixRomSize(uchead.info, 8192);
|
||||
if (!(malloced[16 + z] = (uint8*)FCEU_malloc(t)))
|
||||
return(0);
|
||||
mallocedsizes[16+z]=t;
|
||||
memset(malloced[16+z]+uchead.info,0xFF,t-uchead.info);
|
||||
if(FCEU_fread(malloced[16+z],1,uchead.info,fp)!=uchead.info)
|
||||
{
|
||||
mallocedsizes[16 + z] = t;
|
||||
memset(malloced[16 + z] + uchead.info, 0xFF, t - uchead.info);
|
||||
if (FCEU_fread(malloced[16 + z], 1, uchead.info, fp) != uchead.info) {
|
||||
FCEU_printf("Read Error!\n");
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
} else
|
||||
FCEU_printf("\n");
|
||||
|
||||
SetupCartCHRMapping(z,malloced[16+z],t,0);
|
||||
SetupCartCHRMapping(z, malloced[16 + z], t, 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
#define BMCFLAG_FORCE4 1
|
||||
#define BMCFLAG_16KCHRR 2
|
||||
#define BMCFLAG_32KCHRR 4
|
||||
#define BMCFLAG_EXPCHRR 8
|
||||
#define BMCFLAG_EXPCHRR 8
|
||||
|
||||
static BMAPPING bmap[] = {
|
||||
|
||||
{ "11160", BMC11160_Init, 0 },
|
||||
{ "12-IN-1", BMC12IN1_Init, 0 },
|
||||
{ "13in1JY110", BMC13in1JY110_Init, 0 },
|
||||
|
@ -416,7 +394,7 @@ static BMAPPING bmap[] = {
|
|||
{ "SNROM", SNROM_Init, 0 },
|
||||
{ "SOROM", SOROM_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-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper
|
||||
{ "Sachen-8259A", S8259A_Init, 0 },
|
||||
|
@ -450,7 +428,7 @@ static BMAPPING bmap[] = {
|
|||
{ "VRC7", UNLVRC7_Init, 0 },
|
||||
{ "YOKO", UNLYOKO_Init, 0 },
|
||||
|
||||
{0,0,0}
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static BFMAPPING bfunc[] = {
|
||||
|
@ -458,79 +436,67 @@ static BFMAPPING bfunc[] = {
|
|||
{ "TVCI", TVCI },
|
||||
{ "BATR", EnableBattery },
|
||||
{ "MIRR", DoMirroring },
|
||||
{ "PRG", LoadPRG },
|
||||
{ "CHR", LoadCHR },
|
||||
{ "NAME", NAME },
|
||||
{ "PRG", LoadPRG },
|
||||
{ "CHR", LoadCHR },
|
||||
{ "NAME", NAME },
|
||||
{ "MAPR", SetBoardName },
|
||||
{ "DINF", DINF },
|
||||
{ 0, 0 }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
int LoadUNIFChunks(FCEUFILE *fp)
|
||||
{
|
||||
int LoadUNIFChunks(FCEUFILE *fp) {
|
||||
int x;
|
||||
int t;
|
||||
for(;;)
|
||||
{
|
||||
t=FCEU_fread(&uchead,1,4,fp);
|
||||
if(t<4)
|
||||
{
|
||||
if(t>0)
|
||||
for (;; ) {
|
||||
t = FCEU_fread(&uchead, 1, 4, fp);
|
||||
if (t < 4) {
|
||||
if (t > 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
if(!(FCEU_read32le(&uchead.info,fp)))
|
||||
if (!(FCEU_read32le(&uchead.info, fp)))
|
||||
return 0;
|
||||
t=0;
|
||||
x=0;
|
||||
//printf("Funky: %s\n",((uint8 *)&uchead));
|
||||
while(bfunc[x].name)
|
||||
{
|
||||
if(!memcmp(&uchead,bfunc[x].name,strlen(bfunc[x].name)))
|
||||
{
|
||||
if(!bfunc[x].init(fp))
|
||||
t = 0;
|
||||
x = 0;
|
||||
while (bfunc[x].name) {
|
||||
if (!memcmp(&uchead, bfunc[x].name, strlen(bfunc[x].name))) {
|
||||
if (!bfunc[x].init(fp))
|
||||
return 0;
|
||||
t=1;
|
||||
t = 1;
|
||||
break;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
if(!t)
|
||||
if(FCEU_fseek(fp,uchead.info,SEEK_CUR)<0)
|
||||
if (!t)
|
||||
if (FCEU_fseek(fp, uchead.info, SEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
static int InitializeBoard(void)
|
||||
{
|
||||
int x=0;
|
||||
static int InitializeBoard(void) {
|
||||
int x = 0;
|
||||
|
||||
if(!sboardname) return(0);
|
||||
if (!sboardname) return(0);
|
||||
|
||||
while(bmap[x].name)
|
||||
{
|
||||
if(!strcmp((char *)sboardname,(char *)bmap[x].name))
|
||||
{
|
||||
if(!malloced[16])
|
||||
{
|
||||
if(bmap[x].flags & BMCFLAG_16KCHRR)
|
||||
CHRRAMSize = 16384;
|
||||
else if(bmap[x].flags & BMCFLAG_32KCHRR)
|
||||
CHRRAMSize = 32768;
|
||||
else if(bmap[x].flags & BMCFLAG_EXPCHRR)
|
||||
CHRRAMSize = 128 * 1024;
|
||||
else
|
||||
CHRRAMSize = 8192;
|
||||
if((UNIFchrrama=(uint8 *)FCEU_malloc(CHRRAMSize)))
|
||||
{
|
||||
SetupCartCHRMapping(0,UNIFchrrama,CHRRAMSize,1);
|
||||
AddExState(UNIFchrrama, CHRRAMSize, 0,"CHRR");
|
||||
}
|
||||
while (bmap[x].name) {
|
||||
if (!strcmp((char*)sboardname, (char*)bmap[x].name)) {
|
||||
if (!malloced[16]) {
|
||||
if (bmap[x].flags & BMCFLAG_16KCHRR)
|
||||
CHRRAMSize = 16384;
|
||||
else if (bmap[x].flags & BMCFLAG_32KCHRR)
|
||||
CHRRAMSize = 32768;
|
||||
else if (bmap[x].flags & BMCFLAG_EXPCHRR)
|
||||
CHRRAMSize = 128 * 1024;
|
||||
else
|
||||
CHRRAMSize = 8192;
|
||||
if ((UNIFchrrama = (uint8*)FCEU_malloc(CHRRAMSize))) {
|
||||
SetupCartCHRMapping(0, UNIFchrrama, CHRRAMSize, 1);
|
||||
AddExState(UNIFchrrama, CHRRAMSize, 0, "CHRR");
|
||||
} else
|
||||
return(-1);
|
||||
}
|
||||
if(bmap[x].flags&BMCFLAG_FORCE4)
|
||||
mirrortodo=4;
|
||||
if (bmap[x].flags & BMCFLAG_FORCE4)
|
||||
mirrortodo = 4;
|
||||
MooMirroring();
|
||||
bmap[x].init(&UNIFCart);
|
||||
return(1);
|
||||
|
@ -541,48 +507,45 @@ static int InitializeBoard(void)
|
|||
return(0);
|
||||
}
|
||||
|
||||
static void UNIFGI(GI h)
|
||||
{
|
||||
switch(h)
|
||||
{
|
||||
static void UNIFGI(GI h) {
|
||||
switch (h) {
|
||||
case GI_RESETSAVE:
|
||||
FCEU_ClearGameSave(&UNIFCart);
|
||||
break;
|
||||
|
||||
case GI_RESETM2:
|
||||
if(UNIFCart.Reset)
|
||||
if (UNIFCart.Reset)
|
||||
UNIFCart.Reset();
|
||||
break;
|
||||
case GI_POWER:
|
||||
if(UNIFCart.Power)
|
||||
if (UNIFCart.Power)
|
||||
UNIFCart.Power();
|
||||
if(UNIFchrrama) memset(UNIFchrrama,0,8192);
|
||||
if (UNIFchrrama) memset(UNIFchrrama, 0, 8192);
|
||||
break;
|
||||
case GI_CLOSE:
|
||||
FCEU_SaveGameSave(&UNIFCart);
|
||||
if(UNIFCart.Close)
|
||||
if (UNIFCart.Close)
|
||||
UNIFCart.Close();
|
||||
FreeUNIF();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int UNIFLoad(const char *name, FCEUFILE *fp)
|
||||
{
|
||||
FCEU_fseek(fp,0,SEEK_SET);
|
||||
FCEU_fread(&unhead,1,4,fp);
|
||||
if(memcmp(&unhead,"UNIF",4))
|
||||
int UNIFLoad(const char *name, FCEUFILE *fp) {
|
||||
FCEU_fseek(fp, 0, SEEK_SET);
|
||||
FCEU_fread(&unhead, 1, 4, fp);
|
||||
if (memcmp(&unhead, "UNIF", 4))
|
||||
return 0;
|
||||
|
||||
ResetCartMapping();
|
||||
|
||||
ResetExState(0,0);
|
||||
ResetExState(0, 0);
|
||||
ResetUNIF();
|
||||
if(!FCEU_read32le(&unhead.info,fp))
|
||||
if (!FCEU_read32le(&unhead.info, fp))
|
||||
goto aborto;
|
||||
if(FCEU_fseek(fp,0x20,SEEK_SET)<0)
|
||||
if (FCEU_fseek(fp, 0x20, SEEK_SET) < 0)
|
||||
goto aborto;
|
||||
if(!LoadUNIFChunks(fp))
|
||||
if (!LoadUNIFChunks(fp))
|
||||
goto aborto;
|
||||
{
|
||||
int x;
|
||||
|
@ -590,29 +553,28 @@ int UNIFLoad(const char *name, FCEUFILE *fp)
|
|||
|
||||
md5_starts(&md5);
|
||||
|
||||
for(x=0;x<32;x++)
|
||||
if(malloced[x])
|
||||
{
|
||||
md5_update(&md5,malloced[x],mallocedsizes[x]);
|
||||
for (x = 0; x < 32; x++)
|
||||
if (malloced[x]) {
|
||||
md5_update(&md5, malloced[x], mallocedsizes[x]);
|
||||
}
|
||||
md5_finish(&md5,UNIFCart.MD5);
|
||||
FCEU_printf(" ROM MD5: 0x");
|
||||
for(x=0;x<16;x++)
|
||||
FCEU_printf("%02x",UNIFCart.MD5[x]);
|
||||
FCEU_printf("\n");
|
||||
memcpy(&GameInfo->MD5,&UNIFCart.MD5,sizeof(UNIFCart.MD5));
|
||||
md5_finish(&md5, UNIFCart.MD5);
|
||||
FCEU_printf(" ROM MD5: 0x");
|
||||
for (x = 0; x < 16; x++)
|
||||
FCEU_printf("%02x", UNIFCart.MD5[x]);
|
||||
FCEU_printf("\n");
|
||||
memcpy(&GameInfo->MD5, &UNIFCart.MD5, sizeof(UNIFCart.MD5));
|
||||
}
|
||||
|
||||
if(!InitializeBoard())
|
||||
if (!InitializeBoard())
|
||||
goto aborto;
|
||||
|
||||
FCEU_LoadGameSave(&UNIFCart);
|
||||
|
||||
strcpy(LoadedRomFName,name); //For the debugger list
|
||||
GameInterface=UNIFGI;
|
||||
strcpy(LoadedRomFName, name); //For the debugger list
|
||||
GameInterface = UNIFGI;
|
||||
return 1;
|
||||
|
||||
aborto:
|
||||
aborto:
|
||||
|
||||
FreeUNIF();
|
||||
ResetUNIF();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/Release
|
||||
/ipch
|
||||
/vc10_bin_Debug
|
||||
/vc10_fceux.sdf
|
||||
/vc10_fceux.vcxproj.user
|
||||
/vc10_obj_Debug
|
||||
/vc10_obj_Release
|
||||
|
|
|
@ -243,7 +243,6 @@
|
|||
<ClCompile Include="..\src\boards\156.cpp" />
|
||||
<ClCompile Include="..\src\boards\164.cpp" />
|
||||
<ClCompile Include="..\src\boards\168.cpp" />
|
||||
<ClCompile Include="..\src\boards\17.cpp" />
|
||||
<ClCompile Include="..\src\boards\170.cpp" />
|
||||
<ClCompile Include="..\src\boards\175.cpp" />
|
||||
<ClCompile Include="..\src\boards\176.cpp" />
|
||||
|
@ -287,7 +286,10 @@
|
|||
<ClCompile Include="..\src\boards\57.cpp" />
|
||||
<ClCompile Include="..\src\boards\603-5052.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\69.cpp" />
|
||||
<ClCompile Include="..\src\boards\71.cpp" />
|
||||
<ClCompile Include="..\src\boards\72.cpp" />
|
||||
<ClCompile Include="..\src\boards\77.cpp" />
|
||||
|
@ -307,6 +309,7 @@
|
|||
<ClCompile Include="..\src\boards\cityfighter.cpp" />
|
||||
<ClCompile Include="..\src\boards\dance2000.cpp" />
|
||||
<ClCompile Include="..\src\boards\famicombox.cpp" />
|
||||
<ClCompile Include="..\src\boards\ffe.cpp" />
|
||||
<ClCompile Include="..\src\boards\ks7012.cpp" />
|
||||
<ClCompile Include="..\src\boards\ks7013.cpp" />
|
||||
<ClCompile Include="..\src\boards\ks7017.cpp" />
|
||||
|
@ -317,6 +320,7 @@
|
|||
<ClCompile Include="..\src\boards\le05.cpp" />
|
||||
<ClCompile Include="..\src\boards\lh32.cpp" />
|
||||
<ClCompile Include="..\src\boards\lh53.cpp" />
|
||||
<ClCompile Include="..\src\boards\mmc2and4.cpp" />
|
||||
<ClCompile Include="..\src\boards\onebus.cpp" />
|
||||
<ClCompile Include="..\src\boards\pec-586.cpp" />
|
||||
<ClCompile Include="..\src\boards\sa-9602b.cpp" />
|
||||
|
@ -324,7 +328,9 @@
|
|||
<ClCompile Include="..\src\boards\vrc1.cpp" />
|
||||
<ClCompile Include="..\src\boards\vrc2and4.cpp" />
|
||||
<ClCompile Include="..\src\boards\vrc3.cpp" />
|
||||
<ClCompile Include="..\src\boards\vrc6.cpp" />
|
||||
<ClCompile Include="..\src\boards\vrc7.cpp" />
|
||||
<ClCompile Include="..\src\boards\vrc7p.cpp" />
|
||||
<ClCompile Include="..\src\boards\yoko.cpp" />
|
||||
<ClCompile Include="..\src\boards\__dummy_mapper.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -593,13 +599,7 @@
|
|||
<ClCompile Include="..\src\input\suborkb.cpp" />
|
||||
<ClCompile Include="..\src\input\toprider.cpp" />
|
||||
<ClCompile Include="..\src\input\zapper.cpp" />
|
||||
<ClCompile Include="..\src\mappers\24and26.cpp" />
|
||||
<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">
|
||||
<ClCompile Include="..\src\boards\emu2413.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
|
||||
|
@ -611,7 +611,6 @@
|
|||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\mappers\mmc2and4.cpp" />
|
||||
<ClCompile Include="..\src\utils\ConvertUTF.c" />
|
||||
<ClCompile Include="..\src\utils\crc32.cpp">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
|
@ -826,8 +825,7 @@
|
|||
<ClInclude Include="..\src\x6502struct.h" />
|
||||
<ClInclude Include="..\src\input\share.h" />
|
||||
<ClInclude Include="..\src\input\suborkb.h" />
|
||||
<ClInclude Include="..\src\mappers\emu2413.h" />
|
||||
<ClInclude Include="..\src\mappers\mapinc.h" />
|
||||
<ClInclude Include="..\src\boards\emu2413.h" />
|
||||
<ClInclude Include="..\src\utils\ConvertUTF.h" />
|
||||
<ClInclude Include="..\src\utils\crc32.h" />
|
||||
<ClInclude Include="..\src\utils\endian.h" />
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
<Filter Include="input">
|
||||
<UniqueIdentifier>{5f356733-cee3-4440-aa40-cf138dcfbd8c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="mappers">
|
||||
<UniqueIdentifier>{13cb7bca-c196-4896-b88a-581e99d86457}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="palettes">
|
||||
<UniqueIdentifier>{2a047eb3-7b56-41d4-b228-5df54bc1809d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -635,29 +632,8 @@
|
|||
<ClCompile Include="..\src\lua\src\print.c">
|
||||
<Filter>drivers\win\lua</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\mappers\24and26.cpp">
|
||||
<Filter>mappers</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 Include="..\src\boards\emu2413.c">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\movie.cpp" />
|
||||
<ClCompile Include="..\src\netplay.cpp" />
|
||||
|
@ -784,9 +760,6 @@
|
|||
<ClCompile Include="..\src\boards\12in1.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\boards\17.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\boards\18.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</ClCompile>
|
||||
|
@ -961,6 +934,27 @@
|
|||
<ClCompile Include="..\src\boards\09-034a.cpp">
|
||||
<Filter>boards</Filter>
|
||||
</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>
|
||||
<ClInclude Include="..\src\cart.h">
|
||||
|
@ -1281,12 +1275,6 @@
|
|||
<ClInclude Include="..\src\lua\src\lzio.h">
|
||||
<Filter>drivers\win\lua</Filter>
|
||||
</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">
|
||||
<Filter>include files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1456,6 +1444,9 @@
|
|||
<ClInclude Include="..\src\drivers\win\taseditor\laglog.h">
|
||||
<Filter>drivers\win\taseditor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\boards\emu2413.h">
|
||||
<Filter>include files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\src\drivers\win\res.rc">
|
||||
|
|
Loading…
Reference in New Issue