0
5.5kviews
Explain the difference between a JMP instruction and CALL instruction.

SUBJECT: MICROPROCESSOR AND PERIPHERALS INTERFACING

TOPIC: INSTRUCTION SET AND PROGRAMMING OF 8086

DIFFICULTY: HIGH

1 Answer
0
77views

1) A JMP instruction permanently changes the program counter. A CALL instruction leaves information on the stack so that the original program execution sequence can be resumed.

2) CALL is an instruction that transfers the program control to a sub routine with the intention of coming back to the main program. Thus, in CALL 8086 saves the address of the next instruction in to the stack before branching to the sub routine.

3) At the end of the sub routine, control transfers back to the main program using the return address of the stack. There are two types of CALL: Near CALL and Far CALL. INTRA-segment (NEAR) CALL: The new subroutine called must be in the same segment (hence intra segment). The CALL address can be specified directly in the instruction or indirectly through registers or memory locations. The following sequence is executed for a

4) NEAR CALL 8086 will PUSH current IP in to the stack. Decrement SP by 2. New value loaded in to IP. Control transferred to a sub routine within the same segment.

5) INTER-segment (FAR) CALL: The new sub routine called is in another segment (hence inter segment). Here CS and IP both get new values. The CALL address can be specified directly or through registers or memory locations. The following sequence is executed for a

6)FAR CALL- PUSH CS in to the stack. Decrement SP by 2. PUSH IP in to the stack. Decrement SP by 2. Load CS with new segment address. Load IP with new offset address. Control transferred to a sub routine in the new segment.

7) JMP: INTRA segment (NEAR) JUMP-

The jump address is specified in two ways:

8) INTRA segment direct jump- The new branch location is specified directly in the instruction.

9)The new address is calculated by adding the 8 or 16 bit displacement to the IP. The CS does not change.

10) A positive displacement means that the jump is ahead in the program. A negative displacement means that the jump is behind in the program. It is also called relative jump. INTRA segment indirect jump- The new branch address is specified indirectly through a register or a memory location. The value in the IP is replaced with the new value. The CS does not change. INTER segment (FAR) JUMP-

The jump address is specified in two ways:

INTER segment direct jump- The new branch A JMP instruction permanently changes the program counter. A CALL instruction leaves information on the stack so that the original program execution sequence can be resumed. CALL is an instruction that transfers the program control to a sub routine with the intention of coming back to the main program. Thus, in CALL 8086 saves the address of the next instruction in to the stack before branching to the sub routine. At the end of the sub routine, control transfers back to the main program using the return address of the stack. There are two types of CALL: Near CALL and Far CALL. INTRA-segment (NEAR) CALL: The new subroutine called must be in the same segment (hence intra segment). The CALL address can be specified directly in the instruction or indirectly through registers or memory locations. The following sequence is executed for a NEAR CALL- 8086 will PUSH current IP in to the stack. Decrement SP by 2. New value loaded in to IP. Control transferred to a sub routine within the same segment. INTER-segment (FAR) CALL: The new sub routine called is in another segment (hence inter segment). Here CS and IP both get new values. The CALL address can be specified directly or through registers or memory locations. The following sequence is executed for a FAR CALL- PUSH CS in to the stack. Decrement SP by 2. PUSH IP in to the stack. Decrement SP by 2. Load CS with new segment address. Load IP with new offset address. Control transferred to a sub routine in the new segment. JMP: INTRA segment (NEAR) JUMP-

The jump address is specified in two ways:

INTRA segment direct jump- The new branch location is specified directly in the instruction. The new address is calculated by adding the 8 or 16 bit displacement to the IP. The CS does not change. A positive displacement means that the jump is ahead in the program. A negative displacement means that the jump is behind in the program. It is also called relative jump. INTRA segment indirect jump- The new branch address is specified indirectly through a register or a memory location. The value in the IP is replaced with the new value. The CS does not change. INTER segment (FAR) JUMP-

The jump address is specified in two ways:

INTER segment direct jump- The new branch location is specified directly in the instruction. Both CS and IP get new values as this is an inter segment jump.

1) INTER segment indirect jump- The new branch location is specified indirectly through a register or a memory location. Both CS and IP get new values as this is an inter segment jump.location is specified directly in the instruction. Both CS and IP get new values as this is an inter segment jump.

2)INTER segment indirect jump- The new branch location is specified indirectly through a register or a memory location. Both CS and IP get new values as this is an inter segment jump.

Please log in to add an answer.