Sunday 25 December 2011

Difference between branch and call subroutine instruction


Difference between branch and call subroutine instruction?

              Branch instruction:
  • Every time it is not possible to use line-sequence of instruction, sometime we need breakup in our program according to some condition this is nothing but branching and to perform these branching we require some instruction that is called branch instruction
       Eg:       MOV                    R0,     num1
                   MOV                    R2,     num2
                   CMP           R0,     R1
                   JB .             next
                   Sub            R0,     R1
                   MOV                    R2,     R1
       Next:   Sub            R1,     R0
                   MOV                    R2,     R0
  • Here the task of IB. is it compairs the two Numbers i.e. R0, and R1, if R0, < R1, then it goes to next and execute the instruction otherwise it execute the instructions just next to it.
  • The IB is your branch instruction.
       e.g. : IC, INC, IZ, INZ, IB, INB etc.

       Subroutine instruction:
  • Subrouting instruction is the instruction which is used to call the particular procedure.
  • In your main program we call particular procedure execute that procedure and then again switch to main program.
  • The instruction used for. This called to procedure and getting switch to main program is called subroutine instruction.

No comments:

Post a Comment