feat: initial
This commit is contained in:
commit
92d8a91be4
20 changed files with 1058 additions and 0 deletions
38
kernel/include/init/print.h
Normal file
38
kernel/include/init/print.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
enum class Color : uint8_t {
|
||||
Black = 0,
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Cyan = 3,
|
||||
Red = 4,
|
||||
Magenta = 5,
|
||||
Brown = 6,
|
||||
LightGray = 7,
|
||||
DarkGray = 8,
|
||||
LightBlue = 9,
|
||||
LightGreen = 10,
|
||||
LightCyan = 11,
|
||||
LightRed = 12,
|
||||
LightMagenta = 13,
|
||||
Yellow = 14,
|
||||
White = 15,
|
||||
};
|
||||
|
||||
struct TextAttr {
|
||||
Color fg;
|
||||
Color bg;
|
||||
|
||||
constexpr TextAttr(Color fg = Color::White, Color bg = Color::Black) : fg(fg), bg(bg) {}
|
||||
|
||||
// Returns the attribute in the high byte, ready to OR with a character value.
|
||||
constexpr uint16_t word() const {
|
||||
return (uint16_t)(((uint8_t)bg << 4) | (uint8_t)fg) << 8;
|
||||
}
|
||||
};
|
||||
|
||||
void clear();
|
||||
void print(const char* str, TextAttr attr = {});
|
||||
void print_dec(uint64_t value, TextAttr attr = {});
|
||||
void print_hex(uint64_t value, TextAttr attr = {});
|
||||
Loading…
Add table
Add a link
Reference in a new issue