getting input with nasm
Posted: Mon Jan 06, 2014 12:21 am
so here is the source code for my os:
my problem is, i now want to be able to get a command, or at the very least some text from the user. i have googled it but im not too sure how to get an unknown number of characters in nasm, only that it seems to require the interrupt 21h
Code: Select all
BITS 16
start:
mov ax, 07C0h
add ax, 288
mov ss, ax
mov sp, 4096
mov ax, 07C0h
mov ds, ax
call Terminal
jmp $
Terminal:
input resd 1 ; reserved for storing the command
call Prompt
call GetCommand
jmp Terminal
GetCommand:
int 21h
Prompt:
mov si, prompt
call Print
prompt db "$> ", 0
Print:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
ret
times 510-($-$$) db 0
dw 0xAA55