Mapper 118 (TKSROM/TLSROM) support

This commit is contained in:
Souryo 2016-01-23 21:09:01 -05:00
parent d34baea364
commit 0003edb90c
6 changed files with 72 additions and 0 deletions

View file

@ -486,6 +486,15 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificat
SetMirroringType(_mirroringType);
}
uint8_t* GetNametable(uint8_t index)
{
if(index <= 1) {
return _nesNametableRam[index];
} else {
return _cartNametableRam[index - 2];
}
}
void SetMirroringType(MirroringType type)
{
switch(type) {

View file

@ -521,6 +521,7 @@
<ClCompile Include="GameServer.cpp" />
<ClCompile Include="GameServerConnection.cpp" />
<ClCompile Include="HdVideoFilter.cpp" />
<ClCompile Include="TxSRom.h" />
<ClCompile Include="NtscFilter.cpp" />
<ClCompile Include="SoundMixer.cpp" />
<ClCompile Include="StandardController.cpp" />

View file

@ -577,5 +577,8 @@
<ClCompile Include="SoundMixer.cpp">
<Filter>Nes\APU</Filter>
</ClCompile>
<ClCompile Include="TxSRom.h">
<Filter>Nes\Mappers</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -64,6 +64,16 @@ class MMC3 : public BaseMapper
}
protected:
uint8_t GetCurrentRegister()
{
return _currentRegister;
}
uint8_t GetChrMode()
{
return _chrMode;
}
virtual bool ForceMmc3RevAIrqs() { return false; }
uint8_t _registers[8];

View file

@ -74,6 +74,7 @@
#include "Sunsoft184.h"
#include "TaitoTc0190.h"
#include "TaitoX1005.h"
#include "TxSRom.h"
#include "UnlPci556.h"
#include "UNROM.h"
#include "UnRom_94.h"
@ -152,6 +153,7 @@ BaseMapper* MapperFactory::GetMapperFromID(ROMLoader &romLoader)
case 112: return new Mapper112();
case 113: return new Nina03_06(true);
case 115: return new MMC3_115();
case 118: return new TxSRom();
case 119: return new MMC3_ChrRam(0x40, 0x7F, 8);
case 140: return new JalecoJf11_14();
case 145: return new Sachen_145();

47
Core/TxSRom.h Normal file
View file

@ -0,0 +1,47 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
//TKSROM and TLSROM
class TxSRom : public MMC3
{
protected:
virtual void StreamState(bool saving)
{
MMC3::StreamState(saving);
}
void UpdateMirroring()
{
//This is disabled, 8001 writes are used to setup mirroring instead
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if((addr & 0xE001) == 0x8001) {
uint8_t* nametable = GetNametable(value >> 7);
if(GetChrMode() == 0) {
switch(GetCurrentRegister()) {
case 0:
SetPpuMemoryMapping(0x2000, 0x23FF, nametable);
SetPpuMemoryMapping(0x2400, 0x27FF, nametable);
break;
case 1:
SetPpuMemoryMapping(0x2800, 0x2BFF, nametable);
SetPpuMemoryMapping(0x2C00, 0x2FFF, nametable);
break;
}
} else {
switch(GetCurrentRegister()) {
case 2: SetPpuMemoryMapping(0x2000, 0x23FF, nametable); break;
case 3: SetPpuMemoryMapping(0x2400, 0x27FF, nametable); break;
case 4: SetPpuMemoryMapping(0x2800, 0x2BFF, nametable); break;
case 5: SetPpuMemoryMapping(0x2C00, 0x2FFF, nametable); break;
}
}
}
MMC3::WriteRegister(addr, value);
}
};