示例#1
0
 public Cpu(Memory memory, VirtualMachine vm)
 {
     this.vm = vm;
     this.memory = memory;
     this.PC = 0;
     this.AX = new Word(0);
     this.CX = new Word(0);
     this.SF = 0;
 }
示例#2
0
 private void button2_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(Word.HexToInt("FFFF").ToString());
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         vm = new VirtualMachine(openFileDialog1.FileName);
         executeNextButton.Enabled = true;
         executeAllButton.Enabled = true;
         FillVirtualMemory();
         FillRealMemory();
         FillRegisters();
         SetNextCommandLabel();
         outputTextBox.Text = String.Empty;
         taskNameLabel.Text = "Current task = " + openFileDialog1.FileName.Split('\\').Last();
         this.vm.Cpu.CommandExecuted += new VMEventHandler(FillRegisters);
         this.vm.Cpu.CommandExecuted += new VMEventHandler(FillVirtualMemoryGrid);
         this.vm.Cpu.CommandExecuted += new VMEventHandler(FillRealMemoryGrid);
         this.vm.Cpu.CommandExecuted += new VMEventHandler(SetNextCommandLabel);
         this.vm.Io.InputRequested += new VMEventHandler(PrepareForInput);
         this.vm.Io.OutputRequested += new VMEventHandler(PrInt16Buffer);
         this.vm.VMTaskFinished += new VMEventHandler(vmTaskFinishHandler);
         this.vm.CheckIfInputNext();
     }
 }