From ff96bef431dca22bb3cdb6eae22dcb948ebe2322 Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Fri, 8 May 2020 10:17:34 -0500 Subject: [PATCH] Forgot to add these to the previous commit. --- Makefile | 2 +- build_numbers.c | 2 +- kernel/kmain.c | 25 +++++++++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7af9774..ccb1c0d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .DELETE_ON_ERROR: CC = gcc -GCCPARAMS = -m32 -fno-pie -nostdlib -fstrength-reduce -fomit-frame-pointer -finline-functions -fno-builtin -nostdinc -fno-stack-protector +GCCPARAMS = -m32 -fno-pie -nostdlib -fstrength-reduce -fomit-frame-pointer -finline-functions -fno-builtin -nostdinc -fno-stack-protector -Wall -Wextra ASPARAMS = -f elf32 LDPARAMS = -m elf_i386 diff --git a/build_numbers.c b/build_numbers.c index 1fc5ed0..21a2a3b 100644 --- a/build_numbers.c +++ b/build_numbers.c @@ -1,3 +1,3 @@ #ifndef KERNEL_VERSION_NUMBER -#define KERNEL_VERSION_NUMBER "1.4.10-0" +#define KERNEL_VERSION_NUMBER "1.4.10-8" #endif diff --git a/kernel/kmain.c b/kernel/kmain.c index 727a947..9161adb 100644 --- a/kernel/kmain.c +++ b/kernel/kmain.c @@ -1,5 +1,26 @@ +#include "../includes/io.h" -void kmain() +void write_screen(unsigned int, char, unsigned char, unsigned char); +void move(unsigned short); + +extern void kmain() { - asm("hlt"); + write_screen(0, 'A', 2, 8); + move(80); + //asm("hlt"); +} + +void write_screen(unsigned int i, char c, unsigned char fg, unsigned char bg) +{ + char *fb = (char *) 0x000B8000; + fb[i] = c; + fb[i + 1] = ((fg & 0x0F) << 4) | (bg & 0x0F); +} + +void move(unsigned short pos) +{ + outb(0x3D4, 14); + outb(0x3D5, ((pos >> 8 ) & 0x00FF)); + outb(0x3D4, 15); + outb(0x3D5, pos & 0x00FF); }