Example #1
0
 private void button14_Click(object sender, EventArgs e)
 {
     if (CurrentOperation == operation.clearOperation)
     {
         CurrentOperation = operation.substraction;
         buffer = textBox1.Text;
         textBox1.Text = "";
         textBox1.Focus();
     }
     else
     {
         CurrentOperation = operation.substraction;
     }
 }
Example #2
0
        void route(byte aaaaaa, ref ushort bval, operation op)
        {
            if ((aaaaaa & 0x20) != 0) {
            ushort literal = (ushort)(aaaaaa & 0x1f);
            op(ref literal, ref bval);
              }
              else
              {
            byte loctype = (byte)((aaaaaa >> 3) & 0x03);
            byte reg = (byte)(aaaaaa & 0x07);

            switch (loctype)
            {
              case 0x00:
            op(ref machine.regs[reg], ref bval);
            break;
              case 0x01:
            op(ref machine.ram[machine.regs[reg]], ref bval);
            break;
              case 0x02:
            op(ref machine.ram[machine.regs[reg] + machine.ram[machine.pc++]], ref bval);
            break;
              case 0x03:
            switch (reg)
            {
              case 0x00:
                op(ref machine.ram[machine.sp++], ref bval);
                break;
              case 0x01:
                op(ref machine.ram[machine.sp], ref bval);
                break;
              case 0x02:
                op(ref machine.ram[--machine.sp], ref bval);
                break;
              case 0x03:
                op(ref machine.sp, ref bval);
                break;
              case 0x04:
                op(ref machine.pc, ref bval);
                break;
              case 0x05:
                op(ref machine.o, ref bval);
                break;
              case 0x06:
                op(ref machine.ram[machine.ram[machine.pc++]], ref bval);
                break;
              case 0x07:
                op(ref machine.ram[machine.pc++], ref bval);
                break;
            }
            break;
            }
              }

            //      byte type = (byte)((aaaaaa >> 3) & 0x3);
            //      byte loc = (byte)(aaaaaa & 0x7);
            //      if (type == 0)
            //      {
            //        switch(loc){}
            //      }
        }
Example #3
0
 void dispatch(byte a, byte b, operation op)
 {
     ushort bval = 0;
       route(b, ref bval, get);
       route(a, ref bval, op);
 }
 event.setFieldValue(OrcRecordUpdater.OPERATION, new IntWritable(operation));
Example #5
0
        private void button15_Click(object sender, EventArgs e)
        {
            listView1.Items.Add("hdfh");
            try
            {
                if (textBox1.Text == "")
                {
                    textBox1.Text = buffer;

                }
                else
                {

                    if (CurrentOperation == operation.addiction)
                    {

                        double tmpBuffer = double.Parse(textBox1.Text);
                        textBox1.Text = (double.Parse(buffer) + tmpBuffer).ToString();
                        CurrentOperation = operation.clearOperation;
                    }
                    if (CurrentOperation == operation.substraction)
                    {
                        double tmpBuffer = double.Parse(textBox1.Text);
                        textBox1.Text = (double.Parse(buffer) - tmpBuffer).ToString();
                        CurrentOperation = operation.clearOperation;
                    }
                    if (CurrentOperation == operation.multiplication)
                    {
                        double tmpBuffer = double.Parse(textBox1.Text);
                        textBox1.Text = (double.Parse(buffer) * tmpBuffer).ToString();
                        CurrentOperation = operation.clearOperation;
                    }
                    if (CurrentOperation == operation.division)
                    {
                        double tmpBuffer = double.Parse(textBox1.Text);
                        textBox1.Text = (double.Parse(buffer) / tmpBuffer).ToString();
                        CurrentOperation = operation.clearOperation;
                    }
                }

            }
            catch (Exception)
            {
                MessageBox.Show("Try input incorrect data");
            }
        }
Example #6
0
 public Calc()
 {
     InitializeComponent();
     CurrentOperation = operation.clearOperation;
 }
Example #7
0
 // TODO: double click (add variable "count" with if statement?)
 private void button5_Click(object sender, EventArgs e)
 {
     textBox1.Clear();
     buffer = "";   // preferable double ckick
     CurrentOperation = operation.clearOperation;
 }
 public Transaction(double amount, operation type)
 {
     this.amount = amount;
     this.tranType = type;
     this._transactionDate = DateProvider.getInstance().now();
 }
Example #9
0
        ushort route(byte aaaaaa, operation op, Lazy<ushort> blazy = null)
        {
            // IMPORTANT: op will be set to noop only for the primary op
              // in an instruction, the flag will have already been cleared
              // in time for the bget() phase.
              if (machine.skip)
              {
            op = noop;
            machine.skip = false;
              }

              if ((aaaaaa & 0x20) != 0)
              {
            ushort literal = (ushort)(aaaaaa & 0x1f);
            return op(ref literal, blazy);
              }
              else
              {
            byte loctype = (byte)((aaaaaa >> 3) & 0x03);
            byte reg = (byte)(aaaaaa & 0x07);

            switch (loctype)
            {
              case 0x00:
            return op(ref machine.regs[reg], blazy);
              case 0x01:
            return op(ref machine.ram[machine.regs[reg]], blazy);
              case 0x02:
            return op(ref machine.ram[machine.regs[reg] + machine.ram[machine.pc++]], blazy);
              case 0x03:
            switch (reg)
            {
              case 0x00:
                return op(ref machine.ram[machine.sp++], blazy);
              case 0x01:
                return op(ref machine.ram[machine.sp], blazy);
              case 0x02:
                return op(ref machine.ram[--machine.sp], blazy);
              case 0x03:
                return op(ref machine.sp, blazy);
              case 0x04:
                return op(ref machine.pc, blazy);
              case 0x05:
                return op(ref machine.o, blazy);
              case 0x06:
                return op(ref machine.ram[machine.ram[machine.pc++]], blazy);
              case 0x07:
                return op(ref machine.ram[machine.pc++], blazy);
              default:
                throw new InvalidOperationException();
            }
              default:
            throw new InvalidOperationException();
            }
              }
        }
Example #10
0
        void dispatch(byte aaaaaa, byte bbbbbb, operation op)
        {
            var blazy = new Lazy<ushort>(() => route(bbbbbb, get));
              route(aaaaaa, op, blazy);

              // Make sure that we called blazy.Value (for its side effects).
              System.Diagnostics.Debug.Assert(blazy.IsValueCreated);
        }