mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 17:19:39 +00:00
Mapper 183 support
This commit is contained in:
parent
3aea7f47f8
commit
a514a14c4c
@ -470,6 +470,7 @@
|
||||
<ClInclude Include="Mapper230.h" />
|
||||
<ClInclude Include="Mapper233.h" />
|
||||
<ClInclude Include="Mapper234.h" />
|
||||
<ClInclude Include="Mapper183.h" />
|
||||
<ClInclude Include="MMC3_238.h" />
|
||||
<ClInclude Include="Mapper241.h" />
|
||||
<ClInclude Include="Mapper244.h" />
|
||||
|
@ -883,6 +883,9 @@
|
||||
<ClInclude Include="Bmc255.h">
|
||||
<Filter>Nes\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mapper183.h">
|
||||
<Filter>Nes\Mappers\Unnamed</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
99
Core/Mapper183.h
Normal file
99
Core/Mapper183.h
Normal file
@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
#include "CPU.h"
|
||||
|
||||
class Mapper183 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint8_t _chrRegs[8];
|
||||
uint8_t _prgReg;
|
||||
uint8_t _irqCounter;
|
||||
uint8_t _irqScaler;
|
||||
bool _irqEnabled;
|
||||
bool _needIrq;
|
||||
|
||||
protected:
|
||||
virtual uint16_t RegisterStartAddress() { return 0x6000; }
|
||||
virtual uint16_t RegisterEndAddress() { return 0xFFFF; }
|
||||
virtual uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x400; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
memset(_chrRegs, 0, sizeof(_chrRegs));
|
||||
_prgReg = 0;
|
||||
_irqCounter = 0;
|
||||
_irqScaler = 0;
|
||||
_irqEnabled = false;
|
||||
_needIrq = false;
|
||||
|
||||
UpdatePrg();
|
||||
}
|
||||
|
||||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
ArrayInfo<uint8_t> chrRegs{ _chrRegs, 8 };
|
||||
Stream(_prgReg, _irqCounter, _irqEnabled, _irqScaler, _needIrq, chrRegs);
|
||||
}
|
||||
|
||||
void UpdatePrg()
|
||||
{
|
||||
SetCpuMemoryMapping(0x6000, 0x7FFF, _prgReg, PrgMemoryType::PrgRom);
|
||||
SelectPRGPage(3, -1);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
if((addr & 0xF800) == 0x6800) {
|
||||
_prgReg = addr & 0x3F;
|
||||
UpdatePrg();
|
||||
} else if(((addr & 0xF80C) >= 0xB000) && ((addr & 0xF80C) <= 0xE00C)) {
|
||||
int slot = (((addr >> 11) - 6) | (addr >> 3)) & 0x07;
|
||||
_chrRegs[slot] = (_chrRegs[slot] & (0xF0 >> (addr & 0x04))) | ((value & 0x0F) << (addr & 0x04));
|
||||
SelectCHRPage(slot, _chrRegs[slot]);
|
||||
} else switch(addr & 0xF80C) {
|
||||
case 0x8800: SelectPRGPage(0, value); break;
|
||||
case 0xA800: SelectPRGPage(1, value); break;
|
||||
case 0xA000: SelectPRGPage(2, value); break;
|
||||
case 0x9800:
|
||||
switch(value & 0x03) {
|
||||
case 0: SetMirroringType(MirroringType::Vertical); break;
|
||||
case 1: SetMirroringType(MirroringType::Horizontal); break;
|
||||
case 2: SetMirroringType(MirroringType::ScreenAOnly); break;
|
||||
case 3: SetMirroringType(MirroringType::ScreenBOnly); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xF000: _irqCounter = (_irqCounter & 0xF0) | (value & 0x0F); break;
|
||||
case 0xF004: _irqCounter = (_irqCounter & 0x0F) | ((value & 0x0F) << 4); break;
|
||||
case 0xF008:
|
||||
_irqEnabled = value > 0;
|
||||
if(!_irqEnabled) {
|
||||
_irqScaler = 0;
|
||||
}
|
||||
CPU::ClearIRQSource(IRQSource::External);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ProcessCpuClock()
|
||||
{
|
||||
if(_needIrq) {
|
||||
CPU::SetIRQSource(IRQSource::External);
|
||||
_needIrq = false;
|
||||
}
|
||||
|
||||
_irqScaler++;
|
||||
if(_irqScaler == 114) {
|
||||
_irqScaler = 0;
|
||||
if(_irqEnabled) {
|
||||
_irqCounter++;
|
||||
if(_irqCounter == 0) {
|
||||
_needIrq = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -57,6 +57,7 @@
|
||||
#include "Mapper112.h"
|
||||
#include "Mapper120.h"
|
||||
#include "Mapper170.h"
|
||||
#include "Mapper183.h"
|
||||
#include "Mapper200.h"
|
||||
#include "Mapper201.h"
|
||||
#include "Mapper202.h"
|
||||
@ -184,7 +185,7 @@ Supported mappers:
|
||||
|===|===|===|===|132|133| |===| |137|138|139|140|141|142|143|
|
||||
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
|
||||
| |===| |163|164|165|166|167|168|===|170|171|172|173|===|175|
|
||||
|176|177|178|179|180|---|182| |184|185| |187|188|189|===|191|
|
||||
|176|177|178|179|180|---|182|183|184|185| |187|188|189|===|191|
|
||||
|192|193|194|195| |197| | |200|201|202|203|204|205|206|207|
|
||||
| |209|210|211|212|213|214| | | |218| | |221|222| |
|
||||
| |225|226|227|228|229|230|231|232|233|234|235| |===|238|===|
|
||||
@ -349,6 +350,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
||||
case 179: return new Henggedianzi179();
|
||||
case 180: return new UnRom_180();
|
||||
case 182: return new MMC3_182();
|
||||
case 183: return new Mapper183();
|
||||
case 184: return new Sunsoft184();
|
||||
case 185: return new CNROM(true);
|
||||
case 187: return new MMC3_187();
|
||||
|
Loading…
Reference in New Issue
Block a user