本文整理汇总了C#中Processor.LoadProgram方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.LoadProgram方法的具体用法?C# Processor.LoadProgram怎么用?C# Processor.LoadProgram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Processor
的用法示例。
在下文中一共展示了Processor.LoadProgram方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ADC_Accumulator_Correct_When_Not_In_BDC_Mode
public void ADC_Accumulator_Correct_When_Not_In_BDC_Mode(byte accumlatorIntialValue, byte amountToAdd, bool CarryFlagSet, byte expectedValue)
{
var processor = new Processor();
Assert.That(processor.Accumulator, Is.EqualTo(0x00));
if (CarryFlagSet)
{
processor.LoadProgram(0, new byte[] { 0x38, 0xA9, accumlatorIntialValue, 0x69, amountToAdd }, 0x00);
processor.NextStep();
}
else
processor.LoadProgram(0, new byte[] { 0xA9, accumlatorIntialValue, 0x69, amountToAdd }, 0x00);
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(accumlatorIntialValue));
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(expectedValue));
}
示例2: Absolute_Mode_Accumulator_Has_Correct_Result
public void Absolute_Mode_Accumulator_Has_Correct_Result(byte operation, byte accumulatorInitialValue, byte valueToTest, byte expectedValue)
{
var processor = new Processor();
Assert.That(processor.Accumulator, Is.EqualTo(0x00));
processor.LoadProgram(0, new byte[] { 0xA9, accumulatorInitialValue, operation, 0x05, 0x00, valueToTest }, 0x00);
processor.NextStep();
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(expectedValue));
}
示例3: AbsoluteY_Mode_Accumulator_Has_Correct_Result
public void AbsoluteY_Mode_Accumulator_Has_Correct_Result(byte operation, byte accumulatorInitialValue, byte valueToTest, bool addressWraps, byte expectedValue)
{
var processor = new Processor();
Assert.That(processor.Accumulator, Is.EqualTo(0x00));
processor.LoadProgram(0, addressWraps
? new byte[] { 0xA9, accumulatorInitialValue, 0x84, 0x07, operation, 0xff, 0xff, 0x09, valueToTest }
: new byte[] { 0xA9, accumulatorInitialValue, 0x84, 0x07, operation, 0x07, 0x00, 0x01, valueToTest }, 0x00);
processor.NextStep();
processor.NextStep();
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(expectedValue));
}
示例4: Klaus_Dorman_Functional_Test
[TestCase(0xF0, 0x33b7)] // decimal add/subtract test *** WARNING - tests documented behavior only! *** only valid BCD operands are tested, N V Z flags are ignored iterates through all valid combinations of operands and carry input uses increments/decrements to predict result & carry flag
// ReSharper disable InconsistentNaming
public void Klaus_Dorman_Functional_Test(int accumulator, int programCounter)
// ReSharper restore InconsistentNaming
{
var processor = new Processor();
processor.LoadProgram(0x400, KdTestProgram, 0x400);
var numberOfCycles = 0;
while (true)
{
processor.NextStep();
numberOfCycles++;
if (processor.ProgramCounter == programCounter)
break;
if (numberOfCycles > 40037912)
Assert.Fail("Maximum Number of Cycles Exceeded");
}
Assert.That(processor.Accumulator, Is.EqualTo(accumulator));
// ReSharper disable FunctionNeverReturns
}
示例5: AND_Accumulator_Correct
public void AND_Accumulator_Correct(byte accumlatorIntialValue, byte amountToAnd, byte expectedResult)
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xA9, accumlatorIntialValue, 0x29, amountToAnd }, 0x00);
processor.NextStep();
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(expectedResult));
}
示例6: ADC_Negative_Flag_Correct
public void ADC_Negative_Flag_Correct(byte accumlatorIntialValue, byte amountToAdd, bool expectedValue)
{
var processor = new Processor();
Assert.That(processor.Accumulator, Is.EqualTo(0x00));
processor.LoadProgram(0, new byte[] { 0xA9, accumlatorIntialValue, 0x69, amountToAdd }, 0x00);
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(accumlatorIntialValue));
processor.NextStep();
Assert.That(processor.Sign, Is.EqualTo(expectedValue));
}
示例7: ADC_Overflow_Flag_Correct
public void ADC_Overflow_Flag_Correct(byte accumlatorIntialValue, byte amountToAdd, bool setCarryFlag, bool expectedValue)
{
var processor = new Processor();
Assert.That(processor.Accumulator, Is.EqualTo(0x00));
if (setCarryFlag)
{
processor.LoadProgram(0, new byte[] { 0x38, 0xA9, accumlatorIntialValue, 0x69, amountToAdd }, 0x00);
processor.NextStep();
}
else
processor.LoadProgram(0, new byte[] { 0xA9, accumlatorIntialValue, 0x69, amountToAdd }, 0x00);
processor.NextStep();
Assert.That(processor.Accumulator, Is.EqualTo(accumlatorIntialValue));
processor.NextStep();
Assert.That(processor.IsOverflow, Is.EqualTo(expectedValue));
}
示例8: ProgramCounter_Correct_When_Program_Loaded
public void ProgramCounter_Correct_When_Program_Loaded()
{
var processor = new Processor();
processor.LoadProgram(0, new byte[1], 0x01);
Assert.That(processor.ProgramCounter, Is.EqualTo(0x01));
}
示例9: CLI_Interrup_Flag_Cleared_Correctly
public void CLI_Interrup_Flag_Cleared_Correctly()
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0x58 }, 0x00);
processor.NextStep();
Assert.That(processor.DisableInterruptFlag, Is.EqualTo(false));
}
示例10: CLD_Carry_Flag_Set_And_Cleared_Correctly
public void CLD_Carry_Flag_Set_And_Cleared_Correctly()
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xF8, 0xD8 }, 0x00);
processor.NextStep();
processor.NextStep();
Assert.That(processor.DecimalFlag, Is.EqualTo(false));
}
示例11: NumberOfCyclesRemaining_Correct_When_In_AbsoluteX_Or_AbsoluteY_And_Wrap
public void NumberOfCyclesRemaining_Correct_When_In_AbsoluteX_Or_AbsoluteY_And_Wrap(byte operation, bool isAbsoluteX, int numberOfCyclesUsed)
{
var processor = new Processor();
processor.LoadProgram(0, isAbsoluteX
? new byte[] {0x86, 0x05, operation, 0xff, 0xff, 0x07, 0x03}
: new byte[] {0x84, 0x05, operation, 0xff, 0xff, 0x07, 0x03}, 0x00);
processor.NextStep();
//Get the number of cycles after the register has been loaded, so we can isolate the operation under test
var startingNumberOfCycles = processor.NumberofCyclesLeft;
processor.NextStep();
Assert.That(processor.NumberofCyclesLeft, Is.EqualTo(startingNumberOfCycles - numberOfCyclesUsed));
}
示例12: DEX_Zero_Has_Correct_Value
public void DEX_Zero_Has_Correct_Value(byte initialXRegisterValue, bool expectedResult)
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xA2, initialXRegisterValue, 0xCA }, 0x00);
processor.NextStep();
processor.NextStep();
Assert.That(processor.ZeroFlag, Is.EqualTo(expectedResult));
}
示例13: DEY_YRegister_Has_Correct_Value
public void DEY_YRegister_Has_Correct_Value(byte initialYRegisterValue, byte expectedMemoryValue)
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xA0, initialYRegisterValue, 0x88 }, 0x00);
processor.NextStep();
processor.NextStep();
Assert.That(processor.YRegister, Is.EqualTo(expectedMemoryValue));
}
示例14: DEC_Memory_Has_Correct_Value
public void DEC_Memory_Has_Correct_Value(byte initalMemoryValue, byte expectedMemoryValue)
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xC6, 0x03, 0x00, initalMemoryValue }, 0x00);
processor.NextStep();
Assert.That(processor.Memory.ReadValue(0x03), Is.EqualTo(expectedMemoryValue));
}
示例15: DEC_Negative_Has_Correct_Value
public void DEC_Negative_Has_Correct_Value(byte initalMemoryValue, bool expectedResult)
{
var processor = new Processor();
processor.LoadProgram(0, new byte[] { 0xC6, 0x03, 0x00, initalMemoryValue }, 0x00);
processor.NextStep();
Assert.That(processor.NegativeFlag, Is.EqualTo(expectedResult));
}