BRANCH INSTRUCTIONS Set

Posted By on September 15, 2014


Download PDF
LOGICAL INSTRUCTIONS Set
STRING MANIPULATION INSTRUCTIONS Set

BRANCH INSTRUCTIONS


Branch instruction transfers the flow of execution of the program to a new address specified in the instruction directly or indirectly. When this type of instruction is executed, the CS and IP registers get loaded with new values of CS and IP corresponding to the location to be transferred.

The branch instruction are classified into two types

  1. Unconditional branch instructions
  2. Conditional branch instructions

Unconditional branch instruction :

In unconditional control transfer instructions, the execution control is transferred to the specified location independent of any status or condition . The CS and IP are unconditionally modified to the new CS and IP.
CALL : Unconditional call
This instruction is used to call a subroutine (procedure) from the main program. Address of procedure may be specified directly or indirectly.
There are two types of procedures depending upon whether it is available in the same segment or in another segment.
  1. Near CALL i.e., +32K or -32K displacement
  2. Far CALL i.e., anywhere outside the segment.

On execution this instruction stores the incremented IP and CS onto the stack and loads the CS and IP registers with segment and offset address of the procedure to be called.

RET : Return from procedure
At the end of the procedure, the RET instruction must be executed. When it is executed, the previously stored content of IP and CS along with flags are retrieved into the CS, IP and Flag registers from the stack and execution of the main programs continues further.
INT N : Interrupt Type N
In the interrupt structure of the 8086, 256 interrupts are defined corresponding to the types from 00H to FFH. When INT N instruction is executed, the type byte N is multiplied by 4 and the contents of the IP and CS of the interrupt service routine will be taken from memory block in 0000 segment.
INTO : Interrupt in overflow
This instruction is executed when the overflow flag ODF is set, This is equivalent to a Type4  interrupt instruction.
JMP : Conditional jump
This instruction unconditionally transfers the control of execution to the specified address using an 8 bit ot 16 bit displacement. No flags are affected by this instruction.
IRET : Return from stack
When its is executed the values of IP ,CS and flags are retrieved from the stack to continue the execution of the main program.
LOOP : LOOP unconditional
This instruction executes the part of the program from the Label or address specified in the instruction up to the loop instruction CX number of times . At each iteration ,CX is decremented automatically and JUMP OF NOT ZERO structure.
Conditonal branch instructions 
When this instruction is executed, execution control is transferred to the address specified relatively in the instruction, provided the condition implicit in the opcode is satisfied. Otherwise execution continues sequentially.

JZ/JZE Label
Transfers execution control to address ‘label’ , if ZF = 1

JNZ/JNE Label
Transfers execution control to address ‘label’ , if ZF = 0

JS Label
Transfers execution control to address ‘label’ , if SF = 1

JNS Label
Transfers execution control to address ‘label’ , if SF = 0

JO Label
Transfers execution control to address ‘label’ , if OF = 1

JNO Label
Transfers execution control to address ‘label’ , if OF = 0

JNP Label
Transfers execution control to address ‘label’ , if PF = 0

JP Label
Transfers execution control to address ‘label’ , if PF = 1

JB Label
Transfers execution control to address ‘label’ , if CF = 1

JNB Label
Transfers execution control to address ‘label’ , if CF = 0

JNXZB Label
Transfers execution control to address ‘label’ , if CX = 0


Conditional loop instructions

 

LOOPZ/LOOPE Label
Loop through a sequence of instructions from label while ZF = 1 and CX = 0

LOOPNZ/LOOPENE Label
Loop through a sequence of instructions from label while ZF = 1 and CX = 0

LOGICAL INSTRUCTIONS Set
STRING MANIPULATION INSTRUCTIONS Set

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com