Skip to content
Snippets Groups Projects
Commit 9007f21b authored by abinade2's avatar abinade2
Browse files

control L partially working

parent 044635de
No related branches found
No related tags found
No related merge requests found
......@@ -146,10 +146,10 @@ void KB_init(void) {
// initialize modifier flags
enter_flag[0] = enter_flag[1] = enter_flag[2] = 0;
ctrl_flag[0] = ctrl_flag[1] = ctrl_flag[2] = 0;
caps_flag = 0;
alt_flag = 0;
ctrl_flag = 0;
shift_flag = 0;
enable_irq(KB_IRQ);
......@@ -298,13 +298,13 @@ void KB_handler(void) {
case 0x1D : //ctrl pressed
ctrl_flag = 1;
ctrl_flag[visible_terminal] = 1;
send_eoi(KB_IRQ);
return;
case 0x9D : //ctrl released
ctrl_flag = 0;
ctrl_flag[visible_terminal] = 0;
send_eoi(KB_IRQ);
return;
......@@ -352,9 +352,10 @@ void KB_handler(void) {
// 0x15 = scancode for L
// check if ctrl-L is pressed
if(ctrl_flag && !shift_flag && pressed_key == 0x15)
if(ctrl_flag[visible_terminal] /*&& !shift_flag*/ && pressed_key == 0x15)
{
clear();
//clear();
clear_memory();
reset_cursor();
send_eoi(KB_IRQ);
return;
......@@ -384,6 +385,7 @@ void KB_handler(void) {
}
page_table[0xB8] = ((uint32_t)0xB8000) | USER | READ_WRITE | PRESENT;
flush_tlb();
//memcpy( (void*)TERM_VID, (const void*) terminal[visible_terminal].vid_mem, _4_KB );
......
......@@ -16,10 +16,10 @@
#define ASCII_SIZE 51
// keyboard modifier flags
uint8_t caps_flag;
uint8_t ctrl_flag;
uint8_t shift_flag;
uint8_t alt_flag;
uint8_t caps_flag;
uint8_t shift_flag;
uint8_t alt_flag;
uint8_t ctrl_flag[3];
volatile uint8_t enter_flag[3];
/************************ KB driver functions ************************/
......
......@@ -17,9 +17,31 @@ static char* video_mem = (char *)VIDEO;
* Function: Clears video memory */
void clear(void) {
int32_t i;
for (i = 0; i < NUM_ROWS * NUM_COLS; i++) {
*(uint8_t *)(video_mem + (i << 1)) = ' ';
*(uint8_t *)(video_mem + (i << 1) + 1) = ATTRIB;
*(uint8_t *)(video_mem + (i << 1) + 1) = ATTRIB;
}
}
void clear_memory(void)
{
int32_t i;
uint8_t * video_memory;
if(running_terminal == running_terminal)
video_memory = (uint8_t *) video_mem;
else
video_memory = (uint8_t *) terminal[visible_terminal].vid_mem;
for (i = 0; i < NUM_ROWS * NUM_COLS; i++) {
*(uint8_t *)(video_memory + (i << 1)) = ' ';
*(uint8_t *)(video_memory + (i << 1) + 1) = ATTRIB;
}
for (i = 0; i < NUM_ROWS * NUM_COLS; i++) {
*(uint8_t *)(terminal[visible_terminal].vid_mem + (i << 1)) = ' ';
*(uint8_t *)(terminal[visible_terminal].vid_mem + (i << 1) + 1) = ATTRIB;
}
}
......
......@@ -15,6 +15,7 @@ int8_t *itoa(uint32_t value, int8_t* buf, int32_t radix);
int8_t *strrev(int8_t* s);
uint32_t strlen(const int8_t* s);
void clear(void);
void clear_memory(void);
void reset_cursor(void);
void update_cursor(int32_t term_id);
int32_t get_screen_x(void);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment