outputstring macro x
push ax
push dx
mov ah,9
mov dx,offset x
int 21h ;
pop dx
pop ax
endm
inputstring macro x
push ax
push dx
mov ah,0ah
mov dx,offset x
int 21h ;
pop dx
pop ax
endm
display struc ;struc
ex1 db 20,0,20 dup('$') ;ex1
display ends
assume cs:code,ds:data
data segment
stu_temp display<>
question db "please input a string:",'$'
data ends
code segment
start:
mov ax,data
mov ds,ax
outputstring question
inputstring stu_temp.ex1
call next_line
outputstring stu_temp.ex1+2
mov ah,2
mov dl,9
int 21h ;ascii(9)=tab
outputstring stu_temp.ex1+2
mov ah,2
mov dl,9
int 21h ;ascii(9)=tab
outputstring stu_temp.ex1+2
mov ax,4c00h
int 21h
next_line:
push dx
push ax
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
int 21h
pop ax
pop dx
ret
code ends
end start
I think the result should be
xxxxx(your input) "tab" xxxxx(your input) "tab" xxxxx(your input)
for example,
input thank,
it should output "thank thank thank"
but i got this
i am confused for 2days
what is the solution to this problem? Any help is appreciated
what is the solution to this problem? Any help is appreciated
Like @Michael Petch said,
Int 21h/ah=0ah
read a string, the string returned includes the carriage return (0dh)
So use
mov bl, [x+1]
mov bh, 0
mov [x+2+bx], '$'