Use IRQ 1 to get information from the keyboard instead of polling

This commit is contained in:
Baptiste Wicht 2013-10-18 23:06:19 +02:00
parent 147dfc2374
commit a5293ac79f
3 changed files with 41 additions and 21 deletions

View File

@ -205,6 +205,13 @@ install_irqs:
ret ret
; r8 = irq
; r9 = handler address
register_irq_handler:
mov [irq_handlers + r8 * 8], r9
ret
; Data structures ; Data structures
; each idt entry is form like that: ; each idt entry is form like that:

View File

@ -100,6 +100,8 @@ lm_start:
; Enter the shell ; Enter the shell
call shell_start call shell_start
jmp $
; Includes ; Includes
%include "src/utils/macros.asm" %include "src/utils/macros.asm"

View File

@ -15,8 +15,18 @@ shell_start:
mov r9, command_line_length mov r9, command_line_length
call print_normal call print_normal
.start_waiting: mov r8, 1
call key_wait mov r9, key_entered
call register_irq_handler
ret
key_entered:
in al, 0x60
mov dl, al
and dl, 10000000b
jnz .end_handler
; ENTER key ; ENTER key
cmp al, 28 cmp al, 28
@ -39,8 +49,7 @@ shell_start:
inc r13 inc r13
mov [current_column], r13 mov [current_column], r13
; Wait for the next key again jmp .end_handler
jmp .start_waiting
.new_command: .new_command:
call goto_next_line call goto_next_line
@ -133,7 +142,9 @@ shell_start:
mov r9, command_line_length mov r9, command_line_length
call print_normal call print_normal
jmp .start_waiting .end_handler:
ret
; Variables ; Variables