assembly - How to remove return key when printing -
i trying users name , display greeting, how can remove return key displays greeting on next line?
output this:
hello! name how you?
i need be:
hello! name how you?
.
lea dx, [ansname] ;get name mov ah, 0ah int 21h mov byte [ansname], 19h ; initialize name 25 chars max call clrscr lea dx, [greet] mov ah, 09h int 21h lea dx, [ansname+2] mov ah, 09h int 21h lea dx, [greet2] mov ah, 09h int 21h section .data nextline db 0dh, 0ah, "$" ansname times 25 db "$",0dh, 0ah,"$" greet db "hello!",0dh,0ah,"$" greet2 db "how you?",0dh,0ah,"$"
you need write max value before calling dos service!
lea dx, [ansname] ;get name mov byte [ansname], 19h ; initialize name 25 chars max mov ah, 0ah int 21h
setup input buffer without carriage return , linefeed codes.
ansname times 2+25 db "$"
remove carriage return , linefeed codes greet message , add space after text.
greet db "hello! ", "$"
add space before greet2 message.
greet2 db " how you?",0dh,0ah,"$"
before can print name have remove carriage return (0dh) dos appended result.
mov bl, [ansname+1] mov bh, 0 mov byte [ansname+2+bx], "$" lea dx, [ansname+2] mov ah, 09h int 21h
Comments
Post a Comment