2016-08-11 23:12:40 +00:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "BaseMapper.h"
|
|
|
|
#include "ControlManager.h"
|
|
|
|
#include "StandardController.h"
|
2017-11-20 04:08:23 +00:00
|
|
|
#include "BandaiMicrophone.h"
|
2016-08-11 23:12:40 +00:00
|
|
|
|
|
|
|
class BandaiKaraoke : public BaseMapper
|
|
|
|
{
|
|
|
|
protected:
|
2017-11-20 04:08:23 +00:00
|
|
|
uint16_t GetPRGPageSize() override { return 0x4000; }
|
|
|
|
uint16_t GetCHRPageSize() override { return 0x2000; }
|
|
|
|
bool AllowRegisterRead() override { return true; }
|
|
|
|
bool HasBusConflicts() override { return true; }
|
2017-12-28 17:47:26 +00:00
|
|
|
ConsoleFeatures GetAvailableFeatures() override { return ConsoleFeatures::BandaiMicrophone; }
|
2016-08-11 23:12:40 +00:00
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void InitMapper() override
|
2016-08-11 23:12:40 +00:00
|
|
|
{
|
|
|
|
AddRegisterRange(0x6000, 0x7FFF, MemoryOperation::Read);
|
|
|
|
RemoveRegisterRange(0x8000, 0xFFFF, MemoryOperation::Read);
|
|
|
|
|
|
|
|
SelectPRGPage(0, 0);
|
|
|
|
SelectPRGPage(1, 0x07);
|
|
|
|
SelectCHRPage(0, 0);
|
2017-11-20 04:08:23 +00:00
|
|
|
|
2018-07-14 02:19:26 +00:00
|
|
|
_mapperControlDevice.reset(new BandaiMicrophone(_console, _console->GetSettings()->GetControllerKeys(0)));
|
2016-08-11 23:12:40 +00:00
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
uint8_t ReadRegister(uint16_t addr) override
|
2016-08-11 23:12:40 +00:00
|
|
|
{
|
2018-07-01 19:21:05 +00:00
|
|
|
return _mapperControlDevice->ReadRAM(addr) | _console->GetMemoryManager()->GetOpenBus(0xF8);
|
2016-08-11 23:12:40 +00:00
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void WriteRegister(uint16_t addr, uint8_t value) override
|
2016-08-11 23:12:40 +00:00
|
|
|
{
|
|
|
|
if(value & 0x10) {
|
|
|
|
//Select internal rom
|
|
|
|
SelectPRGPage(0, value & 0x07);
|
|
|
|
} else {
|
|
|
|
//Select expansion rom
|
|
|
|
if(_prgSize >= 0x40000) {
|
|
|
|
SelectPRGPage(0, (value & 0x07) | 0x08);
|
|
|
|
} else {
|
|
|
|
//Open bus for roms that don't contain the expansion rom
|
|
|
|
RemoveCpuMemoryMapping(0x8000, 0xBFFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetMirroringType(value & 0x20 ? MirroringType::Horizontal : MirroringType::Vertical);
|
|
|
|
}
|
|
|
|
};
|