use Dictionary initializers instead of object initializers for various GetCpuFlagsAndRegisters() methods

This commit is contained in:
adelikat 2017-04-25 08:28:06 -05:00
parent 9ec9975f48
commit 2de20e956b
10 changed files with 177 additions and 179 deletions

View File

@ -12,36 +12,36 @@ namespace BizHawk.Emulation.Cores.Calculators
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", Cpu.RegisterA }, ["A"] = Cpu.RegisterA,
{ "AF", Cpu.RegisterAF }, ["AF"] = Cpu.RegisterAF,
{ "B", Cpu.RegisterB }, ["B"] = Cpu.RegisterB,
{ "BC", Cpu.RegisterBC }, ["BC"] = Cpu.RegisterBC,
{ "C", Cpu.RegisterC }, ["C"] = Cpu.RegisterC,
{ "D", Cpu.RegisterD }, ["D"] = Cpu.RegisterD,
{ "DE", Cpu.RegisterDE }, ["DE"] = Cpu.RegisterDE,
{ "E", Cpu.RegisterE }, ["E"] = Cpu.RegisterE,
{ "F", Cpu.RegisterF }, ["F"] = Cpu.RegisterF,
{ "H", Cpu.RegisterH }, ["H"] = Cpu.RegisterH,
{ "HL", Cpu.RegisterHL }, ["HL"] = Cpu.RegisterHL,
{ "I", Cpu.RegisterI }, ["I"] = Cpu.RegisterI,
{ "IX", Cpu.RegisterIX }, ["IX"] = Cpu.RegisterIX,
{ "IY", Cpu.RegisterIY }, ["IY"] = Cpu.RegisterIY,
{ "L", Cpu.RegisterL }, ["L"] = Cpu.RegisterL,
{ "PC", Cpu.RegisterPC }, ["PC"] = Cpu.RegisterPC,
{ "R", Cpu.RegisterR }, ["R"] = Cpu.RegisterR,
{ "Shadow AF", Cpu.RegisterShadowAF }, ["Shadow AF"] = Cpu.RegisterShadowAF,
{ "Shadow BC", Cpu.RegisterShadowBC }, ["Shadow BC"] = Cpu.RegisterShadowBC,
{ "Shadow DE", Cpu.RegisterShadowDE }, ["Shadow DE"] = Cpu.RegisterShadowDE,
{ "Shadow HL", Cpu.RegisterShadowHL }, ["Shadow HL"] = Cpu.RegisterShadowHL,
{ "SP", Cpu.RegisterSP }, ["SP"] = Cpu.RegisterSP,
{ "Flag C", Cpu.RegisterF.Bit(0) }, ["Flag C"] = Cpu.RegisterF.Bit(0),
{ "Flag N", Cpu.RegisterF.Bit(1) }, ["Flag N"] = Cpu.RegisterF.Bit(1),
{ "Flag P/V", Cpu.RegisterF.Bit(2) }, ["Flag P/V"] = Cpu.RegisterF.Bit(2),
{ "Flag 3rd", Cpu.RegisterF.Bit(3) }, ["Flag 3rd"] = Cpu.RegisterF.Bit(3),
{ "Flag H", Cpu.RegisterF.Bit(4) }, ["Flag H"] = Cpu.RegisterF.Bit(4),
{ "Flag 5th", Cpu.RegisterF.Bit(5) }, ["Flag 5th"] = Cpu.RegisterF.Bit(5),
{ "Flag Z", Cpu.RegisterF.Bit(6) }, ["Flag Z"] = Cpu.RegisterF.Bit(6),
{ "Flag S", Cpu.RegisterF.Bit(7) } ["Flag S"] = Cpu.RegisterF.Bit(7)
}; };
} }
@ -120,7 +120,7 @@ namespace BizHawk.Emulation.Cores.Calculators
} }
} }
public IMemoryCallbackSystem MemoryCallbacks { get; } public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem();
[FeatureNotImplemented] [FeatureNotImplemented]
public void Step(StepType type) public void Step(StepType type)

View File

