Fixed some bugs with inputs
This commit is contained in:
@@ -15,6 +15,7 @@ os_read_input:
|
||||
|
||||
; AX = key pressed
|
||||
; Returns straight away
|
||||
; carry flag is set when escape is pressed and data is returned straight away
|
||||
keyboard_check_key:
|
||||
xor ax,ax
|
||||
mov ah, 11h ; BIOS call to check for key
|
||||
@@ -27,11 +28,11 @@ keyboard_check_key:
|
||||
; IN:
|
||||
; AX = output address
|
||||
; BX = max length
|
||||
|
||||
keyboard_display_input:
|
||||
pusha
|
||||
mov di, ax
|
||||
mov ax, bx
|
||||
xor ax,ax
|
||||
mov [prompt_length], bx
|
||||
|
||||
.check_key_pressed:
|
||||
call os_read_input
|
||||
@@ -54,7 +55,9 @@ keyboard_display_input:
|
||||
jmp .check_key_pressed
|
||||
|
||||
.esc_key:
|
||||
call power_reboot
|
||||
stc
|
||||
popa
|
||||
ret
|
||||
|
||||
.enter_key:
|
||||
mov al, 0
|
||||
@@ -63,7 +66,7 @@ keyboard_display_input:
|
||||
ret ; Return to the parent function (whatever that may be)
|
||||
|
||||
.backspace:
|
||||
cmp bx, 20 ; Cannot backspace if the cursor is at the start
|
||||
cmp bx, [prompt_length] ; Cannot backspace if the cursor is at the start
|
||||
jb .move_cursor_back ; then .move_cursor_back
|
||||
jmp .check_key_pressed ; Else check the next key
|
||||
|
||||
@@ -86,6 +89,7 @@ keyboard_display_input:
|
||||
mov ah, 0Eh
|
||||
int 10h
|
||||
jmp .check_key_pressed
|
||||
.input_length db 0
|
||||
|
||||
keyboard_get_cursor_pos:
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user