Global _start must be declared for using gcc The following program illustrates this − Example If this is 1, the number is odd, else the number is even.Īssuming the number is in AL register, we can write − If you want to check whether a given number is odd or even, a simple test would be to check the least significant bit of the number. If you need to clear the high-order bits to zero, you AND it with 0FH. For example, say the BL register contains 0011 1010. The AND operation can be used for clearing one or more bits. The bitwise AND operation returns 1, if the matching bits from both the operands are 1, otherwise it returns 0. The AND instruction is used for supporting logical expressions by performing bitwise AND operation. These instructions compare or match bits of the operands and set the CF, OF, PF, SF and ZF flags. However, memory-to-memory operations are not possible. The second operand could be either in register/memory or an immediate (constant) value. The first operand in all the cases could be either in register or in memory. The format for these instructions − Sr.No. The processor instruction set provides the instructions AND, OR, XOR, TEST, and NOT Boolean logic, which tests, sets, and clears the bits according to the need of the program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |