started work on tty

This commit is contained in:
justuswolff
2026-03-19 15:41:08 +01:00
parent 233f956119
commit fa6c48ae7e
8 changed files with 163 additions and 81 deletions

View File

@@ -1,14 +1,25 @@
#pragma once
#include "stddef.h"
#include "stdlib.h"
#include "tty.h"
// these values are for 320*200*256
enum VGA_colors {
black=0x00,
white=0x0F,
red=0x1F,
green=0x2F,
blue=0x3F,
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} VGA_pixel;
static const VGA_pixel VGA_colors_black = {
0x00,
0x00,
0x00
};
static const VGA_pixel VGA_colors_white = {
0xFF,
0xFF,
0xFF
};
static uint8_t VGA_basic8x8font[128][8] = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001
@@ -139,11 +150,9 @@ static uint8_t VGA_basic8x8font[128][8] = {
{ 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F
};
static char VGA_charbuf[40][25];
void inline VGA_setchar(uint8_t x, uint8_t y, char val) {
VGA_charbuf[x][y] = val;
}
void VGA_renderchar();
static uint8_t VGA_palette[256][3];
void VGA_setchar(virtualConsole* con, uint8_t x, uint8_t y, char val);
void VGA_renderchar(virtualConsole* con);
static uint8_t* VGA_fbuf = (unsigned char*)0xA0000;
static uint8_t VGA_values[] = { // THIS. THIS IS CANCER.
// MISC
@@ -167,12 +176,10 @@ static uint8_t VGA_values[] = { // THIS. THIS IS CANCER.
0x41,0x00,0x0F,0x00,0x00
};
void VGA_switch(uint8_t *regs);
size_t inline VGA_offset(uint16_t x, uint16_t y) {
inline size_t VGA_offset(uint16_t x, uint16_t y) {
return x+(y*320);
}
void VGA_setcol(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
void VGA_setpal(uint8_t* palette);
void inline VGA_setpix(uint16_t x, uint16_t y, enum VGA_colors color) {
VGA_fbuf[VGA_offset(x,y)] = color;
}
void VGA_kstrrend(char* buf, uint16_t count);
void VGA_setpal(uint8_t palette[256][3]);
void VGA_setpix(uint16_t x, uint16_t y, VGA_pixel pix);
void VGA_kstrrend(virtualConsole* con);