Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move display consts to cpp file
  • Loading branch information
djphoenix committed Nov 9, 2016
1 parent 56a68c6 commit 0038646
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/kernlib/display.cpp
Expand Up @@ -16,6 +16,10 @@

#include "kernlib.hpp"

char *const ConsoleDisplay::base = reinterpret_cast<char*>(0xB8000);
char *const ConsoleDisplay::top = reinterpret_cast<char*>(0xB8FA0);
const size_t ConsoleDisplay::size = ConsoleDisplay::top - ConsoleDisplay::base;

ConsoleDisplay::ConsoleDisplay() {
display = base;
}
Expand All @@ -35,7 +39,6 @@ void ConsoleDisplay::putc(const char c) {
*(display++) = 0x0F;
}
if (display >= top) {
size_t size = top - base;
Memory::copy(base, base + 160, size - 160);
display = top - 160;
Memory::fill(display, 0, 160);
Expand All @@ -52,7 +55,6 @@ void ConsoleDisplay::write(const char *str) {

void ConsoleDisplay::clean() {
mutex.lock();
size_t size = top - base;
Memory::fill(base, 0, size);
mutex.release();
}
Expand Down
5 changes: 3 additions & 2 deletions src/kernlib/include/kernlib/display.hpp
Expand Up @@ -30,8 +30,9 @@ class Display {

class ConsoleDisplay: public Display {
private:
static constexpr char * const base = reinterpret_cast<char*>(0xB8000);
static constexpr char * const top = reinterpret_cast<char*>(0xB8FA0);
static char *const base;
static char *const top;
static const size_t size;
char *display;
void putc(const char c);
Mutex mutex;
Expand Down

0 comments on commit 0038646

Please sign in to comment.