You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
885 B
C++
52 lines
885 B
C++
#ifndef VGATERMINAL_HPP
|
|
#define VGATERMINAL_HPP
|
|
|
|
#include "textoutput.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
class VGATerminal : public TextOutput
|
|
{
|
|
public:
|
|
enum class Color : std::uint8_t
|
|
{
|
|
Black = 0,
|
|
Blue,
|
|
Green,
|
|
Cyan,
|
|
Red,
|
|
Magenta,
|
|
Brown,
|
|
LightGray,
|
|
DarkGray,
|
|
LightBlue,
|
|
LightGreen,
|
|
LightCyan,
|
|
LightRed,
|
|
LightMagenta,
|
|
LightBrown,
|
|
White
|
|
};
|
|
|
|
using enum Color;
|
|
|
|
virtual void write(char c) noexcept final;
|
|
|
|
private:
|
|
static constexpr std::uintptr_t Videoram = 0xB8000;
|
|
static constexpr unsigned Width = 80;
|
|
static constexpr unsigned Height = 25;
|
|
|
|
unsigned offset = 0;
|
|
Color foreground = LightGray;
|
|
Color background = Black;
|
|
|
|
void put(char c) noexcept;
|
|
void checkpos() noexcept;
|
|
void updatecursor() const noexcept;
|
|
};
|
|
|
|
#endif // VGATERMINAL_HPP
|
|
|