Esempio n. 1
0
 public void ORG(int row)            //Creates a memory with 0 as much as the given parameter.
 {
     for (int i = 0; i < row; i++)
     {
         RamInfo ramInfo = new RamInfo();
         ramInfo.adres = (Org + i).ToString("X4");
         ramInfo.info  = "0000";
         ram.bellek.AddLast(ramInfo);
     }
 }
Esempio n. 2
0
        private void Yukle_Click(object sender, EventArgs e)
        {
            if (button2.Text == "Yeniden Yükle")
            {
                setupPage();
            }

            if (richTextBox1.Text.Count() <= 0)
            {
                return;
            }
            rows = richTextBox1.Text.Split('\n');           //Splits the values ​​entered by the user.
            for (int row = 0; row < rows.Count(); row++)
            {
                var line = rows[row].Trim().Split(' ');

                if (ram.commandList.ContainsKey(line[0].ToString()))
                {
                    if (ram.commandList[line[0].ToString()] == "X")
                    {
                        Org = Convert.ToInt32(line[1], 16);
                        ORG(1000);
                        bellek = Org;
                    }
                    else if (ram.commandList[line[0].ToString()] == "A")
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "A000";
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (ram.commandList[line[0].ToString()] == "7")
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "7000";
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (ram.commandList[line[0].ToString()] == "8")
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "8" + line[1];
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (ram.commandList[line[0].ToString()] == "5")
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "5000";
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (ram.commandList[line[0].ToString()] == "6")
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "6000";
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (line[0] == "END")
                    {
                        break;
                    }
                    else
                    {
                        READ(line[1], (row - 1).ToString(), ram.commandList[line[0].ToString()]);
                    }
                }
                else   //The part that determines the variables entered by the user.
                {
                    if (line.Count() == 3)
                    {
                        RamInfo ramInfo = new RamInfo();
                        ramInfo.adres = line[0].Split(',')[0];
                        ramInfo.info  = (Org + (Convert.ToInt32((row - 1).ToString()))).ToString("X4");
                        tag.bellek.AddLast(ramInfo);
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                if (line[1] == "DEC")
                                {
                                    row1.info = Convert.ToInt32(line[2]).ToString("X4");
                                    break;
                                }
                                else
                                {
                                    row1.info = Convert.ToInt32(line[2], 16).ToString("X4");
                                    break;
                                }
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else if (line.Count() == 1)
                    {
                        foreach (var row1 in ram.bellek)
                        {
                            if (row1.adres == bellek.ToString("X4"))
                            {
                                row1.info = "Z000";
                                break;
                            }
                        }
                        bellek = bellek + 1;
                    }
                    else
                    {
                        MessageBox.Show("Girilen veri tanımsız. Veri: \"" + rows[row] + "\"");
                    }
                }
            }
            loadTables();
            button2.Text    = "Yeniden Yükle";
            button3.Enabled = true;
        }