Added input ability to BASIC

This commit is contained in:
deadvey
2026-02-09 21:59:35 +00:00
parent e4fc63134f
commit 26ee45eb88
4 changed files with 20 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
; ------------------------------------------------

View File

@@ -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