public void Execute(string[] args)
 {
     try
     {
         if (IntExtensions.TryParseEx(args[0], out int address))
         {
             if (IntExtensions.TryParseEx(args[1], out int value))
             {
                 m_Proc.WriteMemory(address, value);
                 m_Terminal.PrintString("\t" + args[0] + " = " + args[1] + '\n');
             }
             else if (FloatExtensions.TryParseEx(args[1], out float fVal))
             {
                 m_Proc.WriteFloatToMemory(address, fVal);
                 m_Terminal.PrintString("\t" + args[0] + " = " + args[1] + '\n');
             }
             else
             {
                 m_Terminal.PrintString(args[1] + " was not a valid 32 bit value.\n");
             }
         }
         else
         {
             m_Terminal.PrintString(args[0] + " was not a valid 32 bit integer.\n");
         }
     }
     catch (Exception ex)
     {
         m_Terminal.PrintString(ex.Message + '\n');
     }
 }
Example #2
0
 public void Execute(string[] args)
 {
     try
     {
         string regName = args[0];
         if (IntExtensions.TryParseEx(args[1], out int iValue))
         {
             if (RegisterMap.IsNamedIntegerRegister(regName))
             {
                 int regIdx = RegisterMap.GetNumericRegisterValue(regName);
                 m_Registers.UserIntRegisters[regIdx].Value = iValue;
                 m_Terminal.PrintString("\t" + regName + " = " + iValue + '\n');
             }
             else
             {
                 throw new ParseException(regName + " was not a valid register name.");
             }
         }
         else if (FloatExtensions.TryParseEx(args[1], out float fValue))
         {
             if (RegisterMap.IsNamedFloatingPointRegister(regName))
             {
                 int regIdx = RegisterMap.GetNumericFloatingPointRegisterValue(regName);
                 m_Registers.UserFloatingPointRegisters[regIdx].Value = fValue;
                 m_Terminal.PrintString("\t" + regName + " = " + fValue + '\n');
             }
             else
             {
                 throw new ParseException(regName + " was not a valid register name.");
             }
         }
         else
         {
             throw new ParseException(args[1] + " was not a valid 32-bit value");
         }
     }
     catch (Exception ex)
     {
         m_Terminal.PrintString(ex.Message + '\n');
     }
 }