data segment string1 db 'From China to Peru $' len1 equ $-string1 string2 db 'As Cood as ItGets $' len2 equ $-string2 crlf db 0dh,0ah,'$' data ends
stack segment para stack 'stack' dw 256 dup(?) stack ends
code segment assume cs:code,ds:data main proc far mov ax,data mov ds,ax lea si,string1 mov cx,len1 call convert call prints lea si,crlf call prints lea si,string2 mov cx,len2 call convert call prints mov ah,4ch int 21h main endp
convert proc near push ax lop: mov al,[si] cmp al,'a' jb next cmp al,'z' ja next sub al,20h mov [si],al next: inc si loop lop pop ax ret convert endp
prints proc near push dx push ax mov dx,si mov ah,9 int 21h pop ax pop dx ret prints endp code ends end main 这是将两个字符串string1,string2中的小写字母全部转换成大写字母,并显示出来。 我不能得出正确的结果。还请帮忙改下。