/// <summary> /// Main /// </summary> public static void Main() { Mosa.Kernel.x86.Kernel.Setup(); IDT.SetInterruptHandler(ProcessInterrupt); Setup.Initialize(); Setup.Start(); var textDevice = (ITextDevice)Setup.DeviceManager.GetDevices(new FindDevice.IsTypeOf <ITextDevice>()).First.Value; console = new TextScreen(textDevice); Console.ClearScreen(); Console.SetCursor(0, 0); Console.SetColor(TextColor.Blue, TextColor.Green); Console.WriteLine(" MOSA OS Version 1.5 - Compiler Version 1.5 "); Console.SetColor(TextColor.Black, TextColor.White); Console.WriteLine("> System ready"); Console.SetCursor(0, 24); Console.Write(" Copyright (C) 2008-2015 [Managed Operating System Alliance] "); Process(); }
public void InitSettings() { Controls.Clear(); int x = 100; int y = 60; StatsLabel = new Label(Input); StatsLabel.Text = "statistics:"; StatsLabel.SetX(x); StatsLabel.SetY(y); Controls.Add(StatsLabel); y += 20; DateTime PlayingTime = new DateTime(GameComponent.GSettings.List.StatsTimePlayed); Stats = new TextScreen(); Stats.SetX(x + 15); Stats.SetY(y); Stats.AddLine(GameComponent.GSettings.List.StatsKills + " kills"); Stats.AddLine(GameComponent.GSettings.List.StatsDeaths + " deaths"); Stats.AddLine(Int32.Parse(PlayingTime.ToString("hh")) + " hours " + Int32.Parse(PlayingTime.ToString("mm")) + " min " + Int32.Parse(PlayingTime.ToString("ss")) + " sec in game"); Stats.AddLine(GameComponent.GSettings.List.StatsGamesPlayed + " games played"); Stats.AddLine(GameComponent.GSettings.List.StatsAccuracy + " is your accuracy"); Controls.Add(Stats); y += 20 + Stats.TotalHeight; DimensionLabel = new Label(Input); DimensionLabel.Text = "dimension:"; DimensionLabel.SetX(x); DimensionLabel.SetY(y); Controls.Add(DimensionLabel); DimensionOption = new UpDownControl(Input, x + 100, y); DimensionOption.PushValue("640x480"); DimensionOption.PushValue("800x600"); DimensionOption.SetCurrent(GameComponent.GSettings.List.ScreenWidth == 640 ? 0 : 1); DimensionOption.CreateCallback(OnOptionChange); Controls.Add(DimensionOption); y += 20; NameLabel = new Label(Input); NameLabel.Text = "username:"; NameLabel.SetX(x); NameLabel.SetY(y); Controls.Add(NameLabel); NameInput = new TextBox(Input); NameInput.AppendText(GameComponent.GSettings.List.Name); NameInput.SetX(x + 92); NameInput.SetY(y); NameInput.SetKeyDownCallback(OnOptionChange); Controls.Add(NameInput); }
protected override void BeforeRun() { try { Console.Clear(); Encoding.RegisterProvider(CosmosEncodingProvider.Instance); Console.InputEncoding = Encoding.GetEncoding(437); Console.OutputEncoding = Encoding.GetEncoding(437); screen = new TextScreen(); cnsl = new Sys.Console(screen); CustomConsole.WriteLineInfo("Booting Raindrop Operating System..."); #region Register filesystem Console.Write("Initialize file system? (Y/N) "); var fsc = Console.ReadLine().ToLowerInvariant(); if (fsc == "y" || fsc == "yes") { Sys.FileSystem.VFS.VFSManager.RegisterVFS(vFS); if (ContainsVolumes()) { CustomConsole.WriteLineOK("FileSystem Registration"); } else { CustomConsole.WriteLineError("FileSystem Registration"); } } else { CustomConsole.WriteLineWarning("FileSystem not registered!"); } #endregion CM = new CommandManager(); CustomConsole.WriteLineOK("Raindrop OS started."); Console.Write("Press any key to continue..."); Console.ReadKey(); Console.Clear(); current = new Prompt(); /*vFS.CreateDirectory(currentDirectory + @"Test"); * vFS.CreateDirectory(currentDirectory + @"Test\atabo"); * vFS.CreateFile(currentDirectory + @"Test\atabo.rd"); * vFS.CreateFile(currentDirectory + @"Test\passwd.nonono"); * vFS.CreateFile(currentDirectory + @"Test\.hiddenfile.txt"); * vFS.CreateFile(currentDirectory + @"root.conf");*/ } catch (Exception ex) { Crash.StopKernel(ex); } }
// // FUNCTION : listen // // DESCRIPTION : This method will loop looking for messages sent from the server into the message queue. When found, it will // format the message, close the queue and print the message to the screen. // // PARAMETERS : NA // RETURNS : None // private void listen() { while (!this.finished)//Listen forever or until the finished variable is set to true { try { if ((clientQueue != null) && (myClient.connected = true)) { message = new ClientInfo(); //timespan set for graceful shutdown message = (ClientInfo)clientQueue.Receive(new TimeSpan(0, 0, 1)).Body; string messRecv = message.message; clientQueue.Close(); if (message != null) { this.Dispatcher.Invoke(() => { //append received message to screen and scroll to most recent message TextScreen.AppendText(messRecv + "\n"); TextScreen.ScrollToEnd(); }); } } } catch (MessageQueueException mqex) { //catching timeout exceptions and continuing loop (needed for graceful shutdown) if (mqex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout) { continue; } System.Windows.MessageBox.Show("MQ Exception: " + mqex.Message); } catch (Exception ex) { System.Windows.MessageBox.Show("Exception: " + ex.Message); } } }
/// <summary> /// Starts this instance. /// </summary> public static void Start() { // Setup hardware abstraction interface IHardwareAbstraction hardwareAbstraction = new Mosa.EmulatedKernel.HardwareAbstraction(); // Set device driver system to the emulator port and memory methods Mosa.DeviceSystem.HAL.SetHardwareAbstraction(hardwareAbstraction); // Start the emulated devices Mosa.EmulatedDevices.Setup.Initialize(); // Initialize the driver system Mosa.DeviceSystem.Setup.Initialize(); // Registry device drivers Mosa.DeviceSystem.Setup.DeviceDriverRegistry.RegisterBuiltInDeviceDrivers(); Mosa.DeviceSystem.Setup.DeviceDriverRegistry.RegisterDeviceDrivers(typeof(Mosa.DeviceDrivers.ISA.CMOS).Module.Assembly); // Set the interrupt handler Mosa.DeviceSystem.HAL.SetInterruptHandler(Mosa.DeviceSystem.Setup.ResourceManager.InterruptManager.ProcessInterrupt); // Start the driver system Mosa.DeviceSystem.Setup.Start(); // Create pci controller manager PCIControllerManager pciControllerManager = new PCIControllerManager(Mosa.DeviceSystem.Setup.DeviceManager); // Create pci controller devices pciControllerManager.CreatePartitionDevices(); // Create synthetic graphic pixel device Mosa.EmulatedDevices.Synthetic.PixelGraphicDevice pixelGraphicDevice = new Mosa.EmulatedDevices.Synthetic.PixelGraphicDevice(Mosa.EmulatedDevices.Setup.PrimaryDisplayForm); // Added the synthetic graphic device to the device drivers Mosa.DeviceSystem.Setup.DeviceManager.Add(pixelGraphicDevice); // Create synthetic ram disk device Mosa.EmulatedDevices.Synthetic.RamDiskDevice ramDiskDevice = new Mosa.EmulatedDevices.Synthetic.RamDiskDevice(1024 * 1024 * 10 / 512); // Add emulated ram disk device to the device drivers Mosa.DeviceSystem.Setup.DeviceManager.Add(ramDiskDevice); // Create disk controller manager DiskControllerManager diskControllerManager = new DiskControllerManager(Mosa.DeviceSystem.Setup.DeviceManager); // Create disk devices from disk controller devices diskControllerManager.CreateDiskDevices(); // Get the text VGA device LinkedList <IDevice> devices = Mosa.DeviceSystem.Setup.DeviceManager.GetDevices(new FindDevice.WithName("VGAText")); // Create a screen interface to the text VGA device ITextScreen screen = new TextScreen((ITextDevice)devices.First.value); // Create synthetic keyboard device Mosa.EmulatedDevices.Synthetic.Keyboard keyboard = new Mosa.EmulatedDevices.Synthetic.Keyboard(Mosa.EmulatedDevices.Setup.PrimaryDisplayForm); // Add the synthetic keyboard device to the device drivers Mosa.DeviceSystem.Setup.DeviceManager.Add(keyboard); // Create master boot block record MasterBootBlock mbr = new MasterBootBlock(ramDiskDevice); mbr.DiskSignature = 0x12345678; mbr.Partitions[0].Bootable = true; mbr.Partitions[0].StartLBA = 17; mbr.Partitions[0].TotalBlocks = ramDiskDevice.TotalBlocks - 17; mbr.Partitions[0].PartitionType = PartitionType.FAT12; mbr.Write(); // Create partition device PartitionDevice partitionDevice = new PartitionDevice(ramDiskDevice, mbr.Partitions[0], false); // Set FAT settings FatSettings fatSettings = new FatSettings(); fatSettings.FATType = FatType.FAT12; fatSettings.FloppyMedia = false; fatSettings.VolumeLabel = "MOSADISK"; fatSettings.SerialID = new byte[4] { 0x01, 0x02, 0x03, 0x04 }; // Create FAT file system FatFileSystem fat12 = new FatFileSystem(partitionDevice); fat12.Format(fatSettings); // Create partition manager PartitionManager partitionManager = new PartitionManager(Mosa.DeviceSystem.Setup.DeviceManager); // Create partition devices partitionManager.CreatePartitionDevices(); // Get a list of all devices devices = Mosa.DeviceSystem.Setup.DeviceManager.GetAllDevices(); // Print them screen.WriteLine("Devices: "); foreach (IDevice device in devices) { screen.Write(device.Name); screen.Write(" ["); switch (device.Status) { case DeviceStatus.Online: screen.Write("Online"); break; case DeviceStatus.Available: screen.Write("Available"); break; case DeviceStatus.Initializing: screen.Write("Initializing"); break; case DeviceStatus.NotFound: screen.Write("Not Found"); break; case DeviceStatus.Error: screen.Write("Error"); break; } screen.Write("]"); if (device.Parent != null) { screen.Write(" - Parent: "); screen.Write(device.Parent.Name); } screen.WriteLine(); if (device is IPartitionDevice) { FileSystem.FAT.FatFileSystem fat = new Mosa.FileSystem.FAT.FatFileSystem(device as IPartitionDevice); screen.Write(" File System: "); if (fat.IsValid) { switch (fat.FATType) { case FatType.FAT12: screen.WriteLine("FAT12"); break; case FatType.FAT16: screen.WriteLine("FAT16"); break; case FatType.FAT32: screen.WriteLine("FAT32"); break; default: screen.WriteLine("Unknown"); break; } screen.WriteLine(" Volume Name: " + fat.VolumeLabel); } else { screen.WriteLine("Unknown"); } } if (device is PCIDevice) { PCIDevice pciDevice = (device as PCIDevice); screen.Write(" Vendor:0x"); screen.Write(pciDevice.VendorID.ToString("X")); screen.Write(" ["); screen.Write(DeviceTable.Lookup(pciDevice.VendorID)); screen.WriteLine("]"); screen.Write(" Device:0x"); screen.Write(pciDevice.DeviceID.ToString("X")); screen.Write(" Rev:0x"); screen.Write(pciDevice.RevisionID.ToString("X")); screen.Write(" ["); screen.Write(DeviceTable.Lookup(pciDevice.VendorID, pciDevice.DeviceID)); screen.WriteLine("]"); screen.Write(" Class:0x"); screen.Write(pciDevice.ClassCode.ToString("X")); screen.Write(" ["); screen.Write(ClassCodeTable.Lookup(pciDevice.ClassCode)); screen.WriteLine("]"); screen.Write(" SubClass:0x"); screen.Write(pciDevice.SubClassCode.ToString("X")); screen.Write(" ["); screen.Write(SubClassCodeTable.Lookup(pciDevice.ClassCode, pciDevice.SubClassCode, pciDevice.ProgIF)); screen.WriteLine("]"); // screen.Write(" "); // screen.WriteLine(DeviceTable.Lookup(pciDevice.VendorID, pciDevice.DeviceID, pciDevice.SubDeviceID, pciDevice.SubVendorID)); foreach (BaseAddress address in pciDevice.BaseAddresses) { if (address == null) { continue; } if (address.Address == 0) { continue; } screen.Write(" "); if (address.Region == AddressType.IO) { screen.Write("I/O Port at 0x"); } else { screen.Write("Memory at 0x"); } screen.Write(address.Address.ToString("X")); screen.Write(" [size="); if ((address.Size & 0xFFFFF) == 0) { screen.Write((address.Size >> 20).ToString()); screen.Write("M"); } else if ((address.Size & 0x3FF) == 0) { screen.Write((address.Size >> 10).ToString()); screen.Write("K"); } else { screen.Write(address.Size.ToString()); } screen.Write("]"); if (address.Prefetchable) { screen.Write("(prefetchable)"); } screen.WriteLine(); } if (pciDevice.IRQ != 0) { screen.Write(" "); screen.Write("IRQ at "); screen.Write(pciDevice.IRQ.ToString()); screen.WriteLine(); } } } //while (keyboard.GetKeyPressed() == null) ; Mosa.HelloWorld.Boot.Main(); //EmulatorDemo.StartDemo(); return; }