mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-18 17:15:09 -04:00
Use IRQ 1 to get information from the keyboard instead of polling
This commit is contained in:
parent
147dfc2374
commit
a5293ac79f
@ -205,6 +205,13 @@ install_irqs:
|
||||
|
||||
ret
|
||||
|
||||
; r8 = irq
|
||||
; r9 = handler address
|
||||
register_irq_handler:
|
||||
mov [irq_handlers + r8 * 8], r9
|
||||
|
||||
ret
|
||||
|
||||
; Data structures
|
||||
|
||||
; each idt entry is form like that:
|
||||
|
@ -100,6 +100,8 @@ lm_start:
|
||||
; Enter the shell
|
||||
call shell_start
|
||||
|
||||
jmp $
|
||||
|
||||
; Includes
|
||||
|
||||
%include "src/utils/macros.asm"
|
||||
|
@ -15,8 +15,18 @@ shell_start:
|
||||
mov r9, command_line_length
|
||||
call print_normal
|
||||
|
||||
.start_waiting:
|
||||
call key_wait
|
||||
mov r8, 1
|
||||
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
|
||||
cmp al, 28
|
||||
@ -39,8 +49,7 @@ shell_start:
|
||||
inc r13
|
||||
mov [current_column], r13
|
||||
|
||||
; Wait for the next key again
|
||||
jmp .start_waiting
|
||||
jmp .end_handler
|
||||
|
||||
.new_command:
|
||||
call goto_next_line
|
||||
@ -133,7 +142,9 @@ shell_start:
|
||||
mov r9, command_line_length
|
||||
call print_normal
|
||||
|
||||
jmp .start_waiting
|
||||
.end_handler:
|
||||
|
||||
ret
|
||||
|
||||
; Variables
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user