Here is an example of a listing that demonstrates the machine code for the various jump and call instructions. Notice that the short and near jumps and near calls are relative to the current location in the program. Far jumps and far calls are absolute references.
.model small
0000 .data
0000 49 6E 20 64 61 74 msg db "In data segment",0dh,0ah,"$"
61 20 73 65 67 6D
65 6E 74 0D 0A 24
.stack 100h
0000 .code
0000 main proc
0000 B8 ---- R mov ax,@data
0003 8E D8 mov ds,ax
0005 B8 0000 top: mov ax,0
0008 83 C0 01 add ax,1
;Notice how the destination of the jump is calculated in the following instructions.
;When an 8-bit displacement is extended to 16-bits, notice that the sign bit is extended
; F8 in 16-bits is FFF8
; 7F in 16-bits is 007F
; EA in 16-bits is FFE8The
;The offset is added to the starting address of the following instruction. For example,
; jz top
;the machine code is 74 F8. F8 is the displacement. The starting address of the following
;instruction is 000D. 000D + FFF8 = 0005. 0005 is the address of the label TOP, which is
;the destination of the jump!
;
;opcode 74 is for JZ
;opcode E8 is for a near procedure call
;opcode 0E E8 is for a far procedure call
;opcode EB is for a short jump, with 1 byte for the displacement
;opcode E9 is for a near jump, with 2 bytes for the displacement
;opcode EA is for a far jump, with 2 bytes for the segment, and 2 bytees for the offset
000B 74 F8 jz top ;000D + FFF8 = 0005
000D 0E E8 0090 call farproc ;0011 + 0090 = 00A1
0011 E8 0095 call nearproc ;0014 + 0095 = 00A9
0014 EB 7F jmp short_next ;0016 + 007F = 0095
0016 E9 0082 jmp near_next ;0019 + 0082 = 009B
0019 EB EA jmp top ;001B + FFEA = 0005
001B EA ---- 00A1 R jmp far ptr farproc ;00A1 is the offset
0020 B8 0001 mov ax,1
0023 B8 0001 mov ax,1
0026 B8 0001 mov ax,1
0029 B8 0001 mov ax,1
002C B8 0001 mov ax,1
002F B8 0001 mov ax,1
0032 B8 0001 mov ax,1
0035 B8 0001 mov ax,1
0038 B8 0001 mov ax,1
003B B8 0001 mov ax,1
003E B8 0001 mov ax,1
0041 B8 0001 mov ax,1
0044 B8 0001 mov ax,1
0047 B8 0001 mov ax,1
004A B8 0001 mov ax,1
004D B8 0001 mov ax,1
0050 B8 0001 mov ax,1
0053 B8 0001 mov ax,1
0056 B8 0001 mov ax,1
0059 B8 0001 mov ax,1
005C B8 0001 mov ax,1
005F B8 0001 mov ax,1
0062 B8 0001 mov ax,1
0065 B8 0001 mov ax,1
0068 B8 0001 mov ax,1
006B B8 0001 mov ax,1
006E B8 0001 mov ax,1
0071 B8 0001 mov ax,1
0074 B8 0001 mov ax,1
0077 B8 0001 mov ax,1
007A B8 0001 mov ax,1
007D B8 0001 mov ax,1
0080 B8 0001 mov ax,1
0083 B8 0001 mov ax,1
0086 B8 0001 mov ax,1
0089 B8 0001 mov ax,1
008C B8 0001 mov ax,1
008F B8 0001 mov ax,1
0092 B8 0001 mov ax,1
0095 short_next:
0095 B8 0001 mov ax,1
0098 B8 0001 mov ax,1
009B near_next:
009B B8 4C00 mov ax,4c00h
009E CD 21 int 21h
00A0 C3 ret
00A1 main endp
00A1 farproc proc far
00A1 B4 09 mov ah,09h
00A3 BA 0000 R mov dx,offset msg
00A6 CD 21 int 21h
00A8 CB ret
00A9 farproc endp
00A9 nearproc proc
00A9 B4 09 mov ah,09h
00AB BA 0000 R mov dx,offset msg
00AE CD 21 int 21h
00B0 C3 ret
00B1 nearproc endp
end main