-
Notifications
You must be signed in to change notification settings - Fork 0
/
vga.h
62 lines (55 loc) · 1.54 KB
/
vga.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdint.h>
#ifndef VGA_H
#define VGA_H
enum vga_color {
VGA_COLOR_BLACK = 0,
VGA_COLOR_BLUE = 1,
VGA_COLOR_GREEN = 2,
VGA_COLOR_CYAN = 3,
VGA_COLOR_RED = 4,
VGA_COLOR_MAGENTA = 5,
VGA_COLOR_BROWN = 6,
VGA_COLOR_LIGHT_GREY = 7,
VGA_COLOR_DARK_GREY = 8,
VGA_COLOR_LIGHT_BLUE = 9,
VGA_COLOR_LIGHT_GREEN = 10,
VGA_COLOR_LIGHT_CYAN = 11,
VGA_COLOR_LIGHT_RED = 12,
VGA_COLOR_LIGHT_MAGENTA = 13,
VGA_COLOR_LIGHT_BROWN = 14,
VGA_COLOR_WHITE = 15,
};
class VGA {
public:
void fill(enum vga_color color);
void clear();
void scroll(enum vga_color color);
void scroll();
void display_char(char c, enum vga_color fg, enum vga_color bg);
void display_char(char c);
void display_string(const char *str, enum vga_color fg, enum vga_color bg);
void display_string(const char *str);
private:
static VGA vga;
unsigned cursor_row;
unsigned cursor_col;
uint16_t *cursor_buffer;
VGA();
uint16_t *coord_to_addr(unsigned row, unsigned col);
uint16_t *coord_to_addr();
void increment_cursor(enum vga_color bg);
void increment_cursor();
friend void init_VGA();
friend void clear_screen();
friend void fill_screen(enum vga_color color);
friend void splash_screen();
friend int printk(const char *fmt, ...);
friend int atoi_display(unsigned long long abs_value);
friend int print_decimal(int value);
friend int atoi_base16_display(uint64_t value, char a);
};
void init_VGA();
void clear_screen();
void fill_screen(enum vga_color color);
void splash_screen();
#endif