14using namespace MaxOS::common;
15using namespace MaxOS::gui;
16using namespace MaxOS::memory;
17using namespace MaxOS::drivers;
18using namespace MaxOS::drivers::console;
19using namespace MaxOS::system;
26 : m_font((
uint8_t*) AMIGA_FONT) {
36 m_console_area =
new ConsoleArea(
this, 0, 0,
width() / 2 - 25,
height(), ConsoleColour::DarkGrey, ConsoleColour::Black);
46VESABootConsole::~VESABootConsole() =
default;
80 ansi_code[ansi_code_length++] = c;
86 if(ansi_code_length < 8) {
89 ansi_code[ansi_code_length++] = c;
93 ansi_code[ansi_code_length] =
'\0';
94 ansi_code_length = -1;
96 if(
strcmp(
"\033[0m", ansi_code) != 0) {
97 m_foreground_color = ConsoleColour::Uninitialised;
98 m_background_color = ConsoleColour::Uninitialised;
103 const Colour colour(ansi_code);
123 int offset = (y *
width() + x);
126 m_video_memory_meta[offset] = (m_video_memory_meta[offset] & 0xFF00) | (
uint16_t) c;
153 int offset = (y *
width() + x);
156 m_video_memory_meta[offset] = (m_video_memory_meta[offset] & 0xF0FF) | ((
uint16_t)
foreground << 8);
173 int offset = (y *
width() + x);
176 m_video_memory_meta[offset] = (m_video_memory_meta[offset] & 0x0FFF) | ((
uint16_t)
background << 12);
193 int offset = (y *
width() + x);
196 return (
char) (m_video_memory_meta[offset] & 0x00FF);
209 return ConsoleColour::White;
213 return ConsoleColour::White;
216 int offset = (y *
width() + x);
219 return (
ConsoleColour) ((m_video_memory_meta[offset] & 0x0F00) >> 8);
232 return ConsoleColour::Red;
236 return ConsoleColour::Black;
239 int offset = (y *
width() + x);
242 return (
ConsoleColour) ((m_video_memory_meta[offset] & 0xF000) >> 12);
253 const char*
logo =
is_panic ? header_data_kp : header_data;
302 auto* framebuffer_address = (
uint8_t*) s_graphics_context->framebuffer_address();
304 uint64_t framebuffer_bpp = s_graphics_context->color_depth();
369 if(s_graphics_context ==
nullptr)
Defines the Amiga system font used in the GUI.
static Logger * active_logger()
Gets the active logger (to be used to modify the logger)
static Logger INFO()
Gets active logger set to info level.
static Logger HEADER()
Gets active logger set to task level.
Stores the red, green, blue and alpha values of a colour. Can be parsed from a hex string,...
ConsoleColour to_console_colour() const
Converts the colour to a console colour.
Draws pixels to the screen, and handles drawing lines, rectangles and circles.
Stores the left, top, width and height of a rectangle.
Type height
The height of the rectangle.
Type width
The width of the rectangle.
A console that is a subsection of another console, limited by a width and height.
A stream that can be used to write to a console.
void set_cursor(uint16_t x, uint16_t y)
Set the m_position of the cursor.
virtual void scroll_up()
Scroll the entire console up by 1 line.
common::ConsoleColour get_foreground_color(uint16_t x, uint16_t y) final
Gets the foreground color at the specified location.
void set_foreground_color(uint16_t x, uint16_t y, common::ConsoleColour) final
Sets the foreground color at the specified location.
void finish() const
Cleans up the boot console.
char get_character(uint16_t x, uint16_t y) final
Gets the character at the specified location.
void put_character(uint16_t x, uint16_t y, char) final
Places a character at the specified location.
uint16_t width() final
Gets the width of the console.
VESABootConsole(common::GraphicsContext *)
Constructs a new VESA Boot Console object, initializing the console area for text output.
void set_background_color(uint16_t x, uint16_t y, common::ConsoleColour) final
Sets the background color at the specified location.
static void print_logo(bool is_panic=false)
Prints the logo to the center of the screen.
ConsoleStream * cout
The boot console output stream.
static void update_progress_bar(uint8_t percentage)
Updates the progress bar.
uint16_t height() final
Gets the height of the console.
common::ConsoleColour get_background_color(uint16_t x, uint16_t y) final
Gets the background color at the specified location.
virtual void draw_text(int32_t x, int32_t y, common::Colour foreground_colour, common::Colour background_colour, common::GraphicsContext *context, string text)
write the entire text to the screen
static void * kmalloc(size_t size)
Allocates a block of memory in the KERNEL space.
static common::Spinlock panic_lock
Lock to prevent multiple panics at once.
ConsoleColour
Enumeration of console colour codes.
const char *const ANSI_COLOURS[]
ANSI Colour Codes.
constexpr uint8_t FONT_HEIGHT
How many pixels tall the font is.
constexpr uint8_t FONT_WIDTH
How many pixels wide the font is.
Defines a Logger class for logging messages with different severity levels to multiple output streams...
#define LOGO_HEADER_PIXEL(data, pixel)
Call this macro repeatedly. After each use, the pixel data can be extracted.
constexpr int LOGO_WIDTH
Width of the logo in pixels.
constexpr int LOGO_HEIGHT
Height of the logo in pixels.
void * memmove(void *destination, const void *source, uint64_t num)
Copies a block of memory from one location to another.
void * memset(void *ptr, uint32_t value, uint64_t num)
Fills a block of memory with a specified value.
bool strcmp(char const *str1, char const *str2)
Checks if one string pointer is equal to another string pointer.
Defines the VESABootConsole driver for handling console output during boot using an VESA framebuffer.