示例#1
0
 /// <summary>
 /// Gets string from enum
 /// </summary>
 /// <param name="m">The enum representing the message</param>
 /// <returns>String Message</returns>
 public static string GetMessageText(SimulatorMessage m, int iExtraInformation)
 {
     if (m == SimulatorMessage.PRIVILEGED_IS_READ_ONLY)
     {
         return(RegistersSettings.GetPrivilegedRegisterName(iExtraInformation)
                + " is read-only register");
     }
     else if (m == SimulatorMessage.PRIVILEGED_IS_WRITE_ONLY)
     {
         return(RegistersSettings.GetPrivilegedRegisterName(iExtraInformation)
                + " is write-only register");
     }
     else
     {
         return(MessagesArray[(int)m]);
     }
 }
        private void bag1_GetValue(object sender, PropertySpecEventArgs e)
        {
            if (e.Property.Category == "Registers")
            {
                uint iValue;
                if (e.Property.Name == "PSW")
                {
                    iValue = (uint)reg.PSL.PSW;
                }
                else if (e.Property.Name == "Cycles")
                {
                    iValue = (uint)reg.SystemTime;
                }
                else
                {
                    iValue = (uint)reg[int.Parse(e.Property.Name.Substring(1))];
                }

                if (Settings.Simulator.bShowRegistersInHex)
                {
                    e.Value = iValue.ToString("x").ToUpper();
                }
                else
                {
                    e.Value = iValue.ToString();
                }
            }
            else if (e.Property.Category == "VAX11 Flags")
            {
                switch (e.Property.Name)
                {
                case "V": e.Value = reg.PSL.V; break;

                case "C": e.Value = reg.PSL.C; break;

                case "N": e.Value = reg.PSL.N; break;

                case "Z": e.Value = reg.PSL.Z; break;
                }
                ;
            }
            else if (e.Property.Category == "Privileged Registers")
            {
                uint iValue;
                if (e.Property.Name == "PSL")
                {
                    iValue = (uint)reg.PSL.ReadLong();
                }
                else
                {
                    iValue = (uint)reg[RegistersSettings.GetPrivilegedRegister(e.Property.Name)];
                }
                if (Settings.Simulator.bShowRegistersInHex)
                {
                    e.Value = iValue.ToString("x").ToUpper();
                }
                else
                {
                    e.Value = iValue.ToString();
                }
            }
        }