diff --git a/data/hello.bas b/data/hello.bas index fe8118b..9aa0273 100644 --- a/data/hello.bas +++ b/data/hello.bas @@ -1,4 +1,5 @@ -FOR A = 1 TO 10 -PRINT A -NEXT A +PRINT "What's your name?" +INPUT $1 +PRINT "Hello " ; +PRINT $1 END diff --git a/source/kernel/features/basic.asm b/source/kernel/features/basic.asm index e7fd7f0..4df9eca 100644 --- a/source/kernel/features/basic.asm +++ b/source/kernel/features/basic.asm @@ -1951,7 +1951,7 @@ do_input: .number_var: mov ax, .tmpstring ; Get input from the user mov bx, 6 - call string_input + call keyboard_display_input mov ax, .tmpstring call string_length @@ -1981,7 +1981,7 @@ do_input: add ax, string_vars mov bx, 128 - call string_input + call keyboard_display_input call os_print_newline diff --git a/source/kernel/features/cli.asm b/source/kernel/features/cli.asm index d514a6a..aa4e37b 100644 --- a/source/kernel/features/cli.asm +++ b/source/kernel/features/cli.asm @@ -6,11 +6,12 @@ os_start_cli: mov si, prompt call os_print_string - mov ax, 20 + mov bx, 20 - mov di, user_input + mov ax, user_input - call os_display_input + call keyboard_display_input + jmp os_read_cli ; ------------------------------------------------ diff --git a/source/kernel/features/keyboard.asm b/source/kernel/features/keyboard.asm index 330d19e..18f75e2 100644 --- a/source/kernel/features/keyboard.asm +++ b/source/kernel/features/keyboard.asm @@ -13,13 +13,18 @@ os_read_input: ret ; ------------------------------------------- +; IN: +; AX = output address +; BX = max length -os_display_input: +keyboard_display_input: pusha + mov di, ax + mov ax, bx ; Lazy TODO mov cx, [prompt_length] .loop: - call .check_key_pressed + jmp .check_key_pressed jmp .loop @@ -49,7 +54,7 @@ os_display_input: mov al, 0 stosb popa - call os_read_cli + ret ; Return to the parent function (whatever that may be) .backspace: call .move_cursor_back ; then .move_cursor_back @@ -66,9 +71,9 @@ os_display_input: int 10h dec di - jmp os_display_input + jmp keyboard_display_input - .print_current_input: + .print_current_input: ; Echo back that character and return the key inputing stosb mov ah, 0Eh