Added input ability to BASIC
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
FOR A = 1 TO 10
|
PRINT "What's your name?"
|
||||||
PRINT A
|
INPUT $1
|
||||||
NEXT A
|
PRINT "Hello " ;
|
||||||
|
PRINT $1
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -1951,7 +1951,7 @@ do_input:
|
|||||||
.number_var:
|
.number_var:
|
||||||
mov ax, .tmpstring ; Get input from the user
|
mov ax, .tmpstring ; Get input from the user
|
||||||
mov bx, 6
|
mov bx, 6
|
||||||
call string_input
|
call keyboard_display_input
|
||||||
|
|
||||||
mov ax, .tmpstring
|
mov ax, .tmpstring
|
||||||
call string_length
|
call string_length
|
||||||
@@ -1981,7 +1981,7 @@ do_input:
|
|||||||
add ax, string_vars
|
add ax, string_vars
|
||||||
|
|
||||||
mov bx, 128
|
mov bx, 128
|
||||||
call string_input
|
call keyboard_display_input
|
||||||
|
|
||||||
call os_print_newline
|
call os_print_newline
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,12 @@ os_start_cli:
|
|||||||
mov si, prompt
|
mov si, prompt
|
||||||
call os_print_string
|
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
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------
|
; ------------------------------------------------
|
||||||
|
|||||||
@@ -13,13 +13,18 @@ os_read_input:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
; -------------------------------------------
|
; -------------------------------------------
|
||||||
|
; IN:
|
||||||
|
; AX = output address
|
||||||
|
; BX = max length
|
||||||
|
|
||||||
os_display_input:
|
keyboard_display_input:
|
||||||
pusha
|
pusha
|
||||||
|
mov di, ax
|
||||||
|
mov ax, bx ; Lazy TODO
|
||||||
mov cx, [prompt_length]
|
mov cx, [prompt_length]
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
call .check_key_pressed
|
jmp .check_key_pressed
|
||||||
|
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
@@ -49,7 +54,7 @@ os_display_input:
|
|||||||
mov al, 0
|
mov al, 0
|
||||||
stosb
|
stosb
|
||||||
popa
|
popa
|
||||||
call os_read_cli
|
ret ; Return to the parent function (whatever that may be)
|
||||||
|
|
||||||
.backspace:
|
.backspace:
|
||||||
call .move_cursor_back ; then .move_cursor_back
|
call .move_cursor_back ; then .move_cursor_back
|
||||||
@@ -66,9 +71,9 @@ os_display_input:
|
|||||||
int 10h
|
int 10h
|
||||||
|
|
||||||
dec di
|
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
|
stosb
|
||||||
|
|
||||||
mov ah, 0Eh
|
mov ah, 0Eh
|
||||||
|
|||||||
Reference in New Issue
Block a user