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

fixed ctrl L

parent d4dbe141
No related branches found
No related tags found
No related merge requests found
...@@ -146,10 +146,10 @@ void KB_init(void) { ...@@ -146,10 +146,10 @@ void KB_init(void) {
// initialize modifier flags // initialize modifier flags
enter_flag[0] = enter_flag[1] = enter_flag[2] = 0; enter_flag[0] = enter_flag[1] = enter_flag[2] = 0;
ctrl_flag[0] = ctrl_flag[1] = ctrl_flag[2] = 0;
caps_flag = 0; ctrl_flag = 0;
alt_flag = 0; caps_flag = 0;
alt_flag = 0;
shift_flag = 0; shift_flag = 0;
enable_irq(KB_IRQ); enable_irq(KB_IRQ);
...@@ -298,13 +298,13 @@ void KB_handler(void) { ...@@ -298,13 +298,13 @@ void KB_handler(void) {
case 0x1D : //ctrl pressed case 0x1D : //ctrl pressed
ctrl_flag[visible_terminal] = 1; ctrl_flag = 1;
send_eoi(KB_IRQ); send_eoi(KB_IRQ);
return; return;
case 0x9D : //ctrl released case 0x9D : //ctrl released
ctrl_flag[visible_terminal] = 0; ctrl_flag = 0;
send_eoi(KB_IRQ); send_eoi(KB_IRQ);
return; return;
...@@ -350,16 +350,6 @@ void KB_handler(void) { ...@@ -350,16 +350,6 @@ void KB_handler(void) {
pressed_key = scan_to_key_name(SCANCODE, scanCode); pressed_key = scan_to_key_name(SCANCODE, scanCode);
} }
// 0x15 = scancode for L
// check if ctrl-L is pressed
if(ctrl_flag[visible_terminal] /*&& !shift_flag*/ && pressed_key == 0x15)
{
//clear();
clear_memory();
reset_cursor();
send_eoi(KB_IRQ);
return;
}
if(alt_flag && !shift_flag) if(alt_flag && !shift_flag)
{ {
...@@ -387,15 +377,20 @@ void KB_handler(void) { ...@@ -387,15 +377,20 @@ void KB_handler(void) {
page_table[0xB8] = ((uint32_t)0xB8000) | USER | READ_WRITE | PRESENT; page_table[0xB8] = ((uint32_t)0xB8000) | USER | READ_WRITE | PRESENT;
flush_tlb(); flush_tlb();
//memcpy( (void*)TERM_VID, (const void*) terminal[visible_terminal].vid_mem, _4_KB ); // 0x15 = scancode for L
// check if ctrl-L is pressed
if(ctrl_flag && !shift_flag && !alt_flag && pressed_key == 0x15)
{
clear();
reset_cursor();
//update_cursor(visible_terminal); if(terminal[visible_terminal].pcb->shell_flag)
printf("391OS> ");
// if(terminal_switch_return == 0) remap2(running_terminal);
// { send_eoi(KB_IRQ);
// send_eoi(KB_IRQ); return;
// execute((uint8_t *)"shell"); }
// }
// handle unknown keys by not printing // handle unknown keys by not printing
switch (pressed_key) switch (pressed_key)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
uint8_t caps_flag; uint8_t caps_flag;
uint8_t shift_flag; uint8_t shift_flag;
uint8_t alt_flag; uint8_t alt_flag;
uint8_t ctrl_flag[3]; uint8_t ctrl_flag;
volatile uint8_t enter_flag[3]; volatile uint8_t enter_flag[3];
/************************ KB driver functions ************************/ /************************ KB driver functions ************************/
......
...@@ -24,27 +24,6 @@ void clear(void) { ...@@ -24,27 +24,6 @@ void clear(void) {
} }
} }
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;
}
}
/* https://wiki.osdev.org/Text_Mode_Cursor /* https://wiki.osdev.org/Text_Mode_Cursor
* void update_cursor(void); * void update_cursor(void);
* Inputs: void * Inputs: void
......
...@@ -15,7 +15,6 @@ int8_t *itoa(uint32_t value, int8_t* buf, int32_t radix); ...@@ -15,7 +15,6 @@ int8_t *itoa(uint32_t value, int8_t* buf, int32_t radix);
int8_t *strrev(int8_t* s); int8_t *strrev(int8_t* s);
uint32_t strlen(const int8_t* s); uint32_t strlen(const int8_t* s);
void clear(void); void clear(void);
void clear_memory(void);
void reset_cursor(void); void reset_cursor(void);
void update_cursor(int32_t term_id); void update_cursor(int32_t term_id);
int32_t get_screen_x(void); int32_t get_screen_x(void);
......
...@@ -206,6 +206,9 @@ int32_t execute(const uint8_t* command){ ...@@ -206,6 +206,9 @@ int32_t execute(const uint8_t* command){
terminal[running_terminal].pcb = pcb_ptr; terminal[running_terminal].pcb = pcb_ptr;
if(strncmp("shell", parsed_cmd, 5) == 0)
terminal[running_terminal].pcb->shell_flag = 1;
//printf("[EXE] using pcb = %x\n", terminal[running_terminal].pcb); //printf("[EXE] using pcb = %x\n", terminal[running_terminal].pcb);
//printf("[EXE] set pcb ebp to %x , esp to %x\n", terminal[running_terminal].pcb->current_ebp, terminal[running_terminal].pcb->current_esp); //printf("[EXE] set pcb ebp to %x , esp to %x\n", terminal[running_terminal].pcb->current_ebp, terminal[running_terminal].pcb->current_esp);
......
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