From ae803baa4e0ec584c7afd3f6d55f2e6b32010b46 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 21 Aug 2009 21:16:48 +0200 Subject: System boots up and shows a nice ASCII art logo. --- Source/Kernel/Devices/Display/Display.proto.h | 15 +++++++++++ .../Kernel/Devices/Display/VGATextOutput.class.cpp | 29 +++++++++++++++++++++ .../Kernel/Devices/Display/VGATextOutput.class.h | 15 +++++++++++ .../Kernel/Devices/Display/VGATextOutput.class.o | Bin 0 -> 1592 bytes 4 files changed, 59 insertions(+) create mode 100644 Source/Kernel/Devices/Display/Display.proto.h create mode 100644 Source/Kernel/Devices/Display/VGATextOutput.class.cpp create mode 100644 Source/Kernel/Devices/Display/VGATextOutput.class.h create mode 100644 Source/Kernel/Devices/Display/VGATextOutput.class.o (limited to 'Source/Kernel/Devices/Display') diff --git a/Source/Kernel/Devices/Display/Display.proto.h b/Source/Kernel/Devices/Display/Display.proto.h new file mode 100644 index 0000000..8e8e29d --- /dev/null +++ b/Source/Kernel/Devices/Display/Display.proto.h @@ -0,0 +1,15 @@ +#ifndef DEF_DISPLAY_PROTO_H +#define DEF_DISPLAY_PROTO_H + +#include + +class Display { + public: + virtual u16int textCols() = 0; + virtual u16int textRows() = 0; + virtual void putChar(u16int line, u16int col, char c, char color) = 0; //Color : + virtual void moveCursor(u16int line, u16int col) = 0; + virtual void clear() = 0; +}; + +#endif diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp new file mode 100644 index 0000000..66bffd5 --- /dev/null +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp @@ -0,0 +1,29 @@ +#include "VGATextOutput.class.h" + +using namespace Sys; //For outb + +u16int VGATextOutput::textCols() { + return 80; +} + +u16int VGATextOutput::textRows() { + return 25; +} + +void VGATextOutput::putChar(u16int line, u16int col, char c, char color) { + u16int* where = (u16int*)0xB8000; + where[(80 * line) + col] = (color << 8) | c; +} + +void VGATextOutput::moveCursor(u16int line, u16int col) { + u16int csrLoc = (line * 80) + col; + outb(0x3D4, 14); + outb(0x3D5, csrLoc >> 8); + outb(0x3D4, 15); + outb(0x3D5, csrLoc & 0xFF); +} + +void VGATextOutput::clear() { + u16int* where = (u16int*)0xB8000; + for (int i = 0; i < 25 * 80; i++) where[i] = 0; +} diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.h b/Source/Kernel/Devices/Display/VGATextOutput.class.h new file mode 100644 index 0000000..72ad604 --- /dev/null +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.h @@ -0,0 +1,15 @@ +#ifndef DEF_VGATEXTOUTPUT_CLASS_H +#define DEF_VGATEXTOUTPUT_CLASS_H + +#include + +class VGATextOutput : public Display { + public: + u16int textCols(); + u16int textRows(); + void putChar(u16int line, u16int col, char c, char color); + void moveCursor(u16int line, u16int col); + void clear(); +}; + +#endif diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.o b/Source/Kernel/Devices/Display/VGATextOutput.class.o new file mode 100644 index 0000000..ccd63a1 Binary files /dev/null and b/Source/Kernel/Devices/Display/VGATextOutput.class.o differ -- cgit v1.2.3