使用匯編編程,可以直接訪問內存中的數據,對數據進行相關操作,現在需要通過匯編指令and,or對字符串數據進行大小寫轉換。如下例,將BaSiC轉換成大寫,將iNforMaTiOn轉換成小寫。
例子:
assume cs:codesg,ds:datasg
datasg segment
db 'BaSiC'
db 'iNforMaTiOn'
datasg ends
codesg segment
start: mov ax,datasg
mov ds,ax
mov cx,5
mov bx,0
s1: mov al,ds:[bx]
and al,11011111b
mov ds:[bx],al
inc bx
loop s1
mov cx,11
mov bx,5
s2: mov al,ds:[bx]
or al,00100000b
mov ds:[bx],al
inc bx
loop s2
mov ax,4c00h
int 21h
codesg ends
end start
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持html5模板網。
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!