aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/vga/text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/vga/text.cpp')
-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);