check cga pos bounds and debug print

main
Eggert Jung 6 months ago
parent bddcebefae
commit ae3980cfa2

@ -14,12 +14,23 @@ TextWindow::TextWindow(unsigned from_col, unsigned to_col, unsigned from_row,
setPos(0,0); setPos(0,0);
} }
extern unsigned int testx, testy;
void TextWindow::setPos(unsigned rel_x, unsigned rel_y) { void TextWindow::setPos(unsigned rel_x, unsigned rel_y) {
unsigned abs_x = from_col + rel_x;
unsigned abs_y = from_row + rel_y;
if(abs_x >= CGA::COLUMNS)
return;
if(abs_y >= CGA::ROWS)
return;
if(use_cursor){ if(use_cursor){
CGA::setCursor(from_col + rel_x, from_row + rel_y); testx = abs_x;
testy = abs_y;
CGA::setCursor(abs_x, abs_y);
}else{ }else{
pos_x = from_col + rel_x; pos_x = abs_x;
pos_y = from_row + rel_y; pos_y = abs_y;
} }
} }

@ -63,9 +63,13 @@ OutputStream* copyout[Core::MAX]{
&dout[7] &dout[7]
}; };
unsigned int testx, testy;
// Main function // Main function
// (the bootstrap processor starts here)} // (the bootstrap processor starts here)}
extern "C" int main() { extern "C" int main() {
CGA::setCursor(0, 0);
unsigned int numCPUs = Core::count(); unsigned int numCPUs = Core::count();
DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl; DBG_VERBOSE << "Number of CPUs: " << numCPUs << endl;
@ -102,8 +106,12 @@ extern "C" int main() {
PS2Controller::drainBuffer(); PS2Controller::drainBuffer();
Application{}.action(); DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
//Application{}.action();
while (true){ while (true){
DBG << "pos: " << testx << ", " << testy << endl << flush;
Core::pause();
} }
return 0; return 0;

Loading…
Cancel
Save