SxROM - some small cleanup/simplification

This commit is contained in:
adelikat 2018-11-01 10:27:51 -05:00
parent 9ebe0d2531
commit a8e85f742c
2 changed files with 20 additions and 23 deletions

View File

@ -75,9 +75,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//register 0:
public int chr_mode;
public int prg_mode;
public int prg_slot; //complicated
public int prg_slot; // complicated
public NES.NESBoardBase.EMirrorType mirror;
static NES.NESBoardBase.EMirrorType[] _mirrorTypes = new NES.NESBoardBase.EMirrorType[] { NES.NESBoardBase.EMirrorType.OneScreenA, NES.NESBoardBase.EMirrorType.OneScreenB, NES.NESBoardBase.EMirrorType.Vertical, NES.NESBoardBase.EMirrorType.Horizontal };
static readonly NES.NESBoardBase.EMirrorType[] _mirrorTypes =
{
NES.NESBoardBase.EMirrorType.OneScreenA,
NES.NESBoardBase.EMirrorType.OneScreenB,
NES.NESBoardBase.EMirrorType.Vertical,
NES.NESBoardBase.EMirrorType.Horizontal
};
//register 1,2:
int chr_0, chr_1;
@ -87,8 +93,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int prg;
//regenerable state
IntBuffer chr_banks_4k = new IntBuffer(2);
IntBuffer prg_banks_16k = new IntBuffer(2);
readonly IntBuffer chr_banks_4k = new IntBuffer(2);
readonly IntBuffer prg_banks_16k = new IntBuffer(2);
public class MMC1_SerialController
{
@ -117,8 +123,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
shift_count = 0;
shift_val = 0;
if (Reset != null)
Reset();
Reset?.Invoke();
}
else
{
@ -178,7 +183,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
break;
case 3: //E000-FFFF
prg = value & 0xF;
wram_disable = value.Bit(4) ? true : false;
wram_disable = value.Bit(4);
break;
}
//board.NES.LogLine("mapping.. chr_mode={0}, chr={1},{2}", chr_mode, chr_0, chr_1);
@ -227,16 +232,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int Get_PRGBank(int addr)
{
int bank_16k = addr >> 14;
bank_16k = prg_banks_16k[bank_16k];
return bank_16k;
return prg_banks_16k[addr >> 14];
}
public int Get_CHRBank_4K(int addr)
{
int bank_4k = addr >> 12;
bank_4k = chr_banks_4k[bank_4k];
return bank_4k;
return chr_banks_4k[addr >> 12];
}
}
@ -279,8 +280,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (!disablemirror)
SetMirrorType(mmc1.mirror); //often redundant, but gets the job done
}
}
public override byte ReadWRAM(int addr)
@ -314,8 +313,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
if (_is_snrom)
@ -355,8 +352,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public override void WritePPU(int addr, byte value)
{
if (NES._isVS)
{
if (addr < 0x2000)
@ -555,7 +550,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
} //class SxROM
class SoROM : SuROM
{
//this uses a CHR bit to select WRAM banks
@ -639,7 +633,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
class SuROM : SxROM
{
public override bool Configure(NES.EDetectionOrigin origin)
@ -681,5 +674,4 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
return ROM[addr];
}
}
}

View File

@ -168,5 +168,10 @@
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=TextEditor_002DTrackChanges_002D2/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=VCS/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=VsBulb/@EntryIndexedValue">DO_NOTHING</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=XAML_0020Designer/@EntryIndexedValue">LIVE_MONITOR</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=XAML_0020Designer/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=addr/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>