Skip to content

Commit

Permalink
-added support for mappers 64, 77 and 158
Browse files Browse the repository at this point in the history
-some corrections to mapper 30
-disable overscan by default
  • Loading branch information
FIX94 committed Jan 18, 2019
1 parent 6a9e742 commit b8c44d4
Show file tree
Hide file tree
Showing 11 changed files with 630 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To start a file, simply drag and drop it into the fixNES Application or call it
You can also load from a .zip file, the first found supported file from that .zip will be used.

Supported .nes Mappers:
0,1,2,3,4,5,7,9,10,11,12,13,15,19,21,22,23,24,25,26,28,30,31,32,33,34,36,37,38,41,44,45,46,47,48,49,52,57,58,60,61,62,65,66,67,68,69,70,71,73,75,76,78,79,85,87,88,89,93,94,95,97,101,107,112,113,118,119,132,133,136,137,138,139,140,141,144,145,146,147,148,149,152,154,155,156,172,173,174,180,184,185,193,200,201,202,203,205,206,210,212,221,225,226,228,229,230,231,232,235,237,240 and 242.
0,1,2,3,4,5,7,9,10,11,12,13,15,19,21,22,23,24,25,26,28,30,31,32,33,34,36,37,38,41,44,45,46,47,48,49,52,57,58,60,61,62,64,65,66,67,68,69,70,71,73,75,76,77,78,79,85,87,88,89,93,94,95,97,101,107,112,113,118,119,132,133,136,137,138,139,140,141,144,145,146,147,148,149,152,154,155,156,158,172,173,174,180,184,185,193,200,201,202,203,205,206,210,212,221,225,226,228,229,230,231,232,235,237,240 and 242.
Supported Audio Expansions (for both ROMs and NSF Files):
VRC6, VRC7, FDS, MMC5, N163, Sunsoft 5B

Expand Down
2 changes: 2 additions & 0 deletions libretro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ OBJS += ../mapper/m33.o
OBJS += ../mapper/m34.o
OBJS += ../mapper/m48.o
OBJS += ../mapper/m65.o
OBJS += ../mapper/m77.o
OBJS += ../mapper/mmc1.o
OBJS += ../mapper/mmc2_4.o
OBJS += ../mapper/mmc3.o
Expand All @@ -375,6 +376,7 @@ OBJS += ../mapper/namco.o
OBJS += ../mapper/nsf.o
OBJS += ../mapper/p16c8.o
OBJS += ../mapper/p32c8.o
OBJS += ../mapper/rambo1.o
OBJS += ../mapper/s1.o
OBJS += ../mapper/s3.o
OBJS += ../mapper/s4.o
Expand Down
21 changes: 12 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define DEBUG_KEY 0
#define DEBUG_LOAD_INFO 1

const char *VERSION_STRING = "fixNES Alpha v1.2.4";
const char *VERSION_STRING = "fixNES Alpha v1.2.5";
static char window_title[256];
static char window_title_pause[256];

