示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VGAConsole"/> class.
        /// </summary>
        public VGAConsole(SimCPU simCPU, ISimDisplay dislayForm)
            : base(simCPU)
        {
            this.dislayForm      = dislayForm;
            this.IsMemoryMonitor = true;

            ioBase      = StandardIOBase;
            baseAddress = StandardAddressBase;

            width  = 80;
            height = 27;

            cursorPosition = 0;
            lastCommand    = 0;

            font = new Font("Lucida Console", 9, FontStyle.Regular);
            //font = new Font("Consolas", 8, FontStyle.Regular);
            fontWidth  = (int)font.SizeInPoints;
            fontHeight = (int)font.SizeInPoints + 5;

            bitmap  = new System.Drawing.Bitmap(fontWidth * width, fontHeight * height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            graphic = Graphics.FromImage(bitmap);

            dislayForm.SetBitMap(bitmap);
        }
示例#2
0
        protected void AddBreakpointByLabel(int lineNbr, string data)
        {
            var symbol = SimCPU.GetSymbol(data);

            AddOutput(lineNbr, "STATUS: Add breakpoint " + symbol.Name + " at " + MainForm.Format(symbol.Address, MainForm.Display32));
            MainForm.AddBreakpoint(symbol.Name, symbol.Address);
        }
示例#3
0
        protected void AddWatchByLabel(int lineNbr, string data)
        {
            var symbol = SimCPU.GetSymbol(data);

            AddOutput(lineNbr, "STATUS: Add watach " + symbol.Name + " at " + MainForm.Format(symbol.Address, MainForm.Display32));
            MainForm.AddWatch(symbol.Name, symbol.Address, (int)symbol.Size);
        }
示例#4
0
        private void Compile()
        {
            var simAdapter = GetSimAdaptor("x86");

            compileStartTime = DateTime.Now;

            Compiler.CompilerOptions.EnableSSA               = false;
            Compiler.CompilerOptions.EnableOptimizations     = false;
            Compiler.CompilerOptions.EnableVariablePromotion = false;
            Compiler.CompilerOptions.EnableSparseConditionalConstantPropagation = false;
            Compiler.CompilerOptions.EnableInlinedMethods = false;

            Compiler.CompilerOptions.LinkerFactory = delegate { return(new SimLinker(simAdapter)); };
            Compiler.CompilerFactory = delegate { return(new SimCompiler(simAdapter)); };

            Compiler.Execute(Environment.ProcessorCount);

            SimCPU = simAdapter.SimCPU;

            SimCPU.Monitor.BreakAtTick      = 1;
            SimCPU.Monitor.BreakOnException = true;
            SimCPU.Monitor.OnStateUpdate    = UpdateSimState;
            SimCPU.Reset();

            Display32 = SimCPU.GetState().NativeRegisterSize == 32;
        }
示例#5
0
        public override BaseSimDevice Clone(SimCPU simCPU)
        {
            var device = new CMOS(simCPU);

            device.index = index;
            return(device);
        }
示例#6
0
        public override void ExtendState(SimCPU simCPU)
        {
            var x86 = simCPU as CPUx86;

            AddStack(x86);
            AddStackFrame(x86);
            AddCallStack(x86);
        }
示例#7
0
        public override void Execute(SimCPU cpu, SimInstruction instruction)
        {
            var x86 = cpu as CPUx86;

            x86.EIP.Value = x86.EIP.Value + instruction.OpcodeSize;

            Execute(x86, instruction);
        }
        public override void Execute(SimCPU cpu, SimInstruction instruction)
        {
            var x86 = cpu as CPUx86;

            x86.EIP.Value = x86.EIP.Value + instruction.OpcodeSize;

            Execute(x86, instruction);
        }
示例#9
0
        public override BaseSimDevice Clone(SimCPU simCPU)
        {
            var device = new MosaDebug(simCPU, debug);

            device.value32 = value32;
            device.bytes32 = bytes32;
            device.sb      = new StringBuilder(sb.ToString());

            return(device);
        }
示例#10
0
        public override BaseSimDevice Clone(SimCPU simCPU)
        {
            var device = new MosaDebug(simCPU, debug);

            device.value32 = value32;
            device.bytes32 = bytes32;
            device.sb = new StringBuilder(sb.ToString());

            return device;
        }
示例#11
0
        private void AddSymbol(ulong ip)
        {
            SimSymbol symbol = SimCPU.FindSymbol(ip);

            if (symbol != null)
            {
                treeView1.Nodes.Add(new CallStackEntry(symbol, ip, true));
            }
            else
            {
                treeView1.Nodes.Add(new CallStackEntry(ip, true));
            }
        }
示例#12
0
        private void UpdateDisplay()
        {
            int lines = lbMemory.Height / (lbMemory.Font.Height + 2);

            try
            {
                string nbr    = tbMemory.Text.ToUpper().Trim();
                int    digits = 10;
                int where = nbr.IndexOf('X');

                if (where >= 0)
                {
                    digits = 16;
                    nbr    = nbr.Substring(where + 1);
                }

                uint at = Convert.ToUInt32(nbr, digits);

                string[] newlines = new string[lines];

                for (int line = 0; line < lines; line++)
                {
                    string l = at.ToString("X").PadLeft(8, '0') + ':';
                    string d = string.Empty;
                    for (int x = 0; x < 16; x++)
                    {
                        byte mem = SimCPU.DirectRead8(at);

                        if (x % 4 == 0)
                        {
                            l = l + ' ';
                        }
                        l = l + mem.ToString("X").PadLeft(2, '0');
                        char b = (char)mem;
                        d = d + (char.IsLetterOrDigit(b) ? b : '.');
                        at++;
                    }

                    newlines[line] = l + ' ' + d;
                }
                lbMemory.Lines = newlines;
                Status         = string.Empty;
            }
            catch (Exception e)
            {
                Status = "Error: " + e.ToString();
            }
        }
示例#13
0
        public void AddHistory(BaseSimState simState)
        {
            if (!MainForm.Record)
            {
                return;
            }

            if (simState.IP == 0xFFFFFFF0)
            {
                return;
            }

            string methodName = SimCPU.FindSymbol(simState.IP).Name;

            pendingHistory.Enqueue(new HistoryEntry(simState, methodName, MainForm.Display32));
        }
示例#14
0
        public override void UpdateDock(BaseSimState simState)
        {
            var currentInstruction = simState.Instruction;
            var nextInstruction    = SimCPU.GetOpcode(simState.NextIP);

            textBox1.Text = simState.Tick.ToString();
            textBox2.Text = currentInstruction != null?currentInstruction.ToString() : "-BLANK-";

            textBox3.Text = nextInstruction != null?nextInstruction.ToString() : "-BLANK-";

            textBox4.Text = "0x" + simState.IP.ToString("X8");
            textBox5.Text = "0x" + simState.NextIP.ToString("X8");

            textBox6.Text = simState.CPUException != null?simState.CPUException.ToString() : "None";

            double speed = simState.Tick / simState.TotalElapsedSeconds;

            textBox7.Text = speed.ToString("0.00");

            Refresh();
        }
示例#15
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     var device = new CMOS(simCPU);
     device.index = index;
     return device;
 }
