食野苹

大写小写互换

小写转大写
data segment

buffer db 'HoW are YoU!',0
data ends

code segment
assume cs:code,ds:data
main:
mov ax,data
mov ds,ax
mov si, offset buffer

again: mov al,[si]
 or al,al
 jz ok
 cmp al,'a'
 jc next
 cmp al,'z'
 jnc next
 sub al,20h
 mov [si],al

next:  mov dl, al;每处理一个显示一个字符
  mov ah, 2
  int 21h
  inc si
        jmp again

ok: mov ah,4Ch;终止当前程序并返回调用程序
 int 21h

code ends
end main

 

大写转小写
data segment

buffer db 'HoW are YoU!',0
data ends

code segment
assume cs:code,ds:data
main:
mov ax,data
mov ds,ax
mov si, offset buffer

again: mov al,[si]
 or al,al
 jz ok
 cmp al,'A'
 jc next
 cmp al,'Z'
 jnc next
 add al,20h
 mov [si],al

next:  mov dl, al;每处理一个显示一个字符
  mov ah, 2
  int 21h
  inc si
        jmp again

ok: mov ah,4Ch;终止当前程序并返回调用程序
 int 21h

code ends
end main

posted on 2011-07-27 15:55  nyc1893  阅读(348)  评论(0编辑  收藏  举报