Пример #1
0
 public Form1(string obj_file = null)
 {
     InitializeComponent();
     _obj_file_path = obj_file;
     hv             = new HexViewer(_sic_memory);
     _sic_machine   = new MaquinaSic();
     _opcodes       = new Hashtable();
     _opcodes.Add(0x18, "ADD");
     _opcodes.Add(0x40, "AND");
     _opcodes.Add(0x28, "COMP");
     _opcodes.Add(0x24, "DIV");
     _opcodes.Add(0x3C, "J");
     _opcodes.Add(0x30, "JEQ");
     _opcodes.Add(0x34, "JGT");
     _opcodes.Add(0x38, "JLT");
     _opcodes.Add(0x48, "JSUB");
     _opcodes.Add(0x00, "LDA");
     _opcodes.Add(0x50, "LDCH");
     _opcodes.Add(0x08, "LDL");
     _opcodes.Add(0x04, "LDX");
     _opcodes.Add(0x20, "MUL");
     _opcodes.Add(0x44, "OR");
     _opcodes.Add(0xD8, "RD");
     _opcodes.Add(0x4C, "RSUB");
     _opcodes.Add(0x0C, "STA");
     _opcodes.Add(0x54, "STCH");
     _opcodes.Add(0x14, "STL");
     _opcodes.Add(0xE8, "STSW");
     _opcodes.Add(0x10, "STX");
     _opcodes.Add(0x1C, "SUB");
     _opcodes.Add(0xE0, "TD");
     _opcodes.Add(0x2C, "TIX");
     _opcodes.Add(0xDC, "WD");
 }
Пример #2
0
 private void mapaDeMemoriaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (hv.Visible)
     {
         hv.Select();
     }
     else
     {
         hv = new HexViewer(_sic_machine.Memory);
         hv.StartPosition = FormStartPosition.Manual;
         hv.Location      = new Point(this.Location.X + this.Size.Width, this.Location.Y);
         hv.Show();
     }
 }
Пример #3
0
        private int CargaArchivoObjeto(string filepath)
        {
            StreamReader file = new StreamReader(filepath);

            if (file == null)
            {
                return(0);
            }

            file.Close();
            lineas_obj     = File.ReadLines(filepath).ToList();
            _obj_file_path = filepath;
            CargadorSic cargador = new CargadorSic();

            if (cargador.CargaProgramaObjeto(lineas_obj, _sic_machine) == 1)
            {
                MessageBox.Show("Programa cargado correctamente");
                _sic_machine.Reset();
                textBox_PNAME.Text = _sic_machine.ProgName;
                textBox_PSIZE.Text = _sic_machine.ProgSize.ToString() + " bytes";
                ActualizaRegistros();
                toolStrip1.Enabled = true;
                programaObjetoToolStripMenuItem.Enabled = true;
                objv = new ObjViewer(lineas_obj);

                if (hv.Visible)
                {
                    hv.Close();
                }


                hv = new HexViewer(_sic_machine.Memory);
                hv.StartPosition = FormStartPosition.Manual;
                hv.Location      = new Point(this.Location.X + this.Size.Width, this.Location.Y);
                hv.Show();
                hv.SelectLocation(_sic_machine.PC, 3);
            }
            else
            {
                MessageBox.Show("No se pudo cargar el programa objeto, verifique el que arlchivo tenga un formato correcto.");
                return(0);
            }

            return(1);
        }