Types of Program Control Instructions

Program Control Instructions are the machine code that are used by machine or in assembly language by user to command the processor act accordingly. These instructions are of various types. These are used in assembly language by user also. But in level language, user code is translated into machine code and thus instructions are passed to instruct the processor do the task.

Types of Program Control Instructions:
There are different types of Program Control Instructions:

1. Compare Instruction:
Compare instruction is specifically provided, which is similar t a subtract instruction except the result is not stored anywhere, but flags are set according to the result.

Example: 
CMP R1, R2 ;

2. Unconditional Branch Instruction:
It causes an unconditional change of execution sequence to a new location.

Example:
JUMP L2
Mov R3, R1 goto L2

3. Conditional Branch Instruction:
A conditional branch instruction is used to examine the values stored in the condition code register to determine whether the specific condition exists and to branch if it does.



Example:
Assembly Code : BE R1, R2, L1
Compiler allocates R1 for x and R2 for y
High Level Code: if (x==y) goto L1;

4. Subroutines:
A subroutine is a program fragment that lives in user space, performs a well-defined task. It is invoked by another user program and returns control to the calling program when finished.

Example: 
CALL and RET 

5. Halting Instructions:

  • NOP Instruction – NOP is no operation. It cause no change in the processor state other than an advancement of the program counter. It can be used to synchronize timing.
  • HALT – It brings the processor to an orderly halt, remaining in an idle state until restarted by interrupt, trace, reset or external action.

6. Interrupt Instructions:
Interrupt is a mechanism by which an I/O or an instruction can suspend the normal execution of processor and get itself serviced.

  • RESET – It reset the processor. This may include any or all setting registers to an initial value or setting program counter to standard starting location.
  • TRAP – It is non-maskable edge and level triggered interrupt. TRAP has the highest priority and vectored interrupt.
  • INTR – It is level triggered and maskable interrupt. It has the lowest priority. It can be disabled by resetting the processor.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.