private Partition[] userPartitionPointers; // Array pointing to the partitions that are user partitions.

        #endregion Fields

        #region Constructors

        //****************************************************
        // Method: MyFixedPartitionMemoryManager
        //
        // Purpose: Memory manager constructor.
        //****************************************************
        public MyFixedPartitionMemoryManager(IOperatingSystemFactory operatingSystemFactory)
        {
            this.operatingSystemFactory = operatingSystemFactory;
            this.memoryType = OperatingSystemMemoryTypes.FIXEDPARTITION;
            this.cpu = (ICPU)this.operatingSystemFactory.CreateObject(ObjectType.ICPU);
            this.processorManager = (IProcessorManager)this.operatingSystemFactory.CreateObject(ObjectType.IProcessorManager);
        }
Example #2
0
 public VirtualMachine(ICPU cpu,IRAM ram)
 {
     this.cpu = cpu;
     this.ram = ram;
     cpu.machine = this;
     ram.machine = this;
 }
Example #3
0
 protected Computer(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard)
 {
     this.cpu = cpu;
     this.ram = ram;
     this.videoCard = videoCard;
     this.hardDriveRaid = hardDriveRaid;
     this.motherBoard = motherBoard;
 }
        public DissasembleViewModel(BreakpointsViewModel breakpoints, IGameBoy gameBoy)
        {
            _breakpoints = breakpoints;
              _gameBoy = gameBoy;
              _cpu = gameBoy.CPU;
              _disassembler = gameBoy.Disassembler;

              _breakpoints.BreakpointChanged += _breakpoints_BreakpointChanged;
        }
Example #5
0
        public CPUViewModel(IGameBoy gameBoy, IDispatcher dispatcher)
        {
            _gameBoy = gameBoy;
              _cpu = _gameBoy.CPU;
              _dispatcher = dispatcher;

              //_gameBoy.Display.FrameCompleted += OnFrameCompleted;
              //_gameBoy.StepCompleted += OnFrameCompleted;
        }
 public InstructionHistogramViewModel(IGameBoy gameBoy, IDispatcher dispatcher)
 {
     _gameBoy = gameBoy;
       _dispatcher = dispatcher;
       _gameBoy.FrameCompleted += OnFrameCompleted;
       _cpu = _gameBoy.CPU;
       _histogram = new WriteableBitmap(16, 16, 96, 96, PixelFormats.Gray16, null);
       _cbHistogram = new WriteableBitmap(16, 16, 96, 96, PixelFormats.Gray16, null);
       _maxHistogramValue = 65535;
 }
Example #7
0
 public void InitCpu()
 {
     if (cpu != null)
     {
         return;
     }
     cpu = new CPU(this, "ksp");
     cpu.AttachVolume(HardDisk);
     cpu.Boot();
 }
Example #8
0
 public void Initialize()
 {
     m_CPU         = new CPU();
     m_Bank        = new MemoryBank(64);
     m_BankService = new MemoryBankService(new List <IMemoryBank> {
         m_Bank
     });
     m_Fetcher = _CreateFetcher(m_BankService);
     m_Feeder  = new OperationFeeder(m_Fetcher);
 }
Example #9
0
        public static string GetCPUThreadName(this ICPU cpu, Machine machine)
        {
            string machineName;

            if (EmulationManager.Instance.CurrentEmulation.TryGetMachineName(machine, out machineName))
            {
                machineName += ".";
            }
            return("{0}{1}[{2}]".FormatWith(machineName, machine.GetLocalName(cpu), machine.SystemBus.GetCPUId(cpu)));
        }
Example #10
0
 public InstructionHistogramViewModel(IGameBoy gameBoy, IDispatcher dispatcher)
 {
     _gameBoy                 = gameBoy;
     _dispatcher              = dispatcher;
     _gameBoy.FrameCompleted += OnFrameCompleted;
     _cpu               = _gameBoy.CPU;
     _histogram         = new WriteableBitmap(16, 16, 96, 96, PixelFormats.Gray16, null);
     _cbHistogram       = new WriteableBitmap(16, 16, 96, 96, PixelFormats.Gray16, null);
     _maxHistogramValue = 65535;
 }
