Program Control Instructions
Presented By: Dr Nikhil Kumar Marriwala
Jumps
Unconditional
Jumps
Short Jumps Near Jumps Far Jumps
Presented By: Dr Nikhil Kumar 2
Marriwala
Unconditional Jumps
• Short Jump (Intrasegment Jump)
– Two byte Instruction that allows jumps to memory
locations within +127 to -128 bytes from address
following the jump instruction
• Near Jump (Intrasegment Jump)
– Three byte Instruction that allows jumps to memory
locations within 32K bytes from address following
the jump instruction
• Far Jumps (Inter-segment Jump)
– 5 byte instruction that allows jump to any memory
location within the real memory system
Presented By: Dr Nikhil Kumar 3
Marriwala
UNCONDITIONAL JUMPS
Short Jump
Opcode
EB Disp
Near Jump
Opcode
E9 DISP LOW DISP HI
FAR Jump
Opcode
EA IP LOW IP HIGH CS LOW CS HIGH
Presented By: Dr Nikhil Kumar 4
Marriwala
Jxx - Jump Instructions Table
Mnemonic Meaning Jump Condition
JA Jump if Above CF=0 and ZF=0
JAE Jump if Above or Equal CF=0
JB Jump if Below CF=1
JBE Jump if Below or Equal CF=1 or ZF=1
JC Jump if Carry CF=1
JCXZ Jump if CX Zero CX=0
JE Jump if Equal ZF=1
JG Jump if Greater (signed) ZF=0 and SF=O
JGE Jump if Greater or Equal (signed) SF=O
JL Jump if Less (signed) SF != O
JLE Jump if Less or Equal (signed) ZF=1 or SF != O
JMP Unconditional Jump unconditional
JNA Jump if Not Above CF=1 or ZF=1
JNAE Jump if Not Above or Equal CF=1
JNB Jump if Not Below CF=0
JNBE Jump if Not Below or Equal CF=0 and ZF=0
JNC Jump if Not Carry CF=0
Presented By: Dr Nikhil Kumar 5
Marriwala
JNE Jump if Not Equal ZF=0
JNG Jump if Not Greater (signed) ZF=1 or SF != OF
JNGE Jump if Not Greater or Equal (signed) SF != OF
JNL Jump if Not Less (signed) SF=OF
JNLE Jump if Not Less or Equal (signed) ZF=0 and SF=OF
JNO Jump if Not Overflow (signed) OF=0
JNP Jump if No Parity PF=0
JNS Jump if Not Signed (signed) SF=0
JNZ Jump if Not Zero ZF=0
JO Jump if Overflow (signed) OF=1
JP Jump if Parity PF=1
JPE Jump if Parity Even PF=1
JPO Jump if Parity Odd PF=0
JS Jump if Signed (signed) SF=1
JZ Jump if Zero ZF=1
Presented By: Dr Nikhil Kumar 6
Marriwala
JCXZ/JECXZ - Jump if Register (E)CX is Zero
Usage: JCXZ label
JECXZ label (386+)
Modifies flags: None
Causes execution to branch to "label" if register CX is zero. Uses
unsigned comparision.
Clocks Size
Operands 808x 286 386 486 Bytes
label: jump 18 8+m 9+m 8 2
no jump 6 4 5 5
Presented By: Dr Nikhil Kumar 7
Marriwala
- It's a good programming practice to organize code so the
expected case is executed without a jump since the actual
jump takes longer to execute than falling through the test.
Presented By: Dr Nikhil Kumar 8
Marriwala
LOOP INSTRUCTIONS
1) LOOP-Decrement CX and Branch if CX is not Equal to Zero
2) LOOPZ or LOOPE-Decrement CX and Branch if CX Is not equal
to zero and z flag=1
3) LOOPNZ or LOOPNE-Decrement CX and Branch If CX is not
Equal to Zero and Z Flag =0
Presented By: Dr Nikhil Kumar 9
Marriwala
Call Instruction
1) CALL-Intrasegmnet Call or NEAR Call of Direct Type
2) CALL-Intrasegment Indirect Call or NEAR Indirect Call
3) Call-Intersegment Direct Call or FAR Direct Call
4) CALL-Intersegment Indirect Call or FAR Indirect Call
Presented By: Dr Nikhil Kumar 10
Marriwala
Return Instruction
1) RET-Intrasegment return or NEAR Return
2) RET-Intrasegment Return or NEAR Return with Immediate
Value Added to SP Register
3) RET-Intersegment Return or FAR Return
4) RET-Intersegment Return or FAR Return with Immediate Value
Added to SP Register
Presented By: Dr Nikhil Kumar 11
Marriwala
PROCESS CONTROL
INSTRUCTION
1) Set the Carry Flag to 1 State ( STC)
2) Clear the Carry Flag to 0 State ( CTC)
3) Complement the Carry Flag ( CMC)
4) Clear the Direction Flag to 0 State ( CLD)
5) Set the Direction Flag to 1 State ( STD)
6) Clear the Interrupt Enable Flag to 0 State (CLL)
7) Set the Interrupt Enable Flag to 1 State (STL)
Presented By: Dr Nikhil Kumar 12
Marriwala