@ -11,8 +11,7 @@ namespace BizHawk.Emulation.Cores.Calculators
"TI83Hawk", "TI83Hawk",
"zeromus", "zeromus",
isPorted: false, isPorted: false,
isReleased: true isReleased: true)]
)]
[ServiceNotApplicable(typeof(ISoundProvider), typeof(ISaveRam), typeof(IRegionable), typeof(IDriveLight))] [ServiceNotApplicable(typeof(ISoundProvider), typeof(ISaveRam), typeof(IRegionable), typeof(IDriveLight))]
public partial class TI83 : IEmulator, IVideoProvider, IStatable, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object> public partial class TI83 : IEmulator, IVideoProvider, IStatable, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
{ {
@ -37,7 +36,6 @@ namespace BizHawk.Emulation.Cores.Calculators
// different calculators (different revisions?) have different initPC. we track this in the game database by rom hash // different calculators (different revisions?) have different initPC. we track this in the game database by rom hash
// if( *(unsigned long *)(m_pRom + 0x6ce) == 0x04D3163E ) m_Regs.PC.W = 0x6ce; //KNOWN // if( *(unsigned long *)(m_pRom + 0x6ce) == 0x04D3163E ) m_Regs.PC.W = 0x6ce; //KNOWN
// else if( *(unsigned long *)(m_pRom + 0x6f6) == 0x04D3163E ) m_Regs.PC.W = 0x6f6; //UNKNOWN // else if( *(unsigned long *)(m_pRom + 0x6f6) == 0x04D3163E ) m_Regs.PC.W = 0x6f6; //UNKNOWN
if (game["initPC"]) if (game["initPC"])
{ {
_startPC = ushort.Parse(game.OptionValue("initPC"), NumberStyles.HexNumber); _startPC = ushort.Parse(game.OptionValue("initPC"), NumberStyles.HexNumber);

View File

@ -11,21 +11,21 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", Cpu.A }, ["A"] = Cpu.A,
{ "X", Cpu.X }, ["X"] = Cpu.X,
{ "Y", Cpu.Y }, ["Y"] = Cpu.Y,
{ "S", Cpu.S }, ["S"] = Cpu.S,
{ "PC", Cpu.PC }, ["PC"] = Cpu.PC,
{ "Flag C", Cpu.FlagC }, ["Flag C"] = Cpu.FlagC,
{ "Flag Z", Cpu.FlagZ }, ["Flag Z"] = Cpu.FlagZ,
{ "Flag I", Cpu.FlagI }, ["Flag I"] = Cpu.FlagI,
{ "Flag D", Cpu.FlagD }, ["Flag D"] = Cpu.FlagD,
{ "Flag B", Cpu.FlagB }, ["Flag B"] = Cpu.FlagB,
{ "Flag V", Cpu.FlagV }, ["Flag V"] = Cpu.FlagV,
{ "Flag N", Cpu.FlagN }, ["Flag N"] = Cpu.FlagN,
{ "Flag T", Cpu.FlagT } ["Flag T"] = Cpu.FlagT
}; };
} }

View File

@ -11,19 +11,19 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", theMachine.CPU.A }, ["A"] = theMachine.CPU.A,
{ "P", theMachine.CPU.P }, ["P"] = theMachine.CPU.P,
{ "PC", theMachine.CPU.PC }, ["PC"] = theMachine.CPU.PC,
{ "S", theMachine.CPU.S }, ["S"] = theMachine.CPU.S,
{ "X", theMachine.CPU.X }, ["X"] = theMachine.CPU.X,
{ "Y", theMachine.CPU.Y }, ["Y"] = theMachine.CPU.Y,
{ "Flag B", theMachine.CPU.fB }, ["Flag B"] = theMachine.CPU.fB,
{ "Flag C", theMachine.CPU.fC }, ["Flag C"] = theMachine.CPU.fC,
{ "Flag D", theMachine.CPU.fD }, ["Flag D"] = theMachine.CPU.fD,
{ "Flag I", theMachine.CPU.fI }, ["Flag I"] = theMachine.CPU.fI,
{ "Flag N", theMachine.CPU.fN }, ["Flag N"] = theMachine.CPU.fN,
{ "Flag V", theMachine.CPU.fV }, ["Flag V"] = theMachine.CPU.fV,
{ "Flag Z", theMachine.CPU.fZ } ["Flag Z"] = theMachine.CPU.fZ
}; };
} }

View File

