summaryrefslogtreecommitdiff
path: root/Source/Kernel/Devices/Display
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-21 21:16:48 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-21 21:16:48 +0200
commitae803baa4e0ec584c7afd3f6d55f2e6b32010b46 (patch)
treea8d39cdeff28d2ce08ff7485736fef8119669547 /Source/Kernel/Devices/Display
parentf93a269f41659d9a33ea6f24411ca691978986cf (diff)
downloadMelon-ae803baa4e0ec584c7afd3f6d55f2e6b32010b46.tar.gz
Melon-ae803baa4e0ec584c7afd3f6d55f2e6b32010b46.zip
System boots up and shows a nice ASCII art logo.
Diffstat (limited to 'Source/Kernel/Devices/Display')
-rw-r--r--Source/Kernel/Devices/Display/Display.proto.h15
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.cpp29
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.h15
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.obin0 -> 1592 bytes
4 files changed, 59 insertions, 0 deletions
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 <Core/common.wtf.h>
+
+class Display {
+ public:
+ virtual u16int textCols() = 0;
+ virtual u16int textRows() = 0;
+ virtual void putChar(u16int line, u16int col, char c, char color) = 0; //Color : <bg 4byte><fg 4byte>
+ 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 <Devices/Display/Display.proto.h>
+
+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
--- /dev/null
+++ b/Source/Kernel/Devices/Display/VGATextOutput.class.o
Binary files differ