Minor refactor, main is not init

pull/37/head
E. Almqvist 3 years ago
parent ff08fdffab
commit 3c49c1ed7d
  1. 2
      bootloader/bootloader.asm
  2. 2
      bootloader/pm/vga/print.asm
  3. 10
      drivers/vga.c
  4. 4
      drivers/vga.h
  5. 13
      kernel/kernel.c
  6. 2
      kernel/kernel.h
  7. 4
      kernel/kernel_entry.asm

@ -87,7 +87,7 @@ load_kernel:
stat_pm_init: db "Entering 32bit Protected Mode...", ASCII_END
stat_kernel_load: db "Loading kernel into memory...", ASCII_END
stat_boot_success: db "Booting complete!", ASCII_END
stat_boot_success: db "Booting finished. Loading kernel...", ASCII_END
BOOT_DRIVE: db 0

@ -3,7 +3,7 @@
; VGA base address: 0xb8000
; Charpos = 0xb8000 + 2(row*80 + col)
vga_color_buf: db 0x0f ; Buffer to be changed so that we can choose colors!
vga_color_buf: db 0x7f ; Buffer to be changed so that we can choose colors!
vga_print:
pusha

@ -12,6 +12,7 @@ void vga_init() {
port_outb(0x3d5, 0x20);
// Clear screen
// clear_row(0);
// clear_screen();
set_cursor_pos(0, 11);
@ -44,10 +45,15 @@ void set_cursor_pos(unsigned int col, unsigned int row) {
/*
Graphics Functions
*/
void clear_screen() {
void clear_row(unsigned int row) {
for( int c = 0; c < MAX_COLS; c++ )
writechar(0x20, c, row, 0x0);
}
void clear_screen() {
for( int r = 0; r < MAX_ROWS; r++ )
writechar(0x20, c, r, 0x0);
clear_row(r);
}
/*

@ -1,8 +1,7 @@
#define VGA_ADDRESS (char*)0xb8000
#define VGA_ADDRESS_MAX (char*)0xb8fa0
// #define DEFAULT_COLOR 0x07
#define DEFAULT_COLOR 0x0f
#define DEFAULT_COLOR 0x07
#define MAX_ROWS 25
#define MAX_COLS 80
@ -14,6 +13,7 @@ enum align {LEFT, RIGHT, MIDDLE};
char* get_memory_charpos(unsigned int col, unsigned int row);
void writechar(char c, unsigned int col, unsigned int row, int colorcode);
void clear_screen();
void clear_row(unsigned int row);
void set_cursor_pos();
void print();
void println();

@ -1,9 +1,19 @@
#include "kernel.h"
#include "memory.h"
#include "../drivers/vga.h"
#include "../lib/str.h"
#include "../lib/strf.h"
void main() {
void display_status(char* status_text) {
clear_row(0);
set_cursor_pos(0, 0);
print(status_text, 0x7f);
}
void init() {
display_status("Kernel loaded");
vga_init(); // Initialize the screen first
// i.e. clear the screen et cetera.
@ -21,6 +31,5 @@ void main() {
char* strbuf = "Concat test: ";
char* str2 = "Works!";
strbuf = strcat(strbuf, str2);
set_cursor_pos(0, 4);
println(strbuf, DEFAULT_COLOR);
}

@ -0,0 +1,2 @@
void init();
void display_status(char*);

@ -1,5 +1,5 @@
[bits 32]
[extern main]
[extern init]
call main
call init
jmp $

Loading…
Cancel
Save