Exemple #1
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Mosa.Kernel.x86.Kernel.Setup();
            DebugClient.Setup(Serial.COM1);
            IDT.SetInterruptHandler(ProcessInterrupt);

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Color = Colors.White;
            Console.BackgroundColor = Colors.Green;

            Console.Write(@"                   MOSA OS Version 1.2 - Compiler Version 1.2");
            FillLine();
            Console.Color = Colors.White;
            Console.BackgroundColor = Colors.Black;

            BiosInformationStructure biosInfo = new BiosInformationStructure();
            CpuStructure cpuInfo = new CpuStructure();

            Console.WriteLine("> Checking BIOS...");
            BulletPoint(); Console.Write("Vendor  "); InBrackets(biosInfo.BiosVendor, Colors.White, Colors.LightBlue); Console.WriteLine();
            BulletPoint(); Console.Write("Version "); InBrackets(biosInfo.BiosVersion, Colors.White, Colors.LightBlue); Console.WriteLine();

            Console.WriteLine("> Checking CPU...");
            BulletPoint(); Console.Write("Vendor  "); InBrackets(cpuInfo.Vendor, Colors.White, Colors.LightBlue); Console.WriteLine();
            BulletPoint(); Console.Write("Version "); InBrackets(cpuInfo.Version, Colors.White, Colors.LightBlue); Console.WriteLine();

            Console.WriteLine("> Initializing hardware abstraction layer...");
            Setup.Initialize();

            Console.WriteLine("> Adding hardware devices...");
            Setup.Start();

            Console.WriteLine("> System ready");
            Console.WriteLine();
            Console.Goto(24, 0);
            Console.Color = Colors.White;
            Console.BackgroundColor = Colors.Green;
            Console.Write("          Copyright (C) 2008-2001 [Managed Operating System Alliance]");
            FillLine();

            Console.BackgroundColor = Colors.Black;
            Console.Goto(15, 0);
            Console.Color = Colors.Green;
            Console.Write("> ");
            Console.Color = Colors.Yellow;

            Mosa.DeviceDrivers.ScanCodeMap.US KBDMAP = new DeviceDrivers.ScanCodeMap.US();
            int lastSecond = -1;

            while (true)
            {
                byte scancode = Setup.Keyboard.GetScanCode();

                if (scancode != 0)
                {
                    Debug.Trace("Main.Main Key Scan Code: " + scancode.ToString());

                    KeyEvent keyevent = KBDMAP.ConvertScanCode(scancode);

                    Debug.Trace("Main.Main Key Character: " + keyevent.Character.ToString());

                    if (keyevent.KeyPress == KeyEvent.Press.Make)
                    {
                        if (keyevent.Character != 0)
                            Console.Write(keyevent.Character);

                        if (keyevent.KeyType == KeyType.F1)
                            ConsoleManager.Controller.Active = ConsoleManager.Controller.Boot;
                        else if (keyevent.KeyType == KeyType.F2)
                            ConsoleManager.Controller.Active = ConsoleManager.Controller.Debug;
                    }
                    Debug.Trace("Main.Main Key Character: " + ((uint)keyevent.Character).ToString());
                }

                if (Setup.CMOS.Second != lastSecond)
                {
                    DebugClient.SendAlive();
                    lastSecond = Setup.CMOS.Second;
                    Debug.Trace("Main.Main Ping Alive");
                }

                DebugClient.Process();
                Native.Hlt();
            }
        }
Exemple #2
0
        public static void Process()
        {
            int lastSecond = -1;

            Console.BackgroundColor = Colors.Black;
            Console.Goto(15, 0);
            Console.Color = Colors.White;
            Console.Write("> ");

            Mosa.DeviceDrivers.ScanCodeMap.US KBDMAP = new DeviceDrivers.ScanCodeMap.US();

            while (true)
            {
                byte scancode = Setup.Keyboard.GetScanCode();

                if (scancode != 0)
                {
                    //	Debug.Trace("Main.Main Key Scan Code: " + scancode.ToString());

                    KeyEvent keyevent = KBDMAP.ConvertScanCode(scancode);

                    //	Debug.Trace("Main.Main Key Character: " + keyevent.Character.ToString());

                    if (keyevent.KeyPress == KeyEvent.Press.Make)
                    {
                        if (keyevent.Character != 0)
                        {
                            Console.Write(keyevent.Character);
                        }

                        if (keyevent.KeyType == KeyType.F1)
                            ConsoleManager.Controller.Active = ConsoleManager.Controller.Boot;
                        else if (keyevent.KeyType == KeyType.F2)
                            ConsoleManager.Controller.Active = ConsoleManager.Controller.Debug;
                    }
                    //	Debug.Trace("Main.Main Key Character: " + ((uint)keyevent.Character).ToString());
                }

                if (Setup.CMOS.Second != lastSecond)
                {
                    //DebugClient.SendAlive();
                    lastSecond = Setup.CMOS.Second;
                    //Debug.Trace("Main.Main Ping Alive");
                }

                //DebugClient.Process();
                Native.Hlt();
            }
        }