TaitoX1005 (Mapper 80) support
This commit is contained in:
parent
fc86db8f32
commit
f729f67bb8
5 changed files with 98 additions and 1 deletions
|
@ -86,6 +86,7 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificat
|
|||
//Save ram is battery backed and saved to disk
|
||||
virtual uint32_t GetSaveRamSize() { return 0x2000; }
|
||||
virtual uint32_t GetSaveRamPageSize() { return 0x2000; }
|
||||
virtual bool ForceBattery() { return false; }
|
||||
|
||||
virtual uint32_t GetChrRamSize() { return 0x2000; }
|
||||
|
||||
|
@ -321,7 +322,7 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificat
|
|||
romLoader.GetCHRRam(&_chrRam);
|
||||
_prgSize = romLoader.GetPRGSize();
|
||||
_chrSize = romLoader.GetCHRSize();
|
||||
_hasBattery = romLoader.HasBattery();
|
||||
_hasBattery = romLoader.HasBattery() || ForceBattery();
|
||||
_isPalRom = romLoader.IsPalRom();
|
||||
|
||||
_saveRam = new uint8_t[_saveRamSize];
|
||||
|
|
|
@ -338,6 +338,7 @@
|
|||
<ClInclude Include="ROMLoader.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="TaitoTc0190.h" />
|
||||
<ClInclude Include="TaitoX1005.h" />
|
||||
<ClInclude Include="TriangleChannel.h" />
|
||||
<ClInclude Include="UnlPci556.h" />
|
||||
<ClInclude Include="UNROM.h" />
|
||||
|
|
|
@ -275,6 +275,9 @@
|
|||
<ClInclude Include="Bandai74161_7432.h">
|
||||
<Filter>Header Files\Mappers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TaitoX1005.h">
|
||||
<Filter>Header Files\Mappers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPU.cpp">
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "Nina03_06.h"
|
||||
#include "NROM.h"
|
||||
#include "TaitoTc0190.h"
|
||||
#include "TaitoX1005.h"
|
||||
#include "UnlPci556.h"
|
||||
#include "UNROM.h"
|
||||
#include "VRC2_4.h"
|
||||
|
@ -61,6 +62,7 @@ BaseMapper* MapperFactory::GetMapperFromID(uint8_t mapperID)
|
|||
case 70: return new Bandai74161_7432(false);
|
||||
case 71: return new BF909x();
|
||||
case 79: return new Nina03_06();
|
||||
case 80: return new TaitoX1005();
|
||||
case 87: return new JalecoJfxx(false);
|
||||
case 101: return new JalecoJfxx(true);
|
||||
case 152: return new Bandai74161_7432(true);
|
||||
|
|
90
Core/TaitoX1005.h
Normal file
90
Core/TaitoX1005.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
|
||||
class TaitoX1005 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
uint8_t _ramPermission;
|
||||
|
||||
void UpdateRamAccess()
|
||||
{
|
||||
SetCpuMemoryMapping(0x7F00, 0x7FFF, 0, HasBattery() ? PrgMemoryType::SaveRam : PrgMemoryType::WorkRam, _ramPermission == 0xA3 ? MemoryAccessType::ReadWrite : MemoryAccessType::NoAccess);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() { return 0x0400; }
|
||||
virtual uint16_t RegisterStartAddress() { return 0x7EF0; }
|
||||
virtual uint16_t RegisterEndAddress() { return 0x7EFF; }
|
||||
|
||||
virtual uint32_t GetWorkRamSize() { return 0x100; }
|
||||
virtual uint32_t GetWorkRamPageSize() { return 0x100; }
|
||||
virtual uint32_t GetSaveRamSize() { return 0x100; }
|
||||
virtual uint32_t GetSaveRamPageSize() { return 0x100; }
|
||||
|
||||
void InitMapper()
|
||||
{
|
||||
_ramPermission = 0;
|
||||
|
||||
SelectPRGPage(3, -1);
|
||||
|
||||
UpdateRamAccess();
|
||||
}
|
||||
|
||||
virtual bool ForceBattery()
|
||||
{
|
||||
//Patch: Force battery, because some headers are marked as having no battery even though the game expects one
|
||||
return true;
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
{
|
||||
switch(addr) {
|
||||
case 0x7EF0:
|
||||
SelectCHRPage(0, value);
|
||||
SelectCHRPage(1, value + 1);
|
||||
break;
|
||||
case 0x7EF1:
|
||||
SelectCHRPage(2, value );
|
||||
SelectCHRPage(3, value + 1);
|
||||
break;
|
||||
|
||||
case 0x7EF2: SelectCHRPage(4, value); break;
|
||||
case 0x7EF3: SelectCHRPage(5, value); break;
|
||||
case 0x7EF4: SelectCHRPage(6, value); break;
|
||||
case 0x7EF5: SelectCHRPage(7, value); break;
|
||||
|
||||
case 0x7EF6: case 0x7EF7:
|
||||
SetMirroringType((value & 0x01) == 0x01 ? MirroringType::Vertical : MirroringType::Horizontal);
|
||||
break;
|
||||
|
||||
case 0x7EF8: case 0x7EF9:
|
||||
_ramPermission = value;
|
||||
UpdateRamAccess();
|
||||
break;
|
||||
|
||||
case 0x7EFA: case 0x7EFB:
|
||||
SelectPRGPage(0, value);
|
||||
break;
|
||||
|
||||
case 0x7EFC: case 0x7EFD:
|
||||
SelectPRGPage(1, value);
|
||||
break;
|
||||
|
||||
case 0x7EFE: case 0x7EFF:
|
||||
SelectPRGPage(2, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream<uint8_t>(_ramPermission);
|
||||
|
||||
if(!saving) {
|
||||
UpdateRamAccess();
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue