Indirect Jump Example 

In direct jump, the target address (i.e. its relative offset value) is encoded into the jump instruction itself. However, in an indirect jump, the target address is specified indirectly either through memory or a general-purpose register.

For example, if the CX register contains the offset of the target address, then we can write

      JMP CX

It should be observed that in indirect jumps, the target offset is the absolute value (unlike direct jumps, which use a relative offset value). The following example illustrates the use of indirect jump.

Example: An example with an indirect jump.
  .MODEL SMALL
  .STACK 100H
  .DATA
    jump_table  DW   code_0		; indirect jump pointer table 
                DW   code_1
                DW   code_2
                DW   default_code	; default code for digits 3-9  
                DW   default_code
                DW   default_code
                DW   default_code
                DW   default_code
                DW   default_code
                DW   default_code
    prompt_msg  DB   10,13,'Enter a digit (0-9):$'
    msg_0       DB   10,13,'Economy class selected.$'
    msg_1       DB   10,13,'Business class selected.$'
    msg_2       DB   10,13,'First class selected.$'
    msg_default DB   10,13,'Not a valid code!$'
 .code
		  MOV  AX, @DATA
		  MOV  DS, AX
 read_again:        
		  MOV AH, 9		; request a digit
		  LEA DX, prompt_msg
		  INT 21H
		  MOV AH, 1		; read input digit
		  INT 21H
		  SUB AL, '0'		; convert to numeric equivalent 
		  XOR AH, AH		; AH=0
		  MOV SI, AX		; SI is index into jump_table
		  ADD SI, SI		; SI = SI *2
 		  JMP jump_table[SI]	; indirect jump based on SI
 test_termination:
		  CMP AL, 2
		  JA done
		  jmp read_again
 code_0:
		  MOV AH, 9
		  LEA DX, msg_0
		  INT 21H
		  JMP test_termination
 code_1:
		  MOV AH, 9
		  LEA DX, msg_1
		  INT 21H
		  JMP test_termination
 code_2:
		  MOV AH, 9
		  LEA DX, msg_2
		  INT 21H
		  JMP test_termination
 default_code:
		  MOV AH, 9
		  LEA DX, msg_default
		  INT 21H
		  JMP test_termination
  done:
         	  MOV  AH, 4CH	; exit to DOS
        	  INT  21H
 END  
 

The above example shows a simple program that reads a digit from the user and prints the corresponding choice represented by the input. In order to use the indirect jump, a jump table of pointers is built. The input digit is converted to act as an index into this table and is used in the indirect jump instruction.