コード例 #1
0
ファイル: SystemHost.cs プロジェクト: emberian/ArkeOS
        public SystemHost(Stream bootImage, Stream applicationImage, ulong displayWidth, ulong displayHeight)
        {
            var interruptController = new Hdw.InterruptController();
            var ram         = new Hdw.RandomAccessMemoryController(1 * 1024 * 1024);
            var bootManager = new Hdw.BootManager(bootImage);

            this.Processor = new Hdw.Processor();

            this.system = new Hdw.SystemBusController()
            {
                Processor           = this.Processor,
                InterruptController = interruptController
            };

            this.system.AddDevice(ram);
            this.system.AddDevice(bootManager);
            this.system.AddDevice(this.Processor);
            this.system.AddDevice(interruptController);

            applicationImage.SetLength(8 * 1024 * 1024);

            this.system.AddDevice(new Hdw.DiskDrive(applicationImage));

            this.Keyboard = new Hdw.Keyboard();
            this.system.AddDevice(this.Keyboard);

            this.Display = new Hdw.Display(displayWidth, displayHeight);
            this.system.AddDevice(this.Display);

            this.Processor.DebugHandler = (a, b, c) => a.Value = (ulong)DateTime.UtcNow.Ticks;

            this.system.Reset();
        }
コード例 #2
0
        public void Copy(ulong source, ulong destination, ulong length)
        {
            var sourceDevice      = this.devices[SystemBusController.GetDeviceId(source)];
            var destinationDevice = this.devices[SystemBusController.GetDeviceId(destination)];

            if (sourceDevice.Id == destinationDevice.Id)
            {
                sourceDevice.Copy(SystemBusController.GetAddress(source), SystemBusController.GetAddress(destination), length);
            }
            else
            {
                destinationDevice.Write(SystemBusController.GetAddress(destination), sourceDevice.Read(SystemBusController.GetAddress(source), length));
            }
        }
コード例 #3
0
 public void WriteWord(ulong address, ulong data) => this.devices[SystemBusController.GetDeviceId(address)].WriteWord(SystemBusController.GetAddress(address), data);
コード例 #4
0
 public ulong ReadWord(ulong address) => this.devices[SystemBusController.GetDeviceId(address)].ReadWord(SystemBusController.GetAddress(address));
コード例 #5
0
 public void Write(ulong destination, ulong[] data) => this.devices[SystemBusController.GetDeviceId(destination)].Write(SystemBusController.GetAddress(destination), data);
コード例 #6
0
 public ulong[] Read(ulong source, ulong length) => this.devices[SystemBusController.GetDeviceId(source)].Read(SystemBusController.GetAddress(source), length);
コード例 #7
0
ファイル: SystemHost.cs プロジェクト: emberian/ArkeOS
 public void Dispose()
 {
     this.system.Dispose();
     this.system = null;
 }