datasegment
buffdb 255;缓冲区,用于存放字符串
db ?
db 255 dup (?)
crlfdb 0ah, 0dh, "$";回车换行
dataends
code segment
assume ds:data, cs:code
start:
movax, data;取数据段存入ds中
movds, ax
leadx, buff;输入字符串到buff
movah, 0ah
int21h
leadx, crlf;输出回车换行
movah, 9h
int21h
leasi, buff + 2h;取字符串地址到si中
movcl, buff + 1h;取字符个数到cl中
next:
cmpcl, 0h
jefinish
movdl, byte ptr [si];输出一个字符
movah, 2h
int21h
deccl;计数器减1
incsi
jmpnext
finish:
movah, 4ch
int21h
codeends
end start