Added port support, and removed things from BASIC_DEVELOPMENT it does not yet support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
; AX = key pressed
|
||||
; Waits until key is pressed before returning
|
||||
os_read_input:
|
||||
mov ah, 11h ; BIOS call to check for key
|
||||
int 16h ; Interrupt
|
||||
@@ -12,6 +13,16 @@ os_read_input:
|
||||
int 16h
|
||||
ret
|
||||
|
||||
; AX = key pressed
|
||||
; Returns straight away
|
||||
keyboard_check_key:
|
||||
xor ax,ax
|
||||
mov ah, 11h ; BIOS call to check for key
|
||||
int 16h ; Interrupt
|
||||
jz .no_key
|
||||
.no_key:
|
||||
xor ax,ax
|
||||
ret
|
||||
; -------------------------------------------
|
||||
; IN:
|
||||
; AX = output address
|
||||
@@ -23,11 +34,6 @@ keyboard_display_input:
|
||||
mov ax, bx
|
||||
mov bx,20
|
||||
|
||||
.loop:
|
||||
jmp .check_key_pressed
|
||||
|
||||
jmp .loop
|
||||
|
||||
.check_key_pressed:
|
||||
call os_read_input
|
||||
|
||||
@@ -43,7 +49,8 @@ keyboard_display_input:
|
||||
dec bx
|
||||
|
||||
cmp bx, 0
|
||||
jae .print_current_input ; Echo the user input back
|
||||
je .enter_key ; Once the limit is reached just enter it
|
||||
ja .print_current_input ; Echo the user input back
|
||||
|
||||
jmp .check_key_pressed
|
||||
|
||||
@@ -59,7 +66,7 @@ keyboard_display_input:
|
||||
.backspace:
|
||||
cmp bx, 20 ; Cannot backspace if the cursor is at the start
|
||||
jb .move_cursor_back ; then .move_cursor_back
|
||||
jmp .loop ; Else .loop
|
||||
jmp .check_key_pressed ; Else check the next key
|
||||
|
||||
.move_cursor_back:
|
||||
mov ah, 0Eh
|
||||
@@ -73,7 +80,7 @@ keyboard_display_input:
|
||||
|
||||
inc bx
|
||||
dec di
|
||||
jmp .loop
|
||||
jmp .check_key_pressed
|
||||
|
||||
.print_current_input: ; Echo back that character and return the key inputing
|
||||
stosb
|
||||
@@ -81,9 +88,9 @@ keyboard_display_input:
|
||||
int 10h
|
||||
jmp .check_key_pressed
|
||||
|
||||
keyboard_get_cursor_pos: ;TODO
|
||||
keyboard_get_cursor_pos:
|
||||
ret
|
||||
keyboard_wait_for_key: ;TODO
|
||||
keyboard_wait_for_key:
|
||||
ret
|
||||
keyboard_show_cursor:
|
||||
ret
|
||||
@@ -91,5 +98,3 @@ keyboard_hide_cursor:
|
||||
ret
|
||||
keyboard_move_cursor:
|
||||
ret
|
||||
keyboard_check_key:
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user