private static string GetEffectCode(Propeller.MemoryManager memory, bool useShortOpcodes) { Spin.ParsedAssignment ParsedAssignment = new Spin.ParsedAssignment(memory.ReadByte()); string effect = ParsedAssignment.Push ? "" : "POP "; if (useShortOpcodes) { effect += "(" + ParsedAssignment.GetBasicInstruction().NameBrief + ")"; } else { effect += ParsedAssignment.GetBasicInstruction().Name; } if (!ParsedAssignment.Math) { Propeller.Spin.SubAssignment SubAssignment = ParsedAssignment.GetSubAssignment(); switch (SubAssignment.ArgumentMode) { case Propeller.Spin.ArgumentMode.None: break; case Propeller.Spin.ArgumentMode.SignedPackedOffset: effect += " " + DataUnpacker.GetSignedPackedOffset(memory); break; default: throw new Exception("Unexpected Spin Argument Mode: " + SubAssignment.ArgumentMode.ToString()); } } return(effect); }
public Propeller.Spin.SubAssignment GetSubAssignment() { if (this.Math) { return(null); } else if (this.SourceSubAssignment == null) { this.SourceSubAssignment = Spin.GetSubAssignment(this.SourceAssignment, this); } return(this.SourceSubAssignment); }
public ParsedAssignment(byte Opcode) { this.Opcode = Opcode; this.Push = ((Opcode >> 7) & 0x01) == 0x01; this.Math = ((Opcode >> 6) & 0x01) == 0x01; this.ASG = (byte)((Opcode >> 3) & 0x07); this.MTH = (byte)(Opcode & 0x1F); this.Bit1 = ((Opcode >> 1) & 0x01) == 0x01; this.Bit2 = ((Opcode >> 2) & 0x01) == 0x01; this.Size = (Propeller.Spin.AssignmentSize)((Opcode >> 1) & 0x03); this.Swap = ((Opcode >> 5) & 0x01) == 0x01; if (this.Math) { this.MathAssignment = Propeller.Spin.MathInstructions[this.MTH]; } else { this.SourceAssignment = Propeller.Spin.Assignments[this.ASG]; } this.SourceSubAssignment = null; }