Mapper 30 support

This commit is contained in:
Souryo 2017-04-21 12:29:03 -04:00
parent 0f894584aa
commit 139974e8a3
5 changed files with 69 additions and 2 deletions

View file

@ -723,6 +723,7 @@
<ClInclude Include="Unl255in1.h" /> <ClInclude Include="Unl255in1.h" />
<ClInclude Include="Unl43272.h" /> <ClInclude Include="Unl43272.h" />
<ClInclude Include="UnlPuzzle.h" /> <ClInclude Include="UnlPuzzle.h" />
<ClInclude Include="UnRom512.h" />
<ClInclude Include="VideoHud.h" /> <ClInclude Include="VideoHud.h" />
<ClInclude Include="VideoRenderer.h" /> <ClInclude Include="VideoRenderer.h" />
<ClInclude Include="UnlPci556.h" /> <ClInclude Include="UnlPci556.h" />

View file

@ -1147,6 +1147,9 @@
<ClInclude Include="Cheapocabra.h"> <ClInclude Include="Cheapocabra.h">
<Filter>Nes\Mappers</Filter> <Filter>Nes\Mappers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="UnRom512.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">

View file

@ -227,6 +227,7 @@
#include "UNROM.h" #include "UNROM.h"
#include "UnRom_94.h" #include "UnRom_94.h"
#include "UnRom_180.h" #include "UnRom_180.h"
#include "UnRom512.h"
#include "VRC1.h" #include "VRC1.h"
#include "VRC2_4.h" #include "VRC2_4.h"
#include "VRC3.h" #include "VRC3.h"
@ -247,7 +248,7 @@ Supported mappers:
??? : No known roms ??? : No known roms
----------------------------------------------------------------- -----------------------------------------------------------------
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| 14| 15| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| 14| 15|
| 16| 17| 18| 19|...| 21| 22| 23| 24| 25| 26| 27| 28| | | 31| | 16| 17| 18| 19|...| 21| 22| 23| 24| 25| 26| 27| 28| | 30| 31|
| 32| 33| 34| 35| 36| 37| 38|---| 40| 41| 42| 43| 44| 45| 46| 47| | 32| 33| 34| 35| 36| 37| 38|---| 40| 41| 42| 43| 44| 45| 46| 47|
| 48| 49| 50| 51| 52| 53| 54|???| 56| 57| 58|===| 60| 61| 62| 63| | 48| 49| 50| 51| 52| 53| 54|???| 56| 57| 58|===| 60| 61| 62| 63|
| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79| | 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79|
@ -300,6 +301,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 26: return new VRC6(VRCVariant::VRC6b); case 26: return new VRC6(VRCVariant::VRC6b);
case 27: return new VRC2_4(); case 27: return new VRC2_4();
case 28: return new Action53(); case 28: return new Action53();
case 30: return new UnRom512();
case 31: return new NsfCart31(); case 31: return new NsfCart31();
case 32: return new IremG101(); case 32: return new IremG101();
case 33: return new TaitoTc0190(); case 33: return new TaitoTc0190();

View file

@ -198,7 +198,16 @@ struct NESHeader
MirroringType GetMirroringType() MirroringType GetMirroringType()
{ {
if(Byte6 & 0x08) { if(Byte6 & 0x08) {
return MirroringType::FourScreens; if(GetRomHeaderVersion() == RomHeaderVersion::Nes2_0) {
if(Byte6 & 0x01) {
//Based on proposal by rainwarrior/Myask: http://wiki.nesdev.com/w/index.php/Talk:NES_2.0
return MirroringType::ScreenAOnly;
} else {
return MirroringType::FourScreens;
}
} else {
return MirroringType::FourScreens;
}
} else { } else {
return Byte6 & 0x01 ? MirroringType::Vertical : MirroringType::Horizontal; return Byte6 & 0x01 ? MirroringType::Vertical : MirroringType::Horizontal;
} }

52
Core/UnRom512.h Normal file
View file

@ -0,0 +1,52 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
//Missing flashing support + only tested on 1 game demo
class UnRom512 : public BaseMapper
{
private:
bool _oneScreenMirroring;
protected:
virtual uint16_t GetPRGPageSize() override { return 0x4000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }
virtual uint16_t RegisterStartAddress() override { return 0x8000; }
virtual uint16_t RegisterEndAddress() override { return 0xFFFF; }
virtual uint32_t GetChrRamSize() override { return 0x8000; }
virtual bool HasBusConflicts() override { return !HasBattery(); }
void InitMapper() override
{
SelectPRGPage(1, -1);
if(IsNes20()) {
_oneScreenMirroring = GetMirroringType() == MirroringType::ScreenAOnly;
} else {
_oneScreenMirroring = GetMirroringType() == MirroringType::FourScreens;
}
}
void SetDefaultNametables(uint8_t* nametableA, uint8_t* nametableB) override
{
BaseMapper::SetDefaultNametables(nametableA, nametableB);
if(IsNes20() && !_oneScreenMirroring && _chrRam && _chrRamSize >= 0x8000) {
//InfiniteNesLives four-screen mirroring variation, last 8kb of CHR RAM is always mapped to 0x2000-0x3FFF (0x3EFF due to palette)
//This "breaks" the "UNROM512_4screen_test" test ROM - was the ROM actually tested on this board? Seems to contradict hardware specs
SetPpuMemoryMapping(0x2000, 0x3FFF, _chrRam + 0x6000);
}
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(!HasBattery() || addr >= 0xC000) {
SelectPRGPage(0, value & 0x1F);
SelectCHRPage(0, (value >> 5) & 0x03);
if(_oneScreenMirroring) {
SetMirroringType(value & 0x80 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
}
} else {
//Unimplemented (flash process)
}
}
};