示例#16
0
        public static readonly uint VirtualPageBitMap = 1024 * 1024 * 21; // 0x1500000

        #endregion Fields

        #region Constructors

        public MosaKernel(SimCPU simCPU)
            : base(simCPU)
        {
        }
示例#17
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return new MosaImage(simCPU);
 }
示例#18
0
        public static readonly uint VirtualPageBitMap = 1024 * 1024 * 20;  // 0x01400000

        public MosaKernel(SimCPU simCPU)
            : base(simCPU)
        {
        }
示例#19
0
 public PowerUp(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MosaDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 public MosaDebug(SimCPU simCPU)
     : base(simCPU)
 {
     debug = null;
 }
示例#21
0
 public BaseSimDevice(SimCPU simCPU)
 {
     this.simCPU     = simCPU;
     IsMemoryMonitor = false;
 }
示例#22
0
文件: CMOS.cs 项目: tea/MOSA-Project
 /// <summary>
 /// Initializes a new instance of the <see cref="CMOS"/> class.
 /// </summary>
 /// <param name="ioBase">The io base.</param>
 public CMOS(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BochDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 public BochDebug(SimCPU simCPU)
     : base(simCPU)
 {
     debug = null;
 }
示例#24
0
        public static readonly uint MultibootStructure = 0x10090;         // same as QEMU

        public Multiboot(SimCPU simCPU)
            : base(simCPU)
        {
        }
示例#25
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return(new Multiboot(simCPU));
 }
示例#26
0
 public override void ExtendState(SimCPU simCPU)
 {
     var x86 = simCPU as CPUx86;
     AddStack(x86);
     AddStackFrame(x86);
     AddCallStack(x86);
 }
示例#27
0
 public PowerUp(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#28
0
 public SimStream(SimCPU simCPU, ulong offset)
 {
     this.simCPU = simCPU;
     this.internaloffset = offset;
 }
示例#29
0
 public MosaImage(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#30
0
 public virtual void Execute(SimCPU cpu, SimInstruction instruction)
 {
 }
示例#31
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return(new MosaImage(simCPU));
 }
示例#32
0
		public BaseSimDevice(SimCPU simCPU)
		{
			this.simCPU = simCPU;
			IsMemoryMonitor = false;
		}
示例#33
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return(new MosaTestMemory(simCPU));
 }
示例#34
0
 public BaseSimDevice(SimCPU simCPU)
 {
     this.simCPU = simCPU;
 }
示例#35
0
 public MosaTestMemory(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#36
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return new Multiboot(simCPU);
 }
示例#37
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return(new MosaKernel(simCPU));
 }
 public SimLinkerFinalizationStage(SimCPU simCPU)
 {
     this.simCPU = simCPU;
 }
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return new MosaTestMemory(simCPU);
 }