Example #11
0
 public void Initialize()
 {
     m_Oscillator  = new Clock();
     m_CPU         = new CPU();
     m_Bank        = new MemoryBank(512);
     m_BankService = new MemoryBankService(new List <IMemoryBank>
     {
         m_Bank
     });
     m_Machine = new Machine(m_CPU, m_Oscillator, m_BankService);
 }
 public SNESSystem(ICPU cpu, IRenderer renderer, IROM rom, IPPU ppu, IAPU apu, IAudioHandler audioHandler)
 {
     CPU          = cpu;
     Renderer     = renderer;
     AudioHandler = audioHandler;
     ROM          = rom;
     rom?.SetSystem(this);
     PPU = ppu;
     PPU?.SetSystem(this);
     APU = apu;
     CPU?.SetSystem(this);
 }
Example #13
0
            public LockableControl(string name, string propertyName, ICPU cpu, IBindingManager manager)
            {
                Name   = name;
                Cpu    = cpu;
                Vessel = cpu.Vessel;
                Locked = false;
                Value  = 0;

                manager.AddGetter(name, c => Value);
                manager.AddSetter(name, delegate { });

                this.propertyName = propertyName;
            }
        public MainWindow()
        {
            InitializeComponent();

            T.Interval = TimeSpan.FromSeconds(1);
            T.Tick += new EventHandler(T_Tick);

            S.Interval = TimeSpan.FromMilliseconds(10);
            S.Tick += new EventHandler(S_Tick);

            cpu = CPUFactory.GetCPU(CPUFactory.CPU_EASY);

               memoryGrid.ItemsSource = cpu.Memory;
        }
 public Computer
 (
     IMotherboard motherboard,
     IRam ram,
     IGraphicsCard graphicsCard,
     IHardDiskDrive hdd,
     ICPU cpu
 )
 {
     this.motherboard  = motherboard;
     this.ram          = ram;
     this.graphicsCard = graphicsCard;
     this.hdd          = hdd;
     this.cpu          = cpu;
 }
Example #16
0
        public static void CreateAndListenOnPort(int port, ICPU cpu, Machine machine)
        {
            if(gdbs.ContainsKey(cpu))
            {
                throw new RecoverableException(string.Format("GDB server already started for this cpu on port: {0}", gdbs[cpu].Port));
            }

            try 
            {
                gdbs.Add(cpu, new GDB(port, cpu as IControllableCPU, machine));
            }
            catch (SocketException e)
            {
                throw new RecoverableException(string.Format("Could not start GDB server: {0}", e.Message));
            }
        }
Example #17
0
        public BindingManager(ICPU cpu, string context)
        {
            Cpu = cpu;

            var contexts = new string[1];
            contexts[0] = context;

            foreach (var t in Assembly.GetExecutingAssembly().GetTypes())
            {
                var attr = (KOSBinding) t.GetCustomAttributes(typeof (KOSBinding), true).FirstOrDefault();

                if (attr == null || attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any()) continue;
                var b = (IBinding) Activator.CreateInstance(t);
                b.BindTo(this);
                bindings.Add(b);
            }
        }
Example #18
0
		public void ShouldEnumerateCPUs()
		{
			const int numberOfCpus = 10;
			var cpus = new ICPU[numberOfCpus];
			using(var machine = new Machine())
			{
				var sysbus = machine.SystemBus;
				for(var i = 0; i < cpus.Length; i++)
				{
					cpus[i] = new Mock<ICPU>().Object;
					sysbus.Register(cpus[i], new CPURegistrationPoint());
				}
				for(var i = 0; i < cpus.Length; i++)
				{
					Assert.AreEqual(i, sysbus.GetCPUId(cpus[i]));
				}
			}
		}
Example #19
0
        public Lenovo_Unknown(ICPU CPU, IGPU GPU)
        {
            this.Socket         = Sockets.LGA1151;
            this.CompatibleCPUs = new Type[]
            {
                new IntelCore_I3_6100().GetType()
            };

            this.CPU = CPU;

            if (GPU != null)
            {
                this.GPU = GPU;
            }
            else
            {
                this.GPU = new GTX1050();
            }
        }
