// 邏輯與 And:{
1 and 1 = 1;
1 and 0 = 0;
0 and 1 = 0;
0 and 0 = 0;
}
var
ByteNum: Byte;
begin
//例 1asm
mov al, 11111111B {255}
mov cl, 11111111B {255}
and al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {255}
//例2asm
mov al, 00000000B {0}
mov cl, 00000000B {0}
and al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {0}
//例3asm
mov al, 11111111B {255}
mov cl, 00000000B {0}
and al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {0}
//例 4asm
mov al, 10101010B {170}
mov cl, 01010101B {85}
and al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {0}
end;
//邏輯異或 Xor:{
1 Xor 0 = 1;
0 Xor 1 = 1;
1 Xor 1 = 0;
0 Xor 0 = 0;
}
var
ByteNum: Byte;
begin
//例1asm
mov al, 11111111B {255}
mov cl, 11111111B {255}
xor al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {0}
//例2asm
mov al, 11111111B {255}
mov cl, 00000000B {0}
xor al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {255}
//例 3asm
mov al, 10101010B {170}
mov cl, 01010101B {85}
xor al, cl
mov ByteNum, al
end;
ShowMessage(IntToStr(ByteNum)); {255}
end;