From 4528b2347ac72ffdabdbe4d9e7bf7789c81e664f Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Tue, 12 Oct 2021 21:53:40 +0200 Subject: Adding tty --- src/kernel.c | 128 +++-------------------------------------------------------- 1 file changed, 6 insertions(+), 122 deletions(-) (limited to 'src/kernel.c') diff --git a/src/kernel.c b/src/kernel.c index 0882580..0ad3b66 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -1,129 +1,13 @@ -#include -#include -#include -#include"vga.h" - -static const size_t VGA_WIDTH = 80; -static const size_t VGA_HEIGHT = 25; - -#define PIC1_COMMAND_PORT 0x20 -#define PIC1_DATA_PORT 0x21 -#define PIC2_COMMAND_PORT 0xA0 -#define PIC2_DATA_PORT 0xA1 -// IO Ports for Keyboard -#define KEYBOARD_DATA_PORT 0x60 -#define KEYBOARD_STATUS_PORT 0x64 - -extern char ioport_in(uint8_t port); -extern void ioport_out(uint8_t port, char data); - -static inline uint8_t vga_entry_color(enum vga_color fg, enum vga_color bg) -{ - return fg | bg << 4; -} - -static inline uint16_t vga_entry(unsigned char uc, uint8_t color) -{ - return (uint16_t) uc | (uint16_t) color << 8; -} - -size_t terminal_row; -size_t terminal_column; -uint8_t terminal_color; -uint16_t* terminal_buffer; - -void terminal_initialize(void) -{ - terminal_row=0; - terminal_column=0; - terminal_color=vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK); - terminal_buffer=(uint16_t*) 0xB8000; - for(size_t y=0;y= 128) return; - - if(keycode==14) - { - if(terminal_column) terminal_column--; - terminal_putchar(keyboard[keycode]); - terminal_column--; - return; - } - - terminal_putchar(keyboard[keycode]); - - } -} -void print_message() -{ - for(size_t i=0;i<50;i++) - { - for(size_t j=0;j