From 699a1497a4eb432f41d643a18f2ac6ba10a66518 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 8 Nov 2009 18:21:17 +0100 Subject: Worked on graphics mode selection, in prevision for having VESA grpahics --- Source/Kernel/Devices/Display/Display.proto.h | 15 +++++++++++---- .../Kernel/Devices/Display/VGATextOutput.class.cpp | 22 ++++++++++++++++++---- .../Kernel/Devices/Display/VGATextOutput.class.h | 3 +++ 3 files changed, 32 insertions(+), 8 deletions(-) (limited to 'Source/Kernel/Devices/Display') diff --git a/Source/Kernel/Devices/Display/Display.proto.h b/Source/Kernel/Devices/Display/Display.proto.h index 2cec616..e1775bd 100644 --- a/Source/Kernel/Devices/Display/Display.proto.h +++ b/Source/Kernel/Devices/Display/Display.proto.h @@ -5,14 +5,21 @@ #include #include +namespace Disp { struct mode_t; } + class Display : public Device { public: virtual ~Display() {} - virtual u16int textCols() = 0; - virtual u16int textRows() = 0; - virtual void putChar(u16int line, u16int col, WChar c, u8int color) = 0; //Color : - virtual void moveCursor(u16int line, u16int col) = 0; + + virtual void getModes(Vector &to) = 0; + virtual bool setMode(Disp::mode_t& mode) = 0; virtual void clear() = 0; + + //Text functions + virtual void putChar(u16int line, u16int col, WChar c, u8int color) = 0; //Color : + virtual void moveCursor(u16int line, u16int col) = 0; + + //Graphic functions }; #endif diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp index aca5ce6..8840080 100644 --- a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp @@ -1,9 +1,11 @@ #include "VGATextOutput.class.h" +#include //Virtual address in higher half #define RAM_ADDR 0xC00B8000 using namespace Sys; //For outb +using namespace Disp; String VGATextOutput::getClass() { return "display.text"; @@ -13,12 +15,24 @@ String VGATextOutput::getName() { return "Standard mode0 VGA text display"; } -u16int VGATextOutput::textCols() { - return 80; +void VGATextOutput::getModes(Vector &to) { + mode_t m; + m.textCols = 80; + m.textRows = 25; + m.identifier = 0; + m.graphWidth = 0; + m.graphHeight = 0; + m.device = this; + to.push(m); } -u16int VGATextOutput::textRows() { - return 25; +bool VGATextOutput::setMode(mode_t& mode) { + if (mode.device == this && mode.identifier == 0) { + //TODO : switch for real to mode 0. + clear(); + return true; + } + return false; } void VGATextOutput::putChar(u16int line, u16int col, WChar c, u8int color) { diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.h b/Source/Kernel/Devices/Display/VGATextOutput.class.h index 864ae35..1ced227 100644 --- a/Source/Kernel/Devices/Display/VGATextOutput.class.h +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.h @@ -8,6 +8,9 @@ class VGATextOutput : public Display { String getClass(); String getName(); + void getModes(Vector &to); + bool setMode(Disp::mode_t& mode); + u16int textCols(); u16int textRows(); void putChar(u16int line, u16int col, WChar c, u8int color); -- cgit v1.2.3