UNIF DSOUNDV1 - removed due to duplicate of 178 mapper

mapper 178 - added more features of 8/16M carts with 32K SRAM
UNIF 09-034A - added support for a new SMB2j Lite version
This commit is contained in:
CaH4e3 2013-03-16 20:16:14 +00:00
parent bc5d937ca4
commit 031972adb7
13 changed files with 166 additions and 232 deletions

View File

@ -4,7 +4,10 @@
/disksys.rom
/fceux.cfg
/fceux.chm
/fceux.chw
/fceux.exe
/fceux.exp
/fceux.lib
/fceux.pdb
/fcs
/movies

View File

@ -19,11 +19,13 @@
*
* FDS Conversions
*
* Super Mario Bros 2 J alt version is a BAD incomplete dump, should be mapper 43
* Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
*
* Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
* some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
* have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
*
* Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
*
* PCB for this mapper is "09-034A"
*/
@ -31,9 +33,12 @@
#include "mapinc.h"
static uint8 prg;
static uint32 IRQCount, IRQa;
static SFORMAT StateRegs[] =
{
{ &IRQCount, 4, "IRQC" },
{ &IRQa, 4, "IRQA" },
{ &prg, 1, "PRG" },
{ 0 }
};
@ -44,16 +49,40 @@ static void Sync(void) {
setchr8(0);
}
static DECLFW(UNLSMB2JWrite) {
static DECLFW(UNLSMB2JWrite1) {
prg = V & 1;
Sync();
}
static DECLFW(UNLSMB2JWrite2) {
IRQa = V & 1;
IRQCount = 0;
X6502_IRQEnd(FCEU_IQEXT);
}
static DECLFR(UNLSMB2JRead) {
return 0xFF;
}
static void UNLSMB2JPower(void) {
prg = 0;
Sync();
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite);
SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
}
static void UNLSMB2JIRQHook(int a) {
if (IRQa)
{
if (IRQCount < 5750) // completely by guess
IRQCount += a;
else {
IRQa = 0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void StateRestore(int version) {
@ -62,6 +91,7 @@ static void StateRestore(int version) {
void UNLSMB2J_Init(CartInfo *info) {
info->Power = UNLSMB2JPower;
MapIRQHook = UNLSMB2JIRQHook;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -1,7 +1,7 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
* Copyright (C) 2013 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
@ -16,49 +16,133 @@
* 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
*
* DSOUNDV1/FL-TR8MA boards (32K WRAM, 8/16M), 178 mapper boards (8K WRAM, 4/8M)
* Various Education Cartridges
*
*/
#include "mapinc.h"
static uint8 reg[4];
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
// SND Registers
static uint8 pcm_enable = 0;
static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6;
static writefunc pcmwrite;
static SFORMAT StateRegs[] =
{
{ reg, 4, "REGS" },
{ 0 }
};
static void Sync(void) {
uint8 bank = (reg[2] & 3) << 3;
setmirror((reg[0] & 1) ^ 1);
setprg8r(0x10, 0x6000, 0);
setchr8(0);
if (reg[0] & 2) {
setprg16(0x8000, (reg[1] & 7) | bank);
setprg16(0xC000, ((~0) & 7) | bank);
} else {
setprg16(0x8000, (reg[1] & 6) | bank);
setprg16(0xC000, (reg[1] & 6) | bank | 1);
static int16 step_size[49] = {
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
}; //49 items
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
//decode stuff
static int32 jedi_table[16 * 49];
static int32 acc = 0; //ADPCM accumulator, initial condition must be 0
static int32 decstep = 0; //ADPCM decoding step, initial condition must be 0
static void jedi_table_init() {
int step, nib;
for (step = 0; step < 49; step++) {
for (nib = 0; nib < 16; nib++) {
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
}
}
}
static uint8 decode(uint8 code) {
acc += jedi_table[decstep + code];
if ((acc & ~0x7ff) != 0) // acc is > 2047
acc |= ~0xfff;
else acc &= 0xfff;
decstep += step_adj[code & 7] * 16;
if (decstep < 0) decstep = 0;
if (decstep > 48 * 16) decstep = 48 * 16;
return (acc >> 8) & 0xff;
}
static void Sync(void) {
uint32 sbank = reg[1] & 0x7;
uint32 bbank = reg[2];
setchr8(0);
setprg8r(0x10, 0x6000, reg[3] & 3);
if (reg[0] & 2) { // UNROM mode
setprg16(0x8000, (bbank << 3) | sbank);
if (reg[0] & 4)
setprg16(0xC000, (bbank << 3) | 6 | (reg[1] & 1));
else
setprg16(0xC000, (bbank << 3) | 7);
} else { // NROM mode
uint32 bank = (bbank << 3) | sbank;
if (reg[0] & 4) {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
} else
setprg32(0x8000, bank >> 1);
}
setmirror((reg[0] & 1) ^ 1);
}
static DECLFW(M178Write) {
reg[A & 3] = V;
// FCEU_printf("cmd %04x:%02x\n", A, V);
Sync();
}
static DECLFW(M178WriteSnd) {
if (A == 0x5800) {
if (V & 0xF0) {
pcm_enable = 1;
// pcmwrite(0x4011, (V & 0xF) << 3);
pcmwrite(0x4011, decode(V & 0xf));
} else
pcm_enable = 0;
} else
FCEU_printf("misc %04x:%02x\n", A, V);
}
static DECLFR(M178ReadSnd) {
if (A == 0x5800)
return (X.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
else
return X.DB;
}
static void M178Power(void) {
reg[0] = 1;
reg[1] = 0;
reg[2] = 0;
reg[3] = 0;
reg[0] = reg[1] = reg[2] = reg[3] = 0;
Sync();
SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x4800, 0x4803, M178Write);
pcmwrite = GetWriteHandler(0x4011);
SetWriteHandler(0x4800, 0x4fff, M178Write);
SetWriteHandler(0x5800, 0x5fff, M178WriteSnd);
SetReadHandler(0x5800, 0x5fff, M178ReadSnd);
SetReadHandler(0x6000, 0x7fff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR);
}
static void M178SndClk(int a) {
if (pcm_enable) {
pcm_latch -= a;
if (pcm_latch <= 0) {
pcm_latch += pcm_clock;
pcm_enable = 0;
}
}
}
static void M178Close(void) {
@ -67,7 +151,6 @@ static void M178Close(void) {
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
@ -76,8 +159,11 @@ void Mapper178_Init(CartInfo *info) {
info->Power = M178Power;
info->Close = M178Close;
GameStateRestore = StateRestore;
MapIRQHook = M178SndClk;
WRAMSIZE = 8192;
jedi_table_init();
WRAMSIZE = 32768;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
if (info->battery) {

View File

@ -1,175 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2013 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 reg[4];
static uint8 *WRAM = NULL;
static uint32 WRAMSIZE;
// SND Registers
static uint8 pcm_enable = 0;
static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6;
static writefunc pcmwrite;
static SFORMAT StateRegs[] =
{
{ reg, 4, "REGS" },
{ 0 }
};
static int16 step_size[49] = {
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
}; //49 items
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
//decode stuff
static int32 jedi_table[16 * 49];
static int32 acc = 0; //ADPCM accumulator, initial condition must be 0
static int32 decstep = 0; //ADPCM decoding step, initial condition must be 0
static void jedi_table_init()
{
int step, nib;
for (step = 0; step < 49; step++)
{
for (nib = 0; nib < 16; nib++)
{
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
}
}
}
static uint8 decode(uint8 code)
{
acc += jedi_table[decstep + code];
if ((acc & ~0x7ff) != 0) // acc is > 2047
acc |= ~0xfff;
else acc &= 0xfff;
decstep += step_adj[code & 7] * 16;
if (decstep < 0) decstep = 0;
if (decstep > 48 * 16) decstep = 48 * 16;
return (acc >> 8) & 0xff;
}
static void Sync(void) {
uint32 sbank = reg[1] & 0x7;
uint32 bbank = reg[2];
setchr8(0);
setprg8r(0x10, 0x6000, reg[3] & 3);
if(reg[0] & 2) { // UNROM mode
setprg16(0x8000, (bbank << 3) | sbank);
if(reg[0] & 4)
setprg16(0xC000, (bbank << 3) | 6 | (reg[1] & 1));
else
setprg16(0xC000, (bbank << 3) | 7);
} else { // NROM mode
uint32 bank = (bbank << 3) | sbank;
if(reg[0] & 4) {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
} else
setprg32(0x8000, bank >> 1);
}
setmirror((reg[0] & 1) ^ 1);
}
static DECLFW(UNLDSOUNDV1Write) {
reg[A & 3] = V;
// FCEU_printf("cmd %04x:%02x\n", A, V);
Sync();
}
static DECLFW(UNLDSOUNDV1WriteSnd) {
if(A == 0x5800) {
if(V & 0xF0) {
pcm_enable = 1;
// pcmwrite(0x4011, (V & 0xF) << 3);
pcmwrite(0x4011, decode(V & 0xf));
} else
pcm_enable = 0;
} else
FCEU_printf("misc %04x:%02x\n", A, V);
}
static DECLFR(UNLDSOUNDV1ReadSnd) {
if(A == 0x5800)
return (X.DB & 0xBF) | ((pcm_enable ^ 1) <<6);
else
return X.DB;
}
static void UNLDSOUNDV1Power(void) {
reg[0] = reg[1] = reg[2] = reg[3] = 0;
Sync();
pcmwrite = GetWriteHandler(0x4011);
SetWriteHandler(0x4800, 0x4fff, UNLDSOUNDV1Write);
SetWriteHandler(0x5800, 0x5fff, UNLDSOUNDV1WriteSnd);
SetReadHandler(0x5800, 0x5fff, UNLDSOUNDV1ReadSnd);
SetReadHandler(0x6000, 0x7fff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR);
}
static void UNLDSOUNDV1SndClk(int a) {
if (pcm_enable) {
pcm_latch -= a;
if (pcm_latch <= 0) {
pcm_latch += pcm_clock;
pcm_enable = 0;
}
}
}
static void UNLDSOUNDV1Close(void) {
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
}
static void StateRestore(int version) {
Sync();
}
void UNLDSOUNDV1_Init(CartInfo *info) {
info->Power = UNLDSOUNDV1Power;
info->Close = UNLDSOUNDV1Close;
GameStateRestore = StateRestore;
MapIRQHook = UNLDSOUNDV1SndClk;
jedi_table_init();
WRAMSIZE = 32768;
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);
}

View File

@ -533,11 +533,11 @@ static BMAPPINGLocal bmap[] = {
{"JALECO JF-13", 86, Mapper86_Init},
{"74*139/74 DISCRETE", 87, Mapper87_Init},
{"NAMCO 3433", 88, Mapper88_Init},
{"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper
{"SUNSOFT-3", 89, Mapper89_Init}, // SUNSOFT-2 mapper
{"HUMMER/JY BOARD", 90, Mapper90_Init},
{"EARLY HUMMER/JY BOARD",91, Mapper91_Init},
{"JALECO JF-19", 92, Mapper92_Init},
{"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init}, // SUNSOFT-2 mapper with VRAM, different wiring
{"SUNSOFT-3R", 93, SUNSOFT_UNROM_Init},// SUNSOFT-2 mapper with VRAM, different wiring
{"HVC-UN1ROM", 94, Mapper94_Init},
{"NAMCOT 108 Rev. B", 95, Mapper95_Init},
{"BANDAI OEKAKIDS", 96, Mapper96_Init},
@ -620,7 +620,7 @@ static BMAPPINGLocal bmap[] = {
{"", 173, Mapper173_Init},
// {"", 174, Mapper174_Init},
{"", 175, Mapper175_Init},
{"BMCFK23C", 176, BMCFK23C_Init}, //zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it.
{"BMCFK23C", 176, BMCFK23C_Init}, // zero 26-may-2012 - well, i have some WXN junk games that use 176 for instance ????. i dont know what game uses this BMCFK23C as mapper 176. we'll have to make a note when we find it.
{"", 177, Mapper177_Init},
{"", 178, Mapper178_Init},
// {"", 179, Mapper179_Init},
@ -756,7 +756,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
memset(VROM, 0xFF, VROM_size << 13);
}
if (head.ROM_type & 4) { /* Trainer */
if (head.ROM_type & 4) { /* Trainer */
trainerpoo = (uint8*)FCEU_gmalloc(512);
FCEU_fread(trainerpoo, 512, 1, fp);
}

View File

@ -122,8 +122,9 @@ static void MooMirroring(void) {
}
static int DoMirroring(FCEUFILE *fp) {
uint8 t, i;
if(uchead.info == 1) {
int t;
uint32 i;
if (uchead.info == 1) {
if ((t = FCEU_fgetc(fp)) == EOF)
return(0);
mirrortodo = t;
@ -134,7 +135,7 @@ static int DoMirroring(FCEUFILE *fp) {
}
} else {
FCEU_printf(" Incorrect Mirroring Chunk Size (%d). Data is:", uchead.info);
for(i = 0; i < uchead.info; i++) {
for (i = 0; i < uchead.info; i++) {
if ((t = FCEU_fgetc(fp)) == EOF)
return(0);
FCEU_printf(" %02x", t);
@ -192,15 +193,16 @@ static int DINF(FCEUFILE *fp) {
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) {
int t, i;
if(uchead.info == 1) {
int t;
uint32 i;
if (uchead.info == 1) {
if ((t = FCEU_fgetc(fp)) == EOF)
return(0);
/* The information stored in this byte isn't very helpful, but it's
@ -215,8 +217,7 @@ static int CTRL(FCEUFILE *fp) {
GameInfo->input[1] = SI_ZAPPER;
} else {
FCEU_printf(" Incorrect Control Chunk Size (%d). Data is:", uchead.info);
for(i = 0; i < (int)uchead.info; i++)
{
for (i = 0; i < uchead.info; i++) {
t = FCEU_fgetc(fp);
FCEU_printf(" %02x", t);
}
@ -346,10 +347,9 @@ static BMAPPING bmap[] = {
{ "CNROM", CNROM_Init, 0 },
{ "CPROM", CPROM_Init, BMCFLAG_16KCHRR },
{ "D1038", BMCD1038_Init, 0 },
{ "DANCE", UNLOneBus_Init, 0 }, // redundant
{ "DANCE", UNLOneBus_Init, 0 }, // redundant
{ "DANCE2000", UNLD2000_Init, 0 },
{ "DREAMTECH01", DreamTech01_Init, 0 },
{ "DSOUNDV1", UNLDSOUNDV1_Init, 0 },
{ "EDU2000", UNLEDU2000_Init, 0 },
{ "EKROM", EKROM_Init, 0 },
{ "ELROM", ELROM_Init, 0 },
@ -418,9 +418,9 @@ static BMAPPING bmap[] = {
{ "SNROM", SNROM_Init, 0 },
{ "SOROM", SOROM_Init, 0 },
{ "SSS-NROM-256", SSSNROM_Init, 0 },
{ "SUNSOFT_UNROM", SUNSOFT_UNROM_Init, 0 }, // fix me, real pcb name, real pcb type
{ "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-74LS374NA", S74LS374NA_Init, 0 }, //seems to be custom mapper
{ "Sachen-8259A", S8259A_Init, 0 },
{ "Sachen-8259B", S8259B_Init, 0 },
{ "Sachen-8259C", S8259C_Init, 0 },

View File

@ -105,7 +105,6 @@ void TSROM_Init(CartInfo *info);
void Transformer_Init(CartInfo *info);
void UNL22211_Init(CartInfo *info);
void UNL3DBlock_Init(CartInfo *info);
void UNLDSOUNDV1_Init(CartInfo *info);
void UNL43272_Init(CartInfo *info);
void UNL6035052_Init(CartInfo *info);
void UNL8157_Init(CartInfo *info);

2
trunk/vc/.gitignore vendored
View File

@ -11,3 +11,5 @@
/vc9_fceux.vcproj.CaH4.CaH4e3.user
/vc9_obj_Debug
/vc9_obj_Release
/vc10_fceux.suo
/vc10_fceux.opensdf

1
trunk/vc/userconfig/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/svnrev.h

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -308,7 +308,6 @@
<ClCompile Include="..\src\boards\bb.cpp" />
<ClCompile Include="..\src\boards\cityfighter.cpp" />
<ClCompile Include="..\src\boards\dance2000.cpp" />
<ClCompile Include="..\src\boards\dsoundv1.cpp" />
<ClCompile Include="..\src\boards\famicombox.cpp" />
<ClCompile Include="..\src\boards\ffe.cpp" />
<ClCompile Include="..\src\boards\ks7012.cpp" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="boards">
@ -952,9 +952,6 @@
<ClCompile Include="..\src\boards\vrc6.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\boards\dsoundv1.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\utils\ioapi.cpp">
<Filter>utils</Filter>
</ClCompile>

View File

@ -979,10 +979,6 @@
RelativePath="..\src\boards\dream.cpp"
>
</File>
<File
RelativePath="..\src\boards\dsoundv1.cpp"
>
</File>
<File
RelativePath="..\src\boards\edu2000.cpp"
>

View File

@ -753,11 +753,7 @@
RelativePath="..\src\boards\dream.cpp"
>
</File>
<File
RelativePath="..\src\boards\dsoundv1.cpp"
>
</File>
<File
 <File
RelativePath="..\src\boards\edu2000.cpp"
>
</File>