Table of contents |
|
Machine Instructions |
|
Machine instructions used in 8086 microprocessor |
|
Addressing Modes |
|
Important Terms |
|
Different Addressing Modes Used by 8086 |
|
Branch Related addressing modes |
|
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Machine Instructions are commands or programs written in machine code of a machine (computer) that it can recognize and execute.
Machine code or machine language is a set of instructions executed directly by a computer’s central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.
The general format of machine instruction is
Example:
1. Data transfer instructions– move, load exchange, input, output.
2. Arithmetic instructions – add, subtract, increment, decrement, convert byte/word and compare.
3. Logic instructions – AND, OR, exclusive OR, shift/rotate and test
5. String manipulation instruction – load, store, move, compare and scan for byte/word
6. Control transfer instructions – conditional, unconditional, call subroutine and return from subroutine.
7. Loop control instructions-
8. Processor control instructions-
Flag manipulation:
Consider the sequence of machine instructions given below:
MUL R5, R0, R1
DIV R6, R2, R3
ADD R7, R5, R6
SUB R8, R7, R4
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the Result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________
(A) 11
(B) 12
(C) 13
(D) 14
Answer: (C)
Explanation:
The term addressing modes refers to the way in which the operand of an instruction is specified. The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.
Addressing modes for 8086 instructions are divided into two categories:
1) Addressing modes for data
2) Addressing modes for branch
The 8086 memory addressing modes provide flexible access to memory, allowing you to easily access variables, arrays, records, pointers, and other complex data types. The key to good assembly language programming is the proper use of memory addressing modes.
An assembly language program instruction consists of two parts
The memory address of an operand consists of two components:
According to different ways of specifying an operand by 8086 microprocessor, different addressing modes are used by 8086.
Addressing modes used by the 8086 microprocessor are discussed below:
Note: Useful for stepping through arrays in a loop. R2 – start of array d – size of an element.
Note: Auto decrement mode is same as auto increment mode. Both can also be used to implement a stack as push and pop . Auto increment and Auto decrement modes are useful for implementing “Last-In-First-Out” data structures.
Note: Suppose the register BX contain 0301. The offset will be 0301+05=0306. Content of the memory location 0306 will move to AL.
Example. Match each of the high level language statements given on the left hand side with the most natural addressing mode from those listed on the right hand side.
1. A[1] = B[J]; a. Indirect addressing
2. while [*A++]; b. Indexed addressing
3. int temp = *x; c. Autoincrement
(A) (1, c), (2, b), (3, a)
(B) (1, a), (2, c), (3, b)
(C) (1, b), (2, c), (3, a)
(D) (1, a), (2, b), (3, c)
Answer: (C)
Explanation:
Hence (C) is the correct solution.
1. What are machine instructions? | ![]() |
2. What are addressing modes in the 8086 microprocessor? | ![]() |
3. What are the important terms related to machine instructions and addressing modes? | ![]() |
4. What are the different addressing modes used by the 8086 microprocessor for branch-related instructions? | ![]() |
5. Why is knowledge of machine instructions and addressing modes important for programming in the 8086 microprocessor? | ![]() |
150 docs|215 tests
|
150 docs|215 tests
|