public RuntimeProcess(DisassembledFileBase file, ITerminal terminal)
        {
            // intialize this so that we're signaled. this will allow the run task
            // to be initialized to not wait until the user actually commands us to pause
            m_RunTimer = new Stopwatch();
            m_ProcCtrl = new ChildProcControl();
            m_InstructionAddrToBreakpointMap = new Dictionary <int, bool>();
            m_ExecutionState = PrgmExecutionState.Stopped;
            m_Terminal       = terminal;
            m_RegMgr         = new RegisterManager(file.TextSegment.StartingSegmentAddress, CommonConstants.DEFAULT_STACK_ADDRESS);

            m_DataSegment = new RuntimeDataSegmentAccessor(file.DataSegment);

            m_Ctx = new Interpreter.ExecutionContext(this, terminal, m_DataSegment, m_RegMgr, file.TextSegment);

            // initialize the instruction breakpoint map.
            // this will give us a positive performance boost when we execute the program
            // since we will not be creating new boolean entries in the hash table.
            int endingTxtSegmentAddr = file.TextSegment.StartingSegmentAddress + file.TextSegment.SegmentSize;

            for (int instructionAddr = file.TextSegment.StartingSegmentAddress;
                 instructionAddr < endingTxtSegmentAddr;
                 instructionAddr += sizeof(int))
            {
                m_InstructionAddrToBreakpointMap.Add(instructionAddr, false);
            }
        }
      public ExecutionViewModel(ITerminal terminal, DisassembledFileViewModel underlyingVm, IList<ProgramInstructionViewModel> instructionVm)
      {
         // intialize this so that we're signaled. this will allow the run task
         // to be initialized to not wait until the user actually commands us to pause
         m_PauseCtrl = new PauseController();
         m_InstructionAddrToBreakpointMap = new Dictionary<int, bool>();
         m_ExecutionState = PrgmExecutionState.Stopped;
         m_Terminal = terminal;
         var registers = new RegisterViewModel[InterpreterCommon.MAX_BASIC_REGISTERS];
         for (int i = 0; i < InterpreterCommon.MAX_BASIC_REGISTERS; ++i)
         {
            if (i == 0)
            {
               registers[i] = new ZeroRegisterViewModel();
            }
            else
            {
               registers[i] = new RegisterViewModel(i);
            }
         }

         DisassembledFileBase file = underlyingVm.FileData;

         var dataSegmentAccessor = new BindableDataSegmentAccessor(file.DataSegment);
         
         var fltPtRegs = new FloatingPointRegisterViewModel[InterpreterCommon.MAX_FLOATING_PT_REGISTERS];
         for (int i = 0; i < fltPtRegs.Length; ++i)
         {
            fltPtRegs[i] = new FloatingPointRegisterViewModel(i);
         }

         m_RegMgr = new RegisterManager(registers, fltPtRegs, file.TextSegment.StartingSegmentAddress, CommonConstants.DEFAULT_STACK_ADDRESS);
         m_Ctx = new Interpreter.ExecutionContext(this, terminal, dataSegmentAccessor, m_RegMgr, file.TextSegment);

         m_DataSegmentElements = new BindingList<DataAddressViewModel>();

         // increment this by 16. Each row will display four words.
         for (int currElem = file.DataSegment.BaseRuntimeDataAddress; 
             currElem < file.DataSegment.BaseRuntimeDataAddress + file.DataSegmentLength;
             currElem += 16)
         {
            m_DataSegmentElements.Add(new DataAddressViewModel(currElem, dataSegmentAccessor));
         }

         m_ExecuteFileCmd = new RelayCommand(() => OnExecutionTaskBegin(), true);
         m_TerminateExecutionCmd = new RelayCommand(() => CancelExecution(), false);
         m_SwitchRepresentationCmd = new RelayCommand<RegisterDisplayType>((param) => SwitchRegisterDisplayType(param), true);
         m_SwitchDataRepresentationCmd = new RelayCommand<RegisterDisplayType>((param) => SwitchDataDisplayType(param), true);
         m_PauseExecutionCmd = new RelayCommand(() => PauseExecution(), false);
         m_ResumeExecutionCmd = new RelayCommand(() => ResumeExecution(), false);
         m_InstructionStepCmd = new RelayCommand(() => TemporarilyUnblockExecutionTask(), false);
         m_SetBreakpointCmd = new RelayCommand<int>(param => SetProgramBreakpoint(param), true);
         m_UnsetBreakpointCmd = new RelayCommand<int>(param => UnsetProgramBreakpoint(param), true);

         // initialize the instruction breakpoint map.
         // this will give us a positive performance boost when we execute the program
         // since we will not be creating new boolean entries in the hash table.
         foreach (var instruction in instructionVm)
         {
            m_InstructionAddrToBreakpointMap.Add(instruction.ProgramCounterLocation, false);
            instruction.PropertyChanged += OnFileViewModelPropertyChanged;
         }
      }