UNIF: Added support for UNL-T-230 boards
This commit is contained in:
parent
3104e6150d
commit
6d17a5a8e5
6 changed files with 125 additions and 1 deletions
|
@ -622,6 +622,7 @@
|
|||
<ClInclude Include="SnesMouse.h" />
|
||||
<ClInclude Include="SuborKeyboard.h" />
|
||||
<ClInclude Include="SuborMouse.h" />
|
||||
<ClInclude Include="T230.h" />
|
||||
<ClInclude Include="Unl158B.h" />
|
||||
<ClInclude Include="UnlD1038.h" />
|
||||
<ClInclude Include="DaouInfosys.h" />
|
||||
|
|
|
@ -1417,6 +1417,9 @@
|
|||
<ClInclude Include="Yoko.h">
|
||||
<Filter>Nes\Mappers\Unif</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="T230.h">
|
||||
<Filter>Nes\Mappers\Unif</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
|
@ -224,6 +224,7 @@
|
|||
#include "SunsoftFme7.h"
|
||||
#include "Supervision.h"
|
||||
#include "Super40in1Ws.h"
|
||||
#include "T230.h"
|
||||
#include "T262.h"
|
||||
#include "TaitoTc0190.h"
|
||||
#include "TaitoTc0690.h"
|
||||
|
@ -576,6 +577,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
|
|||
case UnifBoards::StreetHeroes: return new MMC3_StreetHeroes();
|
||||
case UnifBoards::Super24in1Sc03: return new MMC3_Super24in1Sc03();
|
||||
case UnifBoards::Super40in1Ws: return new Super40in1Ws();
|
||||
case UnifBoards::T230: return new T230();
|
||||
case UnifBoards::T262: return new T262();
|
||||
case UnifBoards::Tf1201: return new Tf1201();
|
||||
case UnifBoards::Unl158B: return new Unl158B();
|
||||
|
|
117
Core/T230.h
Normal file
117
Core/T230.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
#include "VrcIrq.h"
|
||||
|
||||
class T230 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
VrcIrq _irq;
|
||||
|
||||
uint8_t _prgReg0;
|
||||
uint8_t _prgReg1;
|
||||
uint8_t _prgMode;
|
||||
|
||||
uint16_t _outerBank;
|
||||
|
||||
uint8_t _hiCHRRegs[8];
|
||||
uint8_t _loCHRRegs[8];
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() override { return 0x2000; }
|
||||
virtual uint16_t GetCHRPageSize() override { return 0x0400; }
|
||||
|
||||
void InitMapper() override
|
||||
{
|
||||
_prgMode = GetPowerOnByte() & 0x01;
|
||||
_prgReg0 = GetPowerOnByte() & 0x1F;
|
||||
_prgReg1 = GetPowerOnByte() & 0x1F;
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
_loCHRRegs[i] = GetPowerOnByte() & 0x0F;
|
||||
_hiCHRRegs[i] = GetPowerOnByte() & 0x1F;
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void ProcessCpuClock() override
|
||||
{
|
||||
_irq.ProcessCpuClock();
|
||||
}
|
||||
|
||||
void UpdateState()
|
||||
{
|
||||
if(_chrRamSize) {
|
||||
SelectChrPage8x(0, 0);
|
||||
} else {
|
||||
for(int i = 0; i < 8; i++) {
|
||||
SelectCHRPage(i, _loCHRRegs[i] | (_hiCHRRegs[i] << 4));
|
||||
}
|
||||
}
|
||||
|
||||
if(_prgMode == 0) {
|
||||
SelectPRGPage(0, _prgReg0 | _outerBank);
|
||||
SelectPRGPage(2, (-2 & 0x1F) | _outerBank);
|
||||
} else {
|
||||
SelectPRGPage(0, (-2 & 0x1F) | _outerBank);
|
||||
SelectPRGPage(2, _prgReg0 | _outerBank);
|
||||
}
|
||||
SelectPRGPage(1, _prgReg1);
|
||||
SelectPRGPage(3, -1);
|
||||
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
addr = addr & 0xF000 | (addr & 0x2A ? 0x02 : 0) | (addr & 0x15 ? 0x01 : 0);
|
||||
|
||||
if(addr >= 0x9000 && addr <= 0x9001) {
|
||||
switch(value) {
|
||||
case 0: SetMirroringType(MirroringType::Vertical); break;
|
||||
case 1: SetMirroringType(MirroringType::Horizontal); break;
|
||||
case 2: SetMirroringType(MirroringType::ScreenAOnly); break;
|
||||
case 3: SetMirroringType(MirroringType::ScreenBOnly); break;
|
||||
}
|
||||
} else if(addr >= 0x9002 && addr <= 0x9003) {
|
||||
_prgMode = (value >> 1) & 0x01;
|
||||
} else if(addr >= 0xA000 && addr <= 0xA003) {
|
||||
_prgReg0 = (value & 0x1F) << 1;
|
||||
_prgReg1 = ((value & 0x1F) << 1) | 0x01;
|
||||
} else if(addr >= 0xB000 && addr <= 0xE003) {
|
||||
if(_chrRamSize > 0) {
|
||||
_outerBank = (value & 0x08) << 2;
|
||||
} else {
|
||||
uint8_t regNumber = ((((addr >> 12) & 0x07) - 3) << 1) + ((addr >> 1) & 0x01);
|
||||
bool lowBits = (addr & 0x01) == 0x00;
|
||||
if(lowBits) {
|
||||
//The other reg contains the low 4 bits
|
||||
_loCHRRegs[regNumber] = value & 0x0F;
|
||||
} else {
|
||||
//One reg contains the high 5 bits
|
||||
_hiCHRRegs[regNumber] = value & 0x1F;
|
||||
}
|
||||
}
|
||||
} else if(addr == 0xF000) {
|
||||
_irq.SetReloadValueNibble(value, false);
|
||||
} else if(addr == 0xF001) {
|
||||
_irq.SetReloadValueNibble(value, true);
|
||||
} else if(addr == 0xF002) {
|
||||
_irq.SetControlValue(value);
|
||||
} else if(addr == 0xF003) {
|
||||
_irq.AcknowledgeIrq();
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
public:
|
||||
void StreamState(bool saving) override
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
ArrayInfo<uint8_t> loChrRegs = { _loCHRRegs, 8 };
|
||||
ArrayInfo<uint8_t> hiChrRegs = { _hiCHRRegs, 8 };
|
||||
SnapshotInfo irq { &_irq };
|
||||
Stream(_prgReg0, _prgReg1, _prgMode, loChrRegs, hiChrRegs, irq);
|
||||
}
|
||||
};
|
|
@ -17,6 +17,7 @@ namespace UnifBoards {
|
|||
Gs2004,
|
||||
NovelDiamond,
|
||||
Kof97,
|
||||
T230,
|
||||
T262,
|
||||
A65AS,
|
||||
Bs5,
|
||||
|
|
|
@ -120,7 +120,7 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
|
|||
{ "SuperHIK8in1", 45 },
|
||||
{ "Supervision16in1", 53 },
|
||||
{ "T-227-1", UnifBoards::UnknownBoard },
|
||||
{ "T-230", UnifBoards::UnknownBoard },
|
||||
{ "T-230", UnifBoards::T230 },
|
||||
{ "T-262", UnifBoards::T262 },
|
||||
{ "TBROM", 4 },
|
||||
{ "TC-U01-1.5M", 147 },
|
||||
|
|
Loading…
Add table
Reference in a new issue