Primitive 0x002E - Snap

This primitive relocates a Sim into a routing slot


Use

There is no SimPe wizard for this instruction, so the following table details the meaning of each of the operands.

OperandDescriptionOperand Values
0 & 1 Slot Number (if Op4 Bit4 is 0)
2 & 3 Snap Type 0x00: Stack Object's Slot Param [Slot Number]
0x01: be contained in stack object
0x02: be in front of the stack object
0x03: Stack Object's Slot [Slot Number]
0x04: Global Slot [Slot Number]
4 - bit 1 Unused
4 - bit 2 Ask Sim To Move
4 - bit 3 Unused
4 - bit 4 Controls where Slot Number is taken from Off: Use value in Ops0/1
On: Use value in Temp 0
4 - bit 5 Test Only
4 - bit 6 Unused
4 - bit 7 Unused
4 - bit 8 Unused
5 thru 7 Unused
8 & 9 from slot in temp 1 (1=true, other=false)
10 thru 15 Unused

See Also


SimPe Code

// Decompiled with JetBrains decompiler
// Type: pjse.BhavNameWizards.WizPrim0x002e
// Assembly: pjse.coder.plugin, Version=4.0.3349.37576, Culture=neutral, PublicKeyToken=null

using SimPe;
using SimPe.PackedFiles.Wrapper;
using System;

namespace pjse.BhavNameWizards
{
  public class WizPrim0x002e : BhavWizPrim
  {
    public WizPrim0x002e(Instruction i)
      : base(i)
    {
    }

    protected override string Operands(bool lng)
    {
      byte[] numArray = new byte[16];
      ((byte[]) this.instruction.Operands).CopyTo((Array) numArray, 0);
      ((byte[]) this.instruction.Reserved1).CopyTo((Array) numArray, 8);
      string str1 = "";
      ushort sid = BhavWiz.ToShort(numArray[2], numArray[3]);
      string str2 = str1 + BhavWiz.readStr(GS.BhavStr.SnapType, sid);
      if (((int) numArray[4] & 8) != 0)
      {
        switch (sid)
        {
          case 0:
            str2 = str2 + " [" + this.dataOwner((byte) 8, (ushort) 0) + "]";
            break;
          case 3:
          case 4:
            str2 = str2.Replace("[slot]", "[" + this.dataOwner((byte) 8, (ushort) 0) + "]");
            break;
        }
      }
      else
      {
        switch (sid)
        {
          case 0:
            str2 = str2.Replace(BhavWiz.dnParam(), this.dataOwner(lng, (byte) 9, numArray[0], numArray[1]));
            break;
          case 3:
          case 4:
            str2 = str2.Replace("[slot]", "0x" + Helper.HexString(BhavWiz.ToShort(numArray[0], numArray[1])));
            break;
        }
      }
      if (lng)
        str2 = str2 + ", " + pjse.Localization.GetString("bwp2e_fromTemp1") + ": " + (BhavWiz.ToShort(numArray[8], numArray[9]) == (ushort) 1).ToString() + ", " + pjse.Localization.GetString("bwp2e_askSimToMove") + ": " + (((int) numArray[4] & 2) != 0).ToString() + ", " + pjse.Localization.GetString("bwp_testOnly") + ": " + (((int) numArray[4] & 16) != 0).ToString();
      return str2;
    }
  }
}