Sunteți pe pagina 1din 3

DATA TRANSFER AND MANIPULATION (Cont.

):-
Shift Instructions:-
Shift instruction helps to shift the bits of an operand to the right or to the left. The direction of
shift is based on specific instructions. The operand is first loaded into the accumulator and then
the shift operation is performed bit by bit.
The shift-left operation shifts the zero into low-order vacated position.

In shift-right operations, zeros are shifted into high-order vacated position. The bits that are
shifted can also be the original value of the sign bit as in case of arithmetic right shift or can be
the bits that are shifted out of low-order position of the accumulator-extension as in case of
Rotate Right Accumulator and Extension (RRAE). The main purpose of this RRAE is to fetch
the bits from the accumulator-extension position 15 and shift the bits back to the accumulator
position 0. This ensures that no bits are lost during the shift.
The shift operation can be ended either by decrementing the shift count to zero or by shifting
the bit value of 1 into the high-order position (bit 0) of the accumulator.
In the above program,
1. .model specifies the mode for assembling the program.
2. DB allocates and initializes the bytes of storage.
3. Number1 DB 63H indicates the first number storage and Number2 DB 2EH indicates the
second number storage.
4. DW allocates and initializes the words of storage.
5. Result DW indicates that double byte is reserved for the result.
6. The instructions MOV AX, @data and MOV DS, AX initialize the data segment.
7. MOV AL, Number1 transfers the first number to AL.
8. ADD AL, Number2 adds the second number to AL.
9. MOV AH, 00H makes Most Significant Bit of result zero.
10. ADC AH, 00H puts carry in AH.
11. MOV Result, AX copies result to the memory.
PROGRAM CONTROL:-
Instructions of the computer are always stored in consecutive memory locations. These
instructions are fetched from successive memory locations for processing and executing. When
an instruction is fetched from the memory, the program counter is incremented by 1 so that it
points to the address of the next consecutive instruction in the memory. Once a data transfer
and data manipulation instruction is executed, the program control along with the program
counter, which holds the address of the next instruction to be fetched, is returned to the fetch
cycle.
Data transfer and manipulation instructions specify the conditions for data processing
operations, whereas the program control instructions specify the conditions that can alter the
content of the program counter. The change in the content of program counter can cause an
interrupt/break in the instruction execution. However, the program control instructions control
the flow of program execution and are capable of branching to different program segments.
Some of the program control instructions are listed in table 8.4.
The branch is a one-address instruction. It is represented as BR ADR, where ADR is a
mnemonic for an address. The branch instruction transfers the value of ADR into the program
counter. The branch and jump instructions are interchangeably used to mean the same.
However, sometimes they denote different addressing modes.
Branch and jump instructions can be conditional or unconditional. The unconditional branch
instruction creates a branch to the specified address without any conditions.

The conditional branch instructions such as ‘branch if positive’, or ‘branch if zero’ specify the
condition to transfer the flow of execution. When the condition is met, the branch address is
loaded in the program counter.
Figure 8.7 depicts the conditional branch instructions.

S-ar putea să vă placă și