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

Virtual terminals in VGA text mode, when there is no framebuffer. More...

#include <core/system.h>
#include <cpu/io.h>
#include <mm/mm.h>
#include <dev/vt.h>

Go to the source code of this file.

Macros

#define VGA_ROWS   25
#define VGA_COLS   80

Functions

static void vga_draw (int row, int col, struct vt_cell cell)
 Draws one cell of the screen.
static void vga_cursor (int row, int col, int visible)
 Moves the cursor, or hides it.
int vt_vga_probe (void)
 Says whether VGA text mode can be used.

Variables

static uint16_t * vga = (uint16_t *) VMA(0xB8000)
static struct ioaddr crtc
struct vt_display vt_vga_display

Detailed Description

Virtual terminals in VGA text mode, when there is no framebuffer.

The screen is 80 columns by 25 rows of cells in memory at 0xB8000, each a character and its colours. The cursor is set through the CRT controller's ports (0x3D4 and 0x3D5). The virtual terminals (vt.c) draw through vt_vga_display.

Definition in file vga.c.

Macro Definition Documentation

◆ VGA_COLS

#define VGA_COLS   80

Definition at line 16 of file vga.c.

◆ VGA_ROWS

#define VGA_ROWS   25

Definition at line 15 of file vga.c.

Function Documentation

◆ vga_cursor()

void vga_cursor ( int row,
int col,
int visible )
static

Moves the cursor, or hides it.

Definition at line 32 of file vga.c.

References crtc, io_out8(), VGA_COLS, vga_cursor(), and VGA_ROWS.

Referenced by vga_cursor().

◆ vga_draw()

void vga_draw ( int row,
int col,
struct vt_cell cell )
static

Draws one cell of the screen.

Definition at line 26 of file vga.c.

References vt_cell::ch, vga, VGA_COLS, vga_draw(), and vt_vga_attr().

Referenced by vga_draw().

◆ vt_vga_probe()

int vt_vga_probe ( void )

Says whether VGA text mode can be used.

It always can, on a PC.

Returns
0

Definition at line 48 of file vga.c.

References vt_vga_probe().

Referenced by vt_probe(), and vt_vga_probe().

Variable Documentation

◆ crtc

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

Definition at line 20 of file vga.c.

Referenced by vga_cursor().

◆ vga

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

Definition at line 18 of file vga.c.

◆ vt_vga_display

struct vt_display vt_vga_display
Initial value:
= {
.name = "VGA text mode",
.rows = VGA_ROWS,
.cols = VGA_COLS,
.draw = vga_draw,
.cursor = vga_cursor,
}
#define VGA_ROWS
Definition vga.c:22
#define VGA_COLS
Definition vga.c:21
static void vga_draw(int row, int col, struct vt_cell cell)
Draws one cell of the screen.
Definition vga.c:26
static void vga_cursor(int row, int col, int visible)
Moves the cursor, or hides it.
Definition vga.c:32

Definition at line 53 of file vga.c.

Referenced by vt_probe().