<xmp> &lt;Br/&gt; and: logic and command &lt;br/&gt; or: logic or command &lt;br/&gt; XOR: logic difference or command &lt;br/&gt; not: logical non-instruction &lt;br/&gt; </xmp>
This is exactly the same as the logic commands of Delphi.
// Logical non-not: {not 1 = 0; not 0 = 1;} var bytenum: byte; begin // assign a value of 111111b (255); reverse: ASM mov Al, 11111111b {eax contains ax; ax contains al; Al is the low eight bits of eax} Not Al {returns 11111111} mov bytenum to the 00000000 reverse, al {give the value in register Al to the variable bytenum} end; showmessage (inttostr (bytenum); {0} // assign a value of 1B (1) to get the inverse: ASM mov Al, 00000001} mov bytenum, Al end; showmessage (inttostr (bytenum); {11111110} // returns the inverse value of 254 B (128: ASM mov Al, 00000001b not Al {returns 10000000} mov bytenum, Al end; showmessage (inttostr (bytenum); {01111111} end;
// Logic or: {1 or 0 = 1; 0 or 1 = 1; 1 or 1 = 1; 0 or 0 = 0;} var bytenum: byte; begin ASM mov Al, 10101010b {170} mov Cl, 01010101b {85} or Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum); {255} end;
// Logic and And: {1 and 1 = 1; 1 and 0 = 0; 0 and 1 = 0; 0 and 0 = 0;} var bytenum: byte; begin // Example 1 ASM mov Al, 111111b {255} mov Cl, 11111111b {255} and Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {255} // Example 2 ASM mov Al, 1_1_ B {0} mov Cl, 1_ B {0} and Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {0} // Example 3 ASM mov Al, 111111b {255} mov Cl, 1_ B {0} and Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {0} // Example 4 ASM mov Al, 10101010b {170} mov Cl, 01010101b {85} and Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {0} end;
// Logic or XOR: {1 XOR 0 = 1; 0 XOR 1 = 1; 1 XOR 1 = 0; 0 XOR 0 = 0;} var bytenum: byte; begin // Example 1 ASM mov Al, 111111b {255} mov Cl, 111111b {255} XOR Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {0} // Example 2 ASM mov Al, 111111b {255} mov Cl, 1_ B {0} XOR Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {255} // Example 3 ASM mov Al, 10101010b {170} mov Cl, 01010101b {85} XOR Al, CL mov bytenum, Al end; showmessage (inttostr (bytenum )); {255} end;