@ -12,36 +12,36 @@ namespace BizHawk.Emulation.Cores.ColecoVision
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", Cpu.RegisterA }, ["A"] = Cpu.RegisterA,
{ "AF", Cpu.RegisterAF }, ["AF"] = Cpu.RegisterAF,
{ "B", Cpu.RegisterB }, ["B"] = Cpu.RegisterB,
{ "BC", Cpu.RegisterBC }, ["BC"] = Cpu.RegisterBC,
{ "C", Cpu.RegisterC }, ["C"] = Cpu.RegisterC,
{ "D", Cpu.RegisterD }, ["D"] = Cpu.RegisterD,
{ "DE", Cpu.RegisterDE }, ["DE"] = Cpu.RegisterDE,
{ "E", Cpu.RegisterE }, ["E"] = Cpu.RegisterE,
{ "F", Cpu.RegisterF }, ["F"] = Cpu.RegisterF,
{ "H", Cpu.RegisterH }, ["H"] = Cpu.RegisterH,
{ "HL", Cpu.RegisterHL }, ["HL"] = Cpu.RegisterHL,
{ "I", Cpu.RegisterI }, ["I"] = Cpu.RegisterI,
{ "IX", Cpu.RegisterIX }, ["IX"] = Cpu.RegisterIX,
{ "IY", Cpu.RegisterIY }, ["IY"] = Cpu.RegisterIY,
{ "L", Cpu.RegisterL }, ["L"] = Cpu.RegisterL,
{ "PC", Cpu.RegisterPC }, ["PC"] = Cpu.RegisterPC,
{ "R", Cpu.RegisterR }, ["R"] = Cpu.RegisterR,
{ "Shadow AF", Cpu.RegisterShadowAF }, ["Shadow AF"] = Cpu.RegisterShadowAF,
{ "Shadow BC", Cpu.RegisterShadowBC }, ["Shadow BC"] = Cpu.RegisterShadowBC,
{ "Shadow DE", Cpu.RegisterShadowDE }, ["Shadow DE"] = Cpu.RegisterShadowDE,
{ "Shadow HL", Cpu.RegisterShadowHL }, ["Shadow HL"] = Cpu.RegisterShadowHL,
{ "SP", Cpu.RegisterSP }, ["SP"] = Cpu.RegisterSP,
{ "Flag C", Cpu.RegisterF.Bit(0) }, ["Flag C"] = Cpu.RegisterF.Bit(0),
{ "Flag N", Cpu.RegisterF.Bit(1) }, ["Flag N"] = Cpu.RegisterF.Bit(1),
{ "Flag P/V", Cpu.RegisterF.Bit(2) }, ["Flag P/V"] = Cpu.RegisterF.Bit(2),
{ "Flag 3rd", Cpu.RegisterF.Bit(3) }, ["Flag 3rd"] = Cpu.RegisterF.Bit(3),
{ "Flag H", Cpu.RegisterF.Bit(4) }, ["Flag H"] = Cpu.RegisterF.Bit(4),
{ "Flag 5th", Cpu.RegisterF.Bit(5) }, ["Flag 5th"] = Cpu.RegisterF.Bit(5),
{ "Flag Z", Cpu.RegisterF.Bit(6) }, ["Flag Z"] = Cpu.RegisterF.Bit(6),
{ "Flag S", Cpu.RegisterF.Bit(7) } ["Flag S"] = Cpu.RegisterF.Bit(7)
}; };
} }

View File

