示例#1
0
 public static void Init()
 {
     allThreads = new List <ThreadData>();
     allThreads.Add(new ThreadData());
     Timer.Init();
     INTs.SetIrqHandler(0, SwitchTast);
 }
 public static void Init()
 {
     allThreads = new List <ThreadData>();
     CreateNewThread(0);
     Timer.Init();
     INTs.SetIrqHandler(0, SwitchTast);
 }
示例#3
0
 private void HandleIRQ(ref INTs.IRQContext aContext)
 {
     byte xScanCode = IO.Port60.Byte;
     bool xReleased = (xScanCode & 0x80) == 0x80;
     if (xReleased)
     {
         xScanCode = (byte)(xScanCode ^ 0x80);
     }
     HandleScancode(xScanCode, xReleased);
 }
示例#4
0
        // Bootstrap is a class designed only to get the essentials done.
        // ie the stuff needed to "pre boot". Do only the very minimal here.
        // IDT, PIC, and Float
        // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area.
        public static void Init()
        {
            // Drag this stuff in to the compiler manually until we add the always include attrib
            INTs.Dummy();

            PIC = new PIC();
            CPU.UpdateIDT(true);
            CPU.InitFloat();

            // Managed_Memory_System.ManagedMemory.Initialize();
            // Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
        }
示例#5
0
        // Bootstrap is a class designed only to get the essentials done.
        // ie the stuff needed to "pre boot". Do only the very minimal here.
        // IDT, PIC, and Float
        // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area.
        public static void Init()
        {
            // Drag this stuff in to the compiler manually until we add the always include attrib
            INTs.Dummy();

            PIC = new PIC();
            CPU.UpdateIDT(true);
            CPU.InitFloat();

            // Not sure if this is necessary, heap is already used before we get here
            // and it seems to be fully (or at least partially) self initializing
            Heap.Initialize();

            // Managed_Memory_System.ManagedMemory.Initialize();
            // Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
        }
示例#6
0
        // Bootstrap is a class designed only to get the essentials done.
        // ie the stuff needed to "pre boot". Do only the very minimal here.
        // IDT, PIC, and Float
        // Note: This is changing a bit GDT (already) and IDT are moving to a real preboot area.
        /// <summary>
        /// Init the boot strap. Invoke pre-boot methods.
        /// </summary>
        public static void Init()
        {
            // Drag this stuff in to the compiler manually until we add the always include attrib
            Multiboot2.Init();
            INTs.Dummy();

            PIC = new PIC();
            CPU.UpdateIDT(true);

            /* TODO check using CPUID that SSE2 is supported */
            CPU.InitSSE();

            /*
             * We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code
             * but sadly in x86 this resulte impossible as Intel not implemented some needed instruction (for example conversion
             * for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve
             * definively this problem.
             */
            CPU.InitFloat();
        }
示例#7
0
        protected void HandleNetworkInterrupt(ref INTs.IRQContext aContext)
        {
            UInt32 cur_status = StatusRegister;

            //Console.WriteLine("AMD PCNet IRQ raised!");
            if ((cur_status & 0x100) != 0)
            {
                mInitDone = true;
            }
            if ((cur_status & 0x200) != 0)
            {
                if (mTransmitBuffer.Count > 0)
                {
                    byte[] data = mTransmitBuffer.Peek();
                    if (SendBytes(ref data) == true)
                    {
                        mTransmitBuffer.Dequeue();
                    }
                }
            }
            if ((cur_status & 0x400) != 0)
            {
                ReadRawData();
            }

            StatusRegister = cur_status;
            Cosmos.Core.Global.PIC.EoiSlave();
        }
示例#8
0
        /// <summary>
        /// This is the default mouse handling code.
        /// </summary>
        /// <param name="context"></param>
        public void HandleMouse(ref INTs.IRQContext context)
        {
            switch (mouse_cycle)
            {
                case 0:
                    mouse_byte[0] = p60.Byte;

                    if ((mouse_byte[0] & 0x8) == 0x8)
                        mouse_cycle++;

                    break;
                case 1:
                    mouse_byte[1] = p60.Byte;
                    mouse_cycle++;
                    break;
                case 2:
                    mouse_byte[2] = p60.Byte;
                    mouse_cycle = 0;

                    if ((mouse_byte[0] & 0x10) == 0x10)
                        X -= mouse_byte[1] ^ 0xff;
                    else
                        X += mouse_byte[1];

                    if ((mouse_byte[0] & 0x20) == 0x20)
                        Y += mouse_byte[2] ^ 0xff;
                    else
                        Y -= mouse_byte[2];

                    if (X < 0)
                        X = 0;
                    else if (X > 319)
                        X = 319;

                    if (Y < 0)
                        Y = 0;
                    else if (Y > 199)
                        Y = 199;

                    Buttons = (MouseState)(mouse_byte[0] & 0x7);

                    break;
            }
        }
示例#9
0
        public void HandleMouse(ref INTs.IRQContext context)
        {
            switch (mouse_cycle)
            {
                case 0:
                    mouse_byte[0] = Read();

                    //Bit 3 of byte 0 is 1, then we have a good package
                    if ((mouse_byte[0] & 0x8) == 0x8)
                        mouse_cycle++;

                    break;
                case 1:
                    mouse_byte[1] = Read();
                    mouse_cycle++;
                    break;
                case 2:
                    mouse_byte[2] = Read();
                    mouse_cycle = 0;

                    if ((mouse_byte[0] & 0x10) == 0x10)
                        X -= (mouse_byte[1] ^ 0xff);
                    else
                        X += mouse_byte[1];

                    if ((mouse_byte[0] & 0x20) == 0x20)
                        Y += (mouse_byte[2] ^ 0xff);
                    else
                        Y -= mouse_byte[2];

                    if (X < 0)
                        X = 0;
                    else if (X > ScreenWidth - 1)
                        X = (int)ScreenWidth - 1;

                    if (Y < 0)
                        Y = 0;
                    else if (Y > ScreenHeight - 1)
                        Y = (int)ScreenHeight - 1;

                    Buttons = (MouseState)(mouse_byte[0] & 0x7);

                    break;
            }

        }