2016-06-19 16:45:39 +00:00
|
|
|
#pragma once
|
|
|
|
#include "BaseMapper.h"
|
|
|
|
|
|
|
|
class Waixing164 : public BaseMapper
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
uint8_t _prgBank;
|
|
|
|
|
|
|
|
protected:
|
2016-12-18 04:14:47 +00:00
|
|
|
uint16_t GetPRGPageSize() override { return 0x8000; }
|
|
|
|
uint16_t GetCHRPageSize() override { return 0x2000; }
|
|
|
|
uint16_t RegisterStartAddress() override { return 0x5000; }
|
|
|
|
uint16_t RegisterEndAddress() override { return 0x5FFF; }
|
2016-06-19 16:45:39 +00:00
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void InitMapper() override
|
2016-06-19 16:45:39 +00:00
|
|
|
{
|
|
|
|
_prgBank = 0x0F;
|
|
|
|
SelectPRGPage(0, _prgBank);
|
|
|
|
SelectCHRPage(0, 0);
|
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void StreamState(bool saving) override
|
2016-06-19 16:45:39 +00:00
|
|
|
{
|
|
|
|
BaseMapper::StreamState(saving);
|
|
|
|
Stream(_prgBank);
|
|
|
|
}
|
|
|
|
|
2016-12-18 04:14:47 +00:00
|
|
|
void WriteRegister(uint16_t addr, uint8_t value) override
|
2016-06-19 16:45:39 +00:00
|
|
|
{
|
|
|
|
switch(addr & 0x7300) {
|
|
|
|
case 0x5000: _prgBank = (_prgBank & 0xF0) | (value & 0x0F); SelectPRGPage(0, _prgBank); break;
|
|
|
|
case 0x5100: _prgBank = (_prgBank & 0x0F) | ((value & 0x0F) << 4); SelectPRGPage(0, _prgBank); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|