confusion in asembly language
Posted: Thu Dec 06, 2007 12:21 am
i am trying to display a string entered by the user but it is not giving any ouptut. plz help.
i dont know the code for the enter key so i have used '+' instead
i have made
Print : for displaying a string using int 10h
GET_CHAR : for netering a character
COM1 : for moving COMMAND (the string to be displayed) into si and to call Print
and finally the start:
please point out any other errors if any....
i dont know the code for the enter key so i have used '+' instead
i have made
Print : for displaying a string using int 10h
GET_CHAR : for netering a character
COM1 : for moving COMMAND (the string to be displayed) into si and to call Print
and finally the start:
Code: Select all
jmp start
Print:
lodsb
or al, al
jz PrintDone
mov ah, 0eh
int 10h
jmp Print
PrintDone:
ret
GET_CHAR:
MOV AH,00
INT 0x16 ;character is stored in AL register
RET
COM1 : ; this procedure moves COMMAND into si and displays it using Print
xor si,si
mov si,COMMAND
CALL Print
ret
start:
xor si,si
mov cx,0000H
LBL1 :
CALL GET_CHAR ;call get_char to enter a character
CMP AL,'+' ;i dont know the code for enter so written '+' instead
JE LBL2 ;if '+' has been entered the string is over
inc cx
mov BYTE[si],al ;else store the next character in COMMAND
call Print :to display the character entered
inc si
jmp LBL1
LBL2 :
mov BYTE[si],0 ;make last character 0
inc cl
sub si,cl
mov di,[COMMAND] ;copy the string from si to COMMAND
mov [di],si
call COM1
jmp $
COMMAND db 0