Hi,
I am using NASM and I am having a problem finding the correct instruction to capture string (more than one character) data from the keyboard.

I can capture int data (read_int) or even one character with get_kb

Any help would be appreciated.
Thanks

Call your single key routine in a loop until
- the buffer where you're storing the string becomes full
- some previously determined character (say newline) is received.

Thanks for your reply. So, there is not a readstring command?

Thanks for your reply. So, there is not a readstring command?

Nope -- in assembly language you have to roll your own. You can use C library functions, but that would defeat the purpose of you writing assembly language.

what is actually stored in the label of buffer?

when i run this code, it takes only 5 inputs.
how should i make it to take inputs untill i press "enter key"?


org 0x0100

xor ax,ax
xor dx,dx

;print a string
mov dx,ask
mov ah,9h
int 21h

;read and display a character
mov cx,0ah
mov si,getname

loop1:
mov ah,1h
int 21h

cmp al,0dh
je loop2

mov [si],al
inc si
loop loop1

loop2:
mov ah,9h
mov dx,name
int 21h


mov ax,0x4c00
int 21h

ask: db 'Enter data:$'
name: db 0dh,0ah
getname: db '$$$$$$$$$$$$$$'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.