diff options
author | Alexis211 <alexis211@gmail.com> | 2009-12-22 15:03:48 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-12-22 15:03:48 +0100 |
commit | 2c23da1cf398aef420130dde1b86e4c474e3cacb (patch) | |
tree | 33f31cf7459fe017c35a313c88e4bfcb6f00eb8a /Source/Kernel/Devices/Display | |
parent | 98decfffefc49c82f20a0453cef823f7588e7654 (diff) | |
parent | 837290db7d39c8cd852541cb345dc5a57c9274ce (diff) | |
download | Melon-2c23da1cf398aef420130dde1b86e4c474e3cacb.tar.gz Melon-2c23da1cf398aef420130dde1b86e4c474e3cacb.zip |
Merge branch 'master' into framework
Conflicts:
Melon.img
Diffstat (limited to 'Source/Kernel/Devices/Display')
5 files changed, 33 insertions, 1 deletions
diff --git a/Source/Kernel/Devices/Display/GraphicDisplay.proto.h b/Source/Kernel/Devices/Display/GraphicDisplay.proto.h index 9608ada..f58f5cf 100644 --- a/Source/Kernel/Devices/Display/GraphicDisplay.proto.h +++ b/Source/Kernel/Devices/Display/GraphicDisplay.proto.h @@ -10,6 +10,7 @@ extern u32int consoleColor[16]; #define C_FONT_HEIGHT 16 class GraphicDisplay : public Display { + protected: struct { int line, col; u32int buff[C_FONT_WIDTH][C_FONT_HEIGHT]; diff --git a/Source/Kernel/Devices/Display/VESADisplay.class.cpp b/Source/Kernel/Devices/Display/VESADisplay.class.cpp index 7c4adca..11b0882 100644 --- a/Source/Kernel/Devices/Display/VESADisplay.class.cpp +++ b/Source/Kernel/Devices/Display/VESADisplay.class.cpp @@ -109,7 +109,7 @@ bool VESADisplay::setMode(mode_t &mode) { regs.ax = 0x4F02; regs.bx = mode.identifier | 0x4000; V86::biosInt(0x10, regs); - if (regs.ax != 0x004F) return false; + if ((regs.ax & 0xFF00) != 0) return false; if (m_currMode.bpp == 8) { //Set palette to 8 bit @@ -300,3 +300,20 @@ void VESADisplay::drawChar(u16int line, u16int col, WChar c, u8int color) { y++; } } + +bool VESADisplay::textScroll(u16int line, u16int col, u16int height, u16int width, u8int color) { + u8int* start = memPos(col * C_FONT_WIDTH, line * C_FONT_HEIGHT); + u32int count = width * C_FONT_WIDTH * m_pixWidth; + u32int diff = C_FONT_HEIGHT * m_currMode.pitch; + putCsrBuff(); + for (int i = 0; i < (height - 1) * C_FONT_HEIGHT; i++) { + memcpy(start, start + diff, count); + start += m_currMode.pitch; + } + for (u32int i = 0; i < width; i++) { + drawChar(line + height - 1, col + i, " ", color); + } + if (m_csrBuff.line == line + height - 1) m_csrBuff.line--; + drawCsr(); + return true; +} diff --git a/Source/Kernel/Devices/Display/VESADisplay.class.h b/Source/Kernel/Devices/Display/VESADisplay.class.h index a6001e2..c3bae82 100644 --- a/Source/Kernel/Devices/Display/VESADisplay.class.h +++ b/Source/Kernel/Devices/Display/VESADisplay.class.h @@ -77,6 +77,7 @@ class VESADisplay : public GraphicDisplay { //Advanced graphical functions, recoded for being optimized virtual void drawChar(u16int line, u16int col, WChar c, u8int color); + bool textScroll(u16int line, u16int col, u16int height, u16int width, u8int color); }; #endif diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp index 50a57b2..c597696 100644 --- a/Source/Kernel/Devices/Display/VGATextOutput.class.cpp +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.cpp @@ -24,6 +24,7 @@ void VGATextOutput::getModes(Vector<mode_t> &to) { m.identifier = 1; m.graphWidth = 0; m.graphHeight = 0; + m.graphDepth = 0; m.device = this; to.push(m); m.textCols = 80; @@ -60,3 +61,13 @@ void VGATextOutput::clear() { u16int* where = (u16int*)RAM_ADDR; for (int i = 0; i < 25 * 80; i++) where[i] = 0; } + +bool VGATextOutput::textScroll(u16int line, u16int col, u16int height, u16int width, u8int color) { + u8int* where = (u8int*)RAM_ADDR; + for (u32int i = 1; i < height; i++) { + memcpy(where + ((line + i - 1) * (m_cols * 2)) + (col * 2), where + ((line + i) * (m_cols * 2)) + (col * 2), width * 2); + } + u16int* w = (u16int*)where; + memsetw(w + ((line + height - 1) * m_cols) + col, 0x20 | (color << 8), width); + return true; +} diff --git a/Source/Kernel/Devices/Display/VGATextOutput.class.h b/Source/Kernel/Devices/Display/VGATextOutput.class.h index 2c72d40..0b0ba94 100644 --- a/Source/Kernel/Devices/Display/VGATextOutput.class.h +++ b/Source/Kernel/Devices/Display/VGATextOutput.class.h @@ -18,6 +18,8 @@ class VGATextOutput : public Display { void putChar(u16int line, u16int col, WChar c, u8int color); void moveCursor(u16int line, u16int col); void clear(); + + bool textScroll(u16int line, u16int col, u16int height, u16int width, u8int color); }; #endif |