@ -15,16 +15,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "PC", (ushort)(data[(int)LibGambatte.RegIndicies.PC] & 0xffff) }, ["PC"] = (ushort)(data[(int)LibGambatte.RegIndicies.PC] & 0xffff),
{ "SP", (ushort)(data[(int)LibGambatte.RegIndicies.SP] & 0xffff) }, ["SP"] = (ushort)(data[(int)LibGambatte.RegIndicies.SP] & 0xffff),
{ "A", (byte)(data[(int)LibGambatte.RegIndicies.A] & 0xff) }, ["A"] = (byte)(data[(int)LibGambatte.RegIndicies.A] & 0xff),
{ "B", (byte)(data[(int)LibGambatte.RegIndicies.B] & 0xff) }, ["B"] = (byte)(data[(int)LibGambatte.RegIndicies.B] & 0xff),
{ "C", (byte)(data[(int)LibGambatte.RegIndicies.C] & 0xff) }, ["C"] = (byte)(data[(int)LibGambatte.RegIndicies.C] & 0xff),
{ "D", (byte)(data[(int)LibGambatte.RegIndicies.D] & 0xff) }, ["D"] = (byte)(data[(int)LibGambatte.RegIndicies.D] & 0xff),
{ "E", (byte)(data[(int)LibGambatte.RegIndicies.E] & 0xff) }, ["E"] = (byte)(data[(int)LibGambatte.RegIndicies.E] & 0xff),
{ "F", (byte)(data[(int)LibGambatte.RegIndicies.F] & 0xff) }, ["F"] = (byte)(data[(int)LibGambatte.RegIndicies.F] & 0xff),
{ "H", (byte)(data[(int)LibGambatte.RegIndicies.H] & 0xff) }, ["H"] = (byte)(data[(int)LibGambatte.RegIndicies.H] & 0xff),
{ "L", (byte)(data[(int)LibGambatte.RegIndicies.L] & 0xff) } ["L"] = (byte)(data[(int)LibGambatte.RegIndicies.L] & 0xff)
}; };
} }

View File

@ -11,19 +11,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", cpu.A }, ["A"] = cpu.A,
{ "X", cpu.X }, ["X"] = cpu.X,
{ "Y", cpu.Y }, ["Y"] = cpu.Y,
{ "S", cpu.S }, ["S"] = cpu.S,
{ "PC", cpu.PC }, ["PC"] = cpu.PC,
{ "Flag C", cpu.FlagC }, ["Flag C"] = cpu.FlagC,
{ "Flag Z", cpu.FlagZ }, ["Flag Z"] = cpu.FlagZ,
{ "Flag I", cpu.FlagI }, ["Flag I"] = cpu.FlagI,
{ "Flag D", cpu.FlagD }, ["Flag D"] = cpu.FlagD,
{ "Flag B", cpu.FlagB }, ["Flag B"] = cpu.FlagB,
{ "Flag V", cpu.FlagV }, ["Flag V"] = cpu.FlagV,
{ "Flag N", cpu.FlagN }, ["Flag N"] = cpu.FlagN,
{ "Flag T", cpu.FlagT } ["Flag T"] = cpu.FlagT
}; };
} }

View File

@ -23,29 +23,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "PC", regs.pc }, ["PC"] = regs.pc,
{ "A", regs.a }, ["A"] = regs.a,
{ "X", regs.x }, ["X"] = regs.x,
{ "Y", regs.y }, ["Y"] = regs.y,
{ "Z", regs.z }, ["Z"] = regs.z,
{ "S", regs.s }, ["S"] = regs.s,
{ "D", regs.d }, ["D"] = regs.d,
{ "Vector", regs.vector }, ["Vector"] = regs.vector,
{ "P", regs.p }, ["P"] = regs.p,
{ "AA", regs.aa }, ["AA"] = regs.aa,
{ "RD", regs.rd }, ["RD"] = regs.rd,
{ "SP", regs.sp }, ["SP"] = regs.sp,
{ "DP", regs.dp }, ["DP"] = regs.dp,
{ "DB", regs.db }, ["DB"] = regs.db,
{ "MDR", regs.mdr }, ["MDR"] = regs.mdr,
{ "Flag N", fn }, ["Flag N"] = fn,
{ "Flag V", fv }, ["Flag V"] = fv,
{ "Flag M", fm }, ["Flag M"] = fm,
{ "Flag X", fx }, ["Flag X"] = fx,
{ "Flag D", fd }, ["Flag D"] = fd,
{ "Flag I", fi }, ["Flag I"] = fi,
{ "Flag Z", fz }, ["Flag Z"] = fz,
{ "Flag C", fc }, ["Flag C"] = fc,
}; };
} }

View File

