Compare commits
5 Commits
8b0354b709
...
9ae9f6fd78
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ae9f6fd78 | ||
|
|
2d64c0654f | ||
|
|
6ad2dda8db | ||
|
|
2e81a8b419 | ||
|
|
4fd8b7d749 |
@@ -51,6 +51,18 @@ void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
|
|||||||
for(unsigned i=0; i<length; i++){
|
for(unsigned i=0; i<length; i++){
|
||||||
unsigned x_now, y_now;
|
unsigned x_now, y_now;
|
||||||
getPos(x_now, y_now);
|
getPos(x_now, y_now);
|
||||||
|
if(str[i] == '\n'){
|
||||||
|
x_now = 0;
|
||||||
|
if(from_row + y_now >= to_row-1){
|
||||||
|
//TODO scrollUp()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
y_now++;
|
||||||
|
}
|
||||||
|
setPos(x_now, y_now);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CGA::show(x_now, y_now, str[i], attrib);
|
CGA::show(x_now, y_now, str[i], attrib);
|
||||||
if(from_col+x_now >= to_col-1){
|
if(from_col+x_now >= to_col-1){
|
||||||
x_now = 0;
|
x_now = 0;
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits,
|
|||||||
StopBits stop_bits, Parity parity)
|
StopBits stop_bits, Parity parity)
|
||||||
:Serial(port, baud_rate, data_bits, stop_bits, parity) {}
|
:Serial(port, baud_rate, data_bits, stop_bits, parity) {}
|
||||||
|
|
||||||
SerialStream kout = SerialStream();
|
SerialStream sout = SerialStream();
|
||||||
|
|
||||||
void SerialStream::flush() {
|
void SerialStream::flush() {
|
||||||
print(kout.buffer, kout.pos);
|
print(sout.buffer, sout.pos);
|
||||||
kout.pos = 0;
|
sout.pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialStream::setForeground(Color c) {
|
void SerialStream::setForeground(Color c) {
|
||||||
write(0x1b);
|
write(0x1b);
|
||||||
write('[');
|
write('[');
|
||||||
kout << 30+c;
|
sout << 30+c;
|
||||||
flush();
|
flush();
|
||||||
write('m');
|
write('m');
|
||||||
}
|
}
|
||||||
@@ -44,11 +44,11 @@ void SerialStream::setPos(int x, int y) {
|
|||||||
//char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0};
|
//char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0};
|
||||||
//*this << 0x1b;
|
//*this << 0x1b;
|
||||||
write(0x1b);
|
write(0x1b);
|
||||||
kout << '[';
|
sout << '[';
|
||||||
kout << dec << x;
|
sout << dec << x;
|
||||||
kout << ';';
|
sout << ';';
|
||||||
kout << dec << y;
|
sout << dec << y;
|
||||||
kout << 'H';
|
sout << 'H';
|
||||||
flush();
|
flush();
|
||||||
//itoa(x, &out[2], 10);
|
//itoa(x, &out[2], 10);
|
||||||
//itoa(y, &out[5], 10);
|
//itoa(y, &out[5], 10);
|
||||||
|
|||||||
@@ -142,5 +142,5 @@ class SerialStream : public OutputStream, public Serial {
|
|||||||
void print(char* str, int length);
|
void print(char* str, int length);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SerialStream kout;
|
extern SerialStream sout;
|
||||||
|
|
||||||
|
|||||||
46
main.cc
46
main.cc
@@ -14,29 +14,16 @@ extern "C" int main() {
|
|||||||
DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl;
|
DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl;
|
||||||
|
|
||||||
////test cga implemantation
|
////test cga implemantation
|
||||||
//CGA::setCursor(1, 2);
|
// CGA::setCursor(1, 2);
|
||||||
//unsigned x,y;
|
// unsigned x,y;
|
||||||
//CGA::getCursor(x, y);
|
// CGA::getCursor(x, y);
|
||||||
//CGA::setCursor(x+1, y+1);
|
// CGA::setCursor(x+1, y+1);
|
||||||
//for(uint8_t i = 0; i < 10; i++)
|
// for(uint8_t i = 0; i < 10; i++)
|
||||||
// CGA::show(i, i, i+0x30, CGA::Attribute());
|
// CGA::show(i, i, i+0x30, CGA::Attribute());
|
||||||
|
|
||||||
////test textwindow implemantation
|
////test textwindow implemantation
|
||||||
//TextWindow tw_global = TextWindow(0, 80, 0, 25, true);
|
//TextWindow tw_global = TextWindow(0, 80, 0, 25, true);
|
||||||
//tw_global.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false));
|
//tw_global.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false));
|
||||||
//TextWindow tw = TextWindow(0, 10, 0, 10, true);
|
|
||||||
//tw.reset();
|
|
||||||
//tw.setPos(0,0);
|
|
||||||
//tw.print("lorem ipsum dolor sit amit", 26);
|
|
||||||
//tw.setPos(0,-1);
|
|
||||||
//tw.print("test", 4, CGA::Attribute(CGA::BLACK, CGA::BLUE));
|
|
||||||
//int x,y;
|
|
||||||
//tw.getPos(x,y);
|
|
||||||
//tw.setPos(x+1,y);
|
|
||||||
|
|
||||||
////test Serial
|
|
||||||
//Serial s = Serial();
|
|
||||||
//s.write('a');
|
|
||||||
|
|
||||||
// test SerialStream
|
// test SerialStream
|
||||||
SerialStream ss = SerialStream();
|
SerialStream ss = SerialStream();
|
||||||
@@ -82,5 +69,28 @@ extern "C" int main_ap() {
|
|||||||
DBG_VERBOSE << "CPU core " << static_cast<int>(Core::getID()) << " / LAPIC "
|
DBG_VERBOSE << "CPU core " << static_cast<int>(Core::getID()) << " / LAPIC "
|
||||||
<< static_cast<int>(LAPIC::getID()) << " in main_ap()" << endl;
|
<< static_cast<int>(LAPIC::getID()) << " in main_ap()" << endl;
|
||||||
|
|
||||||
|
|
||||||
|
TextWindow kout = TextWindow(0, 80, 0, 12, true);
|
||||||
|
kout.reset();
|
||||||
|
kout.setPos(0,0);
|
||||||
|
kout.print("Corem ipsum dolor sit amit", 26);
|
||||||
|
kout.setPos(0,-1);
|
||||||
|
kout.print("test", 4, CGA::Attribute(CGA::BLACK, CGA::BLUE));
|
||||||
|
int x,y;
|
||||||
|
kout.getPos(x,y);
|
||||||
|
kout.setPos(x+1,y);
|
||||||
|
kout.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::BLUE, false));
|
||||||
|
|
||||||
|
|
||||||
|
TextWindow dout0 = TextWindow(0,20,13,19, false);
|
||||||
|
dout0.reset();
|
||||||
|
dout0.reset(' ', CGA::Attribute(CGA::LIGHT_GREEN, CGA::RED, false));
|
||||||
|
|
||||||
|
|
||||||
|
////test Serial
|
||||||
|
Serial s = Serial();
|
||||||
|
s.write('a');
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user