protected override string calculaDireccionEnd(string instruccion) { string inicio; string[] aux; inicio = ""; try { if (!string.IsNullOrEmpty(instruccion)) { inicio = MetodosAuxiliares.decimalAHexadecimal(this.tabSim[instruccion]); } else { foreach (string linea in this.intermedio) { aux = linea.Split('\t'); if (this.instrucciones.Keys.Contains(aux[2])) { inicio = aux[0]; break; } } } inicio = MetodosAuxiliares.ajustaDireccion(inicio); } catch (KeyNotFoundException) { inicio = "FFFFFF"; } return(inicio); }
protected override void generaRegistrosT() { int i; int j; string registroT; string aux; string bytes; aux = ""; i = 1; while (!this.archivo[i].Contains("END")) { registroT = "T" + MetodosAuxiliares.ajustaDireccion(this.intermedio[i].Split('\t').First()); for (j = i; j < this.codigoObj.Length - 1; j++) { if (!this.codigoObj[j].Contains("Error")) { if (((aux.Length + this.codigoObj[j].Length) / 2) > 30) { break; } else if (this.codigoObj[j].Equals("---")) { break; } else { aux += this.codigoObj[j]; } } } bytes = MetodosAuxiliares.decimalAHexadecimal(aux.Length / 2); if (bytes.Length < 2) { bytes = "0" + bytes; } registroT += bytes; registroT += aux; aux = ""; this.archivoObj.Add(registroT); for (int k = j; k < this.codigoObj.Length; k++) { if (!codigoObj[k].Equals("---") | this.intermedio[k].Contains("END")) { i = k; break; } } } }
protected override void creaArchivoObj() { string linea; string[] instruccion; this.archivoObj = new List <string>(); instruccion = this.intermedio.First().Split('\t'); linea = instruccion[3].Replace("H", ""); linea = linea.Replace("h", ""); linea = "H" + MetodosAuxiliares.ajustaCadena(instruccion[1], 6) + MetodosAuxiliares.ajustaDireccion(linea) + MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.tamaño)); this.archivoObj.Add(linea); this.generaRegistrosT(); instruccion = this.intermedio.Last().Split('\t'); linea = "E" + this.calculaDireccionEnd(instruccion[3]); this.archivoObj.Add(linea); }
private void toolStripMapa_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.AccessibleName) { case "Abrir": if (openFileObj.ShowDialog().Equals(DialogResult.OK)) { sicEstandar = new SICEstandar(openFileObj.FileName); CP = MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.CP)); A = MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.A); X = MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.X); L = MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.L); this.richTextBox1.Text = ""; this.llenaDataGrid(); } break; } }
private void llenaDataGrid() { this.limpiaDatagrid(); string[] fila; fila = new string[17]; for (int i = 0; i < sicEstandar.Memoria.Filas; i++) { fila[0] = MetodosAuxiliares.decimalAHexadecimal(MetodosAuxiliares.hexadecimalADecimal(sicEstandar.Memoria.Inicio) + (i * 16)); for (int j = 0; j < sicEstandar.Memoria.Columnas; j++) { fila[j + 1] = sicEstandar.Memoria.Mapa[i, j]; } this.dataGridViewMapaDeMemoria.Rows.Add(fila); } this.dataGridViewRegistros.Rows.Add("CP", CP, MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.CP))); this.dataGridViewRegistros.Rows.Add("A", A, MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.A))); this.dataGridViewRegistros.Rows.Add("X", X, MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.X))); this.dataGridViewRegistros.Rows.Add("L", L, MetodosAuxiliares.ajustaDireccion(MetodosAuxiliares.decimalAHexadecimal(this.sicEstandar.L))); this.dataGridViewRegistros.Rows.Add("CC", this.sicEstandar.CC, ""); this.label1.Text = "Tamaño del programa:" + this.sicEstandar.Memoria.Tamaño; }
protected override void generaRegistrosT() { int i; int j; string registroT; string aux; string bytes; aux = ""; i = 1; while (!this.archivo[i].Contains("END")) { registroT = "T" + MetodosAuxiliares.ajustaDireccion(this.intermedio[i].Split('\t').First()); for (j = i; j < this.codigoObj.Length - 1; j++) { if (!this.codigoObj[j].Contains("Error")) { if (this.codigoObj[j].Contains("*")) { string cpHex; cpHex = MetodosAuxiliares.decimalAHexadecimal(MetodosAuxiliares.hexadecimalADecimal(this.intermedio[j].Split('\t').First()) +1); this.relocalizables.Add(MetodosAuxiliares.ajustaOperando(cpHex,6,"0")); this.codigoObj[j] = this.codigoObj[j].Replace("*", ""); } if (((aux.Length + this.codigoObj[j].Length) / 2) > 30) { break; } else if (this.codigoObj[j].Equals("---") & !this.archivo[j].Contains("BASE")) { break; } else if(!this.archivo[j].Contains("BASE")) { aux += this.codigoObj[j]; } } } bytes = MetodosAuxiliares.decimalAHexadecimal(aux.Length / 2); if (bytes.Length < 2) { bytes = "0" + bytes; } registroT += bytes; registroT += aux; aux = ""; if (registroT.Length > 9) { this.archivoObj.Add(registroT); } for (int k = j; k < this.codigoObj.Length; k++) { if (!codigoObj[k].Equals("---") | this.intermedio[k].Contains("END")) { i = k; break; } } } }