示例#40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MosaDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 public MosaDebug(SimCPU simCPU)
     : base(simCPU)
 {
     debug = null;
 }
示例#41
0
 public SimLinkerFinalizationStage(SimCPU simCPU)
 {
     this.simCPU = simCPU;
 }
示例#42
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return new MosaKernel(simCPU);
 }
示例#43
0
        public ulong offset;            // hack until next version of SharpDism

        public SimAssemblyCode(SimCPU simCPU, ulong offset = 0)
        {
            this.simCPU = simCPU;
            this.offset = offset;
        }
示例#44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BochDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 public BochDebug(SimCPU simCPU)
     : base(simCPU)
 {
     debug = null;
 }
示例#45
0
 public MosaTestMemory(SimCPU simCPU)
     : base(simCPU)
 {
 }
示例#46
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return(null);            // not clonable
 }
示例#47
0
 public SimStream(SimCPU simCPU, ulong offset)
 {
     this.simCPU         = simCPU;
     this.internaloffset = offset;
 }
示例#48
0
        public static readonly uint MultibootStructure = 0x10090; // same as QEMU

        #endregion Fields

        #region Constructors

        public Multiboot(SimCPU simCPU)
            : base(simCPU)
        {
        }
示例#49
0
 public abstract BaseSimDevice Clone(SimCPU simCPU);
示例#50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VGAConsole"/> class.
        /// </summary>
        public VGAConsole(SimCPU simCPU, ISimDisplay dislayForm)
            : base(simCPU)
        {
            this.dislayForm = dislayForm;
            IsMemoryMonitor = true;

            ioBase = StandardIOBase;
            baseAddress = StandardAddressBase;

            width = 80;
            height = 27;

            cursorPosition = 0;
            lastCommand = 0;

            font = new Font("Lucida Console", 9, FontStyle.Regular);

            //font = new Font("Consolas", 8, FontStyle.Regular);
            fontWidth = (int)font.SizeInPoints;
            fontHeight = (int)font.SizeInPoints + 5;

            bitmap = new System.Drawing.Bitmap(fontWidth * width, fontHeight * height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            graphic = Graphics.FromImage(bitmap);

            dislayForm.SetBitMap(bitmap);
        }
示例#51
0
        public static readonly uint ImageSize   = 1024 * 1024 * 8;       // 8MB

        public MosaImage(SimCPU simCPU)
            : base(simCPU)
        {
        }
示例#52
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return null; // not clonable
 }
示例#53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MosaDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 /// <param name="output">The output.</param>
 public MosaDebug(SimCPU simCPU, TextWriter output)
     : base(simCPU)
 {
     debug = output;
 }
示例#54
0
 public override BaseSimDevice Clone(SimCPU simCPU)
 {
     return new PowerUp(simCPU);
 }
示例#55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MosaDebug"/> class.
 /// </summary>
 /// <param name="simCPU">The sim cpu.</param>
 /// <param name="output">The output.</param>
 public MosaDebug(SimCPU simCPU, TextWriter output)
     : base(simCPU)
 {
     debug = output;
 }
示例#56
0
 public virtual void Execute(SimCPU cpu, SimInstruction instruction)
 {
 }