Untitled_Kernel/include/vga.h

44 lines
829 B
C
Raw Normal View History

/* vga.h
* VGA
*
* Responsible for VGA buffer control.
*/
#ifndef VGA_H
#define VGA_H
#define VGA_GRID_COLS 80
#define VGA_GRID_ROWS 25
#define DEFAULT_ATTRIBUTES 0x0F00
#include <stdint.h>
#include <stdarg.h>
#include "io.h"
/*
* CONSTANTS AND VARIABLES
*/
//Information on the VGA buffer
extern volatile uint16_t* const vga_buffer;
typedef struct vga_ctx_s {
int cursor_col;
int cursor_row;
uint16_t attributes;
} vga_ctx_t;
//grid is top left origin. This is our cursor!
extern uint16_t vga_attributes; // Black background, White foreground
extern char_writer_t* default_vga;
/*
* Functions
*/
//Clear the VGA buffer, context optional
void vga_clear_ctx(vga_ctx_t* ctx);
void vga_clear();
//Write character c to cursor
//Implements IO generic ASCII output
int vga_out(void* ctx, char c);
#endif