@ -11,19 +11,19 @@ namespace BizHawk.Emulation.Cores.PCEngine
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", Cpu.A }, ["A"] = Cpu.A,
{ "X", Cpu.X }, ["X"] = Cpu.X,
{ "Y", Cpu.Y }, ["Y"] = Cpu.Y,
{ "PC", Cpu.PC }, ["PC"] = Cpu.PC,
{ "S", Cpu.S }, ["S"] = Cpu.S,
{ "MPR-0", Cpu.MPR[0] }, ["MPR-0"] = Cpu.MPR[0],
{ "MPR-1", Cpu.MPR[1] }, ["MPR-1"] = Cpu.MPR[1],
{ "MPR-2", Cpu.MPR[2] }, ["MPR-2"] = Cpu.MPR[2],
{ "MPR-3", Cpu.MPR[3] }, ["MPR-3"] = Cpu.MPR[3],
{ "MPR-4", Cpu.MPR[4] }, ["MPR-4"] = Cpu.MPR[4],
{ "MPR-5", Cpu.MPR[5] }, ["MPR-5"] = Cpu.MPR[5],
{ "MPR-6", Cpu.MPR[6] }, ["MPR-6"] = Cpu.MPR[6],
{ "MPR-7", Cpu.MPR[7] } ["MPR-7"] = Cpu.MPR[7]
}; };
} }

View File

@ -12,36 +12,36 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{ {
return new Dictionary<string, RegisterValue> return new Dictionary<string, RegisterValue>
{ {
{ "A", Cpu.RegisterA }, ["A"] = Cpu.RegisterA,
{ "AF", Cpu.RegisterAF }, ["AF"] = Cpu.RegisterAF,
{ "B", Cpu.RegisterB }, ["B"] = Cpu.RegisterB,
{ "BC", Cpu.RegisterBC }, ["BC"] = Cpu.RegisterBC,
{ "C", Cpu.RegisterC }, ["C"] = Cpu.RegisterC,
{ "D", Cpu.RegisterD }, ["D"] = Cpu.RegisterD,
{ "DE", Cpu.RegisterDE }, ["DE"] = Cpu.RegisterDE,
{ "E", Cpu.RegisterE }, ["E"] = Cpu.RegisterE,
{ "F", Cpu.RegisterF }, ["F"] = Cpu.RegisterF,
{ "H", Cpu.RegisterH }, ["H"] = Cpu.RegisterH,
{ "HL", Cpu.RegisterHL }, ["HL"] = Cpu.RegisterHL,
{ "I", Cpu.RegisterI }, ["I"] = Cpu.RegisterI,
{ "IX", Cpu.RegisterIX }, ["IX"] = Cpu.RegisterIX,
{ "IY", Cpu.RegisterIY }, ["IY"] = Cpu.RegisterIY,
{ "L", Cpu.RegisterL }, ["L"] = Cpu.RegisterL,
{ "PC", Cpu.RegisterPC }, ["PC"] = Cpu.RegisterPC,
{ "R", Cpu.RegisterR }, ["R"] = Cpu.RegisterR,
{ "Shadow AF", Cpu.RegisterShadowAF }, ["Shadow AF"] = Cpu.RegisterShadowAF,
{ "Shadow BC", Cpu.RegisterShadowBC }, ["Shadow BC"] = Cpu.RegisterShadowBC,
{ "Shadow DE", Cpu.RegisterShadowDE }, ["Shadow DE"] = Cpu.RegisterShadowDE,
{ "Shadow HL", Cpu.RegisterShadowHL }, ["Shadow HL"] = Cpu.RegisterShadowHL,
{ "SP", Cpu.RegisterSP }, ["SP"] = Cpu.RegisterSP,
{ "Flag C", Cpu.RegisterF.Bit(0) }, ["Flag C"] = Cpu.RegisterF.Bit(0),
{ "Flag N", Cpu.RegisterF.Bit(1) }, ["Flag N"] = Cpu.RegisterF.Bit(1),
{ "Flag P/V", Cpu.RegisterF.Bit(2) }, ["Flag P/V"] = Cpu.RegisterF.Bit(2),
{ "Flag 3rd", Cpu.RegisterF.Bit(3) }, ["Flag 3rd"] = Cpu.RegisterF.Bit(3),
{ "Flag H", Cpu.RegisterF.Bit(4) }, ["Flag H"] = Cpu.RegisterF.Bit(4),
{ "Flag 5th", Cpu.RegisterF.Bit(5) }, ["Flag 5th"] = Cpu.RegisterF.Bit(5),
{ "Flag Z", Cpu.RegisterF.Bit(6) }, ["Flag Z"] = Cpu.RegisterF.Bit(6),
{ "Flag S", Cpu.RegisterF.Bit(7) }, ["Flag S"] = Cpu.RegisterF.Bit(7)
}; };
} }