mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
Start working on virtual consoles/TTYs.
This is a mess right now, but I'd rather commit as I go.
This commit is contained in:
parent
bd2b5327d0
commit
68739dc43e
22 changed files with 611 additions and 344 deletions
61
Kernel/VirtualConsole.h
Normal file
61
Kernel/VirtualConsole.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include "TTY.h"
|
||||
#include "Keyboard.h"
|
||||
#include "Console.h"
|
||||
|
||||
class VirtualConsole final : public TTY, public KeyboardClient, public ConsoleImplementation {
|
||||
public:
|
||||
enum InitialContents { Cleared, AdoptCurrentVGABuffer };
|
||||
|
||||
VirtualConsole(unsigned index, InitialContents = Cleared);
|
||||
virtual ~VirtualConsole() override;
|
||||
|
||||
void adoptCurrentVGABuffer();
|
||||
void setActive(bool);
|
||||
|
||||
static void switchTo(unsigned);
|
||||
static void initialize();
|
||||
|
||||
private:
|
||||
// ^KeyboardClient
|
||||
void onKeyPress(byte) override;
|
||||
|
||||
// ^ConsoleImplementation
|
||||
void onConsoleReceive(byte) override;
|
||||
|
||||
void onChar(byte);
|
||||
|
||||
byte* m_buffer;
|
||||
unsigned m_index;
|
||||
bool m_active { false };
|
||||
|
||||
void escape$H(const Vector<unsigned>&);
|
||||
void escape$J(const Vector<unsigned>&);
|
||||
void escape$m(const Vector<unsigned>&);
|
||||
void escape$s(const Vector<unsigned>&);
|
||||
void escape$u(const Vector<unsigned>&);
|
||||
|
||||
const byte m_rows { 25 };
|
||||
const byte m_columns { 80 };
|
||||
byte m_cursorRow { 0 };
|
||||
byte m_cursorColumn { 0 };
|
||||
byte m_savedCursorRow { 0 };
|
||||
byte m_savedCursorColumn { 0 };
|
||||
byte m_currentAttribute { 0x07 };
|
||||
|
||||
void executeEscapeSequence(byte final);
|
||||
|
||||
enum EscapeState {
|
||||
Normal,
|
||||
ExpectBracket,
|
||||
ExpectParameter,
|
||||
ExpectIntermediate,
|
||||
ExpectFinal,
|
||||
};
|
||||
EscapeState m_escState { Normal };
|
||||
Vector<byte> m_parameters;
|
||||
Vector<byte> m_intermediates;
|
||||
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue