Input in Assembly Language

assemblyemulationinput

I've got some problems with Assembly Language.
The user have to enter some number from keyboard and then i'm going to do some operations with that number.
Is it ok to use this:

LEA DX ,SIZE;before in SEGMENT "DATA": SIZE DB 7
MOV AH,9
INT 21H 

So,answer me,please,will this work,if not give an example,please.And where this number will be stored? In AX?
Thanks.
P.S.
I'm writting on emu8086.

Best Answer

According to your sample code you need the answer for the old DOS. As mentioned in a comment of Robert Harvey, the function 09 of interrupt 21h is for the output. The function 0Ah is responsible for the input. Here's a sample code taken from my other recent answer:

.data
Mystr   db  'sssssssdsdsdsdsdsdsdddddddddddddd'  ;reserve some space for the input
;some other data
.code
;... some code
mov ax, @data  ;this line may depend on actual assembler (works with MASM, check for exact syntax of your assembler if it doesn't work for you)
mov ds, ax
mov dx, Mystr ; now ds:dx is pointing to Mystr string
              ; some assemblers accept mov dx, offset Mystr or similar syntax
mov ah, 0Ah ; Function 0Ah
    int 21h     ;invoke the DOS function, which reads the input from the keyboard and saves it into Mystr