Ejemplo n.º 1
0
        private static void Normal(byte b)
        {
            if ((b >= 33 && b <= 126))
            {
                VGAText.Write(b);
                return;
            }

            switch (b)
            {
            case 0x08: VGAText.Backspace(); return;                         // ascii

            case 0x0A: VGAText.Newline(); return;                           // ascii

            case 0x0C: VGAText.Formfeed(); return;                          // ascii

            case 0x0D: VGAText.CarriageReturn(); return;                    // ascii

            case 0x1b: State = ControlState.Escape; return;                 // vt100

            case 0x9E: State = ControlState.Color; return;

            case 0x9F: State = ControlState.Background; return;

            default: return;
            }
        }
Ejemplo n.º 2
0
        public static void Write(byte b)
        {
            switch (State)
            {
            case ControlState.Normal: { Normal(b); return; }

            case ControlState.Escape: { Escape(b); return; }

            case ControlState.Color: { VGAText.SetColor(b); State = ControlState.Normal; return; }

            case ControlState.Background: { VGAText.SetBackground(b); State = ControlState.Normal;; return; }
            }
        }
Ejemplo n.º 3
0
        private static void Evaluate()
        {
            if (FirstCharacter == (byte)'E')
            {
                // Move to next line (ESC E)
                VGAText.Newline();
            }
            else if (FirstCharacter == (byte)'[')
            {
                if (FinalCharacter == (byte)'m')
                {
                    // Display Attributes
                    for (int i = 0; i < ParameterCount; i++)
                    {
                        var parameter = GetParameter(i + 1);

                        switch (parameter)
                        {
                        case 30: VGAText.SetColor(VGAColor.Black); break;

                        case 31: VGAText.SetColor(VGAColor.Red); break;

                        case 32: VGAText.SetColor(VGAColor.Green); break;

                        case 33: VGAText.SetColor(VGAColor.Yellow); break;

                        case 34: VGAText.SetColor(VGAColor.Blue); break;

                        case 35: VGAText.SetColor(VGAColor.Magenta); break;

                        case 36: VGAText.SetColor(VGAColor.Cyan); break;

                        case 37: VGAText.SetColor(VGAColor.White); break;

                        case 40: VGAText.SetBackground(VGAColor.Black); break;

                        case 41: VGAText.SetBackground(VGAColor.Red); break;

                        case 42: VGAText.SetBackground(VGAColor.Green); break;

                        case 43: VGAText.SetBackground(VGAColor.Yellow); break;

                        case 44: VGAText.SetBackground(VGAColor.Blue); break;

                        case 45: VGAText.SetBackground(VGAColor.Magenta); break;

                        case 46: VGAText.SetBackground(VGAColor.Cyan); break;

                        case 47: VGAText.SetBackground(VGAColor.White); break;

                        // FUTURE:
                        //0   Reset all attributes
                        //1   Bright
                        //2   Dim
                        //4   Underscore
                        //5   Blink
                        //7   Reverse
                        //8   Hidden

                        default: break;
                        }
                    }
                }
                else if (FinalCharacter == (byte)'J')
                {
                    var parameter = GetParameter(1);

                    switch (parameter)
                    {
                    case 0: break;                             // TODO: Clear screen cursor dowon

                    case 1: break;                             // TODO: Clear screen cursor up

                    case 2: VGAText.Clear(); break;

                    default: break;
                    }
                }
                ClearControlSequences();
            }
        }