ingnore invalid scancodes

main
Eggert Jung 6 months ago
parent bccd23c0c6
commit 2c60b88849

@ -51,9 +51,10 @@ void TextWindow::getPos(int& rel_x, int& rel_y) const {
}
void TextWindow::scrollUp(){
for(uint8_t row = from_row; row < to_row; row++){
for(uint8_t row = from_row; row < to_row-1; row++){
memmove(&CGA::TEXT_BUFFER_BASE[row*CGA::COLUMNS + from_col], &CGA::TEXT_BUFFER_BASE[(row+1)*CGA::COLUMNS + from_col], 2*(to_col-from_col));
}
memset(&CGA::TEXT_BUFFER_BASE[(to_row-1)*CGA::COLUMNS + from_col] , 0, 2*(to_col-from_col));
}
void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
@ -76,7 +77,7 @@ void TextWindow::print(const char* str, size_t length, CGA::Attribute attrib) {
if(from_col+x_now >= to_col-1){
x_now = 0;
if(from_row + y_now >= to_row-1){
//TODO scrollUp()
scrollUp();
}
else{
y_now++;

@ -43,7 +43,8 @@
* possible that the debug output in a multi core system is displayed
* on the wrong (previous) core.
*/
#define DBG nullstream
#include "arch/lapic.h"
#define DBG dout[LAPIC::getID()]
#include "../arch/core.h"
#include "../device/textstream.h"

@ -112,15 +112,15 @@ bool fetch(Key &pressed) {
uint8_t status_reg = ctrl_port.inb();
if(status_reg & IS_MOUSE || !(status_reg & HAS_OUTPUT) )
return false; // TODO Remove mouse events from buffer
DBG_VERBOSE << "status: " << hex << static_cast<int>(status_reg) << "\n" << flush;
uint8_t out_buffer = data_port.inb();
DBG_VERBOSE << "scancode: " << hex << static_cast<int>(out_buffer) << "\n" << flush;
pressed = key_decoder.decode(out_buffer);
if (pressed.alt() || pressed.ctrl() || pressed.shift) {
if (pressed.alt() || pressed.ctrl() || pressed.shift || !pressed.valid())
return false;
}
else
return true;
}

@ -108,8 +108,8 @@ extern "C" int main_ap() {
//uint8_t from = static_cast<int>(LAPIC::getID()) * 20;
//uint8_t to = from+20;
//dout[LAPIC::getID()] = TextStream(from, to, 0, 6, false);
dout[LAPIC::getID()] << "test\n" << flush;
dout[LAPIC::getID()] << static_cast<int>(LAPIC::getID()) << flush;
DBG << "test\n" << flush;
DBG << static_cast<int>(LAPIC::getID()) << flush;
return 0;
}

Loading…
Cancel
Save