public VirtualMachine(VirtualMachine oldVirtualMachine)
        {
            this.DP            = oldVirtualMachine.DP;
            this.PC            = oldVirtualMachine.PC;
            this.SP            = oldVirtualMachine.SP;
            this.DP            = oldVirtualMachine.DP;
            this.Console       = new StringBuilder(oldVirtualMachine.Console.ToString());
            this.IsFinished    = oldVirtualMachine.IsFinished;
            this.Name          = oldVirtualMachine.Name;
            this.m_realMachine = oldVirtualMachine.m_realMachine;

            maxPID++;
            PID             = maxPID;
            this.PagesTable = new PageTable(oldVirtualMachine.PagesTable);
        }
Esempio n. 2
0
        public VirtualMachine(RealMachine realMachine, short pc = 0, short sp = 0)
        {
            m_segmentsStartAddresses.Add(Segments.PS, 0);
            m_segmentsStartAddresses.Add(Segments.DS, (short)((Settings.Default.ProgramSegmentPagesCount) * Settings.Default.PageSize));
            m_segmentsStartAddresses.Add(Segments.SS, (short)((Settings.Default.ProgramSegmentPagesCount + Settings.Default.DataSegmentPagesCount) * Settings.Default.PageSize));

            m_realMachine = realMachine;
            PagesTable    = new PageTable(m_realMachine);
            if (sp == 0)
            {
                SP = m_segmentsStartAddresses[Segments.SS];
            }
            else
            {
                SP = sp;
            }
            PC = pc;
            DP = m_segmentsStartAddresses[Segments.DS];
            maxPID++;
            PID = maxPID;
        }