Example #20
0
 public void Attach(ICPU cpu)
 {
     try
     {
         if (cpu.GetType().ToString().EndsWith("AMD"))
         {
             Console.WriteLine("MSIK7N2G");
         }
         else
         {
             Console.WriteLine("主板MSIK7N2G只能配AMD的CPU");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("主板MSIK7N2G只能配AMD的CPU");
         Console.WriteLine("With Exception : {0}", ex.Message);
     }
 }
Example #21
0
 public void Attach(ICPU cpu)
 {
     try
     {
         if (cpu.GetType().ToString().EndsWith("Intel"))
         {
             Console.WriteLine("MSI865PE");
         }
         else
         {
             Console.WriteLine("主板MSI865PE只能配Intel的CPU");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("主板MSI865PE只能配Intel的CPU");
         Console.WriteLine("With Exception : {0}", ex.Message);
     }
 }
Example #22
0
        public Aorus_X590(ICPU CPU, IGPU GPU)
        {
            this.Socket         = Sockets.AM4;
            this.CompatibleCPUs = new Type[]
            {
                new Ryzen5_5600X().GetType()
            };

            this.CPU = CPU;

            if (GPU != null)
            {
                this.GPU = GPU;
            }
            else
            {
                this.GPU = new GTX1050();
            }
        }
        public void ShouldEnumerateCPUs()
        {
            const int numberOfCpus = 10;
            var       cpus         = new ICPU[numberOfCpus];

            using (var machine = new Machine())
            {
                var sysbus = machine.SystemBus;
                for (var i = 0; i < cpus.Length; i++)
                {
                    cpus[i] = new Mock <ICPU>().Object;
                    sysbus.Register(cpus[i], new CPURegistrationPoint());
                }
                for (var i = 0; i < cpus.Length; i++)
                {
                    Assert.AreEqual(i, sysbus.GetCPUId(cpus[i]));
                }
            }
        }
Example #24
0
        public void BindTo(IBindingManager manager)
        {
            cpu = manager.Cpu;
            vessel = manager.Cpu.Vessel;

            controls.Add(new LockableControl("THROTTLE", "throttle", cpu, manager));
            controls.Add(new LockableControl("STEERING", "steering", cpu, manager));

            controls.Add(new LockableControl("WHEELSTEERING", "wheelsteering", cpu, manager));
            controls.Add(new LockableControl("WHEELTHROTTLE", "wheelthrottle", cpu, manager));

            // Temporarily removing the ability of RT2 to take over
            // the on-rails autpilot as it seems to be buggy

            //if (RTHook.Instance == null || !RTHook.Instance.HasFlightComputer(vessel.id))
            //{
            //    vessel.OnFlyByWire += OnFlyByWire;
            //}
            vessel.OnFlyByWire += OnFlyByWire;
        }
Example #25
0
        public void BindTo(IBindingManager manager)
        {
            cpu    = manager.Cpu;
            vessel = manager.Cpu.Vessel;

            controls.Add(new LockableControl("THROTTLE", "throttle", cpu, manager));
            controls.Add(new LockableControl("STEERING", "steering", cpu, manager));

            controls.Add(new LockableControl("WHEELSTEERING", "wheelsteering", cpu, manager));
            controls.Add(new LockableControl("WHEELTHROTTLE", "wheelthrottle", cpu, manager));

            // Temporarily removing the ability of RT2 to take over
            // the on-rails autpilot as it seems to be buggy

            //if (RTHook.Instance == null || !RTHook.Instance.HasFlightComputer(vessel.id))
            //{
            //    vessel.OnFlyByWire += OnFlyByWire;
            //}
            vessel.OnFlyByWire += OnFlyByWire;
        }
Example #26
0
        public Aorus_Z370(ICPU CPU, IGPU GPU)
        {
            this.Socket         = Sockets.AM4;
            this.CompatibleCPUs = new Type[]
            {
                new IntelCore_I3_6100().GetType(),
                new IntelCore_I5_9300H().GetType()
            };

            this.CPU = CPU;

            if (GPU != null)
            {
                this.GPU = GPU;
            }
            else
            {
                this.GPU = new GTX1050();
            }
        }
        public InstructionViewModel(ICPU cpu, IInstruction instruction)
        {
            _cpu = cpu;

              _instruction = instruction;
              originalAddress = instruction.Address;
              Address = "0x" + instruction.Address.ToString("x2");
              Opcode = "0x" + instruction.OpCode.ToString("x2");
              Name = instruction.Name;
              Literal = "0x" + instruction.Literal.ToString("x2");
              Description = instruction.Description;

              if (!instruction.CB)
              {
            Ticks = CPUSpace.Dictionaries.CPUInstructionClocks.Get((byte)instruction.OpCode);
              }
              else
              {
            Ticks = CPUSpace.Dictionaries.CPUCBInstructionClocks.Get((byte)instruction.OpCode);
              }
        }
Example #28
0
        public BindingManager(ICPU cpu, string context)
        {
            Cpu = cpu;

            var contexts = new string[1];

            contexts[0] = context;

            foreach (var t in Assembly.GetExecutingAssembly().GetTypes())
            {
                var attr = (KOSBinding)t.GetCustomAttributes(typeof(KOSBinding), true).FirstOrDefault();

                if (attr == null || attr.Contexts.Any() && !attr.Contexts.Intersect(contexts).Any())
                {
                    continue;
                }
                var b = (IBinding)Activator.CreateInstance(t);
                b.BindTo(this);
                bindings.Add(b);
            }
        }
        public InstructionViewModel(ICPU cpu, IInstruction instruction)
        {
            _cpu = cpu;

            _instruction    = instruction;
            originalAddress = instruction.Address;
            Address         = "0x" + instruction.Address.ToString("x2");
            Opcode          = "0x" + instruction.OpCode.ToString("x2");
            Name            = instruction.Name;
            Literal         = "0x" + instruction.Literal.ToString("x2");
            Description     = instruction.Description;

            if (!instruction.CB)
            {
                Ticks = CPUSpace.Dictionaries.CPUInstructionClocks.Get((byte)instruction.OpCode);
            }
            else
            {
                Ticks = CPUSpace.Dictionaries.CPUCBInstructionClocks.Get((byte)instruction.OpCode);
            }
        }
        public void WriteDoubleWord(ulong address, uint value, ICPU context)
        {
            ulong startAddress, endAddress;

            var accessMethods = globalPeripherals.FindAccessMethods(address, out startAddress, out endAddress);

            if (accessMethods == null)
            {
                accessMethods = cpuLocalPeripherals[context].FindAccessMethods(address, out startAddress, out endAddress);
            }
            if (accessMethods == null)
            {
                ReportNonExistingWrite(address, value, SysbusAccessWidth.DoubleWord);
                return;
            }
            if (!IsTargetAccessible(accessMethods.Peripheral))
            {
                this.Log(LogLevel.Warning, "Tried to write a locked peripheral: {0}. Address 0x{1:X}, value 0x{2:X}", accessMethods.Peripheral, address, value);
                return;
            }

            var lockTaken = false;

            try
            {
                accessMethods.Lock.Enter(ref lockTaken);
                if (accessMethods.SetAbsoluteAddress != null)
                {
                    accessMethods.SetAbsoluteAddress(address);
                }
                accessMethods.WriteDoubleWord(checked ((long)(address - startAddress)), value);
            }
            finally
            {
                if (lockTaken)
                {
                    accessMethods.Lock.Exit();
                }
            }
        }
Example #31
0
        public MainWindow()
        {
            InitializeComponent();

            var pf        = PixelFormats.Bgra32;
            int width     = 64;
            int height    = 32;
            int rawStride = (width * pf.BitsPerPixel + 7) / 8;

            byte[] rawImage = new byte[rawStride * height];

            var screenImage = BitmapSource.Create(width, height, 96, 96, pf, null, rawImage, rawStride);

            imgScreen.Source = screenImage;

            // Initialize the CHIP - 8 system(Clear the memory, registers and screen)
            myChip8               = new CPU((uint)((appleIIcGreen.A << 24) | (appleIIcGreen.R << 16) | (appleIIcGreen.G << 8) | appleIIcGreen.B));
            myChip8.OnDraw       += OnDraw;
            myChip8.OnStartSound += OnStartSound;
            myChip8.OnEndSound   += OnEndSound;

            RenderOptions.SetBitmapScalingMode(imgScreen, BitmapScalingMode.NearestNeighbor);

            //EventManager.RegisterClassHandler(typeof(Window), Keyboard.KeyUpEvent, new KeyEventHandler(OnKeyUp), true);
            //EventManager.RegisterClassHandler(typeof(Window), Keyboard.KeyDownEvent, new KeyEventHandler(OnKeyDown), true);

            const string STARTUP_FILE = "demo";

            var files = Directory.EnumerateFiles("progs", "*.c8");

            foreach (var file in files)
            {
                cbPrograms.Items.Add(Path.GetFileNameWithoutExtension(file));
            }

            cbPrograms.SelectedIndex = cbPrograms.Items.IndexOf(STARTUP_FILE);
            LoadProgram(STARTUP_FILE);
        }
        public byte ReadByte(ulong address, ICPU context)
        {
            ulong startAddress, endAddress;

            var accessMethods = globalPeripherals.FindAccessMethods(address, out startAddress, out endAddress);

            if (accessMethods == null)
            {
                accessMethods = cpuLocalPeripherals[context].FindAccessMethods(address, out startAddress, out endAddress);
            }
            if (accessMethods == null)
            {
                return((byte)ReportNonExistingRead(address, SysbusAccessWidth.Byte));
            }
            if (!IsTargetAccessible(accessMethods.Peripheral))
            {
                this.Log(LogLevel.Warning, "Tried to read a locked peripheral: {0}. Address 0x{1:X}.", accessMethods.Peripheral, address);
                return(0);
            }
            var lockTaken = false;

            try
            {
                accessMethods.Lock.Enter(ref lockTaken);
                if (accessMethods.SetAbsoluteAddress != null)
                {
                    accessMethods.SetAbsoluteAddress(address);
                }
                return(accessMethods.ReadByte(checked ((long)(address - startAddress))));
            }
            finally
            {
                if (lockTaken)
                {
                    accessMethods.Lock.Exit();
                }
            }
        }
Example #33
0
 public PC(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard) 
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
 }
Example #34
0
 public Server(ICPU cpu, IRAM ram, MonochromeVideoCard videoCard, RAID hardDriveRaid, MonochromeVideoCard motherBoard)
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
 }
