Initial commit.
This commit is contained in:
51
include/os/tty.hpp
Normal file
51
include/os/tty.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(OS_TTY_HPP_INCLUDED)
|
||||
#define OS_TTY_HPP_INCLUDED 1
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace tty
|
||||
{
|
||||
enum class VgaColor : uint8_t
|
||||
{
|
||||
BLACK = 0,
|
||||
BLUE = 1,
|
||||
GREEN = 2,
|
||||
CYAN = 3,
|
||||
RED = 4,
|
||||
MAGENTA = 5,
|
||||
BROWN = 6,
|
||||
LIGHT_GREY = 7,
|
||||
DARK_GREY = 8,
|
||||
LIGHT_BLUE = 9,
|
||||
LIGHT_GREEN = 10,
|
||||
LIGHT_CYAN = 11,
|
||||
LIGHT_RED = 12,
|
||||
LIGHT_MAGENTA = 13,
|
||||
LIGHT_BROWN = 14,
|
||||
WHITE = 15
|
||||
};
|
||||
|
||||
struct VgaDoubleColor
|
||||
{
|
||||
VgaColor foreground : 4 = VgaColor::LIGHT_GREY;
|
||||
VgaColor background : 4 = VgaColor::BLACK;
|
||||
};
|
||||
|
||||
[[nodiscard]] size_t strlen(const char* str); // TODO: move to standard lib
|
||||
void initialize();
|
||||
void setColor(VgaDoubleColor color);
|
||||
void putEntryAt(char chr, VgaDoubleColor color, size_t posX, size_t posY);
|
||||
void putChar(char chr);
|
||||
void write(const char* data, size_t size);
|
||||
|
||||
inline void write(const char* data)
|
||||
{
|
||||
write(data, strlen(data));
|
||||
}
|
||||
} // namespace tty
|
||||
|
||||
#endif // OS_TTY_HPP_INCLUDED
|
||||
Reference in New Issue
Block a user