From 74eaee0fcc7390d4290b41a2a92ee34346e2f7c2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 11 Oct 2023 14:43:50 +0200 Subject: teachos: restructure file layout --- source/arch/x86_64/src/video/vga/text.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 source/arch/x86_64/src/video/vga/text.cpp (limited to 'source/arch/x86_64/src/video') diff --git a/source/arch/x86_64/src/video/vga/text.cpp b/source/arch/x86_64/src/video/vga/text.cpp new file mode 100644 index 0000000..11e3b1a --- /dev/null +++ b/source/arch/x86_64/src/video/vga/text.cpp @@ -0,0 +1,29 @@ +#include "arch/video/vga/text.hpp" + +#include "arch/boot/pointers.hpp" +#include "memory/asm_pointer.hpp" + +#include +#include + +namespace teachos::arch::video::vga::text +{ + + namespace + { + auto constinit text_buffer = teachos::boot::asm_pointer{boot::vga_buffer_pointer}; + + auto write(char character, std::byte color) -> void + { + auto & p = *text_buffer; + (*p++) = static_cast(character); + (*p++) = color; + }; + } // namespace + + auto write(std::string_view text, std::byte color) -> void + { + std::ranges::for_each(text, [&](auto character) { write(character, color); }); + } + +} // namespace teachos::arch::video::vga::text \ No newline at end of file -- cgit v1.2.3