public static List <string> ValidateTS(DataTable _dataDT, List <DataSegment> dataSG, List <string> code, out string err, out List <TextSegment> txSegment) { dataDT = _dataDT; dxSG = dataSG; err = string.Empty; string msg = string.Empty; List <string> txCode = DataCleaner.ExtractSegment(code, ".text", string.Empty); txSegment = new List <TextSegment>(); txCode = CheckFormat(txCode, code, out err, out txSegment); if (string.IsNullOrEmpty(err)) { txSegment = SetAddress(txSegment); txSegment = OpCodeController.GenerateOpCode(txSegment); } return(txCode); }
private void BuildClickEvt(object sender, System.EventArgs e) { if (filePathTxt.Text != "Select *.asm file.") { List <string> code = FileController.ReadFile(filePathTxt.Text); List <string> text = new List <string>(); bool isTextPart = false; foreach (string c in code) { if (isTextPart) { text.Add(c); } if (c == ".text") { isTextPart = true; } } List <string> OpCode = OpCodeController.GetOpCode(text); textSegment.Columns.Add("Address", typeof(string)); textSegment.Columns.Add("Opcode", typeof(string)); textSegment.Columns.Add("Source", typeof(string)); string hx = "1000"; for (int i = 0; i < text.Count; i++) { string addr = "0x0000" + hx; textSegment.Rows.Add(addr, OpCode[i], text[i]); int decval = Convert.ToInt32(hx, 16) + 4; hx = Convert.ToString(decval, 16).ToUpper(); } textSegmentDataGrid.DataSource = textSegment; textSegmentDataGrid.ReadOnly = true; } else { errorLogTxt.Text = errorLogTxt.Text + "ERROR: No *.asm file has been selected." + "\r\n"; errorLogTxt.SelectionStart = errorLogTxt.Text.Length; errorLogTxt.ScrollToCaret(); } }