Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program.

Similar presentations


Presentation on theme: "Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program."— Presentation transcript:

1 Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program to carry useful task, there must be a way to make decisions and repeat section of code. In this topic we show how these thing can be accomplished with the JMP and LOOP instruction. The jump and loop instruction transfer control to another part of the program. This transfer can be unconditional or can depend on a particular combination of status flag settings. Unconditional JMP/ Unconditional Branching. JMP Instruction The JMP instruction causes an unconditional transfer of control. Syntax JMP destination/Label name Example

2 Conditional Jmp/Conditional Branching Instruction Symbols or Instruction 1.JE // Then Jump Equal to 2.JNE // Then Jump Not Equal to 3.JG // Then Jump greater then 4.JNLE // Then Jump not less then or equal 5.JL // Then Jump less then 6.JNLE 7.JLE 8.JNG 9.JZ 10.JNZ

3 Unconditional branching Main proc mov dl,0 start1: inc dl mov ah,2 int 21h jmp start1: mov ah,4ch int 21h Main endp End main Conditional Branching Main proc mov dl,0 start1: inc dl mov ah,2 int 21h cmp dl,5 jne start1: mov ah,4ch int 21h Main endp End main Both types of Branching Main proc mov dl,0 start1: inc dl mov ah,2 int 21h cmp dl,5 je para_end jmp start1 Para_end: mov ah,4ch int 21h Main endp End main

4 Prog.-(12)* Write a program to input a number and display the number is Even or Odd by using control branching structure. 1Store 2 into BL 2Input a number in AL 3 Divide to AL from BL 4If AH =0 Then go to step 6 5 go to step no 8 6Display this is Even No. 7Go to step 9 8 Display this is Odd no 9End of program

5 Start End BL=2 AH = AL/ BL Input AL If AH=0 No Yes Display EVEN NO Display ODD NO


Download ppt "Flow of Control Instruction/Control structure Looping structure Looping structure Branching structure Branching structure For assembly language program."

Similar presentations


Ads by Google