mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
TXC 22211A/B/C support (Mappers 132, 172, 173)
This commit is contained in:
parent
d685b556a1
commit
bf5ad7439d
6 changed files with 98 additions and 2 deletions
|
@ -584,6 +584,9 @@
|
|||
<ClInclude Include="TaitoX1017.h" />
|
||||
<ClInclude Include="TraceLogger.h" />
|
||||
<ClInclude Include="TriangleChannel.h" />
|
||||
<ClInclude Include="Txc22211A.h" />
|
||||
<ClInclude Include="Txc22211B.h" />
|
||||
<ClInclude Include="Txc22211C.h" />
|
||||
<ClInclude Include="TxSRom.h" />
|
||||
<ClInclude Include="VideoRenderer.h" />
|
||||
<ClInclude Include="UnlPci556.h" />
|
||||
|
|
|
@ -727,6 +727,15 @@
|
|||
<ClInclude Include="Sachen_133.h">
|
||||
<Filter>Nes\Mappers\Sachen</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211A.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211B.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Txc22211C.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
|
@ -105,6 +105,9 @@
|
|||
#include "TaitoTc0690.h"
|
||||
#include "TaitoX1005.h"
|
||||
#include "TaitoX1017.h"
|
||||
#include "Txc22211A.h"
|
||||
#include "Txc22211B.h"
|
||||
#include "Txc22211C.h"
|
||||
#include "TxSRom.h"
|
||||
#include "UnlPci556.h"
|
||||
#include "UNROM.h"
|
||||
|
@ -131,9 +134,9 @@ Supported mappers: (... denotes bad mappers)
|
|||
| 80| | 82| | | 85| 86| 87| 88| 89| | 91| 92| 93| 94| 95|
|
||||
| | 97| | 99|...|101| | | | | |107| | | | |
|
||||
|112|113| |115| | |118|119| | | | | | | | |
|
||||
| | | | | |133| | | |137|138|139|140|141| |143|
|
||||
| | | | |132|133| | | |137|138|139|140|141| |143|
|
||||
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|
||||
| | | |163|164| | | | | | | | | | | |
|
||||
| | | |163|164| | | | | | | |172|173| | |
|
||||
|176| | | |180| |182| |184|185| | | |189| |191|
|
||||
|192|193|194|195| | | | |200|201|202|203| |205|206|207|
|
||||
| | |210| | | | | | | |218| | | | | |
|
||||
|
@ -244,6 +247,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
|||
case 115: return new MMC3_115();
|
||||
case 118: return new TxSRom();
|
||||
case 119: return new MMC3_ChrRam(0x40, 0x7F, 8);
|
||||
case 132: return new Txc22211A();
|
||||
case 133: return new Sachen_133();
|
||||
case 137: return new Sachen8259(Sachen8259Variant::Sachen8259D);
|
||||
case 138: return new Sachen8259(Sachen8259Variant::Sachen8259B);
|
||||
|
@ -268,6 +272,8 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
|||
case 159: return new BandaiFcg();
|
||||
case 163: return new Nanjing();
|
||||
case 164: return new Waixing164();
|
||||
case 172: return new Txc22211B();
|
||||
case 173: return new Txc22211C();
|
||||
case 176: return new Waixing176();
|
||||
case 180: return new UnRom_180();
|
||||
case 182: return new MMC3_182();
|
||||
|
|
53
Core/Txc22211A.h
Normal file
53
Core/Txc22211A.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
|
||||
class Txc22211A : public BaseMapper
|
||||
{
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() { return 0x8000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x2000; }
|
||||
virtual uint16_t RegisterStartAddress() { return 0x8000; }
|
||||
virtual uint16_t RegisterEndAddress() { return 0xFFFF; }
|
||||
virtual bool AllowRegisterRead() { return true; }
|
||||
|
||||
uint8_t _regs[4];
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
AddRegisterRange(0x4100, 0x4103, MemoryOperation::Any);
|
||||
RemoveRegisterRange(0x8000, 0xFFFF, MemoryOperation::Read);
|
||||
|
||||
memset(_regs, 0, sizeof(_regs));
|
||||
|
||||
SelectPRGPage(0, 0);
|
||||
SelectCHRPage(0, 0);
|
||||
}
|
||||
|
||||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_regs[0], _regs[1], _regs[2], _regs[3]);
|
||||
}
|
||||
|
||||
virtual uint8_t ReadRegister(uint16_t addr)
|
||||
{
|
||||
return (_regs[1] ^ _regs[2]) | 0x40;
|
||||
}
|
||||
|
||||
virtual void UpdateState(uint8_t value)
|
||||
{
|
||||
SelectPRGPage(0, _regs[2] >> 2);
|
||||
SelectCHRPage(0, _regs[2]);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
if(addr < 0x8000) {
|
||||
_regs[addr & 0x03] = value;
|
||||
} else {
|
||||
UpdateState(value);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
13
Core/Txc22211B.h
Normal file
13
Core/Txc22211B.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "Txc22211A.h"
|
||||
|
||||
class Txc22211B : public Txc22211A
|
||||
{
|
||||
protected:
|
||||
virtual void UpdateState(uint8_t value)
|
||||
{
|
||||
SelectPRGPage(0, _regs[2] >> 2);
|
||||
SelectCHRPage(0, (((value ^ _regs[2]) >> 3) & 0x02) | (((value ^ _regs[2]) >> 5) & 0x01));
|
||||
}
|
||||
};
|
12
Core/Txc22211C.h
Normal file
12
Core/Txc22211C.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "Txc22211A.h"
|
||||
|
||||
class Txc22211C : public Txc22211A
|
||||
{
|
||||
protected:
|
||||
virtual uint8_t ReadRegister(uint16_t addr)
|
||||
{
|
||||
return (_regs[1] ^ _regs[2]) | 0x41;
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue