summaryrefslogtreecommitdiff
path: root/Source/Kernel/Devices/Display
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-11-08 18:21:17 +0100
committerAlexis211 <alexis211@gmail.com>2009-11-08 18:21:17 +0100
commit699a1497a4eb432f41d643a18f2ac6ba10a66518 (patch)
tree06983d53f9507a7f3f265925700ecc440ae18ff4 /Source/Kernel/Devices/Display
parent87a1dd39d0036f55f5bdbf4ef8921a4767d95825 (diff)
downloadMelon-699a1497a4eb432f41d643a18f2ac6ba10a66518.tar.gz
Melon-699a1497a4eb432f41d643a18f2ac6ba10a66518.zip
Worked on graphics mode selection, in prevision for having VESA grpahics
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.cpp22
-rw-r--r--Source/Kernel/Devices/Display/VGATextOutput.class.h3
3 files changed, 32 insertions, 8 deletions
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 <Devices/Device.proto.h>
#include <WChar.class.h>
+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 : <bg 4byte><fg 4byte>
- virtual void moveCursor(u16int line, u16int col) = 0;
+
+ virtual void getModes(Vector<Disp::mode_t> &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 : <bg 4bits><fg 4bits>
+ 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 <DeviceManager/Disp.ns.h>
//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<mode_t> &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<Disp::mode_t> &to);
+ bool setMode(Disp::mode_t& mode);
+
u16int textCols();
u16int textRows();
void putChar(u16int line, u16int col, WChar c, u8int color);