当前位置: 首页>>代码示例>>C#>>正文


C# Memory.GetValue方法代码示例

本文整理汇总了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);
 }
开发者ID:joshpeterson,项目名称:mos,代码行数:10,代码来源:ArgumentUtils.cs

示例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));
        }
开发者ID:joshpeterson,项目名称:mos,代码行数:10,代码来源:MemoryTests.cs

示例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);
        }
开发者ID:joshpeterson,项目名称:mos,代码行数:19,代码来源:ArgumentUtils.cs

示例4: InitialValueOfMemoryLocationIsZero

 public void InitialValueOfMemoryLocationIsZero()
 {
     var memory = new Memory();
       Assert.That(memory.GetValue(0xFF50), Is.EqualTo(0));
 }
开发者ID:joshpeterson,项目名称:mos,代码行数:5,代码来源:MemoryTests.cs

示例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;
    }
开发者ID:Syclamoth,项目名称:GamesAI6,代码行数:26,代码来源:Wolf_eating.cs


注:本文中的Memory.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。