IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
vmem.hpp
Go to the documentation of this file.
1
11
12
13#pragma once
14
15
16// C++
17#include <bit>
18#include <string_view>
19// IgrOS-Kernel arch
20#include <arch/types.hpp>
21
22
23// Arch-dependent code zone
24namespace igros::arch {
25
26
28 constexpr static auto VIDEO_MEM_WIDTH {80_usize};
30 constexpr static auto VIDEO_MEM_HEIGHT {25_usize};
33
35 constexpr static auto VIDEO_MEM_TAB_SIZE {8_usize};
36
38 constexpr static auto VIDEO_MEM_CURSOR_START {0x0A_u8};
39
40
42 enum class vmemColor : igros_byte_t {
43 Black = 0x00_u8,
44 Blue = 0x01_u8,
45 Green = 0x02_u8,
46 Cyan = 0x03_u8,
47 Red = 0x04_u8,
48 Magenta = 0x05_u8,
49 Brown = 0x06_u8,
50 LightGray = 0x07_u8,
51 DarkGray = 0x08_u8,
52 LightBlue = 0x09_u8,
53 LightGreen = 0x0A_u8,
54 LightCyan = 0x0B_u8,
55 LightRed = 0x0C_u8,
56 LightMagenta = 0x0D_u8,
57 Yellow = 0x0E_u8,
58 White = 0x0F_u8,
59 };
60
66
72
73
77 void vmemCursorSet(const igros_byte_t x, const igros_byte_t y) noexcept;
80 void vmemCursorSet(const vmemCursor cursor) noexcept;
81
84 [[nodiscard]]
85 auto vmemCursorGet() noexcept -> vmemCursor;
86
88 void vmemCursorDisable() noexcept;
90 void vmemCursorEnable() noexcept;
91
95 void vmemSetColor(const igros_byte_t background, const igros_byte_t foreground) noexcept;
96
99 void vmemWrite(const char symbol) noexcept;
102 void vmemWrite(const char* const message) noexcept;
105 void vmemWrite(const std::string_view message) noexcept;
106
108 void vmemClear() noexcept;
109
112 [[nodiscard]]
113 auto vmemInit() noexcept -> bool;
114
115
116} // namespace igros::arch
117
std::uint8_t igros_byte_t
8-bit unsigned integer
Definition types.hpp:41
std::int8_t igros_sbyte_t
8-bit signed integer
Definition types.hpp:35
Architecture-independent interface: drivers and aliases of current architecture types.
auto vmemCursorGet() noexcept -> vmemCursor
Get VGA memory cursor position.
Definition vmem.cpp:92
void vmemWrite(const char symbol) noexcept
Write symbol to VGA memory.
Definition vmem.cpp:134
void vmemCursorDisable() noexcept
Disable VGA memory cursor.
Definition vmem.cpp:110
auto vmemInit() noexcept -> bool
Init VGA console.
Definition vmem.cpp:215
static constexpr auto VIDEO_MEM_WIDTH
VGA console max width.
Definition vmem.hpp:28
vmemColor
VGA memory colors enumeration.
Definition vmem.hpp:42
@ Cyan
Cyan VGA color.
Definition vmem.hpp:46
@ White
White VGA color.
Definition vmem.hpp:58
@ LightBlue
Light blue VGA color.
Definition vmem.hpp:52
@ Yellow
Yellow VGA color.
Definition vmem.hpp:57
@ LightGreen
Light green VGA color.
Definition vmem.hpp:53
@ DarkGray
Dark gray VGA color.
Definition vmem.hpp:51
@ Blue
Blue VGA color.
Definition vmem.hpp:44
@ Magenta
Magenta VGA color.
Definition vmem.hpp:48
@ LightCyan
Light cyan VGA color.
Definition vmem.hpp:54
@ Green
Green VGA color.
Definition vmem.hpp:45
@ Black
Black VGA color.
Definition vmem.hpp:43
@ Brown
Brown VGA color.
Definition vmem.hpp:49
@ Red
Red VGA color.
Definition vmem.hpp:47
@ LightMagenta
Light magenta VGA color.
Definition vmem.hpp:56
@ LightRed
Light red VGA color.
Definition vmem.hpp:55
@ LightGray
Light gray VGA color.
Definition vmem.hpp:50
void vmemCursorEnable() noexcept
Enable VGA memory cursor.
Definition vmem.cpp:118
void vmemCursorSet(const igros_byte_t x, const igros_byte_t y) noexcept
Set VGA memory cursor position.
Definition vmem.cpp:69
static constexpr auto VIDEO_MEM_CURSOR_START
VGA cursor start register.
Definition vmem.hpp:38
void vmemClear() noexcept
Clear VGA console.
Definition vmem.cpp:207
static constexpr auto VIDEO_MEM_HEIGHT
VGA console max height.
Definition vmem.hpp:30
static constexpr auto VIDEO_MEM_TAB_SIZE
TAB size.
Definition vmem.hpp:35
void vmemSetColor(const igros_byte_t background, const igros_byte_t foreground) noexcept
Set VGA memory color.
Definition vmem.cpp:128
static constexpr auto VIDEO_MEM_SIZE
VGA console size.
Definition vmem.hpp:32
VGA memory cursor struct.
Definition vmem.hpp:68
igros_byte_t x
Cursor X coordinate.
Definition vmem.hpp:69
igros_byte_t y
Cursor Y coordinate.
Definition vmem.hpp:70
VGA memory symbol representation.
Definition vmem.hpp:62
igros_sbyte_t symbol
Symbol.
Definition vmem.hpp:63
igros_byte_t color
Color of symbol and background.
Definition vmem.hpp:64
Common C++ types redefinition.