private static string GetEffectCode(PropellerCPU chip, ref uint address, bool useShortOpcodes)
        {
            Spin.ParsedAssignment ParsedAssignment = new Spin.ParsedAssignment(chip.ReadByte(address++));

            string effect = ParsedAssignment.Push ? string.Empty : "POP ";

            if (useShortOpcodes)
            {
                effect += "(" + ParsedAssignment.GetBasicInstruction().NameBrief + ")";
            }
            else
            {
                effect += ParsedAssignment.GetBasicInstruction().Name;
            }

            if (!ParsedAssignment.Math)
            {
                Spin.SubAssignment SubAssignment = ParsedAssignment.GetSubAssignment();
                switch (SubAssignment.ArgumentMode)
                {
                case Spin.ArgumentMode.None:
                    break;

                case Spin.ArgumentMode.SignedPackedOffset:
                    effect += " " + GetSignedPackedOffset(chip, ref address);
                    break;

                default:
                    throw new Exception("Unexpected Spin Argument Mode: " + SubAssignment.ArgumentMode.ToString());
                }
            }

            return(effect);
        }
Exemple #2
0
        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);
        }