使用匯編編程,可以直接訪問內(nèi)存中的數(shù)據(jù),對(duì)數(shù)據(jù)進(jìn)行相關(guān)操作,現(xiàn)在需要通過匯編指令and,or對(duì)字符串?dāng)?shù)據(jù)進(jìn)行大小寫轉(zhuǎn)換。如下例,將BaSiC轉(zhuǎn)換成大寫,將iNforMaTiOn轉(zhuǎn)換成小寫。
例子:
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
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持html5模板網(wǎng)。
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!