Example #1
0
 public Propeller.Assembly.SubInstruction GetSubInstruction()
 {
     if (this.SourceSubInstruction == null)
     {
         this.SourceSubInstruction = Assembly.GetSubInstruction(this.SourceInstruction, this);
     }
     return(this.SourceSubInstruction);
 }
Example #2
0
            public ParsedInstruction(uint Opcode)
            {
                this.Opcode = Opcode;
                this.INSTR  = (byte  )((Opcode >> 26) & 0x03F);  // (bits 31:26)
                this.ZCRI   = (byte  )((Opcode >> 22) & 0x00F);  // (bits 25:22)
                this.CON    = (byte  )((Opcode >> 18) & 0x00F);  // (bits 21:18)
                this.DEST   = (ushort)((Opcode >> 9) & 0x1FF);   // (bits 17:09)
                this.SRC    = (ushort)(Opcode & 0x1FF);          // (bits 08:00)

                this.SourceInstruction    = Propeller.Assembly.Instructions[this.INSTR];
                this.SourceSubInstruction = null;
            }
Example #3
0
        public static string AssemblyText(uint Operation)
        {
            Assembly.ParsedInstruction instr = new Assembly.ParsedInstruction(Operation);
            string text;

            if (instr.CON > 0x00)
            {
                Propeller.Assembly.SubInstruction ActualInstruction = instr.GetSubInstruction();

                string SrcString  = string.Empty;
                string DestString = string.Empty;

                if (ActualInstruction.Source)
                {
                    if (instr.SRC >= Propeller.Assembly.RegisterBaseAddress)
                    {
                        SrcString = String.Format("{0}{1}",
                                                  instr.ImmediateValue() ? "#" : string.Empty,
                                                  Propeller.Assembly.Registers[instr.SRC - Propeller.Assembly.RegisterBaseAddress].Name);
                    }
                    else
                    {
                        SrcString = String.Format("{0}${1:X3}",
                                                  instr.ImmediateValue() ? "#" : string.Empty,
                                                  instr.SRC);
                    }
                }

                if (ActualInstruction.Destination)
                {
                    if (instr.DEST >= Propeller.Assembly.RegisterBaseAddress)
                    {
                        DestString = String.Format("{0}", Propeller.Assembly.Registers[instr.DEST - Propeller.Assembly.RegisterBaseAddress].Name);
                    }
                    else
                    {
                        DestString = String.Format("${0:X3}", instr.DEST);
                    }
                }

                text = String.Format("{0} {1} {2}{3}{4}", new object[] {
                    Propeller.Assembly.Conditions[instr.CON][0],
                    ActualInstruction.Name,
                    DestString,
                    (ActualInstruction.Source && ActualInstruction.Destination) ? ", " : "",
                    SrcString
                }
                                     );

                if (instr.WriteResult())
                {
                    text += " WR";
                }

                if (instr.NoResult())
                {
                    text += " NR";
                }

                if (instr.WriteZero())
                {
                    text += " WZ";
                }

                if (instr.WriteCarry())
                {
                    text += " WC";
                }
            }
            else
            {
                text = String.Format("{0} {1}", new object[] { Propeller.Assembly.Conditions[0][1], Propeller.Assembly.Conditions[0][2] });
            }
            return(text);
        }