public Instructions()
 {
     label = null;
     startAddress = 0;
     nob = 0;
     lineNo = 0;
     opcode = new MyByte8();
     operand = new MyByte16();
     IsArgError = false;                   //Caused only if a data value is of invalid length or if data characters are invalid(not[0-9a-f])  ... except for rst
     IsUnrecognizedInstruction = false;  //Last else block: Caused if an invalid reg is invalid or ins name itself is unrecognized and for invalid data of rst (i.e. not[0-7])
 }
Beispiel #2
0
        private void UpdateS(byte i)
        {
            MyByte8 temp = new MyByte8();

            temp.DEC8 = i;
            if (temp[7] == true)
            {
                PSW.LB[7] = true;
            }
            else
            {
                PSW.LB[7] = false;
            }
        }
Beispiel #3
0
        private void UpdateP(byte i)
        {
            MyByte8 temp = new MyByte8();

            temp.DEC8 = i;
            int NoOfOnes = 0;

            for (int j = 0; j <= 7; j++)
            {
                if (temp[j] == true)
                {
                    NoOfOnes++;
                }
            }
            if (NoOfOnes % 2 == 0)
            {
                PSW.LB[2] = true;
            }
            else
            {
                PSW.LB[2] = false;
            }
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();

            int i, j, k, myHexNo;

            //Initialize initial state
            IsRbMemoryChecked = true;
            IsStopped         = true;
            bStop.IsEnabled   = false;
            bStep.IsEnabled   = false;
            bR75.IsEnabled    = false;
            bR65.IsEnabled    = false;
            bR55.IsEnabled    = false;
            bIntr.IsEnabled   = false;

            //Initialize memory
            for (i = 0; i <= 65535; i++)
            {
                m[i] = new MyByte8();
            }

            //Initialize IO
            for (i = 0; i <= 255; i++)
            {
                io[i] = new MyByte8();
            }

            //Initialize Registers
            M   = new MyByteM();
            BC  = new MyByte16();
            DE  = new MyByte16();
            HL  = new MyByte16();
            PSW = new MyByte16();
            PC  = new MyByte16();
            SP  = new MyByte16();

            //Initialize TextBoxes
            FArray    = new TextBox[] { tbF0, tbF1, tbF2, tbF3, tbF4, tbF5, tbF6, tbF7 };
            tbGo.Text = "0000";

            tbPCMenu.Text = "0000";
            //tbCIMenu
            //tbNIMenu
            //tbCI
            //tcNI
            tbPC.Text = "0000";
            tbSP.Text = "0000";
            //tbCCC
            //tbIC
            tbA.Text = "00";
            tbF.Text = "00";
            tbB.Text = "00";
            tbC.Text = "00";
            tbD.Text = "00";
            tbE.Text = "00";
            tbH.Text = "00";
            tbL.Text = "00";
            tbM.Text = "00";
            for (i = 0; i <= 7; i++)
            {
                FArray[i].Text = "0";
            }



            // Define the Rows
            RowDefinition[] r = new RowDefinition[17];
            for (i = 0; i <= 16; i++)
            {
                r[i] = new RowDefinition();
                myGrid.RowDefinitions.Add(r[i]);
            }

            //Define columns
            ColumnDefinition[] c = new ColumnDefinition[17];
            for (i = 0; i <= 16; i++)
            {
                c[i] = new ColumnDefinition();
                myGrid.ColumnDefinitions.Add(c[i]);
            }

            k       = 0;
            myHexNo = 0x000;

            for (i = 1, j = 0; i <= 16; i++)
            {
                lb[k] = new TextBox();
                lb[k].TextAlignment = TextAlignment.Center;
                lb[k].Text          = myHexNo.ToString("X3");
                myHexNo++;
                lb[k].Focusable  = false;
                lb[k].Background = Brushes.BlanchedAlmond;


                Grid.SetRow(lb[k], i);
                Grid.SetColumn(lb[k], j);
                myGrid.Children.Add(lb[k]);
                k++;
            }

            for (i = 0, j = 1; j <= 16; j++)
            {
                lb[k] = new TextBox();
                lb[k].TextAlignment = TextAlignment.Center;
                lb[k].Text          = (j - 1).ToString("X");
                lb[k].Focusable     = false;
                lb[k].Background    = Brushes.BlanchedAlmond;

                Grid.SetRow(lb[k], i);
                Grid.SetColumn(lb[k], j);
                myGrid.Children.Add(lb[k]);
                k++;
            }

            k = 0;
            for (i = 1; i <= 16; i++)
            {
                for (j = 1; j <= 16; j++)
                {
                    tb[k]       = new myTextBox2d();
                    tb[k].Index = k;
                    tb[k].Text  = "00";


                    Grid.SetRow(tb[k], i);
                    Grid.SetColumn(tb[k], j);
                    myGrid.Children.Add(tb[k]);
                    k++;
                }
            }

            rbMemory.IsChecked = true;

            IsSaved = true;
            CommandBinding cmdBindingPaste = new CommandBinding(ApplicationCommands.Paste);

            cmdBindingPaste.Executed += PasteCommandHandler;
            rtb1.CommandBindings.Add(cmdBindingPaste);

            CommandBinding cmdBindingExit = new CommandBinding(ApplicationCommands.Close);

            cmdBindingExit.Executed += ExitCommandHandler;
            CommandBindings.Add(cmdBindingExit);

            CommandBinding cmdBindingOpen = new CommandBinding(ApplicationCommands.Open);

            cmdBindingOpen.Executed += OpenCommandHandler;
            CommandBindings.Add(cmdBindingOpen);

            CommandBinding cmdBindingSave = new CommandBinding(ApplicationCommands.Save);

            cmdBindingSave.Executed += SaveCommandHandler;
            CommandBindings.Add(cmdBindingSave);
        }
        public MainWindow()
        {
            InitializeComponent();

            int i, j, k, myHexNo;

            //Initialize initial state
            IsRbMemoryChecked = true;
            IsStopped = true;
            bStop.IsEnabled = false;
            bStep.IsEnabled = false;
            bR75.IsEnabled = false;
            bR65.IsEnabled = false;
            bR55.IsEnabled = false;
            bIntr.IsEnabled = false;

            //Initialize memory
            for (i = 0; i <= 65535; i++)
            {
                m[i] = new MyByte8();
            }

            //Initialize IO
            for (i = 0; i <= 255; i++)
            {
                io[i] = new MyByte8();
            }

            //Initialize Registers
            M = new MyByteM();
            BC = new MyByte16();
            DE = new MyByte16();
            HL = new MyByte16();
            PSW = new MyByte16();
            PC = new MyByte16();
            SP = new MyByte16();

            //Initialize TextBoxes
            FArray = new TextBox[] { tbF0, tbF1, tbF2, tbF3, tbF4, tbF5, tbF6, tbF7 };
            tbGo.Text = "0000";

            tbPCMenu.Text = "0000";
            //tbCIMenu
            //tbNIMenu
            //tbCI
            //tcNI
            tbPC.Text = "0000";
            tbSP.Text = "0000";
            //tbCCC
            //tbIC
            tbA.Text = "00";
            tbF.Text = "00";
            tbB.Text = "00";
            tbC.Text = "00";
            tbD.Text = "00";
            tbE.Text = "00";
            tbH.Text = "00";
            tbL.Text = "00";
            tbM.Text = "00";
            for (i = 0; i <= 7; i++)
                FArray[i].Text = "0";



            // Define the Rows
            RowDefinition[] r = new RowDefinition[17];
            for (i = 0; i <= 16; i++)
            {
                r[i] = new RowDefinition();
                myGrid.RowDefinitions.Add(r[i]);
            }

            //Define columns
            ColumnDefinition[] c = new ColumnDefinition[17];
            for (i = 0; i <= 16; i++)
            {
                c[i] = new ColumnDefinition();
                myGrid.ColumnDefinitions.Add(c[i]);
            }

            k = 0;
            myHexNo = 0x000;

            for (i = 1, j = 0; i <= 16; i++)
            {
                lb[k] = new TextBox();
                lb[k].TextAlignment = TextAlignment.Center;
                lb[k].Text = myHexNo.ToString("X3");
                myHexNo++;
                lb[k].Focusable = false;
                lb[k].Background = Brushes.BlanchedAlmond;


                Grid.SetRow(lb[k], i);
                Grid.SetColumn(lb[k], j);
                myGrid.Children.Add(lb[k]);
                k++;
            }

            for (i = 0, j = 1; j <= 16; j++)
            {
                lb[k] = new TextBox();
                lb[k].TextAlignment = TextAlignment.Center;
                lb[k].Text = (j - 1).ToString("X");
                lb[k].Focusable = false;
                lb[k].Background = Brushes.BlanchedAlmond;

                Grid.SetRow(lb[k], i);
                Grid.SetColumn(lb[k], j);
                myGrid.Children.Add(lb[k]);
                k++;
            }

            k = 0;
            for (i = 1; i <= 16; i++)
            {
                for (j = 1; j <= 16; j++)
                {
                    tb[k] = new myTextBox2d();
                    tb[k].Index = k;
                    tb[k].Text = "00";


                    Grid.SetRow(tb[k], i);
                    Grid.SetColumn(tb[k], j);
                    myGrid.Children.Add(tb[k]);
                    k++;
                }
            }

            rbMemory.IsChecked = true;

            IsSaved = true;
            CommandBinding cmdBindingPaste = new CommandBinding(ApplicationCommands.Paste);
            cmdBindingPaste.Executed += PasteCommandHandler;
            rtb1.CommandBindings.Add(cmdBindingPaste);

            CommandBinding cmdBindingExit = new CommandBinding(ApplicationCommands.Close);
            cmdBindingExit.Executed += ExitCommandHandler;
            CommandBindings.Add(cmdBindingExit);

            CommandBinding cmdBindingOpen = new CommandBinding(ApplicationCommands.Open);
            cmdBindingOpen.Executed += OpenCommandHandler;
            CommandBindings.Add(cmdBindingOpen);

            CommandBinding cmdBindingSave = new CommandBinding(ApplicationCommands.Save);
            cmdBindingSave.Executed += SaveCommandHandler;
            CommandBindings.Add(cmdBindingSave);
        }
Beispiel #6
0
 public MyByte16()
 {
     dec16 = (ushort)0;
     lb    = new MyByte8();
     hb    = new MyByte8();
 }
 private void UpdateP(byte i)
 {
     MyByte8 temp = new MyByte8();
     temp.DEC8 = i;
     int NoOfOnes = 0;
     for (int j = 0; j <= 7; j++)
     {
         if (temp[j] == true)
             NoOfOnes++;
     }
     if (NoOfOnes % 2 == 0)
         PSW.LB[2] = true;
     else
         PSW.LB[2] = false;
 }
 private void UpdateS(byte i)
 {
     MyByte8 temp = new MyByte8();
     temp.DEC8 = i;
     if (temp[7] == true)
         PSW.LB[7] = true;
     else
         PSW.LB[7] = false;
 }
 public MyByte16()
 {
     dec16 = (ushort)0;
     lb = new MyByte8();
     hb = new MyByte8();
 }