(i) the foregoing
You can modify the IP, or both CS and IP instructions are collectively referred to as transfer instructions .
The transfer behavior has the following categories:
When you modify IP only, it is called intra-segment transfer, for example: JMP ax.
Simultaneous modification of CS and IPs is called inter-segment transfer, for example: jmp 1000:0.
because the transfer instruction has different scope for IP modification , the transfer is divided into: short transfer and near transfer.
The modified range of the short transfer IP is -128~127.
The modified range of near-transfer IP is -32768~32767.
The 8086CPU transfer instruction is divided into the following categories:
Unconditional transfer instructions (e.g., JMP)
Conditional Transfer Directives
loop instructions (e.g. loop)
Process
Interrupt
Although the preconditions for these transfer instructions may vary, the rationale for the transfer is the same.
(ii) Operator offset
The operator offset is a symbol that is handled by the compiler in assembly language, and its function is to obtain the offset address of the label. Such as:
Assume CS:CODESG
CODESG segment
Start:mov Ax,offset Start
S:mov Ax,offset S
CODESG ends
End Start
(iii) JMP directives
The JMP directive is an unconditional transfer instruction that can modify only the IP or both CS and IP.
The JMP directive gives you two kinds of information:
The destination address of the transfer.
Transfer distance (inter-segment transfer, intra-segment short transfer, intra-segment near transfer)
(iv) JMP instructions for transfer based on displacement
jmp short label (go to label to execute instruction)
In this format, the JMP instruction implements a short transfer within the segment, which modifies the IP range to -128~127, that is, it can move forward up to 128 bytes, and the backward transfer can be up to 127 bytes. The "short" symbol in the JMP directive, which indicates that the instruction is carried out in a shorter transition. The "designator" in the JMP directive is the designator in the code snippet, indicating the destination to which the instruction is to be transferred, and the CS:IP should point to the instruction at the label at the end of the transfer instruction. Such as:
Assume CS:CODESG
CODESG segment
Start:mov ax,0
JMP Short S
Add ax,1
S:inc Ax
CODESG ends
End Start
JMP near PTR designator (intra-segment transfer)
(iv) The purpose of the transfer of the address in the instruction of the JMP directive
Transfer between segments of JMP far PTR designator
Far PTR indicates that CS and IP are modified with the segment address and offset address of the designator.
(v) Transfer of the JMP instructions in the Register
Instruction format: jmp 16-bit Reg
Function: (IP) = (16-bit REG)
(vi) Transfer address in-memory JMP instructions
JMP Word PTR memory cell address (intra-segment transfer)
Function: A word is stored at the address of the memory unit, which is the destination offset address of the transfer.
MOV ax,0123h
MOV Ds:[0],ax
JMP word ptr ds:[0]
After execution, (IP) =0123h
MOV ax,0123h
mov [Bx],ax
JMP word ptr [bx]
After execution, (IP) =0123h
JMP DWORD ptr memory cell address (inter-segment transfer)
Function: From the memory unit address at the beginning of the two words, the high address of the word is the destination of the transfer of the address, the low address is the purpose of the transfer of the destination offset address.
MOV ax,0123h
MOV Ds:[0],ax
mov word ptr ds:[2],0
JMP DWORD ptr ds:[0]
After execution, (CS) =0, (IP) =0123h,cs:ip point to 0000:0123
MOV ax,0123h
mov [Bx],ax
mov word ptr [bx+2],0
JMP DWORD ptr [BX]
After execution, (CS) =0, (IP) =0123h,cs:ip point to 0000:0123
(vii) JCXZ directive
The JCXZ instruction is a conditional transfer instruction, and all conditional transfer instructions are short-shifted, including the shifted displacement in the corresponding machine code, not the destination address.
Instruction format: JCXZ label (if (CX) = 0, transfer to label execution)
Simply put, the function of the JCXZ label is equivalent to:
if ((CX) ==0) jmp short label;
Summary complete!
This article is from the "where No Play" blog, please be sure to keep this source http://liaofan.blog.51cto.com/12295212/1919178
"Assembly Language" summarizes the principle of 06--transfer instruction