summaryrefslogtreecommitdiff
path: root/Source/Kernel/VTManager/VirtualTerminal.class.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-22 21:44:32 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-22 21:44:32 +0200
commit2582a11c37ccc22d64974b20b0793e5ba873fe1f (patch)
tree485565c0950f0355290690d3396bcb4c22774fd0 /Source/Kernel/VTManager/VirtualTerminal.class.cpp
parent74e721676ddd5d996ccf2e1d35da57320f658609 (diff)
downloadMelon-2582a11c37ccc22d64974b20b0793e5ba873fe1f.tar.gz
Melon-2582a11c37ccc22d64974b20b0793e5ba873fe1f.zip
Lots of stuff added : heap, timer, device managment, ...
Diffstat (limited to 'Source/Kernel/VTManager/VirtualTerminal.class.cpp')
-rw-r--r--Source/Kernel/VTManager/VirtualTerminal.class.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/Kernel/VTManager/VirtualTerminal.class.cpp b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
index 6478be4..a0c920b 100644
--- a/Source/Kernel/VTManager/VirtualTerminal.class.cpp
+++ b/Source/Kernel/VTManager/VirtualTerminal.class.cpp
@@ -1,7 +1,8 @@
#include "VirtualTerminal.class.h"
-#include <DisplayManager/Disp.ns.h>
+#include <DeviceManager/Disp.ns.h>
+#include <VTManager/VT.ns.h>
-#define BUFCHR(l, c) m_buff[(l * m_rows) + c]
+#define BUFCHR(l, c) m_buff[((l) * m_cols) + (c)]
VirtualTerminal::VirtualTerminal(u32int rows, u32int cols, u8int fgcolor, u8int bgcolor) {
m_buff = new chr[rows * cols];
@@ -15,6 +16,11 @@ VirtualTerminal::VirtualTerminal(u32int rows, u32int cols, u8int fgcolor, u8int
m_csrlin = 0;
}
+VirtualTerminal::~VirtualTerminal() {
+ if (m_mapped) VT::unmap(this);
+ delete [] m_buff;
+}
+
void VirtualTerminal::setColor(u8int fgcolor, u8int bgcolor) {
if (bgcolor == 0xFF) {
m_color = (m_color & 0xF0) | fgcolor;
@@ -24,6 +30,7 @@ void VirtualTerminal::setColor(u8int fgcolor, u8int bgcolor) {
}
void VirtualTerminal::putChar(u32int row, u32int col, char c) {
+ if (row >= m_rows or col >= m_cols) return;
chr* ch = &BUFCHR(row, col);
ch->c = c;
ch->color = m_color;
@@ -44,10 +51,12 @@ void VirtualTerminal::map(s32int row, s32int col) {
m_mapcol = (col == -1 ? (Disp::textCols() / 2) - (m_cols / 2) : col);
m_mapped = true;
redraw();
+ VT::map(this);
}
void VirtualTerminal::unmap() {
m_mapped = false;
+ VT::unmap(this);
}
void VirtualTerminal::redraw() {
@@ -68,7 +77,8 @@ void VirtualTerminal::scroll() {
for (u32int c = 0; c < m_cols; c++) {
BUFCHR(m_rows - 1, c).c = ' ';
BUFCHR(m_rows - 1, c).color = m_color;
- }
+ }
+ if (m_mapped) redraw();
}
void VirtualTerminal::updateCursor() {
@@ -112,7 +122,7 @@ void VirtualTerminal::put(char c, bool updatecsr) {
m_csrcol = 0;
m_csrlin++;
}
- if (m_csrlin >= m_rows) {
+ while (m_csrlin >= m_rows) {
scroll();
m_csrlin--;
}