![]() |
#2
chenwei4352011-11-02 20:25
一个输入字符串,然后倒序输出程序(enter键结束)
|

DATAS SEGMENT
str db 50 dup (?)
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
mov cx,50
mov bx,0
loops: mov ah,1h
int 21h
cmp al,13
jz exit
mov [str+bx],al
inc bx
loop loops
exit: mov [str+bx],'a'
mov [str+bx+1],'$'
lea dx,str
mov ah,9h
int 21h
MOV AH,4CH
INT 21H
CODES ENDS
END START
str db 50 dup (?)
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
mov cx,50
mov bx,0
loops: mov ah,1h
int 21h
cmp al,13
jz exit
mov [str+bx],al
inc bx
loop loops
exit: mov [str+bx],'a'
mov [str+bx+1],'$'
lea dx,str
mov ah,9h
int 21h
MOV AH,4CH
INT 21H
CODES ENDS
END START