Esempio n. 1
0
        private string GetASMTextFromHex(string hex, uint pc, bool littleEndian, bool useRegAliases)
        {
            ASMDecoderResult decodeResult = Decoder.DecodeASM(hex, pc, "", littleEndian, false, useRegAliases, true);

            _errorTextBuilder.Append(decodeResult.ErrorText);

            return(decodeResult.DecodedASM);
        }
Esempio n. 2
0
        void Btn_DecodeClick(object sender, EventArgs e)
        {
            txt_ASM.Text      = "";
            txt_Messages.Text = "";

            ASMDecoderResult decodeResult = _asmUtility.DecodeASM(txt_Hex.Text, txt_StartPC.Text, GetSpacePadding(), chk_littleEndian.Checked, chk_IncludeAddress.Checked, chk_NameRegs.Checked);

            txt_ASM.Text = decodeResult.DecodedASM;

            txt_Messages.ForeColor = Color.Red;
            txt_Messages.Text      = decodeResult.ErrorText;

            if (string.IsNullOrEmpty(decodeResult.ErrorText))
            {
                ASMCheckResult checkResult = _asmUtility.CheckASM(decodeResult.DecodedASM, txt_StartPC.Text, chk_littleEndian.Checked, chk_NameRegs.Checked, false);
                txt_Messages.Text = checkResult.ErrorText;
            }
        }
Esempio n. 3
0
        private string GetASMTextFromBytes(byte[] bytes, uint pc, bool littleEndian, bool useRegAliases)
        {
            if (bytes.Length > 4)
            {
                uint offsetBytes = pc % 4;
                if (offsetBytes != 0)
                {
                    uint skipBytes = 4 - offsetBytes;
                    pc = pc + skipBytes;
                    int    length   = (int)(bytes.Length - skipBytes);
                    byte[] newBytes = new byte[length];
                    Array.Copy(bytes, skipBytes, newBytes, 0, length);
                    bytes = newBytes;
                }
            }

            ASMDecoderResult decodeResult = Decoder.DecodeASM(bytes, pc, littleEndian, useRegAliases);

            _errorTextBuilder.Append(decodeResult.ErrorText);

            return(decodeResult.DecodedASM);
        }