本文整理汇总了C#中Memory.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Memory.GetValue方法的具体用法?C# Memory.GetValue怎么用?C# Memory.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memory
的用法示例。
在下文中一共展示了Memory.GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndexedIndirectAddressFor
private static ushort IndexedIndirectAddressFor(ProgrammingModel model,
Memory memory,
RegisterName register,
ushort operand)
{
var zeroPageAddress = OffsetAddressFor(model, register, operand);
var effectiveAddressLow = memory.GetValue(zeroPageAddress);
var effectiveAddressHi = memory.GetValue((ushort)(zeroPageAddress + 1));
return (ushort)(effectiveAddressHi << 8 | effectiveAddressLow);
}
示例2: CanSetAndGetAtAnAddress
public void CanSetAndGetAtAnAddress()
{
const ushort address = 0x34FA;
const byte value = 251;
var memory = new Memory();
memory.SetValue(address, value);
Assert.That(memory.GetValue(address), Is.EqualTo(value));
}
示例3: ArgumentFor
public static byte ArgumentFor(ProgrammingModel model, Memory memory,
AddressingMode mode, ushort operand)
{
ushort address = 0;
if (mode == AddressingMode.Immediate)
return (byte)operand;
else if (mode == AddressingMode.Absolute || mode == AddressingMode.Zeropage)
address = operand;
else if (mode == AddressingMode.AbsoluteX || mode == AddressingMode.ZeropageX)
address = OffsetAddressFor(model, RegisterName.X, operand);
else if (mode == AddressingMode.AbsoluteY || mode == AddressingMode.ZeropageY)
address = OffsetAddressFor(model, RegisterName.Y, operand);
else if (mode == AddressingMode.IndexedIndirectX)
address = IndexedIndirectAddressFor(model, memory, RegisterName.X, operand);
else if (mode == AddressingMode.IndexedIndirectY)
address = IndexedIndirectAddressFor(model, memory, RegisterName.Y, operand);
return memory.GetValue(address);
}
示例4: InitialValueOfMemoryLocationIsZero
public void InitialValueOfMemoryLocationIsZero()
{
var memory = new Memory();
Assert.That(memory.GetValue(0xFF50), Is.EqualTo(0));
}
示例5: Enter
public override IEnumerator Enter(Machine owner, Brain controller)
{
mainMachine = owner;
myBrain = controller;
Legs myLeg = myBrain.legs;
//get sheep target
sheepTarget = myBrain.memory.GetValue<SensedObject>("hasCommand");
sheepBrain = (Brain)sheepTarget.getObject().GetComponent("Brain");
sheepMemory = sheepBrain.memory;
sheepMemory.SetValue("BeingEaten", true);
arriveBehaviour = new Arrive();
arriveBehaviour.Init(myLeg);
arriveBehaviour.setTarget(sheepTarget.getObject());
//speed is zero
myBrain.legs.maxSpeed = 0f;
Debug.Log("I'm eating:" + sheepTarget.getObject() + " HP: " + sheepMemory.GetValue<float>("HP"));
yield return null;
}