1 / 5

Flow of Control Instruction/Control structure Looping structure Branching structure

Flow of Control Instruction/Control structure Looping structure Branching structure

onslow
Download Presentation

Flow of Control Instruction/Control structure Looping structure Branching structure

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Flow of Control Instruction/Control structure • Looping 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 JE // Then Jump Equal to JNE // Then Jump Not Equal to JG // Then Jump greater then JNLE // Then Jump not less then or equal JL // Then Jump less then JNLE JLE JNG JZ JNZ

  3. 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 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

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

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

More Related