AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
vga.c File Reference

x86: the early console in VGA text mode, written straight into the text buffer at 0xB8000 (through the kernel's mapping of low memory, VMA(), which i386 and x86_64 both have). More...

#include <core/system.h>
#include <core/string.h>
#include <console/earlycon.h>
#include <cpu/io.h>
#include <mm/mm.h>

Go to the source code of this file.

Macros

#define VGA_COLS   80
#define VGA_ROWS   25
#define VGA_SIZE   (2 * VGA_COLS * VGA_ROWS)

Functions

static void earlycon_vga_scroll (int n)
 Scrolls the screen up by n lines, clearing the lines at the bottom.
static int earlycon_vga_putc (char c)
 Writes a character at the cursor, scrolling when it goes past the last line.
static int earlycon_vga_puts (char *s)
 Writes a string, and returns how many characters it wrote.
static void earlycon_vga_init ()
 Hides the hardware cursor, and clears the screen.

Variables

static char * vga_start = (char *) VMA(0xB8000)
static char * vga = (char *) VMA(0xB8000)
struct ioaddr vga_ioaddr
struct earlycon earlycon_vga

Detailed Description

x86: the early console in VGA text mode, written straight into the text buffer at 0xB8000 (through the kernel's mapping of low memory, VMA(), which i386 and x86_64 both have).

Definition in file vga.c.

Macro Definition Documentation

◆ VGA_COLS

#define VGA_COLS   80

Definition at line 21 of file vga.c.

Referenced by earlycon_vga_scroll(), vga_cursor(), and vga_draw().

◆ VGA_ROWS

#define VGA_ROWS   25

Definition at line 22 of file vga.c.

Referenced by earlycon_vga_scroll(), and vga_cursor().

◆ VGA_SIZE

#define VGA_SIZE   (2 * VGA_COLS * VGA_ROWS)

Definition at line 23 of file vga.c.

Referenced by earlycon_vga_putc().

Function Documentation

◆ earlycon_vga_init()

void earlycon_vga_init ( )
static

Hides the hardware cursor, and clears the screen.

Definition at line 73 of file vga.c.

References earlycon_vga_init(), io_out8(), vga_ioaddr, and vga_start.

Referenced by earlycon_vga_init().

◆ earlycon_vga_putc()

int earlycon_vga_putc ( char c)
static

Writes a character at the cursor, scrolling when it goes past the last line.

Returns 1, or 0 for a NUL.

Definition at line 41 of file vga.c.

References earlycon_vga_putc(), earlycon_vga_scroll(), vga, VGA_SIZE, and vga_start.

Referenced by earlycon_vga_putc(), and earlycon_vga_puts().

◆ earlycon_vga_puts()

int earlycon_vga_puts ( char * s)
static

Writes a string, and returns how many characters it wrote.

Definition at line 62 of file vga.c.

References earlycon_vga_putc(), and earlycon_vga_puts().

Referenced by earlycon_vga_puts().

◆ earlycon_vga_scroll()

void earlycon_vga_scroll ( int n)
static

Scrolls the screen up by n lines, clearing the lines at the bottom.

Definition at line 27 of file vga.c.

References earlycon_vga_scroll(), memmove(), vga, VGA_COLS, VGA_ROWS, and vga_start.

Referenced by earlycon_vga_putc(), and earlycon_vga_scroll().

Variable Documentation

◆ earlycon_vga

struct earlycon earlycon_vga
Initial value:
= {
}
static int earlycon_vga_puts(char *s)
Writes a string, and returns how many characters it wrote.
Definition vga.c:62
static int earlycon_vga_putc(char c)
Writes a character at the cursor, scrolling when it goes past the last line.
Definition vga.c:41
static void earlycon_vga_init()
Hides the hardware cursor, and clears the screen.
Definition vga.c:73

Definition at line 85 of file vga.c.

Referenced by earlycon_reinit().

◆ vga

char* vga = (char *) VMA(0xB8000)
static

Definition at line 14 of file vga.c.

Referenced by earlycon_vga_putc(), earlycon_vga_scroll(), vga_draw(), and vt_vga_attr().

◆ vga_ioaddr

struct ioaddr vga_ioaddr
Initial value:
= {
.addr = 0x3D4,
.type = IOADDR_PORT,
}
#define IOADDR_PORT
Definition io.h:89

Definition at line 16 of file vga.c.

Referenced by earlycon_vga_init().

◆ vga_start

char* vga_start = (char *) VMA(0xB8000)
static

Definition at line 13 of file vga.c.

Referenced by earlycon_vga_init(), earlycon_vga_putc(), and earlycon_vga_scroll().