Expand Down Expand Up @@ -98,7 +98,7 @@ uint16_t textureImage[0xF000];
#endif
bool nesPause = false;
bool ppuDebugPauseFrame = false;
bool doOverscan = true;
bool doOverscan = false;
bool nesPAL = false;
bool nesEmuNSFPlayback = false;
uint8_t emuInitialNT = NT_UNKNOWN;
Expand Down Expand Up @@ -172,9 +172,11 @@ int main(int argc, char** argv)
emuFdsHasSideB = false;
nesPause = false;
ppuDebugPauseFrame = false;
doOverscan = true;
doOverscan = false;
nesPAL = false;
nesEmuNSFPlayback = false;
m30_flashable = false;
m30_singlescreen = false;
m32_singlescreen = false;
m78_m78a = false;
ppuMapper5 = false;
Expand Down Expand Up @@ -263,7 +265,13 @@ int main(int argc, char** argv)
memInit();
apuInit();
inputInit();
if(emuNesROM[6] & 8)
//special 1-screen case
if(mapper == 30 && (emuNesROM[6] & 9) == 8)
{
printf("Using Single Screen for Mapper 30\n");
m30_singlescreen = true;
}
else if(emuNesROM[6] & 8)
{
emuInitialNT = NT_4SCREEN;
ppuSetNameTbl4Screen();
Expand All @@ -284,11 +292,6 @@ int main(int argc, char** argv)
#endif
if(mapper == 5)
ppuMapper5 = true;
else if(mapper == 30)
{
//TODO: add single screen ones here
m30_singlescreen = false;
}
else if(mapper == 32)
{
if(strstr(emuFileName,"Major League") != NULL)
Expand Down
6 changes: 3 additions & 3 deletions mapper/m206.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static uint8_t m76getCHRBank3(uint16_t addr) { return m206CHRBank3Ptr[addr&0x7FF
static uint8_t m76getCHRBank4(uint16_t addr) { return m206CHRBank4Ptr[addr&0x7FF]; }
static uint8_t m76getCHRBank5(uint16_t addr) { return m206CHRBank5Ptr[addr&0x7FF]; }

void m76initChrGet8(uint16_t addr)
void m76initPPUGet8(uint16_t addr)
{
if(addr < 0x800) memInitMapperPPUGetPointer(addr, m76getCHRBank2);
else if(addr < 0x1000) memInitMapperPPUGetPointer(addr, m76getCHRBank3);
Expand All @@ -320,7 +320,7 @@ static uint8_t m206getCHRBank3(uint16_t addr) { return m206CHRBank3Ptr[addr&0x3F
static uint8_t m206getCHRBank4(uint16_t addr) { return m206CHRBank4Ptr[addr&0x3FF]; }
static uint8_t m206getCHRBank5(uint16_t addr) { return m206CHRBank5Ptr[addr&0x3FF]; }

void m206initChrGet8(uint16_t addr)
void m206initPPUGet8(uint16_t addr)
{
if(addr < 0x800) memInitMapperPPUGetPointer(addr, m206getCHRBank0);
else if(addr < 0x1000) memInitMapperPPUGetPointer(addr, m206getCHRBank1);
Expand All @@ -330,7 +330,7 @@ void m206initChrGet8(uint16_t addr)
else if(addr < 0x2000) memInitMapperPPUGetPointer(addr, m206getCHRBank5);
}

void m206initChrSet8(uint16_t addr)
void m206initPPUSet8(uint16_t addr)
{
(void)addr;
}
14 changes: 7 additions & 7 deletions mapper/m30.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void m30sidExit()

static void m30setParams8000(uint16_t addr, uint8_t val)
{
//printf("%04x %02x\n", addr, val);
//printf("%04x %02x %02x\n", addr, val, m30.step);
if(val == 0xF0 && m30.software_id)
m30sidExit();
switch(m30.step)
Expand Down Expand Up @@ -174,19 +174,19 @@ static void m30setParams8000(uint16_t addr, uint8_t val)
if(m30.prgRAMptr && m30.prgRAMsize)
memset(m30.prgRAMptr, 0xFF, m30.prgRAMsize);
}
else if(val == 30) //sector erase
else if(val == 0x30) //sector erase
{
//printf("M30 Sector Erase %04x\n", (addr&0x7000));
//printf("M30 Sector Erase %04x\n", (addr&0x3000));
if(m30.prgRAMBankPtr)
memset(m30.prgRAMBankPtr+(addr&0x7000), 0xFF, 0x1000);
memset(m30.prgRAMBankPtr+(addr&0x3000), 0xFF, 0x1000);
}
goto _8000_step_reset;
//executes write
case M30_STATE_83_WRI:
if(m30.prgRAMBankPtr) //byte write
{
//printf("M30 Byte Write %04x %02x\n", addr&0x7FFF, val);
m30.prgRAMBankPtr[addr&0x7FFF] = val;
//printf("M30 Byte Write %04x %02x\n", addr&0x3FFF, val);
m30.prgRAMBankPtr[addr&0x3FFF] &= val;
}
goto _8000_step_reset;
//any other state or state verify fail
Expand All @@ -200,7 +200,7 @@ static void m30setParams8000(uint16_t addr, uint8_t val)

static void m30setParamsC000(uint16_t addr, uint8_t val)
{
//printf("%04x %02x\n", addr, val);
//printf("%04x %02x %02x\n", addr, val, m30.step);
m30setParamsNoFlash(addr, val);
if(val == 0xF0 && m30.software_id)
m30sidExit();
Expand Down
51 changes: 51 additions & 0 deletions mapper/m77.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2019 FIX94
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

#include <stdio.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "../ppu.h"
#include "../mapper.h"
#include "../mem.h"
#include "../mapper_h/common.h"

void m77init(uint8_t *prgROMin, uint32_t prgROMsizeIn,
uint8_t *prgRAMin, uint32_t prgRAMsizeIn,
uint8_t *chrROMin, uint32_t chrROMsizeIn)
{
(void)prgRAMin;
(void)prgRAMsizeIn;
prg32init(prgROMin,prgROMsizeIn);
chr2init(chrROMin,chrROMsizeIn);
//extra chr ram
chr8init(NULL,0);
printf("Mapper 77 inited\n");
}

static void m77setParams8000(uint16_t addr, uint8_t val) { (void)addr; chr2setBank0(((val>>4)&0xF)<<11); prg32setBank0((val&0xF)<<15); }
void m77initSet8(uint16_t addr)
{
if(addr < 0x8000) return;
memInitMapperSetPointer(addr, m77setParams8000);
}

void m77initPPUGet8(uint16_t addr)
{
if(addr < 0x800) //ROM
chr2initPPUGet8(addr);
else if(addr < 0x2000) //RAM
chr8initPPUGet8(addr);
}

void m77initPPUSet8(uint16_t addr)
{
if(addr < 0x800) //ROM
chr2initPPUSet8(addr);
else if(addr < 0x2000) //RAM
chr8initPPUSet8(addr);
}
Loading

0 comments on commit b8c44d4

Please sign in to comment.