The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
vga.h File Reference
#include "common/stdint.h"

Go to the source code of this file.

Enumerations

enum  vga_color {
  VGA_BLACK = 0 , VGA_BLUE , VGA_GREEN , VGA_CYAN ,
  VGA_RED , VGA_MAGENTA , VGA_BROWN , VGA_LIGHT_GREY ,
  VGA_DARK_GREY , VGA_LIGHT_BLUE , VGA_LIGHT_GREEN , VGA_LIGHT_CYAN ,
  VGA_LIGHT_RED , VGA_LIGHT_MAGENTA , VGA_YELLOW , VGA_WHITE
}
 enumeration of VGA colors. More...

Functions

void vga_initialize (void)
 initializes the VGA driver.
void vga_clear (void)
 clears the VGA text buffer and resets the cursor position to the top left corner.
void vga_set_color (uint8_t foreground, uint8_t background)
 sets the foreground and background colors for text output.
void vga_put_at (char c, uint8_t row, uint8_t col)
 write a character at an explicit screen location.
void vga_scroll (void)
 scroll the text buffer up by one row and move the cursor to the last row.
void vga_set_cursor (uint8_t row, uint8_t col)
 set the cursor position to the specified row and column.
void vga_get_cursor (uint8_t *row, uint8_t *col)
 get the current cursor position.
void vga_putchar (char c)
 writes a single character to the VGA text buffer at the current cursor position.
void vga_write (const char *str)
 writes a null-terminated string to the VGA text buffer starting at the current cursor position.

Enumeration Type Documentation

◆ vga_color

enum vga_color

enumeration of VGA colors.

Enumerator
VGA_BLACK 
VGA_BLUE 
VGA_GREEN 
VGA_CYAN 
VGA_RED 
VGA_MAGENTA 
VGA_BROWN 
VGA_LIGHT_GREY 
VGA_DARK_GREY 
VGA_LIGHT_BLUE 
VGA_LIGHT_GREEN 
VGA_LIGHT_CYAN 
VGA_LIGHT_RED 
VGA_LIGHT_MAGENTA 
VGA_YELLOW 
VGA_WHITE 

Function Documentation

◆ vga_initialize()

void vga_initialize ( void )

initializes the VGA driver.

must be called before any other VGA functions.

◆ vga_clear()

void vga_clear ( void )

clears the VGA text buffer and resets the cursor position to the top left corner.

◆ vga_set_color()

void vga_set_color ( uint8_t foreground,
uint8_t background )

sets the foreground and background colors for text output.

Parameters
foregroundthe foreground color.
backgroundthe background color.

◆ vga_put_at()

void vga_put_at ( char c,
uint8_t row,
uint8_t col )

write a character at an explicit screen location.

invalid row/column values are ignored.

◆ vga_scroll()

void vga_scroll ( void )

scroll the text buffer up by one row and move the cursor to the last row.

◆ vga_set_cursor()

void vga_set_cursor ( uint8_t row,
uint8_t col )

set the cursor position to the specified row and column.

Parameters
rowthe row to set the cursor to.
colthe column to set the cursor to.

◆ vga_get_cursor()

void vga_get_cursor ( uint8_t * row,
uint8_t * col )

get the current cursor position.

Parameters
rowpointer to a variable to receive the current cursor row.
colpointer to a variable to receive the current cursor column.

◆ vga_putchar()

void vga_putchar ( char c)

writes a single character to the VGA text buffer at the current cursor position.

Parameters
cthe character to write.

◆ vga_write()

void vga_write ( const char * str)

writes a null-terminated string to the VGA text buffer starting at the current cursor position.

Parameters
strthe string to write.