分析:
‘a’=1010001
‘A’=1000001
当第五位为1时是小写,为0位大写
小写转大写用到按位与运算
;小写转大写 assume cs:code,ds:data data segment db 'BaSic' data ends code segment start: mov ax,data mov ds,ax mov cx,5 mov bx,0 s: mov al,[bx] and al,11011111b mov [bx],al inc bx loop s mov ax,4c00h int 21h code ends end start
大写转小写用到按位或运算
;大写转小写 assume cs:code,ds:data data segment db 'BaSic' data ends code segment start: mov ax,data mov ds,ax mov cx,5 mov bx,0 s: mov al,[bx] or al,00100000b mov [bx],al inc bx loop s mov ax,4c00h int 21h code ends end start
将第一个字符串转为小写,第二个字符串转为大写
;将第一个字符串转为小写,第二个字符串转为大写 assume cs:code,ds:data data segment db 'Basic' db 'MinIX' data ends code segment start: mov ax,data mov ds,ax mov cx,5 mov bx,0 s: mov al,[bx] and al,11011111b mov [bx],al mov al,[bx+5]; mov al,5[bx] or al,00100000b mov [bx+5],al inc bx loop s mov ax,4c00h int 21h code ends end start