SBN

Logical Instructions

Introduction

This article defines logical instructions as executed by x86 processors. It goes on to describe four key classifications of logical instructions in brief.

This article is designed for students and professionals who want to gain a detailed understanding of logical instructions, their classifications and how they’re used. Through the use of an 8086 emulator, this article will give you a better understanding of logical instructions, its syntax and in some cases, memory flow during execution.

Logical instructions in x86

The logical instructions define the set of operations performed by the processor Arithmetic Logic Unit (ALU). This article will discuss only the four key operations of logical instructions: AND, OR, XOR and NOT.

Basic format of instructions

Table 1: Logical Instructions and their basic formats

 

The first operand in most cases refers to a register or memory. The second operand could be either in a register, memory or a constant value.

AND instruction

The AND instruction is used for performing operations on bits. 

Table 2: Possible binary states for two inputs

 

Figure 1: AND logic has an OFF state when both inputs are OFF

 

Figure 2: AND logic has an OFF state when either of the inputs are OFF

 

Figure 3: AND logic has an OFF state when either of the inputs is OFF

 

Figure 4: AND logic has an ON state only when both inputs are ON

 

Table 3: Output of AND logic with two inputs

 

Following from figures 1 to 4, it can be summarized that the bitwise AND operation returns 1 if the matching bits from both inputs or operands are 1. Otherwise, it returns 0.

Example 1

  • MOV AX, 10100011b ; Copy the binary value 10100011 to the accumulator

*** This is a Security Bloggers Network syndicated blog from Infosec Resources authored by Richard Azu. Read the original post at: http://feedproxy.google.com/~r/infosecResources/~3/v4G3s5vpjy8/

Avatar photo

Richard Azu

Richard has over 16 years of experience in Network/Telecom Engineering. Experienced in the deployment of voice and data over the 3 media; radio, copper and fibre, Richard – a system support technician currently with First National Bank Ghana Limited is still looking for ways to derive benefit from the WDM technology in Optics. Using Kali as a springboard, he has developed an interest in digital forensics and penetration testing.

richard-azu has 12 posts and counting.See all posts by richard-azu