KraKern

C++ Kernel
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/KraKern

commit e653a33daec676084b533a3ad88cd1d8cba1550c
parent aa53f4f04d51f42842430b19a9202a1b30a8fedc
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 12 Jan 2016 13:33:09 +0100

Fix(IO class): Constructor not call, have to do an .init() function.

Diffstat:
A.gitignore | 2++
D.ycm_extra_conf.pyc | 0
DKraKern | 0
Mincludes/core/Io.hpp | 2++
Mkern.img | 0
Mkernel/Io.cpp | 15+++++++++++++--
Mkernel/Io.o | 0
Mkernel/main.cpp | 4++--
Mkernel/main.o | 0
9 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +./KraKern diff --git a/.ycm_extra_conf.pyc b/.ycm_extra_conf.pyc Binary files differ. diff --git a/KraKern b/KraKern Binary files differ. diff --git a/includes/core/Io.hpp b/includes/core/Io.hpp @@ -34,6 +34,7 @@ class Io { Io(void); ~Io(void); + void init(void); // Assembly Interface void obyte(u32 a, u8 v); @@ -46,6 +47,7 @@ class Io { void putctty(char c); u32 read(char* buf,u32 count); void putc(char c); + void puts(const char *s); void set_color(char fcol,char bcol); void setXY(char xc,char yc); void clear(void); diff --git a/kern.img b/kern.img Binary files differ. diff --git a/kernel/Io.cpp b/kernel/Io.cpp @@ -13,6 +13,11 @@ Io::~Io(void) { this->_real_screen = (char *)this->_screen; } +void Io::init(void) { + this->_real_screen = (char *)RAM_SCREEN; + this->clear(); +} + void Io::scrollup(u32 n) { u8 *video, *tmp; @@ -48,12 +53,18 @@ void Io::switch_tty(void) { current_io = this; } +void Io::puts(const char *s) { + while (s && *s) { + this->putc(*s++); + } +} + void Io::putc(char c) { u8 *video; this->_kattr = 0x07; video = (u8 *)(this->_real_screen + 2 * this->_x + 160 * this->_y); - if (c == 10) { + if (c == 10) { this->_x = 0; this->_y++; } else if (c == 8 && this->_x) { @@ -66,7 +77,7 @@ void Io::putc(char c) { } else { *video = c; *(video + 1) = this->_kattr; - this->_x++; + this->_x++; if (this->_x > 79) { this->_x = 0; this->_y++; diff --git a/kernel/Io.o b/kernel/Io.o Binary files differ. diff --git a/kernel/main.cpp b/kernel/main.cpp @@ -5,7 +5,7 @@ extern Io __io; extern "C" void kmain(multiboot_info *info) { (void)info; - __io.clear(); - + __io.init(); + __io.puts("Hello World !"); return ; } diff --git a/kernel/main.o b/kernel/main.o Binary files differ.