Skip to content

Commit 05a001c

Browse files
committed
NES: UNROM 512 - Added support for submappers 1 to 3
1 parent f9c7bc6 commit 05a001c

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

Core/NES/Mappers/Homebrew/UnRom512.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class UnRom512 : public BaseMapper
2222
uint16_t RegisterStartAddress() override { return 0x8000; }
2323
uint16_t RegisterEndAddress() override { return 0xFFFF; }
2424
uint32_t GetChrRamSize() override { return 0x8000; }
25-
bool HasBusConflicts() override { return !HasBattery(); }
25+
bool HasBusConflicts() override { return (_romInfo.SubMapperID == 0 && !HasBattery()) || _romInfo.SubMapperID == 2; }
2626
bool AllowRegisterRead() override { return HasBattery(); }
2727

2828
void InitMapper() override
@@ -32,15 +32,20 @@ class UnRom512 : public BaseMapper
3232
SelectPrgPage(1, -1);
3333

3434
_enableMirroringBit = false;
35-
if(GetMirroringType() == MirroringType::ScreenAOnly || GetMirroringType() == MirroringType::ScreenBOnly) {
36-
SetMirroringType(MirroringType::ScreenAOnly);
35+
if(_romInfo.SubMapperID == 3) {
3736
_enableMirroringBit = true;
37+
SetMirroringType(MirroringType::Vertical);
3838
} else {
39-
switch(_romInfo.Header.Byte6 & 0x09) {
40-
case 0: SetMirroringType(MirroringType::Horizontal); break;
41-
case 1: SetMirroringType(MirroringType::Vertical); break;
42-
case 8: SetMirroringType(MirroringType::ScreenAOnly); _enableMirroringBit = true; break;
43-
case 9: SetMirroringType(MirroringType::FourScreens); break;
39+
if(GetMirroringType() == MirroringType::ScreenAOnly || GetMirroringType() == MirroringType::ScreenBOnly) {
40+
SetMirroringType(MirroringType::ScreenAOnly);
41+
_enableMirroringBit = true;
42+
} else {
43+
switch(_romInfo.Header.Byte6 & 0x09) {
44+
case 0: SetMirroringType(MirroringType::Horizontal); break;
45+
case 1: SetMirroringType(MirroringType::Vertical); break;
46+
case 8: SetMirroringType(MirroringType::ScreenAOnly); _enableMirroringBit = true; break;
47+
case 9: SetMirroringType(MirroringType::FourScreens); break;
48+
}
4449
}
4550
}
4651

@@ -106,7 +111,11 @@ class UnRom512 : public BaseMapper
106111
SelectChrPage(0, (value >> 5) & 0x03);
107112

108113
if(_enableMirroringBit) {
109-
SetMirroringType(value & 0x80 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
114+
if(_romInfo.SubMapperID == 3) {
115+
SetMirroringType(value & 0x80 ? MirroringType::Horizontal : MirroringType::Vertical);
116+
} else {
117+
SetMirroringType(value & 0x80 ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
118+
}
110119
}
111120
} else {
112121
_flash->Write((addr & 0x3FFF) | (_prgBank << 14), value);

0 commit comments

Comments
 (0)