|11111111将原串中的0变成1 &00000000 将原串中的1变成0
11111111B=00ffH 00000000B=0000H
Assemble:
assume cs:code,ds:datasg
datasg segment
db 'BaSiC'
db 'MinIX'
datase ends
codesg segment
start: mov ax,datasg
mov ds,ax
mov bx,0
mov cx,5
s: mov al,0[bx]
and al,11011111b //11011111b=DFh
mov [bx],al
mov al,5[bx]
or al,00100000b //00100000b=20h
mov 5[bx],al
inc bx
loop s
mov ax,4c00h
int 21h
codesg ends
end start
C:
char a[5]="BaSiC";
char b[5]="MinIX";
main(){
int i;
i=0;
do{
a[i]=a[i]&0xdf;
b[i]=b[i]|0x20;
i++;
}while(i<5)
}