Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Describe the subroutine. Write a program which move the block of data. Write a note on subroutines.

    Subroutine :

    1. A subroutine is a set of common instructions that can be used in a program many times.
    2. A subroutine consists of a self-contained sequence of instructions that carries out a given task.
    3. Each time that a subroutine is used in the main part of the program, a branch is executed to the beginning of the subroutine.
    4. After the subroutine has been executed, a branch is made back to the main program.
    5. A branch can be made to the subroutine from any part of the main program.
    6. Because branching to a subroutine and returning to the main program is such a common operation, all computers provide special instructions to facilitate subroutine entry and return.
      Program :
      LXI H, XX50H ; Set up HL as a pointer for the source memory
      LXI D, XX70H ; Set up DE as a pointer for the destination memory
      MVI B, 10H ; Set up B as byte counter
      NEXT : MOV A,M ; Get data byte from the source memory
      STAX D ; Store the data byte in destination memory
      INX H
      INX D ; Get ready to transfer next byte
      DCR B
      JNZ NEXT ; Go back to get next byte if byte counter 0
      HLT

    Leave a Comment