Exemple #1
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);
 }
Exemple #2
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();
        }
Exemple #3
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;
            }
        }
Exemple #4
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;
            }

        }