Better support for MMC3_198

Courtesy to @Rabenda

I took the liberty of polishing and tidying up the comments, otherwise it should work as intended.
This commit is contained in:
RokkumanX 2021-06-22 19:47:00 +02:00 committed by GitHub
parent 1d0792133e
commit 3477a2663e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,9 +4,12 @@
#include "MMC3.h" #include "MMC3.h"
//Most likely incorrect/incomplete, but works (with minor glitches) with the 2 games marked as mapper 198 that I am aware of. //Most likely incorrect/incomplete, but works (with minor glitches) with the 2 games marked as mapper 198 that I am aware of.
//Game 1: 吞食天地2 (CHR RAM, but uses chr banking?, has save ram at 6000-7FFF?) //Game 1: 吞食天地: 三国外传 (Tūnshí Tiāndì - Sānguó Wàizhuàn) (CHR RAM, but uses chr banking?, has save ram at 6000-7FFF)
//Game 2: Cheng Ji Si Han (ES-1110) (Ch) (CHR RAM, work ram mirrored from 5000-7FFF?, doesn't use chr banking) // 吞食天地: 三国外传 (Tūnshí Tiāndì - Sānguó Wàizhuàn) uses ram 5000-7FFF (Add Chinese character process program in 5000-5FFF)
//These games may actually use different mappers. // Original 1994 Hong Kong release by an unknown publisher, 640 KiB PRG-ROM.
//Game 2: 成吉思汗 (Chéngjísīhán) (CHR RAM, work ram mirrored from 5000-7FFF?, doesn't use chr banking)
// 成吉思汗 (Chéngjísīhán) could actually be using MMC3_199 in reality according to the Nesdev wiki.
//These games may actually use different mappers altogether.
class MMC3_198 : public MMC3 class MMC3_198 : public MMC3
{ {
private: private:
@ -44,7 +47,7 @@ protected:
void WriteRegister(uint16_t addr, uint8_t value) override void WriteRegister(uint16_t addr, uint8_t value) override
{ {
if(addr == 0x8001 && (GetState().Reg8000 & 0x07) >= 6) { if(addr == 0x8001 && (GetState().Reg8000 & 0x07) >= 6) {
_exRegs[(GetState().Reg8000 & 0x07) - 6] = value & (value >= 0x40 ? 0x4F : 0x3F); _exRegs[(GetState().Reg8000 & 0x07) - 6] = value & 0x7F;
} }
MMC3::WriteRegister(addr, value); MMC3::WriteRegister(addr, value);
} }
@ -62,4 +65,4 @@ protected:
MMC3::UpdateChrMapping(); MMC3::UpdateChrMapping();
} }
} }
}; };