aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/vga
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-10-29 17:01:22 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-10-29 17:01:22 +0100
commit7b9df8bec5038e0316540d2397df632fb14c9169 (patch)
tree3b5959510cbfd336479b97413427a35972e6e305 /arch/x86_64/src/vga
parentb157e2c472d8bd67ac1656404a6a6ee821260f4b (diff)
downloadteachos-7b9df8bec5038e0316540d2397df632fb14c9169.tar.xz
teachos-7b9df8bec5038e0316540d2397df632fb14c9169.zip
chore: configure clang-tidy
Diffstat (limited to 'arch/x86_64/src/vga')
-rw-r--r--arch/x86_64/src/vga/text.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86_64/src/vga/text.cpp b/arch/x86_64/src/vga/text.cpp
index 8aa809f..0e0d353 100644
--- a/arch/x86_64/src/vga/text.cpp
+++ b/arch/x86_64/src/vga/text.cpp
@@ -15,10 +15,12 @@ namespace teachos::vga::x86_64::text
namespace
{
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
auto constinit buffer_offset = std::ptrdiff_t{};
constexpr auto DEFAULT_TEXT_BUFFER_WIDTH = 80U;
constexpr auto DEFAULT_TEXT_BUFFER_HEIGHT = 25U;
+ constexpr auto CURSOR_ENABLED_BIT = 5U;
auto write_char(char code_point, attribute attribute) -> void
{
@@ -29,12 +31,13 @@ namespace teachos::vga::x86_64::text
auto device::clear(attribute attribute) -> void
{
buffer_offset = 0;
- std::ranges::fill_n(vga_buffer_pointer.get(), 2000, std::pair{' ', std::bit_cast<std::byte>(attribute)});
+ std::ranges::fill_n(vga_buffer_pointer.get(), DEFAULT_TEXT_BUFFER_WIDTH * DEFAULT_TEXT_BUFFER_HEIGHT,
+ std::pair{' ', std::bit_cast<std::byte>(attribute)});
}
auto device::cursor(bool enabled) -> void
{
- auto cursor_disable_byte = std::byte{!enabled} << 5;
+ auto cursor_disable_byte = std::byte{!enabled} << CURSOR_ENABLED_BIT;
crtc::address::write(crtc::registers::cursor_start);
crtc::data::write(crtc::data::read() | cursor_disable_byte);