The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
vga.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
common/stdint.h
"
4
5
/**
6
* enumeration of VGA colors.
7
*/
8
enum
vga_color
9
{
10
VGA_BLACK
= 0,
11
VGA_BLUE
,
12
VGA_GREEN
,
13
VGA_CYAN
,
14
VGA_RED
,
15
VGA_MAGENTA
,
16
VGA_BROWN
,
17
VGA_LIGHT_GREY
,
18
VGA_DARK_GREY
,
19
VGA_LIGHT_BLUE
,
20
VGA_LIGHT_GREEN
,
21
VGA_LIGHT_CYAN
,
22
VGA_LIGHT_RED
,
23
VGA_LIGHT_MAGENTA
,
24
VGA_YELLOW
,
25
VGA_WHITE
26
};
27
28
/**
29
* initializes the VGA driver. must be called before any other VGA functions.
30
*/
31
void
vga_initialize
(
void
);
32
33
/**
34
* clears the VGA text buffer and resets the cursor position to the top left corner.
35
*/
36
void
vga_clear
(
void
);
37
38
/**
39
* sets the foreground and background colors for text output.
40
* @param foreground the foreground color.
41
* @param background the background color.
42
*/
43
void
vga_set_color
(
44
uint8_t
foreground,
45
uint8_t
background);
46
47
/**
48
* write a character at an explicit screen location.
49
* invalid row/column values are ignored.
50
*/
51
void
vga_put_at
(
char
c,
uint8_t
row,
uint8_t
col);
52
53
/**
54
* scroll the text buffer up by one row and move the cursor to the last row.
55
*/
56
void
vga_scroll
(
void
);
57
58
/**
59
* set the cursor position to the specified row and column.
60
* @param row the row to set the cursor to.
61
* @param col the column to set the cursor to.
62
*/
63
void
vga_set_cursor
(
uint8_t
row,
uint8_t
col);
64
65
/**
66
* get the current cursor position.
67
* @param row pointer to a variable to receive the current cursor row.
68
* @param col pointer to a variable to receive the current cursor column.
69
*/
70
void
vga_get_cursor
(
uint8_t
*row,
uint8_t
*col);
71
72
/**
73
* writes a single character to the VGA text buffer at the current cursor position.
74
* @param c the character to write.
75
*/
76
void
vga_putchar
(
char
c);
77
78
/**
79
* writes a null-terminated string to the VGA text buffer starting at the current cursor position.
80
* @param str the string to write.
81
*/
82
void
vga_write
(
const
char
*str);
stdint.h
uint8_t
unsigned char uint8_t
Definition
fb.h:18
vga_get_cursor
void vga_get_cursor(uint8_t *row, uint8_t *col)
get the current cursor position.
Definition
vga.c:174
vga_scroll
void vga_scroll(void)
scroll the text buffer up by one row and move the cursor to the last row.
Definition
vga.c:85
vga_set_color
void vga_set_color(uint8_t fg, uint8_t bg)
sets the foreground and background colors for text output.
Definition
vga.c:107
vga_write
void vga_write(const char *str)
writes a null-terminated string to the VGA text buffer starting at the current cursor position.
Definition
vga.c:148
vga_set_cursor
void vga_set_cursor(uint8_t row, uint8_t col)
set the cursor position to the specified row and column.
Definition
vga.c:166
vga_initialize
void vga_initialize(void)
initializes the VGA driver.
Definition
vga.c:156
vga_put_at
void vga_put_at(char c, uint8_t row, uint8_t col)
write a character at an explicit screen location.
Definition
vga.c:75
vga_clear
void vga_clear(void)
clears the VGA text buffer and resets the cursor position to the top left corner.
Definition
vga.c:112
vga_putchar
void vga_putchar(char c)
writes a single character to the VGA text buffer at the current cursor position.
Definition
vga.c:128
vga_color
vga_color
enumeration of VGA colors.
Definition
vga.h:9
VGA_LIGHT_MAGENTA
@ VGA_LIGHT_MAGENTA
Definition
vga.h:23
VGA_WHITE
@ VGA_WHITE
Definition
vga.h:25
VGA_MAGENTA
@ VGA_MAGENTA
Definition
vga.h:15
VGA_YELLOW
@ VGA_YELLOW
Definition
vga.h:24
VGA_DARK_GREY
@ VGA_DARK_GREY
Definition
vga.h:18
VGA_BLACK
@ VGA_BLACK
Definition
vga.h:10
VGA_LIGHT_GREY
@ VGA_LIGHT_GREY
Definition
vga.h:17
VGA_BROWN
@ VGA_BROWN
Definition
vga.h:16
VGA_LIGHT_RED
@ VGA_LIGHT_RED
Definition
vga.h:22
VGA_GREEN
@ VGA_GREEN
Definition
vga.h:12
VGA_RED
@ VGA_RED
Definition
vga.h:14
VGA_LIGHT_GREEN
@ VGA_LIGHT_GREEN
Definition
vga.h:20
VGA_BLUE
@ VGA_BLUE
Definition
vga.h:11
VGA_LIGHT_BLUE
@ VGA_LIGHT_BLUE
Definition
vga.h:19
VGA_CYAN
@ VGA_CYAN
Definition
vga.h:13
VGA_LIGHT_CYAN
@ VGA_LIGHT_CYAN
Definition
vga.h:21
src
drivers
video
vga
vga.h
Generated by
1.18.0