diff options
Diffstat (limited to 'Source/Kernel/Devices/Display')
-rw-r--r-- | Source/Kernel/Devices/Display/Display.proto.h | 15 | ||||
-rw-r--r-- | Source/Kernel/Devices/Display/VGATextOutput.class.cpp | 29 | ||||
-rw-r--r-- | Source/Kernel/Devices/Display/VGATextOutput.class.h | 15 | ||||
-rw-r--r-- | Source/Kernel/Devices/Display/VGATextOutput.class.o | bin | 0 -> 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 Binary files differnew file mode 100644 index 0000000..ccd63a1 --- /dev/null +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.o |