Example #35
0
File: Core.cs Project: QuakeIV/KOS
 public static void CloseWindow(ICPU cpu)
 {
     Fetch.Window.AttachTo(cpu);
     Fetch.Window.Close();
 }
Example #36
0
 public ASL(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #37
0
 public NOTInstruction(ICPU cpu)
 {
     this.cpu = cpu;
 }
 public InstructionViewModel(ICPU cpu)
 {
     _cpu = cpu;
 }
Example #39
0
 internal void AttachTo(ICPU cpu)
 {
     Cpu = cpu;
 }
Example #40
0
File: Core.cs Project: QuakeIV/KOS
 internal static void ToggleWindow(ICPU cpu)
 {
     Fetch.Window.AttachTo(cpu);
     Fetch.Window.Toggle();
 }
Example #41
0
File: Core.cs Project: QuakeIV/KOS
 public static void OpenWindow(ICPU cpu)
 {
     Fetch.Window.AttachTo(cpu);
     Fetch.Window.Open();
 }
 public abstract DeviceBuilder CPU(ICPU cpu);
Example #43
0
 public SWAP(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #44
0
 public EXT(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #45
0
 public MOVEQ(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #46
0
 public JMP(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #47
0
 public DIVS(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #48
0
 public DebugLog(MOS6510 cpu, bool enabled)
     : this()
 {
     Enabled = enabled;
     _cpu = (ICPU)(new MOS6510Wrapper(cpu));
 }
Example #49
0
 public RTR(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #50
0
            public LockableControl(string name, string propertyName, ICPU cpu, IBindingManager manager)
            {
                Name = name;
                Cpu = cpu;
                Vessel = cpu.Vessel;
                Locked = false;
                Value = 0;

                manager.AddGetter(name, c => Value);
                manager.AddSetter(name, delegate { });

                this.propertyName = propertyName;
            }
 public SpecialValueTester(ICPU cpu)
 {
     this.cpu = cpu;
 }
Example #52
0
 public void InitCpu()
 {
     if (cpu != null) return;
     cpu = new CPU(this, "ksp");
     cpu.AttachVolume(HardDisk);
     cpu.Boot();
 }
Example #53
0
 private Mobile(ICPU CPU)
 {
     this.CPU = CPU;
 }
Example #54
0
 public Laptop(ICPU cpu, IRAM ram, IVideoCard videoCard, RAID hardDriveRaid, IMotherboard motherBoard, IBattery battery)
     : base(cpu, ram, videoCard, hardDriveRaid, motherBoard)
 {
     this.battery = battery;
 }