instead of stuffing all of the i/o stuff into the "kio" library, i've decided to rework i/o to be a generic handler that takes in a function pointer for putc, and does the rest of the logic onto that pointer. That way, you can pass any function that can take in characters and move them to buffers. I'll do a writeup on this at some point to document it.
40 lines
742 B
C
40 lines
742 B
C
/* vga.h
|
|
* VGA
|
|
*
|
|
* Responsible for VGA buffer control.
|
|
*/
|
|
#ifndef VGA_H
|
|
#define VGA_H
|
|
#define VGA_GRID_COLS 80
|
|
#define VGA_GRID_ROWS 25
|
|
#include <stdint.h>
|
|
#include <stdarg.h>
|
|
|
|
/*
|
|
* CONSTANTS AND VARIABLES
|
|
*/
|
|
|
|
//Information on the VGA buffer
|
|
|
|
extern volatile uint16_t* const vga_buffer;
|
|
|
|
//grid is top left origin. This is our cursor!
|
|
extern int cursor_col;
|
|
extern int cursor_row;
|
|
extern uint16_t vga_attributes; // Black background, White foreground
|
|
|
|
|
|
/*
|
|
* Functions
|
|
*/
|
|
|
|
//Clear the VGA buffer
|
|
void vga_clear();
|
|
//Put a character in the VGA buffer and move the cursor to the right by one
|
|
void vga_set_attributes(uint8_t attributes);
|
|
//Write character c to cursor
|
|
//Implements IO generic ASCII output
|
|
int vga_out(char c);
|
|
|
|
|
|
#endif
|