diff --git a/Core/Bmc63.h b/Core/Bmc63.h new file mode 100644 index 00000000..856af06b --- /dev/null +++ b/Core/Bmc63.h @@ -0,0 +1,48 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Bmc63 : public BaseMapper +{ +private: + bool _openBus; + +protected: + virtual uint16_t GetPRGPageSize() { return 0x2000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + WriteRegister(0x8000, 0); + } + + void Reset(bool softReset) + { + _openBus = false; + } + + void StreamState(bool saving) + { + BaseMapper::StreamState(saving); + Stream(_openBus); + if(!saving && _openBus) { + RemoveCpuMemoryMapping(0x8000, 0xBFFF); + } + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + _openBus = ((addr & 0x0300) == 0x0300); + + if(_openBus) { + RemoveCpuMemoryMapping(0x8000, 0xBFFF); + } else { + SelectPRGPage(0, (addr >> 1 & 0x1FC) | ((addr & 0x2) ? 0x0 : (addr >> 1 & 0x2) | 0x0)); + SelectPRGPage(1, (addr >> 1 & 0x1FC) | ((addr & 0x2) ? 0x1 : (addr >> 1 & 0x2) | 0x1)); + } + SelectPRGPage(2, (addr >> 1 & 0x1FC) | ((addr & 0x2) ? 0x2 : (addr >> 1 & 0x2) | 0x0)); + SelectPRGPage(3, (addr & 0x800) ? ((addr & 0x07C) | ((addr & 0x06) ? 0x03 : 0x01)) : ((addr >> 1 & 0x01FC) | ((addr & 0x02) ? 0x03 : ((addr >> 1 & 0x02) | 0x01)))); + + SetMirroringType(addr & 0x01 ? MirroringType::Horizontal : MirroringType::Vertical); + } +}; \ No newline at end of file diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 5d010d49..c2d57eb3 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -412,6 +412,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 6e4dcc34..ad804e3d 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -775,6 +775,9 @@ Nes\Mappers + + Nes\Mappers + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 3d843999..59706ff4 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -8,6 +8,7 @@ #include "Bandai74161_7432.h" #include "BandaiFcg.h" #include "Bmc51.h" +#include "Bmc63.h" #include "Bmc235.h" #include "BnRom.h" #include "BF909x.h" @@ -139,7 +140,7 @@ Supported mappers: (... denotes bad mappers, --- denotes potentially bad mapper | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| | 15| | 16| 17| 18| 19|...| 21| 22| 23| 24| 25| 26| 27| 28| | | 31| | 32| 33| 34| | 36| 37| 38|---| 40| 41| 42|---| 44| 45| 46| 47| -| 48| 49| 50| 51| 52| | | | 56| 57| 58| | 60| 61| 62| | +| 48| 49| 50| 51| 52| | | | 56| 57| 58| | 60| 61| 62| 63| | 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79| | 80| | 82| | | 85| 86| 87| 88| 89| | 91| 92| 93| 94| 95| | | 97| | 99|...|101| | | | | |107| | | | | @@ -222,6 +223,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 60: return new Mapper60(); //Partial support? case 61: return new Mapper61(); case 62: return new Mapper62(); + case 63: return new Bmc63(); case 64: return new Rambo1(); case 65: return new IremH3001(); case 66: return new GxRom();