rk/vga.h

47 lines
961 B
C
Raw Normal View History

2024-05-20 17:39:20 -04:00
#ifndef RK_VGA_H_
#define RK_VGA_H_
#include <stdint.h>
/*
* Location of the linear text buffer
* Used to directly modify text on screen
* 80 columns by 25 rows
*/
#define VGA_MEMORY_ADDR 0xb8000
#define VGA_MAX_COLS 80
#define VGA_MAX_ROWS 25
#define WHITE_ON_BLACK 0x0f
#define CRTC_ADDR_PORT 0x3d4
#define CRTC_DATA_PORT 0x3d5
#define CRTC_CURSOR_LO_REGISTER 0x0f
#define CRTC_CURSOR_HI_REGISTER 0x0e
/**
* @brief Gets the text-mode cursor's position.
*
* @return The position, not offset, of the cursor. Multiply this by two for the offset.
*/
uint16_t get_cursor_pos();
/**
* @brief Sets the cursor's position in VGA text-mode.
*
* @param pos The position, not offset, of the cursor. Multiply by two for the offset.
*/
void set_cursor_pos(uint16_t pos);
/**
* @brief Clears the screen in VGA text-mode by overwriting every character with a zero, then resets the cursor position.
*/
void clear_screen(void);
void popchar();
#endif