diff options
Diffstat (limited to 'source/arch/x86_64/include')
| -rw-r--r-- | source/arch/x86_64/include/arch/boot/pointers.hpp | 1 | ||||
| -rw-r--r-- | source/arch/x86_64/include/arch/video/vga/text.hpp | 53 |
2 files changed, 50 insertions, 4 deletions
diff --git a/source/arch/x86_64/include/arch/boot/pointers.hpp b/source/arch/x86_64/include/arch/boot/pointers.hpp index 052b115..dcd14fe 100644 --- a/source/arch/x86_64/include/arch/boot/pointers.hpp +++ b/source/arch/x86_64/include/arch/boot/pointers.hpp @@ -6,7 +6,6 @@ namespace teachos::arch::boot { extern "C" std::byte const multiboot_information_pointer; - extern "C" std::byte * vga_buffer_pointer; } // namespace teachos::arch::boot #endif
\ No newline at end of file diff --git a/source/arch/x86_64/include/arch/video/vga/text.hpp b/source/arch/x86_64/include/arch/video/vga/text.hpp index 04b74d1..c9a79b8 100644 --- a/source/arch/x86_64/include/arch/video/vga/text.hpp +++ b/source/arch/x86_64/include/arch/video/vga/text.hpp @@ -1,12 +1,59 @@ #ifndef TEACHOS_ARCH_X86_64_VIDEO_VGA_TEXT_HPP #define TEACHOS_ARCH_X86_64_VIDEO_VGA_TEXT_HPP -#include <cstddef> +#include <cstdint> #include <string_view> namespace teachos::arch::video::vga::text { - auto write(std::string_view text, std::byte color) -> void; -} + enum struct color : std::uint8_t + { + black, + blue, + green, + cyan, + red, + purple, + brown, + gray, + }; + + enum struct foreground_flag : bool + { + none, + intense, + }; + + enum struct background_flag : bool + { + none, + blink_or_bright, + }; + + struct attribute + { + color foreground_color : 3; + enum foreground_flag foreground_flag : 1; + color bacground_color : 3; + enum background_flag background_flag : 1; + }; + + static_assert(sizeof(attribute) == 1); + + namespace common_attributes + { + [[maybe_unused]] + auto constexpr gray_on_black = attribute{color::gray, foreground_flag::none, color::black, background_flag::none}; + + [[maybe_unused]] + auto constexpr green_on_black = attribute{color::green, foreground_flag::none, color::black, background_flag::none}; + + [[maybe_unused]] + auto constexpr white_on_red = attribute{color::gray, foreground_flag::intense, color::red, background_flag::none}; + } + + auto clear(attribute attribute = common_attributes::gray_on_black) -> void; + auto write(std::string_view code_points, attribute attribute) -> void; +} // namespace teachos::arch::video::vga::text #endif
\ No newline at end of file |
