/// <summary> /// Displays the seconds. /// </summary> private static void DisplayTime(CMOS cmos) { Screen.Goto(24, 52); Screen.Color = Colors.Green; Screen.Write(@"Time: "); byte bcd = 10; if (cmos.BCD) { bcd = 16; } Screen.Color = Colors.White; Screen.Write(cmos.Hour, bcd, 2); Screen.Color = Colors.Gray; Screen.Write(':'); Screen.Color = Colors.White; Screen.Write(cmos.Minute, bcd, 2); Screen.Color = Colors.Gray; Screen.Write(':'); Screen.Color = Colors.White; Screen.Write(cmos.Second, bcd, 2); Screen.Write(' '); Screen.Color = Colors.Gray; Screen.Write('('); Screen.Color = Colors.White; Screen.Write(cmos.Month, bcd, 2); Screen.Color = Colors.Gray; Screen.Write('/'); Screen.Color = Colors.White; Screen.Write(cmos.Day, bcd, 2); Screen.Color = Colors.Gray; Screen.Write('/'); Screen.Color = Colors.White; Screen.Write('2'); Screen.Write('0'); Screen.Write(cmos.Year, bcd, 2); Screen.Color = Colors.Gray; Screen.Write(')'); }
/// <summary> /// Mains this instance. /// </summary> public static void Main() { Screen.Clear(); Screen.Color = 0x0E; Screen.SetCursor(24, 0); Screen.Write('1'); Multiboot.SetMultibootLocation(Memory.Get32(0x200004), Memory.Get32(0x200000)); // Screen.SetCursor(24, 1); Screen.Write('2'); PageFrameAllocator.Setup(); Screen.SetCursor(24, 2); Screen.Write('3'); Screen.SetCursor(24, 3); Screen.Write('4'); Screen.GotoTop(); Screen.Color = 0x0E; Screen.Write('M'); Screen.Write('O'); Screen.Write('S'); Screen.Write('A'); Screen.Write(' '); Screen.Write('O'); Screen.Write('S'); Screen.Write(' '); Screen.Write('V'); Screen.Write('e'); Screen.Write('r'); Screen.Write('s'); Screen.Write('i'); Screen.Write('o'); Screen.Write('n'); Screen.Write(' '); Screen.Write('0'); Screen.Write('.'); Screen.Write('6'); Screen.Write(' '); Screen.Write('\''); Screen.Color = 0x0C; Screen.Write('T'); Screen.Write('a'); Screen.Write('n'); Screen.Write('i'); Screen.Write('g'); Screen.Write('a'); Screen.Write('w'); Screen.Write('a'); Screen.Color = 0x0E; Screen.Write('\''); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x0E; Screen.Write('C'); Screen.Write('o'); Screen.Write('p'); Screen.Write('y'); Screen.Write('r'); Screen.Write('i'); Screen.Write('g'); Screen.Write('h'); Screen.Write('t'); Screen.Write(' '); Screen.Write('2'); Screen.Write('0'); Screen.Write('0'); Screen.Write('8'); Screen.Write('-'); Screen.Write('2'); Screen.Write('0'); Screen.Write('0'); Screen.Write('9'); Screen.NextLine(); Screen.Color = 0x0F; for (uint index = 0; index < 80; index++) { if (index == 60) { Screen.Write((char)203); } else { Screen.Write((char)205); } } Screen.NextLine(); Screen.SetCursor(2, 0); Screen.Color = 0x0A; Screen.Write('M'); Screen.Write('u'); Screen.Write('l'); Screen.Write('t'); Screen.Write('i'); Screen.Write('b'); Screen.Write('o'); Screen.Write('o'); Screen.Write('t'); Screen.Write('a'); Screen.Write('d'); Screen.Write('d'); Screen.Write('r'); Screen.Write('e'); Screen.Write('s'); Screen.Write('s'); Screen.Write(':'); Screen.Write(' '); Screen.Color = 0x07; Screen.Write(Memory.Get32(0x200004), 16, 8); Screen.NextLine(); Screen.Color = 0x0A; Screen.Write('M'); Screen.Write('a'); Screen.Write('g'); Screen.Write('i'); Screen.Write('c'); Screen.Write(' '); Screen.Write('n'); Screen.Write('u'); Screen.Write('m'); Screen.Write('b'); Screen.Write('e'); Screen.Write('r'); Screen.Write(':'); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x07; Screen.Write(Memory.Get32(0x200000), 16, 8); Screen.NextLine(); Screen.Color = 0x0A; Screen.Write('M'); Screen.Write('u'); Screen.Write('l'); Screen.Write('t'); Screen.Write('i'); Screen.Write('b'); Screen.Write('o'); Screen.Write('o'); Screen.Write('t'); Screen.Write('-'); Screen.Write('F'); Screen.Write('l'); Screen.Write('a'); Screen.Write('g'); Screen.Write('s'); Screen.Write(':'); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x07; Screen.Write(Multiboot.Flags, 2, 32); Screen.NextLine(); Screen.NextLine(); Screen.Color = 0x0A; Screen.Write('S'); Screen.Write('i'); Screen.Write('z'); Screen.Write('e'); Screen.Write(' '); Screen.Write('o'); Screen.Write('f'); Screen.Write(' '); Screen.Write('M'); Screen.Write('e'); Screen.Write('m'); Screen.Write('o'); Screen.Write('r'); Screen.Write('y'); Screen.Write(':'); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x07; Screen.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1); Screen.Write(' '); Screen.Write('M'); Screen.Write('B'); Screen.Write(' '); Screen.Write('('); Screen.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1); Screen.Write(' '); Screen.Write('K'); Screen.Write('B'); Screen.Write(')'); Screen.NextLine(); Screen.Color = 0x0F; for (uint index = 0; index < 60; index++) { Screen.Write((char)205); } Screen.NextLine(); Screen.Color = 0x0A; Screen.Write('M'); Screen.Write('e'); Screen.Write('m'); Screen.Write('o'); Screen.Write('r'); Screen.Write('y'); Screen.Write('-'); Screen.Write('M'); Screen.Write('a'); Screen.Write('p'); Screen.Write(':'); Screen.NextLine(); for (uint index = 0; index < (Multiboot.MemoryMapCount & 7); index++) { Screen.Color = 0x0F; Screen.Write(Multiboot.GetMemoryMapBaseLow(index), 16, 10); Screen.Write(' '); Screen.Write('-'); Screen.Write(' '); Screen.Write(Multiboot.GetMemoryMapBaseLow(index) + Multiboot.GetMemoryMapLengthLow(index), 16, 10); Screen.Write(' '); Screen.Write('('); Screen.Color = 0x07; Screen.Write(Multiboot.GetMemoryMapLengthLow(index), 16, 10); Screen.Color = 0x0F; Screen.Write(')'); Screen.Write(' '); Screen.Color = 0x07; Screen.Write('T'); Screen.Write('y'); Screen.Write('p'); Screen.Write('e'); Screen.Write(':'); Screen.Write(' '); Screen.Write(Multiboot.GetMemoryMapType(index), 16, 1); Screen.NextLine(); } Screen.Color = 0x0F; for (uint index = 0; index < 60; index++) { Screen.Write((char)205); } Screen.NextLine(); Screen.NextLine(); #region Vendor Screen.Color = 0x0A; Screen.Write('V'); Screen.Write('e'); Screen.Write('n'); Screen.Write('d'); Screen.Write('o'); Screen.Write('r'); Screen.Write(':'); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x0F; int identifier = Platforms.x86.Native.CpuIdEbx(0); for (int i = 0; i < 4; ++i) { Screen.Write((char)((identifier >> (i * 8)) & 0xFF)); } identifier = Platforms.x86.Native.CpuIdEdx(0); for (int i = 0; i < 4; ++i) { Screen.Write((char)((identifier >> (i * 8)) & 0xFF)); } identifier = Platforms.x86.Native.CpuIdEcx(0); for (int i = 0; i < 4; ++i) { Screen.Write((char)((identifier >> (i * 8)) & 0xFF)); } Screen.NextLine(); #endregion #region Brand Screen.Color = 0x0A; Screen.Write('B'); Screen.Write('r'); Screen.Write('a'); Screen.Write('n'); Screen.Write('d'); Screen.Write(':'); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Write(' '); Screen.Color = 0x0F; PrintBrand((uint)2147483650); PrintBrand((uint)2147483651); PrintBrand((uint)2147483652); Screen.NextLine(); #endregion int info = Platforms.x86.Native.CpuIdEax(1); #region Stepping Screen.Color = 0x0A; Screen.Write('S'); Screen.Write('t'); Screen.Write('e'); Screen.Write('p'); Screen.Write('p'); Screen.Write('i'); Screen.Write('n'); Screen.Write('g'); Screen.Write(':'); Screen.Write(' '); Screen.Color = 0x0F; Screen.Write((ulong)(info & 0xF), 16, 2); #endregion #region Model Screen.Color = 0x0A; Screen.Write(' '); Screen.Write('M'); Screen.Write('o'); Screen.Write('d'); Screen.Write('e'); Screen.Write('l'); Screen.Write(':'); Screen.Write(' '); Screen.Color = 0x0F; Screen.Write((ulong)((info & 0xF0) >> 4), 16, 2); #endregion #region Family Screen.Color = 0x0A; Screen.Write(' '); Screen.Write('F'); Screen.Write('a'); Screen.Write('m'); Screen.Write('i'); Screen.Write('l'); Screen.Write('y'); Screen.Write(':'); Screen.Write(' '); Screen.Color = 0x0F; Screen.Write((ulong)((info & 0xF00) >> 8), 16, 2); #endregion #region Type Screen.Color = 0x0A; Screen.Write(' '); Screen.Write('T'); Screen.Write('y'); Screen.Write('p'); Screen.Write('e'); Screen.Write(':'); Screen.Write(' '); Screen.Color = 0x0F; Screen.Write((ulong)((info & 0x3000) >> 12), 16, 2); Screen.NextLine(); #endregion //Multiboot.Dump(4,53); Screen.Row = 23; for (uint index = 0; index < 80; index++) { Screen.Column = index; Screen.Write((char)205); } for (uint index = 2; index < 24; index++) { Screen.Column = 60; Screen.Row = index; Screen.Color = 0x0F; if (index == 7) { Screen.Write((char)185); } else if (index == 15) { Screen.Write((char)185); } else if (index == 23) { Screen.Write((char)202); } else { Screen.Write((char)186); } } Screen.SetCursor(24, 29); Screen.Color = 0x0E; Screen.Write('w'); Screen.Write('w'); Screen.Write('w'); Screen.Write('.'); Screen.Write('m'); Screen.Write('o'); Screen.Write('s'); Screen.Write('a'); Screen.Write('-'); Screen.Write('p'); Screen.Write('r'); Screen.Write('o'); Screen.Write('j'); Screen.Write('e'); Screen.Write('c'); Screen.Write('t'); Screen.Write('.'); Screen.Write('o'); Screen.Write('r'); Screen.Write('g'); while (true) { CMOS.Dump(2, 65); DisplayTime(); } }
/// <summary> /// Mains this instance. /// </summary> public static void Main() { Mosa.Kernel.x86.Kernel.Setup(); Screen.GotoTop(); Screen.Color = Colors.Yellow; Screen.Write(@"MOSA OS Version 0.9 '"); Screen.Color = Colors.Red; Screen.Write(@"Prophecy"); Screen.Color = Colors.Yellow; Screen.Write(@"' Copyright 2008-2011"); Screen.NextLine(); Screen.Color = 0x0F; Screen.Write(new String((char)205, 60)); Screen.Write((char)203); Screen.Write(new String((char)205, 19)); Screen.NextLine(); Screen.Goto(2, 0); Screen.Color = Colors.Green; Screen.Write(@"Multibootaddress: "); Screen.Color = Colors.Gray; Screen.Write(Native.Get32(0x200004), 16, 8); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Magic number: "); Screen.Color = Colors.Gray; Screen.Color = 0x07; Screen.Write(Native.Get32(0x200000), 16, 8); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Multiboot-Flags: "); Screen.Color = Colors.Gray; Screen.Write(Multiboot.Flags, 2, 32); Screen.NextLine(); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Size of Memory: "); Screen.Color = Colors.Gray; Screen.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1); Screen.Write(@" MB ("); Screen.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1); Screen.Write(@" KB)"); Screen.NextLine(); Screen.Color = Colors.White; for (uint index = 0; index < 60; index++) { Screen.Write((char)205); } Screen.NextLine(); /*Screen.Color = Colors.Green; * Screen.Write(@"Memory-Map:"); * Screen.NextLine(); * * for (uint index = 0; index < Multiboot.MemoryMapCount; index++) * { * Screen.Color = Colors.White; * Screen.Write(Multiboot.GetMemoryMapBase(index), 16, 10); * Screen.Write(@" - "); * Screen.Write(Multiboot.GetMemoryMapBase(index) + Multiboot.GetMemoryMapLength(index) - 1, 16, 10); * Screen.Write(@" ("); * Screen.Color = Colors.Gray; * Screen.Write(Multiboot.GetMemoryMapLength(index), 16, 10); * Screen.Color = Colors.White; * Screen.Write(@") "); * Screen.Color = Colors.Gray; * Screen.Write(@"Type: "); * Screen.Write(Multiboot.GetMemoryMapType(index), 16, 1); * Screen.NextLine(); * }*/ Screen.Color = Colors.Green; Screen.Write(@"Smbios Info: "); if (SmbiosManager.IsAvailable) { Screen.Color = Colors.White; Screen.Write(@"["); Screen.Color = Colors.Gray; Screen.Write(@"Version "); Screen.Write(SmbiosManager.MajorVersion, 10, -1); Screen.Write(@"."); Screen.Write(SmbiosManager.MinorVersion, 10, -1); Screen.Color = Colors.White; Screen.Write(@"]"); Screen.NextLine(); Screen.Color = Colors.Yellow; Screen.Write(@"[Bios]"); Screen.Color = Colors.White; Screen.NextLine(); BiosInformationStructure biosInformation = new BiosInformationStructure(); Screen.Color = Colors.White; Screen.Write(@"Vendor: "); Screen.Color = Colors.Gray; Screen.Write(biosInformation.BiosVendor); Screen.NextLine(); Screen.Color = Colors.Yellow; Screen.Row = 9; Screen.Column = 25; Screen.Write(@"[Cpu]"); Screen.Color = Colors.White; Screen.NextLine(); Screen.Column = 25; CpuStructure cpuStructure = new CpuStructure(); Screen.Color = Colors.White; Screen.Write(@"Vendor: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.Vendor); Screen.NextLine(); Screen.Column = 25; Screen.Color = Colors.White; Screen.Write(@"Clock Freq.: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.ClockFrequency, 10, -1); Screen.Write(@" MHz"); Screen.NextLine(); Screen.Column = 25; Screen.Color = Colors.White; Screen.Write(@"Max. Speed: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.MaxSpeed, 10, -1); Screen.Write(@" MHz"); Screen.NextLine(); Screen.Column = 25; } else { Screen.Color = Colors.Red; Screen.Write(@"No SMBIOS available on this system!"); } Screen.Goto(17, 0); Screen.Color = 0x0F; for (uint index = 0; index < 60; index++) { Screen.Write((char)205); } Screen.NextLine(); CpuInfo cpuInfo = new CpuInfo(); #region Vendor Screen.Color = Colors.Green; Screen.Write(@"Vendor: "); Screen.Color = Colors.White; cpuInfo.PrintVendorString(); Screen.NextLine(); #endregion #region Brand Screen.Color = Colors.Green; Screen.Write(@"Brand: "); Screen.Color = Colors.White; cpuInfo.PrintBrandString(); Screen.NextLine(); #endregion #region Stepping Screen.Color = Colors.Green; Screen.Write(@"Stepping: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Stepping, 16, 2); #endregion #region Model Screen.Color = Colors.Green; Screen.Write(@" Model: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Model, 16, 2); #endregion #region Family Screen.Color = Colors.Green; Screen.Write(@" Family: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Family, 16, 2); #endregion #region Type Screen.Color = Colors.Green; Screen.Write(@" Type: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Type, 16, 2); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Cores: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.NumberOfCores, 16, 2); #endregion //Multiboot.Dump(4,53); Screen.Row = 22; for (uint index = 0; index < 80; index++) { Screen.Column = index; Screen.Write((char)205); } for (uint index = 2; index < 23; index++) { Screen.Column = 60; Screen.Row = index; Screen.Color = Colors.White; if (index == 7) { Screen.Write((char)185); } else if (index == 17) { Screen.Write((char)185); } else if (index == 22) { Screen.Write((char)202); } else { Screen.Write((char)186); } } Screen.Goto(24, 29); Screen.Color = Colors.Yellow; Screen.Write(@"www.mosa-project.org"); CMOS cmos = new CMOS(); KernelTest.RunTests(); while (true) { cmos.Dump(2, 65); DisplayTime(cmos); } }