diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2023-10-07 17:15:31 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2023-10-07 17:15:31 +0200 |
| commit | ff81b5438f280a59ca1825bfdf120d8f256bd154 (patch) | |
| tree | 0a63ea3eb9fc28ca655c3ca3d1c70000d514aecd /source/kernel/arch/x86_64/src/vga.cpp | |
| parent | 7e785ff5a7a2e9c98fd1679e74a728f4babf722a (diff) | |
| download | teachos-ff81b5438f280a59ca1825bfdf120d8f256bd154.tar.xz teachos-ff81b5438f280a59ca1825bfdf120d8f256bd154.zip | |
x86_64: implement very simple VGA text output
Diffstat (limited to 'source/kernel/arch/x86_64/src/vga.cpp')
| -rw-r--r-- | source/kernel/arch/x86_64/src/vga.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/kernel/arch/x86_64/src/vga.cpp b/source/kernel/arch/x86_64/src/vga.cpp new file mode 100644 index 0000000..d25eaa5 --- /dev/null +++ b/source/kernel/arch/x86_64/src/vga.cpp @@ -0,0 +1,30 @@ +#include "kernel/vga.hpp" + +#include "boot/asm_pointer.hpp" +#include "boot/pointers.hpp" + +#include <string_view> +#include <algorithm> + +namespace teachos::kernel::vga +{ + + namespace + { + auto constinit text_buffer_pointer = boot::asm_pointer{boot::vga_buffer_pointer}; + + auto write(char character, std::byte color) -> void + { + auto & p = *text_buffer_pointer; + (*p++) = static_cast<std::byte>(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::kernel
\ No newline at end of file |
