Merge pull request #21 from Oggom/master

Backport changes from main repo...
This commit is contained in:
Twinaphex
2015-06-28 12:32:22 +02:00
52 changed files with 536 additions and 366 deletions

View File

@@ -1,7 +1,7 @@
[Project] [Project]
FileName=Fceuwin.dev FileName=Fceuwin.dev
Name=Fceu Name=Fceu
UnitCount=297 UnitCount=298
Type=0 Type=0
Ver=1 Ver=1
ObjFiles= ObjFiles=
@@ -2297,18 +2297,8 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit260]
FileName=src\boards\addrlatch.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit266] [Unit266]
FileName=src\boards\246.c FileName=src\boards\32.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
Compile=1 Compile=1
@@ -2318,9 +2308,9 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit270] [Unit270]
FileName=src\boards\40.c FileName=src\boards\41.c
CompileCpp=0 CompileCpp=0
Folder=boards/fds conversions Folder=boards/multigame boards
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@@ -2328,16 +2318,6 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit272] [Unit272]
FileName=src\boards\42.c
CompileCpp=0
Folder=boards/fds conversions
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit273]
FileName=src\boards\46.c FileName=src\boards\46.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards/multigame boards
@@ -2347,107 +2327,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit275] [Unit273]
FileName=src\boards\51.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit276]
FileName=src\boards\62.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit277]
FileName=src\boards\80.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit278]
FileName=src\boards\79.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit279]
FileName=src\boards\77.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit280]
FileName=src\boards\vrc1.c
CompileCpp=0
Folder=boards/vrc based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit281]
FileName=src\boards\vrc3.c
CompileCpp=0
Folder=boards/vrc based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit282]
FileName=src\boards\72.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit284]
FileName=src\boards\36.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit285]
FileName=src\boards\65.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit274]
FileName=src\boards\50.c FileName=src\boards\50.c
CompileCpp=0 CompileCpp=0
Folder=boards/fds conversions Folder=boards/fds conversions
@@ -2457,7 +2337,77 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit283] [Unit275]
FileName=src\boards\62.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit276]
FileName=src\boards\80.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit277]
FileName=src\boards\79.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit278]
FileName=src\boards\77.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit279]
FileName=src\boards\vrc1.c
CompileCpp=0
Folder=boards/vrc based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit280]
FileName=src\boards\vrc3.c
CompileCpp=0
Folder=boards/vrc based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit281]
FileName=src\boards\72.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit282]
FileName=src\boards\71.c FileName=src\boards\71.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
@@ -2467,6 +2417,46 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit284]
FileName=src\boards\65.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit285]
FileName=src\boards\67.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit274]
FileName=src\boards\51.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit283]
FileName=src\boards\36.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit23] [Unit23]
FileName=src\video.c FileName=src\video.c
CompileCpp=0 CompileCpp=0
@@ -2488,16 +2478,6 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit261] [Unit261]
FileName=src\boards\228.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit262]
FileName=src\boards\230.c FileName=src\boards\230.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards/multigame boards
@@ -2507,8 +2487,8 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit264] [Unit262]
FileName=src\boards\234.c FileName=src\boards\232.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards/multigame boards
Compile=1 Compile=1
@@ -2517,7 +2497,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit265] [Unit264]
FileName=src\boards\244.c FileName=src\boards\244.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
@@ -2527,8 +2507,8 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit267] [Unit265]
FileName=src\boards\32.c FileName=src\boards\246.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
Compile=1 Compile=1
@@ -2537,7 +2517,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit268] [Unit267]
FileName=src\boards\33.c FileName=src\boards\33.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
@@ -2547,7 +2527,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit269] [Unit268]
FileName=src\boards\252.c FileName=src\boards\252.c
CompileCpp=0 CompileCpp=0
Folder=boards/vrc based Folder=boards/vrc based
@@ -2557,10 +2537,20 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit271] [Unit269]
FileName=src\boards\41.c FileName=src\boards\40.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards/fds conversions
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit271]
FileName=src\boards\42.c
CompileCpp=0
Folder=boards/fds conversions
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@@ -2568,7 +2558,7 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit263] [Unit263]
FileName=src\boards\232.c FileName=src\boards\234.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards/multigame boards
Compile=1 Compile=1
@@ -2588,16 +2578,6 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit287] [Unit287]
FileName=src\boards\vrc6.c
CompileCpp=0
Folder=boards/vrc based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit288]
FileName=src\boards\mmc2and4.c FileName=src\boards\mmc2and4.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
@@ -2607,7 +2587,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit289] [Unit288]
FileName=src\boards\69.c FileName=src\boards\69.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards
@@ -2617,7 +2597,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit290] [Unit289]
FileName=src\boards\vrc7.c FileName=src\boards\vrc7.c
CompileCpp=0 CompileCpp=0
Folder=boards/vrc based Folder=boards/vrc based
@@ -2627,7 +2607,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit291] [Unit290]
FileName=src\boards\emu2413.c FileName=src\boards\emu2413.c
CompileCpp=0 CompileCpp=0
Folder=boards/vrc based Folder=boards/vrc based
@@ -2637,7 +2617,7 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit292] [Unit291]
FileName=src\boards\mapinc.h FileName=src\boards\mapinc.h
CompileCpp=0 CompileCpp=0
Folder=_Headers Folder=_Headers
@@ -2647,8 +2627,18 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit292]
FileName=src\boards\emu2413.h
CompileCpp=0
Folder=_Headers
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit297] [Unit297]
FileName=src\boards\158B.c FileName=src\boards\BMW8544.c
CompileCpp=0 CompileCpp=0
Folder=boards/mmc3 based Folder=boards/mmc3 based
Compile=1 Compile=1
@@ -2657,20 +2647,10 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit298]
FileName=src\boards\addrlatch.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit286] [Unit286]
FileName=src\boards\67.c FileName=src\boards\vrc6.c
CompileCpp=0 CompileCpp=0
Folder=boards Folder=boards/vrc based
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@@ -3088,9 +3068,9 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit293] [Unit293]
FileName=src\boards\emu2413.h FileName=src\boards\178.c
CompileCpp=0 CompileCpp=0
Folder=_Headers Folder=boards/multigame boards
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@@ -3098,9 +3078,9 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit294] [Unit294]
FileName=src\boards\178.c FileName=src\boards\mihunche.c
CompileCpp=0 CompileCpp=0
Folder=boards/multigame boards Folder=boards
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@@ -3158,16 +3138,6 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit295] [Unit295]
FileName=src\boards\mihunche.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit296]
FileName=src\boards\coolboy.c FileName=src\boards\coolboy.c
CompileCpp=0 CompileCpp=0
Folder=boards/mmc3 based Folder=boards/mmc3 based
@@ -3177,3 +3147,33 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit296]
FileName=src\boards\158B.c
CompileCpp=0
Folder=boards/mmc3 based
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit298]
FileName=src\boards\addrlatch.c
CompileCpp=0
Folder=boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit260]
FileName=src\boards\228.c
CompileCpp=0
Folder=boards/multigame boards
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@@ -72,6 +72,7 @@ static void M112Power(void) {
SetWriteHandler(0x4020, 0x5FFF, M112Write); SetWriteHandler(0x4020, 0x5FFF, M112Write);
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(8, 0x6000, WRAM);
} }
static void StateRestore(int version) { static void StateRestore(int version) {

View File

@@ -76,6 +76,7 @@ static void M15Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, M15Write); SetWriteHandler(0x8000, 0xFFFF, M15Write);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
Sync(); Sync();
} }
@@ -99,7 +100,6 @@ void Mapper15_Init(CartInfo *info) {
WRAMSIZE = 8192; WRAMSIZE = 8192;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
if (info->battery) { if (info->battery) {
info->SaveGame[0] = WRAM; info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE; info->SaveGameLen[0] = WRAMSIZE;

View File

@@ -92,6 +92,7 @@ static void M156Power(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0xC000, 0xCFFF, M156Write); SetWriteHandler(0xC000, 0xCFFF, M156Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M156Close(void) { static void M156Close(void) {

View File

@@ -397,6 +397,7 @@ static void Power(void) {
SetWriteHandler(0x5000, 0x5FFF, Write); SetWriteHandler(0x5000, 0x5FFF, Write);
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
WSync(); WSync();
} }
@@ -450,6 +451,7 @@ static void Power2(void) {
SetWriteHandler(0x5000, 0x5FFF, Write2); SetWriteHandler(0x5000, 0x5FFF, Write2);
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
WSync(); WSync();
} }
@@ -503,6 +505,7 @@ static void Power3(void) {
SetWriteHandler(0x5000, 0x5FFF, Write3); SetWriteHandler(0x5000, 0x5FFF, Write3);
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
WSync(); WSync();
} }

View File

@@ -50,6 +50,7 @@ static void M177Power(void) {
SetWriteHandler(0x6000, 0x7fff, CartBW); SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M177Write); SetWriteHandler(0x8000, 0xFFFF, M177Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M177Close(void) { static void M177Close(void) {

View File

@@ -133,6 +133,7 @@ static void M178Power(void) {
SetReadHandler(0x6000, 0x7fff, CartBR); SetReadHandler(0x6000, 0x7fff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW); SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR); SetReadHandler(0x8000, 0xffff, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M178SndClk(int a) { static void M178SndClk(int a) {

View File

@@ -89,6 +89,7 @@ static void M18Power(void) {
SetWriteHandler(0x8000, 0x9FFF, M18WritePrg); SetWriteHandler(0x8000, 0x9FFF, M18WritePrg);
SetWriteHandler(0xA000, 0xDFFF, M18WriteChr); SetWriteHandler(0xA000, 0xDFFF, M18WriteChr);
SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ); SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void FP_FASTAPASS(1) M18IRQHook(int a) { static void FP_FASTAPASS(1) M18IRQHook(int a) {

View File

@@ -69,6 +69,7 @@ static void M186Power(void) {
SetWriteHandler(0x4200, 0x43FF, M186Write); SetWriteHandler(0x4200, 0x43FF, M186Write);
SetReadHandler(0x4400, 0x4FFF, ASWRAM); SetReadHandler(0x4400, 0x4FFF, ASWRAM);
SetWriteHandler(0x4400, 0x4FFF, BSWRAM); SetWriteHandler(0x4400, 0x4FFF, BSWRAM);
FCEU_CheatAddRAM(32, 0x6000, WRAM);
regs[0] = regs[1] = regs[2] = regs[3]; regs[0] = regs[1] = regs[2] = regs[3];
Sync(); Sync();
} }

View File

@@ -61,6 +61,7 @@ static DECLFW(M228Write) {
static void M228Reset(void) { static void M228Reset(void) {
areg = 0x8000; areg = 0x8000;
vreg = 0; vreg = 0;
memset(mram, 0, sizeof(mram));
Sync(); Sync();
} }

View File

@@ -54,6 +54,7 @@ static void M246Power(void) {
SetReadHandler(0x6800, 0x6FFF, CartBR); SetReadHandler(0x6800, 0x6FFF, CartBR);
SetWriteHandler(0x6800, 0x6FFF, CartBW); SetWriteHandler(0x6800, 0x6FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M246Close(void) { static void M246Close(void) {

View File

@@ -80,6 +80,7 @@ static void M252Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M252Write); SetWriteHandler(0x8000, 0xFFFF, M252Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M252IRQ(int a) { static void M252IRQ(int a) {

View File

@@ -96,6 +96,7 @@ static void M253Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M253Write); SetWriteHandler(0x8000, 0xFFFF, M253Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M253Close(void) { static void M253Close(void) {

View File

@@ -75,6 +75,7 @@ static void M32Power(void) {
SetWriteHandler(0x9000, 0x9FFF, M32Write1); SetWriteHandler(0x9000, 0x9FFF, M32Write1);
SetWriteHandler(0xA000, 0xAFFF, M32Write2); SetWriteHandler(0xA000, 0xAFFF, M32Write2);
SetWriteHandler(0xB000, 0xBFFF, M32Write3); SetWriteHandler(0xB000, 0xBFFF, M32Write3);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M32Close(void) { static void M32Close(void) {

View File

@@ -66,6 +66,7 @@ static void M34Power(void) {
SetWriteHandler(0x6000, 0x7ffc, CartBW); SetWriteHandler(0x6000, 0x7ffc, CartBW);
SetReadHandler(0x8000, 0xffff, CartBR); SetReadHandler(0x8000, 0xffff, CartBR);
SetWriteHandler(0x7ffd, 0xffff, M34Write); SetWriteHandler(0x7ffd, 0xffff, M34Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M34Close(void) { static void M34Close(void) {

View File

@@ -134,6 +134,7 @@ static void M68Power(void) {
SetWriteHandler(0xF000, 0xFFFF, M68WriteROM); SetWriteHandler(0xF000, 0xFFFF, M68WriteROM);
SetWriteHandler(0x6000, 0x6000, M68WriteLo); SetWriteHandler(0x6000, 0x6000, M68WriteLo);
SetWriteHandler(0x6001, 0x7FFF, CartBW); SetWriteHandler(0x6001, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M68Close(void) { static void M68Close(void) {

View File

@@ -2,6 +2,7 @@
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2012 CaH4e3 * Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -166,7 +167,7 @@ static void DoAYSQ(int x) {
} }
static void DoAYSQHQ(int x) { static void DoAYSQHQ(int x) {
int32 V; uint32 V;
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4; int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4;
int32 amp = (sreg[0x8 + x] & 15) << 6; int32 amp = (sreg[0x8 + x] & 15) << 6;
@@ -231,6 +232,7 @@ static void M69Power(void) {
SetWriteHandler(0xA000, 0xBFFF, M69Write1); SetWriteHandler(0xA000, 0xBFFF, M69Write1);
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0); SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1); SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M69Close(void) { static void M69Close(void) {

View File

@@ -2,6 +2,7 @@
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2012 CaH4e3 * Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -2,6 +2,7 @@
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2012 CaH4e3 * Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -68,6 +68,7 @@ static void M82Power(void) {
SetReadHandler(0x6000, 0xffff, CartBR); SetReadHandler(0x6000, 0xffff, CartBR);
SetWriteHandler(0x6000, 0x7fff, CartBW); SetWriteHandler(0x6000, 0x7fff, CartBW);
SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M82Close(void) { static void M82Close(void) {

View File

@@ -51,6 +51,7 @@ static void M99Power(void) {
SetWriteHandler(0x4016, 0x4016, M99Write); SetWriteHandler(0x4016, 0x4016, M99Write);
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M99Close(void) { static void M99Close(void) {

79
src/boards/BMW8544.c Normal file
View File

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

View File

@@ -54,6 +54,7 @@ static void UNLKS7012Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, UNLKS7012Write); SetWriteHandler(0x8000, 0xFFFF, UNLKS7012Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void UNLKS7012Reset(void) { static void UNLKS7012Reset(void) {

View File

@@ -87,6 +87,7 @@ static void UNLKS7017Power(void) {
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0x4030, 0x4030, FDSRead4030); SetReadHandler(0x4030, 0x4030, FDSRead4030);
SetWriteHandler(0x4020, 0x5FFF, UNLKS7017Write); SetWriteHandler(0x4020, 0x5FFF, UNLKS7017Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void UNLKS7017Close(void) { static void UNLKS7017Close(void) {

View File

@@ -82,6 +82,7 @@ static void LH10Power(void) {
SetWriteHandler(0x8000, 0xBFFF, UNLKS7037Write); SetWriteHandler(0x8000, 0xBFFF, UNLKS7037Write);
SetWriteHandler(0xC000, 0xDFFF, CartBW); SetWriteHandler(0xC000, 0xDFFF, CartBW);
SetWriteHandler(0xE000, 0xFFFF, UNLKS7037Write); SetWriteHandler(0xE000, 0xFFFF, UNLKS7037Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void Close(void) { static void Close(void) {

View File

@@ -44,6 +44,7 @@ static void LatchPower(void) {
if (WRAM) { if (WRAM) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} else } else
SetReadHandler(0x6000, 0xFFFF, defread); SetReadHandler(0x6000, 0xFFFF, defread);
SetWriteHandler(addrreg0, addrreg1, LatchWrite); SetWriteHandler(addrreg0, addrreg1, LatchWrite);

View File

@@ -2,6 +2,7 @@
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2007 CaH4e3 * Copyright (C) 2007 CaH4e3
* Copyright (C) 2011 FCEUX team
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -269,6 +270,7 @@ static void M153Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, BandaiWrite); SetWriteHandler(0x8000, 0xFFFF, BandaiWrite);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }

View File

@@ -1,4 +1,4 @@
/* FCE Ultra - NES/Famicom Emulator /* FCE Ultra - NES/Famicom Emulator
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2015 CaH4e3 * Copyright (C) 2015 CaH4e3
@@ -45,12 +45,9 @@ static void COOLBOYCW(uint32 A, uint8 V) {
} }
static void COOLBOYPW(uint32 A, uint8 V) { static void COOLBOYPW(uint32 A, uint8 V) {
uint32 mask, shift; uint32 mask = 0x3F;
uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2); uint32 base = ((EXPREGS[0] & 0x07) >> 0) | ((EXPREGS[1] & 0x10) >> 1) | ((EXPREGS[1] & 0x0C) << 2) | ((EXPREGS[0] & 0x30) << 2);
switch(EXPREGS[0] & 0xC0) { switch(EXPREGS[0] & 0xC0) {
case 0x00:
mask = 0x3F;
break;
case 0x80: case 0x80:
mask = 0x1F; mask = 0x1F;
break; break;

View File

@@ -70,6 +70,7 @@ static void UNLD2000Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, UNLD2000Read); SetReadHandler(0x8000, 0xFFFF, UNLD2000Read);
SetWriteHandler(0x5000, 0x5FFF, UNLD2000Write); SetWriteHandler(0x5000, 0x5FFF, UNLD2000Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void FP_FASTAPASS(1) UNL2000Hook(uint32 A) { static void FP_FASTAPASS(1) UNL2000Hook(uint32 A) {

View File

@@ -19,6 +19,7 @@
*/ */
#include "mapinc.h" #include "mapinc.h"
#include "../ines.h"
static uint8 latche, latcheinit, bus_conflict; static uint8 latche, latcheinit, bus_conflict;
static uint16 addrreg0, addrreg1; static uint16 addrreg0, addrreg1;
@@ -41,6 +42,7 @@ static void LatchPower(void) {
if (WRAM) { if (WRAM) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} else { } else {
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
} }
@@ -99,6 +101,8 @@ static void NROMPower(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
#ifdef DEBUG_MAPPER #ifdef DEBUG_MAPPER
SetWriteHandler(0x4020, 0xFFFF, NROMWrite); SetWriteHandler(0x4020, 0xFFFF, NROMWrite);
#endif #endif

View File

@@ -48,6 +48,7 @@ static void UNLEDU2000Power(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0xFFFF, CartBW); SetWriteHandler(0x6000, 0xFFFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, UNLEDU2000HiWrite); SetWriteHandler(0x8000, 0xFFFF, UNLEDU2000HiWrite);
FCEU_CheatAddRAM(32, 0x6000, WRAM);
reg = 0; reg = 0;
Sync(); Sync();
} }

View File

@@ -79,6 +79,7 @@ static void SSSNROMPower(void) {
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void SSSNROMReset(void) { static void SSSNROMReset(void) {
@@ -109,7 +110,6 @@ void SSSNROM_Init(CartInfo *info) {
WRAMSIZE = 16384; WRAMSIZE = 16384;
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM"); AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0); AddExState(&StateRegs, ~0, 0, 0);
} }

View File

@@ -102,6 +102,7 @@ static void FFEPower(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, FFEWriteLatch); SetWriteHandler(0x8000, 0xFFFF, FFEWriteLatch);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void FP_FASTAPASS(1) FFEIRQHook(int a) { static void FP_FASTAPASS(1) FFEIRQHook(int a) {

View File

@@ -52,6 +52,7 @@ static void LH32Power(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0xC000, 0xDFFF, CartBW); SetWriteHandler(0xC000, 0xDFFF, CartBW);
SetWriteHandler(0x6000, 0x6000, LH32Write); SetWriteHandler(0x6000, 0x6000, LH32Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void LH32Close(void) { static void LH32Close(void) {

View File

@@ -80,6 +80,7 @@ static void LH53Power(void) {
SetWriteHandler(0xB800, 0xD7FF, LH53RamWrite); SetWriteHandler(0xB800, 0xD7FF, LH53RamWrite);
SetWriteHandler(0xE000, 0xEFFF, LH53IRQaWrite); SetWriteHandler(0xE000, 0xEFFF, LH53IRQaWrite);
SetWriteHandler(0xF000, 0xFFFF, LH53Write); SetWriteHandler(0xF000, 0xFFFF, LH53Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void LH53Close(void) { static void LH53Close(void) {

View File

@@ -2,6 +2,7 @@
* *
* Copyright notice for this file: * Copyright notice for this file:
* Copyright (C) 2012 CaH4e3 * Copyright (C) 2012 CaH4e3
* Copyright (C) 2002 Xodnizel
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -94,6 +95,7 @@ static void MMC2and4Power(void) {
if (is10) { if (is10) {
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0xA000, 0xFFFF, MMC2and4Write); SetWriteHandler(0xA000, 0xFFFF, MMC2and4Write);

View File

@@ -88,12 +88,13 @@ static uint8 MMC5LineCounter;
static uint8 mmc5psize, mmc5vsize; static uint8 mmc5psize, mmc5vsize;
static uint8 mul[2]; static uint8 mul[2];
static uint32 WRAMSIZE = 0;
static uint8 *WRAM = NULL; static uint8 *WRAM = NULL;
static uint8 *MMC5fill = NULL; static uint8 *MMC5fill = NULL;
static uint8 *ExRAM = NULL; static uint8 *ExRAM = NULL;
static uint8 MMC5WRAMsize; static uint8 MMC5WRAMsize; //configuration, not state
static uint8 MMC5WRAMIndex[8]; static uint8 MMC5WRAMIndex[8]; //configuration, not state
static uint8 MMC5ROMWrProtect[4]; static uint8 MMC5ROMWrProtect[4];
static uint8 MMC5MemIn[5]; static uint8 MMC5MemIn[5];
@@ -230,6 +231,7 @@ static void FASTAPASS(2) MMC5WRAM(uint32 A, uint32 V) {
V = MMC5WRAMIndex[V & 7]; V = MMC5WRAMIndex[V & 7];
if (V != 255) { if (V != 255) {
setprg8r(0x10, A, V); setprg8r(0x10, A, V);
FCEU_CheatAddRAM(8, 0x6000, (WRAM + ((V * 8192) & (WRAMSIZE - 1))));
MMC5MemIn[(A - 0x6000) >> 13] = 1; MMC5MemIn[(A - 0x6000) >> 13] = 1;
} else } else
MMC5MemIn[(A - 0x6000) >> 13] = 0; MMC5MemIn[(A - 0x6000) >> 13] = 0;
@@ -455,31 +457,56 @@ void MMC5Synco(void) {
MMC5CHRA(); MMC5CHRA();
MMC5CHRB(); MMC5CHRB();
} }
//in case the fill register changed, we need to overwrite the fill buffer
FCEU_dwmemset(MMC5fill, NTFill | (NTFill << 8) | (NTFill << 16) | (NTFill << 24), 0x3c0); FCEU_dwmemset(MMC5fill, NTFill | (NTFill << 8) | (NTFill << 16) | (NTFill << 24), 0x3c0);
{ {
unsigned char moop = ATFill | (ATFill << 2) | (ATFill << 4) | (ATFill << 6); unsigned char moop = ATFill | (ATFill << 2) | (ATFill << 4) | (ATFill << 6);
FCEU_dwmemset(MMC5fill + 0x3c0, moop | (moop << 8) | (moop << 16) | (moop << 24), 0x40); FCEU_dwmemset(MMC5fill + 0x3c0, moop | (moop << 8) | (moop << 16) | (moop << 24), 0x40);
} }
X6502_IRQEnd(FCEU_IQEXT);
MMC5HackCHRMode = CHRMode & 3; MMC5HackCHRMode = CHRMode & 3;
//zero 17-apr-2013 - why the heck should this happen here? anything in a `synco` should be depending on the state.
//im going to leave it commented out to see what happens
//X6502_IRQEnd(FCEU_IQEXT);
} }
void MMC5_hb(int scanline) { void MMC5_hb(int scanline) {
if (scanline == 240) { //zero 24-jul-2014 - revised for newer understanding, to fix metal slader glory credits. see r7371 in bizhawk
int sl = scanline + 1;
int ppuon = (PPU[1] & 0x18);
if (!ppuon || sl >= 241)
{
// whenever rendering is off for any reason (vblank or forced disable
// the irq counter resets, as well as the inframe flag (easily verifiable from software)
MMC5IRQR &= ~0x40;
MMC5IRQR &= ~0x80;
MMC5LineCounter = 0; MMC5LineCounter = 0;
MMC5IRQR = 0x40; X6502_IRQEnd(FCEU_IQEXT);
return; return;
} }
if (MMC5LineCounter < 240) {
if (MMC5LineCounter == IRQScanline) { if (!(MMC5IRQR&0x40))
{
MMC5IRQR |= 0x40;
MMC5IRQR &= ~0x80;
MMC5LineCounter = 0;
X6502_IRQEnd(FCEU_IQEXT);
}
else
{
MMC5LineCounter++;
if (MMC5LineCounter == IRQScanline)
{
MMC5IRQR |= 0x80; MMC5IRQR |= 0x80;
if (IRQEnable & 0x80) if (IRQEnable & 0x80)
X6502_IRQBegin(FCEU_IQEXT); X6502_IRQBegin(FCEU_IQEXT);
} }
MMC5LineCounter++;
} }
if (MMC5LineCounter == 240)
MMC5IRQR = 0;
} }
void MMC5_StateRestore(int version) { void MMC5_StateRestore(int version) {
@@ -682,8 +709,11 @@ void NSFMMC5_Init(void) {
} }
void NSFMMC5_Close(void) { void NSFMMC5_Close(void) {
if (WRAM)
FCEU_gfree(WRAM);
WRAM = NULL;
FCEU_gfree(ExRAM); FCEU_gfree(ExRAM);
ExRAM = 0; ExRAM = NULL;
} }
static void GenMMC5Reset(void) { static void GenMMC5Reset(void) {
@@ -715,7 +745,7 @@ static void GenMMC5Reset(void) {
SetReadHandler(0x5205, 0x5206, MMC5_read); SetReadHandler(0x5205, 0x5206, MMC5_read);
// GameHBIRQHook=MMC5_hb; // GameHBIRQHook=MMC5_hb;
FCEU_CheatAddRAM(8, 0x6000, WRAM); // FCEU_CheatAddRAM(8, 0x6000, WRAM);
FCEU_CheatAddRAM(1, 0x5c00, ExRAM); FCEU_CheatAddRAM(1, 0x5c00, ExRAM);
} }
@@ -733,6 +763,15 @@ static SFORMAT MMC5_StateRegs[] = {
{ &NTFill, 1, "NTFL" }, { &NTFill, 1, "NTFL" },
{ &ATFill, 1, "ATFL" }, { &ATFill, 1, "ATFL" },
//zero 17-apr-2013 - added
{ &MMC5IRQR, 1, "IRQR" },
{ &MMC5LineCounter, 1, "LCTR" },
{ &mmc5psize, 1, "PSIZ" },
{ &mmc5vsize, 1, "VSIZ" },
{ mul, 2, "MUL2" },
{ MMC5ROMWrProtect, 4, "WRPR" },
{ MMC5MemIn, 5, "MEMI" },
{ &MMC5Sound.wl[0], 2 | FCEUSTATE_RLSB, "SDW0" }, { &MMC5Sound.wl[0], 2 | FCEUSTATE_RLSB, "SDW0" },
{ &MMC5Sound.wl[1], 2 | FCEUSTATE_RLSB, "SDW1" }, { &MMC5Sound.wl[1], 2 | FCEUSTATE_RLSB, "SDW1" },
{ MMC5Sound.env, 2, "SDEV" }, { MMC5Sound.env, 2, "SDEV" },
@@ -740,6 +779,15 @@ static SFORMAT MMC5_StateRegs[] = {
{ &MMC5Sound.running, 1, "SDRU" }, { &MMC5Sound.running, 1, "SDRU" },
{ &MMC5Sound.raw, 1, "SDRW" }, { &MMC5Sound.raw, 1, "SDRW" },
{ &MMC5Sound.rawcontrol, 1, "SDRC" }, { &MMC5Sound.rawcontrol, 1, "SDRC" },
//zero 17-apr-2013 - added
{ &MMC5Sound.dcount[0], 4 | FCEUSTATE_RLSB, "DCT0" },
{ &MMC5Sound.dcount[1], 4 | FCEUSTATE_RLSB, "DCT1" },
{ &MMC5Sound.BC[0], 4 | FCEUSTATE_RLSB, "BC00" },
{ &MMC5Sound.BC[1], 4 | FCEUSTATE_RLSB, "BC01" },
{ &MMC5Sound.BC[2], 4 | FCEUSTATE_RLSB, "BC02" },
{ &MMC5Sound.vcount[0], 4 | FCEUSTATE_RLSB, "VCT0" },
{ &MMC5Sound.vcount[1], 4 | FCEUSTATE_RLSB, "VCT1" },
{ 0 } { 0 }
}; };
@@ -783,7 +831,8 @@ static void GenMMC5_Init(CartInfo *info, int wsize, int battery) {
} }
void Mapper5_Init(CartInfo *info) { void Mapper5_Init(CartInfo *info) {
GenMMC5_Init(info, DetectMMC5WRAMSize(info->CRC32), info->battery); WRAMSIZE = DetectMMC5WRAMSize(info->CRC32);
GenMMC5_Init(info, WRAMSIZE, info->battery);
} }
// ELROM seems to have 0KB of WRAM // ELROM seems to have 0KB of WRAM

View File

@@ -79,7 +79,6 @@ static void PSync(void) {
uint8 bank2 = (cpu410x[0xb] & 0x40) ? (cpu410x[0x9]) : (~1); uint8 bank2 = (cpu410x[0xb] & 0x40) ? (cpu410x[0x9]) : (~1);
uint8 bank3 = ~0; uint8 bank3 = ~0;
// FCEU_printf(" PRG OFFSET: %08x\n", (block | (bank0 & mask)) * 8192);
// FCEU_printf(" PRG: %04x [%02x]",0x8000^pswap,block | (bank0 & mask)); // FCEU_printf(" PRG: %04x [%02x]",0x8000^pswap,block | (bank0 & mask));
setprg8(0x8000 ^ pswap, block | (bank0 & mask)); setprg8(0x8000 ^ pswap, block | (bank0 & mask));
// FCEU_printf(" %04x [%02x]",0xa000^pswap,block | (bank1 & mask)); // FCEU_printf(" %04x [%02x]",0xa000^pswap,block | (bank1 & mask));
@@ -105,22 +104,13 @@ static void CSync(void) {
uint8 bank6 = ppu201x[0x4]; uint8 bank6 = ppu201x[0x4];
uint8 bank7 = ppu201x[0x5]; uint8 bank7 = ppu201x[0x5];
// FCEU_printf(" CHR OFFSET: %08x\n", (block | (bank0 & mask)) * 1024);
// FCEU_printf(" CHR: %04x [%02x]", 0x0000^cswap,block | (bank0 & mask));
setchr1(0x0000 ^ cswap, block | (bank0 & mask)); setchr1(0x0000 ^ cswap, block | (bank0 & mask));
// FCEU_printf(" %04x [%02x]",0x0400^cswap,block | (bank1 & mask));
setchr1(0x0400 ^ cswap, block | (bank1 & mask)); setchr1(0x0400 ^ cswap, block | (bank1 & mask));
// FCEU_printf(" %04x [%02x]",0x0800^cswap,block | (bank2 & mask));
setchr1(0x0800 ^ cswap, block | (bank2 & mask)); setchr1(0x0800 ^ cswap, block | (bank2 & mask));
// FCEU_printf(" %04x [%02x]",0x0c00^cswap,block | (bank3 & mask));
setchr1(0x0c00 ^ cswap, block | (bank3 & mask)); setchr1(0x0c00 ^ cswap, block | (bank3 & mask));
// FCEU_printf(" %04x [%02x]",0x1000^cswap,block | (bank4 & mask));
setchr1(0x1000 ^ cswap, block | (bank4 & mask)); setchr1(0x1000 ^ cswap, block | (bank4 & mask));
// FCEU_printf(" %04x [%02x]",0x1400^cswap,block | (bank5 & mask));
setchr1(0x1400 ^ cswap, block | (bank5 & mask)); setchr1(0x1400 ^ cswap, block | (bank5 & mask));
// FCEU_printf(" %04x [%02x]",0x1800^cswap,block | (bank6 & mask));
setchr1(0x1800 ^ cswap, block | (bank6 & mask)); setchr1(0x1800 ^ cswap, block | (bank6 & mask));
// FCEU_printf(" %04x [%02x]\n",0x1c00^cswap,block | (bank7 & mask));
setchr1(0x1c00 ^ cswap, block | (bank7 & mask)); setchr1(0x1c00 ^ cswap, block | (bank7 & mask));
setmirror(mirror & 1); setmirror(mirror & 1);
@@ -190,7 +180,7 @@ static void UNLOneBusIRQHook(void) {
} }
static DECLFW(UNLOneBusWriteAPU40XX) { static DECLFW(UNLOneBusWriteAPU40XX) {
// FCEU_printf("APU %04x:%04x\n",A,V); // if(((A & 0x3f)!=0x16) && ((apu40xx[0x30] & 0x10) || ((A & 0x3f)>0x17)))FCEU_printf("APU %04x:%04x\n",A,V);
apu40xx[A & 0x3f] = V; apu40xx[A & 0x3f] = V;
switch (A & 0x3f) { switch (A & 0x3f) {
case 0x12: case 0x12:

View File

@@ -101,6 +101,7 @@ static void UNLPEC586Power(void) {
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x5000, 0x5fff, UNLPEC586Write); SetWriteHandler(0x5000, 0x5fff, UNLPEC586Write);
SetReadHandler(0x5000, 0x5fff, UNLPEC586Read); SetReadHandler(0x5000, 0x5fff, UNLPEC586Read);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void UNLPEC586Close(void) { static void UNLPEC586Close(void) {

View File

@@ -42,7 +42,7 @@ static void FP_FASTAPASS(1) TransformerIRQHook(int a) {
else else
TransformerChar = i | 0x80; TransformerChar = i | 0x80;
X6502_IRQBegin(FCEU_IQEXT); X6502_IRQBegin(FCEU_IQEXT);
memcpy((void*)&oldkeys[0], (void*)TransformerKeys, 256); memcpy((void*)&oldkeys[0], (void*)TransformerKeys, sizeof(oldkeys));
break; break;
} }
} }
@@ -71,6 +71,7 @@ static void TransformerPower(void) {
SetReadHandler(0x6000, 0x7FFF, CartBR); SetReadHandler(0x6000, 0x7FFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
MapIRQHook = TransformerIRQHook; MapIRQHook = TransformerIRQHook;
} }

View File

@@ -19,6 +19,7 @@
* *
* VRC-2/VRC-4 Konami * VRC-2/VRC-4 Konami
* VRC-4 Pirate * VRC-4 Pirate
*
*/ */
#include "mapinc.h" #include "mapinc.h"
@@ -136,8 +137,8 @@ static DECLFW(M21Write) {
} }
static DECLFW(M22Write) { static DECLFW(M22Write) {
if (A == 0xC007) { // Ganbare Goemon Gaiden does strange things!!! at the end credits if ((A >= 0xC004) && (A <= 0xC007)) { // Ganbare Goemon Gaiden does strange things!!! at the end credits
weirdo = 8; // quick dirty hack, seems there is no other games with such PCB, so weirdo = 1; // quick dirty hack, seems there is no other games with such PCB, so
// we never know if it will not work for something else lol // we never know if it will not work for something else lol
} }
A |= ((A >> 2) & 0x3); // It's just swapped lines from 21 mapper A |= ((A >> 2) & 0x3); // It's just swapped lines from 21 mapper
@@ -172,6 +173,7 @@ static void M23Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M23Write); SetWriteHandler(0x8000, 0xFFFF, M23Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M25Power(void) { static void M25Power(void) {
@@ -182,6 +184,7 @@ static void M25Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x8000, 0xFFFF, CartBR); SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M22Write); SetWriteHandler(0x8000, 0xFFFF, M22Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
void FP_FASTAPASS(1) VRC24IRQHook(int a) { void FP_FASTAPASS(1) VRC24IRQHook(int a) {

View File

@@ -74,7 +74,7 @@ static DECLFW(M73Write) {
} }
static void M73IRQHook(int a) { static void M73IRQHook(int a) {
uint32 i; int32 i;
if (!IRQa) return; if (!IRQa) return;
for (i = 0; i < a; i++) { for (i = 0; i < a; i++) {
if (IRQm) { if (IRQm) {
@@ -106,6 +106,7 @@ static void M73Power(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, M73Write); SetWriteHandler(0x8000, 0xFFFF, M73Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void M73Close(void) { static void M73Close(void) {

View File

@@ -184,6 +184,7 @@ static void M190Power(void) {
SetWriteHandler(0x8000, 0xFFFF, M190Write); SetWriteHandler(0x8000, 0xFFFF, M190Write);
SetReadHandler(0xDC00, 0xDC00, M190Read); SetReadHandler(0xDC00, 0xDC00, M190Read);
SetReadHandler(0xDD00, 0xDD00, M190Read); SetReadHandler(0xDD00, 0xDD00, M190Read);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
Sync(); Sync();
} }

View File

@@ -127,6 +127,7 @@ static void VRC6Power(void) {
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetWriteHandler(0x8000, 0xFFFF, VRC6Write); SetWriteHandler(0x8000, 0xFFFF, VRC6Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void VRC6IRQHook(int a) { static void VRC6IRQHook(int a) {
@@ -244,11 +245,11 @@ static INLINE void DoSQVHQ(int x) {
if (vpsg1[(x << 2) | 0x2] & 0x80) { if (vpsg1[(x << 2) | 0x2] & 0x80) {
if (vpsg1[x << 2] & 0x80) { if (vpsg1[x << 2] & 0x80) {
for (V = cvbc[x]; V < SOUNDTS; V++) for (V = cvbc[x]; V < (int)SOUNDTS; V++)
WaveHi[V] += amp; WaveHi[V] += amp;
} else { } else {
int32 thresh = (vpsg1[x << 2] >> 4) & 7; int32 thresh = (vpsg1[x << 2] >> 4) & 7;
for (V = cvbc[x]; V < SOUNDTS; V++) { for (V = cvbc[x]; V < (int)SOUNDTS; V++) {
if (dcount[x] > thresh) if (dcount[x] > thresh)
WaveHi[V] += amp; WaveHi[V] += amp;
vcount[x]--; vcount[x]--;
@@ -276,7 +277,7 @@ static void DoSawVHQ(void) {
int32 V; int32 V;
if (vpsg2[2] & 0x80) { if (vpsg2[2] & 0x80) {
for (V = cvbc[2]; V < SOUNDTS; V++) { for (V = cvbc[2]; V < (int)SOUNDTS; V++) {
WaveHi[V] += (((phaseacc >> 3) & 0x1f) << 8) * 6 / 8; WaveHi[V] += (((phaseacc >> 3) & 0x1f) << 8) * 6 / 8;
vcount[2]--; vcount[2]--;
if (vcount[2] <= 0) { if (vcount[2] <= 0) {

View File

@@ -151,6 +151,7 @@ static void VRC7Power(void) {
SetWriteHandler(0x6000, 0x7FFF, CartBW); SetWriteHandler(0x6000, 0x7FFF, CartBW);
SetReadHandler(0x6000, 0xFFFF, CartBR); SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, VRC7Write); SetWriteHandler(0x8000, 0xFFFF, VRC7Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void VRC7Close(void) { static void VRC7Close(void) {

View File

@@ -174,6 +174,7 @@ static void M83Power(void) {
SetWriteHandler(0x6000, 0x7fff, CartBW);// Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM SetWriteHandler(0x6000, 0x7fff, CartBW);// Pirate Dragon Ball Z Party [p1] used if for saves instead of seraial EEPROM
SetReadHandler(0x8000, 0xffff, CartBR); SetReadHandler(0x8000, 0xffff, CartBR);
SetWriteHandler(0x8000, 0xffff, M83Write); SetWriteHandler(0x8000, 0xffff, M83Write);
FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM);
} }
static void UNLYOKOReset(void) { static void UNLYOKOReset(void) {

View File

@@ -451,6 +451,7 @@ static BMAPPING bmap[] = {
{ "YOKO", UNLYOKO_Init, 0 }, { "YOKO", UNLYOKO_Init, 0 },
{ "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR }, { "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR },
{ "158B", UNL158B_Init, 0 }, { "158B", UNL158B_Init, 0 },
{ "DRAGONFIGHTER", UNLBMW8544_Init, 0},
#ifdef COPYFAMI #ifdef COPYFAMI
{ "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 }, { "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 },

View File

@@ -122,6 +122,7 @@ void Mapper112_Init(CartInfo *);
void Mapper113_Init(CartInfo *); void Mapper113_Init(CartInfo *);
void Mapper114_Init(CartInfo *); void Mapper114_Init(CartInfo *);
void Mapper115_Init(CartInfo *); void Mapper115_Init(CartInfo *);
void Mapper116_Init(CartInfo *);
void Mapper117_Init(CartInfo *); void Mapper117_Init(CartInfo *);
void Mapper119_Init(CartInfo *); void Mapper119_Init(CartInfo *);
void Mapper120_Init(CartInfo *); void Mapper120_Init(CartInfo *);

View File

@@ -21,5 +21,6 @@ void FCEUPPU_SaveState(void);
void FCEUPPU_LoadState(int version); void FCEUPPU_LoadState(int version);
extern int scanline; extern int scanline;
extern uint8 PPU[4];
#endif #endif

View File

@@ -451,6 +451,7 @@ static BMAPPING bmap[] = {
{ "YOKO", UNLYOKO_Init, 0 }, { "YOKO", UNLYOKO_Init, 0 },
{ "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR }, { "COOLBOY", COOLBOY_Init, BMCFLAG_256KCHRR },
{ "158B", UNL158B_Init, 0 }, { "158B", UNL158B_Init, 0 },
{ "DRAGONFIGHTER", UNLBMW8544_Init, 0},
#ifdef COPYFAMI #ifdef COPYFAMI
{ "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 }, { "COPYFAMI_MMC3", MapperCopyFamiMMC3_Init, 0 },

View File

@@ -147,6 +147,7 @@ void UNLYOKO_Init(CartInfo *info);
void UNROM_Init(CartInfo *info); void UNROM_Init(CartInfo *info);
void COOLBOY_Init(CartInfo *info); void COOLBOY_Init(CartInfo *info);
void UNL158B_Init(CartInfo *info); void UNL158B_Init(CartInfo *info);
void UNLBMW8544_Init(CartInfo *info);
#ifdef COPYFAMI #ifdef COPYFAMI
void MapperCopyFamiMMC3_Init(CartInfo *info); void MapperCopyFamiMMC3_Init(CartInfo *info);

View File

@@ -15,6 +15,7 @@ N 004 mapper - "Long Zhu Ying Xiong (As) [p1].nes"
016 mapper - as like 157, äîáàâèòü EEPROM ýìóëÿöèþ. 016 mapper - as like 157, äîáàâèòü EEPROM ýìóëÿöèþ.
126 mapper - "PowerJoy 84-in-1 (PJ-008) (Unl) [!]" íå ýìóëèðóåòñÿ (Nestopia) 126 mapper - "PowerJoy 84-in-1 (PJ-008) (Unl) [!]" íå ýìóëèðóåòñÿ (Nestopia)
253 mapper - ïëîõàÿ ñèíõðîíèçàöèÿ IRQ, ïðîáëåìà â âû÷èñëåíèÿõ òàéìèíãà èëè â ÿäðå? 253 mapper - ïëîõàÿ ñèíõðîíèçàöèÿ IRQ, ïðîáëåìà â âû÷èñëåíèÿõ òàéìèíãà èëè â ÿäðå?
015 mapper - âåøàåòñÿ ïðè çàãðóçêå-ñåéâå Yuefei (Unl) [h1]
Ãîòîâî: Ãîòîâî: