From bb38250190442702d127a3c7225c52263da13985 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 6 Nov 2016 14:21:57 -0500 Subject: [PATCH] UNIF A65AS board support --- Core/A65AS.h | 32 ++++++++++++++++++++++++++++++++ Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 +++ Core/MapperFactory.cpp | 3 +++ Core/MapperFactory.h | 1 + Core/UnifLoader.h | 3 +-- 6 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Core/A65AS.h diff --git a/Core/A65AS.h b/Core/A65AS.h new file mode 100644 index 00000000..ca0279a0 --- /dev/null +++ b/Core/A65AS.h @@ -0,0 +1,32 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class A65AS : public BaseMapper +{ +protected: + uint16_t GetPRGPageSize() { return 0x4000; } + uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() override + { + SelectCHRPage(0, 0); + WriteRegister(0x8000, 0); + } + + void WriteRegister(uint16_t addr, uint8_t value) override + { + if(value & 0x40) { + SelectPrgPage2x(0, value & 0x1E); + } else { + SelectPRGPage(0, ((value & 0x30) >> 1) | (value & 0x07)); + SelectPRGPage(1, ((value & 0x30) >> 1) | 0x07); + } + + if(value & 0x80) { + SetMirroringType(value & 0x20 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly); + } else { + SetMirroringType(value & 0x08 ? MirroringType::Horizontal : MirroringType::Vertical); + } + } +}; \ No newline at end of file diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 94545713..cc93ecc9 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -417,6 +417,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index faf52ff8..1a1236d6 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -991,6 +991,9 @@ Nes\Mappers\Unif + + Nes\Mappers\Unif + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 9747443b..74b23c4c 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -2,6 +2,7 @@ #include "MessageManager.h" #include "MapperFactory.h" #include "RomLoader.h" +#include "A65AS.h" #include "Action53.h" #include "ActionEnterprises.h" #include "AXROM.h" @@ -227,6 +228,7 @@ Supported mappers: const uint16_t MapperFactory::FdsMapperID; const uint16_t MapperFactory::NsfMapperID; const uint16_t MapperFactory::UnknownBoard; +const uint16_t MapperFactory::UnifA65AS; const uint16_t MapperFactory::UnifCoolboy; const uint16_t MapperFactory::UnifDreamTech01; const uint16_t MapperFactory::UnifEdu2000; @@ -465,6 +467,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 254: return new MMC3_254(); case 255: return new Bmc255(); + case MapperFactory::UnifA65AS: return new A65AS(); case MapperFactory::UnifCoolboy: return new MMC3_Coolboy(); case MapperFactory::UnifDreamTech01: return new DreamTech01(); case MapperFactory::UnifEdu2000: return new Edu2000(); diff --git a/Core/MapperFactory.h b/Core/MapperFactory.h index a0d47296..489a0a5f 100644 --- a/Core/MapperFactory.h +++ b/Core/MapperFactory.h @@ -24,6 +24,7 @@ class MapperFactory static const uint16_t UnifNovelDiamond = 65523; static const uint16_t UnifKof97 = 65522; static const uint16_t UnifT262 = 65521; + static const uint16_t UnifA65AS = 65520; static shared_ptr InitializeFromFile(string romFilename, stringstream *filestream, string ipsFilename, int32_t archiveFileIndex); }; diff --git a/Core/UnifLoader.h b/Core/UnifLoader.h index 7b1c7c5c..bfb27fc9 100644 --- a/Core/UnifLoader.h +++ b/Core/UnifLoader.h @@ -26,7 +26,7 @@ private: { "8237", 215 }, { "8237A", MapperFactory::UnknownBoard }, { "830118C", MapperFactory::UnknownBoard }, - { "A65AS", MapperFactory::UnknownBoard }, + { "A65AS", MapperFactory::UnifA65AS }, { "AC08", MapperFactory::UnknownBoard }, { "ANROM", 7 }, { "AX5705", MapperFactory::UnknownBoard }, @@ -150,7 +150,6 @@ private: { "VRC7", MapperFactory::UnknownBoard }, { "YOKO", MapperFactory::UnknownBoard }, { "SB-2000", MapperFactory::UnknownBoard }, - { "COOLBOY", MapperFactory::UnknownBoard }, { "158B", MapperFactory::UnknownBoard }, { "DRAGONFIGHTER", MapperFactory::UnknownBoard }, { "EH8813A", MapperFactory::UnknownBoard },