mirror of
https://github.com/NovaSquirrel/Mesen-X.git
synced 2024-06-01 02:48:18 -04:00
UNIF: Add BTL-831128C board (Mapper 528)
This commit is contained in:
parent
de2dee6cc1
commit
6564cb7cd1
|
@ -261,6 +261,7 @@
|
|||
#include "Unl158B.h"
|
||||
#include "Unl255in1.h"
|
||||
#include "Unl8237A.h"
|
||||
#include "Unl831128C.h"
|
||||
#include "UnlD1038.h"
|
||||
#include "UnlDripGame.h"
|
||||
#include "UnlPci556.h"
|
||||
|
@ -655,7 +656,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
|||
case 525: break; //KS7021A
|
||||
case 526: break; //BJ56
|
||||
case 527: break; //AX40G
|
||||
case 528: break; //831128C
|
||||
case 528: return new Unl831128C();
|
||||
case 529: return new T230();
|
||||
case 530: return new Ax5705();
|
||||
|
||||
|
|
|
@ -185,4 +185,5 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
|
|||
{ "TJ-03", 341 },
|
||||
{ "TH2131-1", 308 },
|
||||
{ "900218", 524 },
|
||||
{ "831128C", 528 },
|
||||
};
|
79
Core/Unl831128C.h
Normal file
79
Core/Unl831128C.h
Normal file
|
@ -0,0 +1,79 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "VrcIrq.h"
|
||||
|
||||
class Unl831128C : public BaseMapper
|
||||
{
|
||||
private:
|
||||
unique_ptr<VrcIrq> _irq;
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() override { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() override { return 0x400; }
|
||||
virtual uint32_t GetWorkRamSize() override { return 0x8000; }
|
||||
virtual uint32_t GetWorkRamPageSize() override { return 0x2000; }
|
||||
|
||||
void InitMapper() override
|
||||
{
|
||||
_irq.reset(new VrcIrq(_console));
|
||||
|
||||
SelectPRGPage(2, -2);
|
||||
SelectPRGPage(3, -1);
|
||||
|
||||
RemoveRegisterRange(0x8000, 0x9FFF, MemoryOperation::Write);
|
||||
RemoveRegisterRange(0xD000, 0xFFFF, MemoryOperation::Write);
|
||||
}
|
||||
|
||||
void ProcessCpuClock() override
|
||||
{
|
||||
_irq->ProcessCpuClock();
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
uint8_t gameReg = (addr >> 10) & 0x10;
|
||||
uint8_t prgMask = 0x0F | gameReg;
|
||||
|
||||
switch(addr & 0xF) {
|
||||
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
||||
SelectCHRPage(addr & 0x07, value + (gameReg << 4));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (value == 1) {
|
||||
SetCpuMemoryMapping(0x6000, 0x7FFF, 0, PrgMemoryType::WorkRam, MemoryAccessType::ReadWrite);
|
||||
} else {
|
||||
SetCpuMemoryMapping(0x6000, 0x7FFF, (value & prgMask) + gameReg, PrgMemoryType::PrgRom);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9: case 0xA:
|
||||
SelectPRGPage((addr >> 1) & 0x01, (value & prgMask) + gameReg);
|
||||
break;
|
||||
|
||||
case 0xC:
|
||||
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 0xD:
|
||||
_irq->SetControlValue(value);
|
||||
break;
|
||||
|
||||
case 0xE:
|
||||
_irq->AcknowledgeIrq();
|
||||
break;
|
||||
|
||||
case 0xF:
|
||||
_irq->SetReloadValue(value);
|
||||
break;
|
||||
}
|
||||
|
||||
SelectPRGPage(2, (-2 & prgMask) + gameReg);
|
||||
SelectPRGPage(3, (-1 & prgMask) + gameReg);
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue