汇编 输入输出字符串(最简单版)
data segment max_len db 10 real_len db ? buf_str db 10 dup(0) CRLF DB 0AH,0DH,"$"; data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax xor ax,ax mov dx,offset max_len;输入 mov ah,10 int 21h mov bx,offset buf_str;去掉输入的最后一个回车字符,避免遮住已显示字符 add bl,real_len adc bh,0 mov byte ptr[bx],20h
mov dx,offset CRLF
mov ah,09
int 21h
mov dx,offset buf_str;输出字符串 mov ah,09 int 21h mov ax,4c00h int 21h code ends end start