build system refresh

This commit is contained in:
2026-07-16 16:09:12 -05:00
parent b588634253
commit 3246dbbd19
49 changed files with 185 additions and 203 deletions

View File

@@ -2,6 +2,8 @@
#include <drivers/ps2/ps2.h>
#include <vfs.h>
static const char scancode_to_ascii[] = {
0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b',
'\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
@@ -73,7 +75,11 @@ int init_ps2() {
write_ccb(ccb);
return 0;
}
}
void ps2_init_kbd(vfs_node_t* dev) {
}
char ps2_get_ascii(uint8_t scancode) {
if (scancode & 0x80) {
@@ -88,4 +94,5 @@ char ps2_get_ascii(uint8_t scancode) {
}
return 0;
}
}

View File

@@ -18,8 +18,10 @@
#ifndef __ASSEMBLER__
#include <stdint.h>
#include <vfs.h>
int init_ps2();
void ps2_init_kbd(vfs_node_t* dev);
uint8_t ps2_read_data();
char ps2_get_ascii(uint8_t scancode);

View File

@@ -2,7 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <lib/stream.h>
#include <lib/print.h>
#include <drivers/vga/vga.h>
#include <drivers/serial/serial.h>
@@ -10,7 +10,7 @@
#include <common.h>
#include <memory/mm.h>
#include <user/video.h>
#include <sys/video.h>
static uint32_t framebuffer_address;
static uint32_t framebuffer_width;
@@ -19,25 +19,11 @@ static uint32_t framebuffer_total_pixels;
static uint32_t framebuffer_pitch;
static uint32_t framebuffer_bpp;
static uint8_t red_mask_sz;
static uint8_t red_field_pos;
static uint8_t green_mask_sz;
static uint8_t green_field_pos;
static uint8_t blue_mask_sz;
static uint8_t blue_field_pos;
static uint32_t create_pixel(uint8_t r, uint8_t g, uint8_t b) {
return (r >> (8 - red_mask_sz)) << red_field_pos
| (g >> (8 - green_mask_sz)) << green_field_pos
| (b >> (8 - blue_mask_sz)) << blue_field_pos;
}
vga_color_t VGA_COLOR_BLACK = {0, 0, 0, 255};
vga_color_t VGA_COLOR_RED = {0, 0, 255, 255};
vga_color_t VGA_COLOR_GREEN = {0, 255, 0, 255};
vga_color_t VGA_COLOR_BLUE = {255, 0, 0, 255};
uint32_t vga_mmap(vfs_node_t* node, uint32_t address) {
uint32_t fb_size_bytes = framebuffer_height * framebuffer_pitch;
uint32_t num_pages = (fb_size_bytes + 4095) / 4096;
@@ -77,6 +63,8 @@ void vga_init(
framebuffer_pitch = fb_pitch;
framebuffer_bpp = fb_bpp;
kprintf("mapping vga pages\n");
uint32_t fb_size_bytes = fb_height * fb_pitch;
uint32_t num_pages = (fb_size_bytes + 4095) / 4096;
for (uint32_t i = 0; i < num_pages; i++) {
@@ -113,9 +101,7 @@ uint8_t vga_get_bpp() {
}
void vga_clear_scrn(uint32_t color) {
if (framebuffer_address == 0) return;
uint8_t* fb_bytes = (uint8_t*)framebuffer_address;
uint8_t* fb_bytes = (uint8_t*)VGA_FRAMEBUFFER;
uint8_t bytes_per_pixel = framebuffer_bpp / 8;
for (uint32_t y = 0; y < framebuffer_height; y++) {

View File

@@ -1,4 +1,3 @@
#include "lib/font.h"
#include "multiboot.h"
#include "interrupts.h"
#include "gdt.h"
@@ -166,20 +165,16 @@ void kmain(multiboot_info* mbi) {
dev->mnt = devfs;
kprintf("mounted devfs\n");
console_init();
kprintf("kernel console initialized\n");
int font_loaded = set_console_font("/fonts/kernel_font.psf");
int font_loaded = set_console_font("/usr/fonts/kernel_font.psf");
if (!font_loaded) {
kprintf("failed to load console font\n");
}
console_init();
kprintf("console font set\n");
kprintf("kernel console initialized\n");
kprintf("basic initializations complete. check serial for details\n");
kprintf("starting rockos\n");
load_root_program("/bin/vga_text_term.elf");
kprintf("kernel going to sleep...\n");
load_root_program("/usr/bin/rockterm");
}

View File

@@ -16,7 +16,6 @@ static uint32_t console_text_color;
static uint32_t console_backgrnd_color;
static void write_vga_char(char c) {
print_serial("write_vga_char invoked\r\n");
uint32_t vga_pitch = vga_get_pitch();
uint8_t* glyph = (uint8_t*)font->glyphs + (c * font->hdr->charsz);
@@ -71,7 +70,6 @@ void console_putchar(char c) {
if (!font) return;
if (c == '\n') {
print_serial("\r\n");
console_col = 0;
console_row++;
if (console_row >= console_height) {
@@ -80,7 +78,6 @@ void console_putchar(char c) {
return;
}
write_serial(c);
write_vga_char(c);
console_col++;