Professional Documents
Culture Documents
H00000
0 0 1 0 0 0 0 0 00011H
0 0 0 0 0 0 0 1 00010H
1 1 0 1 1 0 0 0 00001H
00000H
Microprocessor 8086
11011000 Memory chip
Architecture/ Internal Block Diagram of the 8086 (10Marks Theory-Important)
Internal block diagram has been partitioned into two logical units;
ES/DS CS SS
(1) the Bus Interface Unit (BIU) (2) the Execution Unit (EU)
ADDRESS BUS
AH(8) AL(8) AX
BH BL BX Data 20 bits
registers
CH CL CX
DH DL DX segment
ES
SP (16 bit) registers
Address CS
BP(16 bit) 8
registers SS 0
SI(16 bit)
DS 8
DI(16 bit)
IP 6
BUS
CONTROL
B
UNIT
16 bits U
S
TEMPORARY REGISTERS INSTRUCTION QUEUE
EU
ALU CONTROL 1 2 3 4 5 6
UNIT 8 bits
FLAGS
EXECUTION UNIT (EU) BUS INTERFACE UNIT (BIU)
The Execution Unit (EU)
EU contains the arithmetic and logic unit (ALU), the control unit, an internal
bus, plus a few registers
Register sets:
AX AH AL ACCUMULATOR
BX BH BL BASE REGISTER
CX CH CL COUNT REGISTER
DX DH DL DATA REGISTER
SP STACK POINTER
BP BASE POINTER
SI SOURCE INDEX
DI DESTINATION INDEX
IP INSTRUCTION POINTER
FLAGH FLAGL STATUS FLAG
Register sets:
8086 has four 16-bit general-purpose registers labeled as AX, BX, CX and DX. Each of these registers can also be used as two
separate and exclusive 8-bit registers also i.e., AX has two parts AH and AL, where H and L stands for the high and low portions
respectively.
AX: AL /AX is sometimes called the accumulator, but the relevance of the accumulator is less for 8086 compared to the earlier
8085 in which one operand is implied to be in the A register for many instructions.
BX, CX and DX:
These are the other working registers of the 8086, which means that temporary data storage, arithmetic calculations and data
manipulation can be done with these registers
Base register BX is frequently used as an address register in many based addressing modes.
Counting register CX is used as a counter in many instructions.
Data register DX is used in I/O instructions as a pointer to data by storing the address of the I/O port.
Pointer and Index Registers : SP, BP, SI and DI are address registers, and can be used only as
16-bit registers
BP and SP : They are the Base pointer and Stack pointer respectively. SP always points to the top of the stack, while BP can
point to any location in the stack.
SI and DI These are Index registers, labeled as Source Index and Destination Index respectively.
They function as address registers in various addressing modes
The Execution Unit contd..
Flag Register
It is a 16-bit register, of which 7 bits are unused. 6 bits are used as conditional flags. The
others are control flags. The conditional flags available are the Carry (CF), Zero (ZF), Parity
(PF), Overflow (OF) and the Sign Flag (SF).
× × × × OF DF IF TF SF ZF × AF × PF × CF
× × × × OF DF IF TF SF ZF × AF × PF × CF
This flag is specifically used Interrupt Flag (I) – This flag Trap Flag (T) –If TF=1, the CPU
in string instructions. is for interrupts. automatically generates an
If DF=1, then access the If IF=1, the microprocessor internal interrupt after each
string data from higher will recognize interrupt instruction, allowing a
memory location towards requests from the program to be inspected as it
lower memory location. peripherals. executes instruction by
If DF=0, then access the If IF=0, the microprocessor instruction.
string data from lower will not recognize any If TF=0, no function is
memory location towards interrupt requests and will performed.
higher memory location. ignore them.
The Execution Unit contd..
Solved Example on carry Flag
Q. Find the status of the flags CF, SF, AF after the following instructions are executed.
MOV AL, 35H
ADD AL, 0CEH
35H 0011 0101
+ CEH 1100 1110
103H 1 0000 0011
CF = 1 since there is a carry out from D7.
SF = 0 since the sign bit (MSB) of the 8-bit destination is 0.
AF = 1 since there is an overflow from D3 to D4.
Example 1.2 Show the effect of the following instructions on the CF, ZF and OF bits of the flag register.
MOV BX, 45ECH
ADD BX, 7723H
Solution: This is the case of 16-bit addition
45ECH 0100 0101 1110 1100
7723H 0111 0111 0010 0011
BD0FH 1011 1101 0000 1111
The sum will be in BX, which is the destination register.
CF = 0 since there is no carry-out from D15. ZF = 0 since the destination is not zero. OF = 1 since there is an overflow into
the MSB D15.
Bus Interface Unit (BIU)
This unit BIU is responsible for address calculations, pre-fetching instructions for the
queue and sequencing instructions one by one.
The Instruction Queue
✓ Instructions are found in memory, from where they are fetched and decoded as and when they need to be
executed.
✓ However in 8086, there is a queue which fetches instructions ahead of the execution time and places them
in a 6-byte first-in-first-out (FIFO) queue. This pre-fetching is done when the buses are free i.e., not being
used for the execution of the current instruction.
✓ The advantage of pre-fetching is that when a particular instruction is to be executed, there is a good chance
of finding it in the queue (which is on-chip), rather than having to go to memory to fetch it.
✓ This pre-fetching belongs to a class of ideas called pipelining, which means that both execution and
fetching take place at the same time i.e., while the execution of one instruction is going on, the fetching of
another one can be done.
Decode and
execution of first 3E F2 80 76 ---- ----
instruction code 06
78 in ALU 6-byte Instruction queue
EU
BIU
Processor
Memory Segmentation
Segmentation is the process in which the main memory of the computer is logically divided into different segments and each
segment has its own base address. It is basically used to enhance the speed of execution of the computer system so that the
processor is able to fetch and execute the data from the memory easily and fast.
The four-segment registers actually contain the upper 16 bits of the starting addresses of the four memory segments.
Advantages of the Segmentation The main advantages of segmentation are as follows:
❑ It provides a powerful memory management mechanism.
❑ Data-related or stack-related operations can be performed in different segments.
❑ Code related operations can be done in separate code segments.
❑ It allows to processes to easily share data.
❑ It allows to extend the address ability of the processor, i.e. segmentation allows the use of 16 bit registers to give an
addressing capability of 1 Megabytes. Without segmentation, it would require 20 bit registers.
❑ It is possible to enhance the memory size of code data or stack segments beyond 64 KB by allotting more than one
segment for each area.
Memory Segmentation
The stack is used to keep aside address and data
temporarily, when a subprogram is called
Base address Extra segment use to store data in a special way
SS
A0000H
Segment Register
ES These registers are all 16-
90000H A000H SS
bit in size. Each register
9000H ES stores the base address of
7000H DS the corresponding
DS Segment.
70000H 5000H CS
Address byte
22236H
-
Physical address -
=22220H + - Data
0016H - OFFSET=0016H (displacement) Segment
22236H
BYTE-2
BYTE-1
Base address
22220H BYTE-0 2222H DS Register
Memory Segmentation contd…
The Code Segment and the Instruction Pointer
✓ The code segment is the area of memory where code alone is stored.
✓ The offsets within the code segment are referenced using the Instruction Pointer (IP),
which is a 16-bit register.
✓ The IP sequences the instructions, and always points to the next instruction to be
executed.
✓ Whenever an instruction byte has to be fetched from memory, the bus interface unit (BIU)
performs the address calculation using the contents of CS register and the IP.
✓ This 20-bit address is then placed on the address bus and the instruction byte is fetched.
Thus the logical address for an instruction bye is of the form CS : IP.
Example Address byte
The contents of the following segment registers are as
-
given. -
CS = 1111H -
IP = 1232H. -
Calculate the corresponding physical addresses for the BYTE-2
addressed byte in a) CS BYTE-1
Base address
Ans: The base address of the code segment is 11110H. 11110H BYTE-0 1111H
The address of the next instruction to be CS Register
executed is referenced by CS and IP which is given by
11110H + 1232H = 12342H.
Memory Segmentation contd…
The Stack Segment and the Stack Pointer
✓ The stack is an area of memory that is used in a special way.
✓ There is a 16-bit register called Stack Pointer (SP) which points to the top of the stack.
✓ The upper 16 bits of its base address is available in the SS register.
✓ A stack address of the form 4466H : 0122H means that the SS register contains 4466H, the
stack pointer (SP) contains the number 0122H, and the physical address of the top of the
stack is 44660H + 0122H = 44782H
✓ The 8086 has a stack which grows downwards (i.e., to lower memory addresses).
✓ Thus the format SS : BP is also a logical address.
Memory Segmentation contd…
The Data Segment and Extra Segment
✓ Both these segments store data, but in certain special cases (string instructions),
it may be necessary to list them separately.
✓ There is an Extra Segment (ES) register to store the upper 16 bits of the base
address of the extra segment.
✓ The offset within the data segment is also termed as an ‘effective address’.
1. It allows all address registers to have the same size as the data registers (16-bit),
while allowing the use of 20-bit physical addresses.
2. All addresses in memory are re-locatable. This means that any program or data
can be loaded in any address in memory. A re-locatable program is one which can
be placed in any area of memory and executed without change. Data is also re-
locatable. Changing the base address of the corresponding segment is the only
action we need to perform, in order to re-locate. All addresses within the
program are relative to the base address, as they are of the form Base address:
off set. All processors in the x86 family have this kind of segmentation.
Addressing Modes (10Marks Theory-Important)
For computations in assembly language, we need an opcode and operands
The way in which operands are specified in an assembly language instruction is called its
addressing mode.
Let us use the MOV instruction for understanding these modes. This has the format
MOV destination, source ………. source data is copied into the destination.
A19 A18 A17 A16 AD AD AD AD AD AD AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0
15 14 13 12 11 10
The address
values is saved
in LATCH when
ALE=1
These lines
are free to
carry data
when ALE=0
PIN Details of 8086 contd…
Minimum Mode Pin Functions
Pin No. Designation Function Type
16 to 2, 39 AD0–AD14, 16 multiplexed address / data lines Bidirectional
AD15 which carry address when ALE is high,
and later functions as data lines
D0–D15, when ALE is low
35 to 38 A19 / S6– Address lines A19 to A16, which are Output
A16 / S3 multiplexed with status signals S6 to S3.
The status bits function are as follows:
S6 – always 0
S5 – condition of the interrupt flag (IF)
S4 and S 3 show the current segment in
use as below:
S4 S3
0 0 Extra Segment
0 1 Stack Segment
1 0 Code or no Segment
1 1 Data Segment
PIN Details of 8086 contd…
Minimum Mode Pin Functions
Pin No. Designation Function Type
32 𝑅𝐷 When this signal is low, data can be received from Output
memory or input devices
29 𝑊𝑅 When this signal is low, it is an indication that the Output
data on the data lines are available for writing into
memory or outputting to output devices
19 CLK This is the clock pin to which a clock with at least 33% Input
duty cycle is to be supplied
21 RESET This is an active high signal which signals the Input
microprocessor to reset itself provided the pin is held
high for at least 4 clock periods
22 READY For the bus cycle to proceed normally, the READY pin Input
should be found to be at logic high when it is
sampled. If it is at logic low, WAIT states are inserted
into the current bus cycle
PIN Details of 8086 contd…
Minimum Mode Pin Functions
Pin No. Designation Function Type
23 𝑇𝐸𝑆𝑇 This pin is used usually when an arithmetic co- Input
processor is in the system. This pin is tested by the
WAIT instruction. If the pin is at logic zero, the ‘WAIT’
instruction becomes a NOP instruction. Otherwise, the
processor waits until this pin becomes logic zero
25 ALE Address Latch Enable’ – this signal goes high in the Output
beginning of a bus cycle and indicates that the
multiplexed address bus contains address
information
26 𝐷𝐸𝑁 Data Enable’ – This active low signal functions as an Output
activation signal for the external data bus buffers
27 DT/𝑅ത Data Transmit / Receive’ – The logic value of this signal Output
indicates whether the data is received (in a read cycle
DT / R = 0) or transmitted (in a write cycle DT / R = 1).
Thus, it is used as a direction pin for external data bus
buffers
28 M/𝐼𝑂 For I / O access this pin is low, and for Output
memory access, it is high
PIN Details of 8086 contd…
Minimum Mode Pin Functions
Pin No. Designation Function Type
31 HOLD (See This is a signal from a peripheral requesting direct Input
slide no. 91) memory access (DMA). If the signal is high, the
processor issues a Hold Acknowledge signal and tri-
states its data, address and control bus
30 HLDA(See Hold Acknowledge’ indicates the acknowledgement of Output
slide no. 91) the HOLD request
33 𝑀𝑁/𝑀𝑋 This pin is used to select the mode of operation – Input
minimum or maximum. For minimum mode, the pin is to
be connected to the 5 V supply
34 𝐵𝐻𝐸/𝑆7 BHE stands for Bus High Enable. It is available at pin 34 Output
and used to indicate the transfer of data using data bus
D8-D15. This signal is low during the first clock cycle,
thereafter it is active.
1, 20 GND Ground’ – The common point is to be connected to two -----
pins. Two Ground pins are used so as to prevent having
to connect them together internally, due to possible
noise in the internal routing of the pins
PIN Details of 8086 contd…
Minimum Mode Pin Functions
Pin No. Designation Function Type
40 VCC The power supply must be + 5V + /−10% -----
Microprocessor Instruction
Step-2: RD signal is sent to Memory chip codes are
(Instruction
code is decoded stored inside
and executed) Memory-chip
Step-3: Content of the address location is placed
on data bus from memory chip
Timing Diagram for Memory Read machine cycle
√
√
√
MOD = 00
REG = 011
R/M = 101
The machine code is 0010 1011 0001 1101 = 2B1DH.
The instruction set of 8086 microprocessor can be broadly classified into eight groups depending
on the functions these instructions perform. The Data Transfer Instructions are used for transferring
data from source location to destination location. The Arithmetic Instructions are used to
perform arithmetic operations like addition, subtraction, multiplication and division. Logical
Instructions perform the logical operations like AND, OR, EXOR operations. Shift and Rotate
Instructions are used to perform the logical and arithmetic shift operations and left and right
shifting. String Instructions performs the string related operations. The Data Adjustment
Instructions are used to convert the binary data in ASCII or in BCD format. As the name
suggests the Flag Related Instructions are used to modify the flag bits. The Control Transfer
Instructions are used to transfer the control within the program or from main program to
subroutine program or from subroutine to main program. The Machine Control Instructions
are used to perform the machine control operations like halt.
XCHG Exchange
Operands Rd, M
M, Rs
Rd, Rs
Exchange values of two operands. The order of the XCHGs operands does not matter but both
operands should be of the same size. The flag register remain unchanged after this instruction.
For example, if BL = 15 and AH = 20, then after the instruction XCHG BL, AH the
content of BL will be 20 and AH will be 15.
PUSH Push content on to stack top
Operands REG
SREG
memory
Push instruction pushes the source operand onto the stack. After the PUSH instruction, the
content of SP is decreased by 2 and the source value is copied to SS:SP. The PUSH instruction
always operates on words. The operands in the PUSH instruction can be a memory location,
a general purpose 16-bit register, or a segment register. PUSH SP copies the value of SP after
the push.
For example, if the content of the AX register is 1234H, then after the PUSH AX instruction
the 12h is loaded on [SP] and 34H is loaded on [SP 1] and SP is further decremented by
1 and becomes SP = SP 2. The flag register remain unchanged after this instruction.
POP Pop-off contents from top of stack
Operands REG
SREG
memory
This instruction pops the top of the stack into the destination operand. This means that the
value at SS:SP is copied to the destination operand and SP is increased by 2. The destination
operand can be a memory location, a general purpose 16-bit register, or any segment register
except CS. For example, if the top of the stack contains 12H and 34H, then after the instruction
Increment the operand by 1. This instruction increment the destination operand by 1. This
instruction differs with the ADD by 1 instruction in the way that the INC instruction does not
affect the carry flag whereas the ADD instruction modifies the carry flag. The INC instruction
is more compact and often faster than the comparable ADD instruction because it is a one-
byte instruction.
In INC all flags, except the carry flag, changes as that of in ADD and ADC instructions.
DEC Decrement
Operands REG
memory
Decrement the operand by 1. This instruction decrement the destination operand by 1.
This instruction differs with the SUB by 1 instruction in the way that the DEC instruction does
not affect the carry flag whereas the SUB instruction modifies the carry flag. The DEC
instruction is more compact and often faster than the comparable ADD instruction because it
is a one-byte instruction. In DEC except the carry flag all other flag changes as that of in SUB
and SBB instructions.
DIV Unsigned division
Operands REG
memory
This instruction divides the contents of the AX or the DX:AX by a specified source operand.
The AX and the DX:AX is the implied destination operands for 16-bit and 32-bit division.
This is an unsigned operation and hence both operands are treated as unsigned operands. If
the divisor is 16-bits wide, then the dividend is the DX:AX register pair. After the division
the quotient will be stored into AX and the remainder into DX. When the divisor is of 8 bits,
the dividend is AX. And in this case the quotient will be stored in AL and the remainder in
AH. Figure 4.20 shows the pictorial representation of DIV. All the flag bits are undefined, i.e.
the value of all the flag bits may be either 0 or 1.
CMP Compare
Operands REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
This instruction compares the source operand with the destination operand. Microprocessor
executes this CMP instruction by subtracting the source operand from the destination operand
but none of the operands are modified. The result is reflected by the flag bits. Generally the
result (i.e. flag conditions) of this instruction is used for conditional control transfer instructions.
The comparison may be a signed comparison or an unsigned comparison. For unsigned
comparison, the result is reflected by the Carry and Zero flag bits whereas for signed comparison
the result is reflected by the Zero, Sign and the Overflow flag.
For unsigned comparison operation, consider instruction CMP AX, BX, the microprocessor
performs the AX BX operation.
Now if AX = BX, then the result will be zero and hence the zero flag will set. If AX is
greater than BX, the result will be non-zero and positive and hence both the Zero and Carry
are reset. Similarly, when BX is greater than AX, then to perform AX BX we require to take
borrow and hence the Zero flag is reset and the carry is set.
For signed comparison if the EX-OR operation of the Sign and Overflow flag is 1, then
the result is negative. It is to be noted that for signed comparisons, the sign flag doesnt show
the proper status. For example, CMP AX, BX.
The CMP instruction also affects the parity and auxiliary carry flags, but these two flags
are rarely tested after a compare operation.
NOT Logically NOT
Operands REG
memory
This instruction complements the individual bits of the operand and save the result in the same
operand. In other words, we can say that it generates the 1s complement or the NOT operation
of the operand. After this instruction the flag register remain unmodified. Table 4.8 shows the
logical NOT operation.
Example MOV AL, 39H
NOT AL; AL = C6H
Instructions Set of 8086 105
OR Logically OR
Operands REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
This instruction performs a bitwise logical OR operation between the source and destination
operands. The result is stored in the destination operand. Table 4.8 shows the logical OR
operation. After the operation, the Z, S, and P flag bits are modified whereas the carry and
overflow flag bits are 0 and auxiliary carry is undefined (i.e. may be 0 or 1).
TEST Test
Operands REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
This instruction performs logical AND between all bits of the source and destination operands.
In this instruction perform the logical AND operation but none of the operands is modified,
it is only the ZF, SF, PF flags are modified. The carry and the overflow flags are cleared.
This instruction is used to tests specified bits of an operand and sets the flags for a
subsequent conditional jump or set instruction. One of the operands contains the value to be
tested. The other contains a bit mask indicating the bits to be tested. TEST works by doing
a logical bitwise AND on the source and destination operands. The flags are modified according
to the result, but the destination operand is not changed. This instruction is the same as the
AND instruction, except that the result is not stored.
Example MOV AL, 25H
TEST AL, 05H; ZF = 0
TEST AL, 20H; ZF = 0
XOR Logically EX-OR
Operands REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
This instruction performs a bitwise exclusive OR operation between the source and destination
operands. After the operation, the result is stored in the destination. Table 4.8 shows the
logical EX-OR operation. The Z, S, and P bits of the flag register are modified as per the
result whereas the carry and overflow flag bits are set to 0 and auxiliary carry is undefined
(i.e. may be 0 or 1).
106 Microprocessor 8086Architecture, Programming and Interfacing
1. However, if the count is not one, the value of the overflow flag is undefined. Figure 4.24
shows the pictorial representation of RCR.
The most significant BCD digit is stored in the AH register and the last significant BCD
digit is stored in AL register before the execution of AAD. The two unpacked BCD digits are
combined into a single binary number by the AAD instruction by setting AL = (AH*10) + AL
and clearing AH to 0. The carry, auxiliary carry and overflow flag bits are modified as per the
result and all other flag bits are undefined.
AAM no operands ASCII adjustment after multiplication
AAM converts the result of the multiplication of two valid unpacked BCD digits into a valid
unpacked BCD number. AX is the implicit operand in AAM.
AAM unpacks the result by dividing AX by 10, placing the quotient (Most Significant
Digit) in AH and the remainder (Least Significant Digit) in AL. In AAM, except carry and
auxiliary carry flag bits, all the other flag bits are undefined.
AAS no operands ASCII adjustment after Subtraction
AAS converts the result of the subtraction of two valid unpacked BCD digits to a single valid
BCD number. AL register is an implicit operand.
The two operands of the subtraction must have its lower 4-bit contain number in the range
of 0 to 9. The AAS instruction then adjust AL so that it contains a correct BCD digit.
The AAS instruction operates on strings of ASCII numbers with one-decimal digit (in the
range of 0 to 9) per byte. This instruction can be used after a SUB or SBB instruction on the
ASCII value. Except carry and auxiliary flag bits, all other flag bits are undefined.
DAA no operands Decimal adjust after addition
The DAA instruction adjusts the result of an addition to a packed BCD number. DAA converts
this binary sum to packed BCD format. If the sum is greater than 99h after adjustment, then
the carry and auxiliary carry flags are set. Otherwise, the carry and auxiliary carry flags are
cleared.
For example, two BCD values are added as if they were binary numbers and the result will
be in binary and then to convert this binary sum the DAA instruction is executed to correct
the result in BCD. The DAA instruction functions like AAA except it handles packed BCD
(binary code decimal) values rather than unpacked. All flag bits are modified as per the result.
DAS no operands Decimal adjust after subtraction
The DAS instruction adjusts the result of a subtraction to a packed BCD number (less than
100 decimal). DAS converts the binary result of subtraction into packed BCD. If the sum is
greater than 99H after adjustment, then the carry and auxiliary carry flags are set. Otherwise,
carry and auxiliary carry flags are cleared. All flag bits are modified as per the result.
These instructions are used to set or reset the individual control flag bits and also the carry
flag. No operands are associated with these instructions.
Instructions Set of 8086 115
CLC no operands Clear carry
CLC clear the carry flag (CF) to 0. This instruction has no effect on the processor, registers,
or other flags. It is often used to clear the CF before returning from a procedure to indicate
a successful termination. It is also use to clear the CF during rotate operation involving the
CF such as ADC, RCL, and RCR.
CLD no operands Clear direction flag
This instruction reset the designation flag to zero. This instruction has no effect on the
registers or other flags. When the direction flag is cleared/reset SI and DI will automatically
be incremented when one of the string instructions such as MOVS, CMPS, SCAS, MOVSB
and STOSB executes.
CLI no operands Clear interrupt enable flag
This instruction resets the interrupt flag to zero. No other flags are affected. If the interrupt
flag is reset, the 8086 will not respond to an interrupt signal on its INTR input. This CLI
instruction has no effect on the nonmaskable interrupt input, NMI.
CMC no operands Complement carry
If the carry flag CF is zero before this instruction, it will be set to one after the instruction.
If the carry flag is one before this instruction, it will be reset to zero after the instruction
executes. CMC has no effect on other flags.
STC no operands Set carry
This instruction sets the Carry flag.
STD no operands Set direction flag
This instruction sets the Direction flag. SI and DI will be decremented by chain instructions:
CMPSB, CMPSW, LODSB, LODSW, MOVSB, MOVSW, STOSB, and STOSW.
STI no operands Set interrupt enable flag
This instruction sets the Interrupt enable flag. When the interrupt flag is set, maskable interrupts
are enabled. If interrupts were disabled by a previous CLI instruction, pending interrupts will
not be executed immediately; they will be executed after the instruction following STI.
Algorithm:
if CF = 1, then jump
(iii) JBE label: Short jump if first operand is below or equal to second operand (as set by
CMP instruction). It is unsigned jump operation.
Algorithm:
if CF = 1 or ZF = 1, then jump
(iv) JC label: Short jump if carry flag is set to 1.
Algorithm:
if CF = 1, then jump
(v) JCXZ label: Short jump if CX register is 0.
Algorithm:
if CX = 0, then jump
(vi) JE label: Short jump if first operand is equal to second operand (as set by CMP
instruction). It may be a signed or an unsigned jump operation.
Algorithm:
if ZF = 1, then jump
(vii) JG label: Short jump if first operand is greater than second operand (as set by CMP
instruction). It is a signed operation.
Algorithm:
if (ZF = 0) and (SF = OF), then jump
(viii) JGE label: Short jump if first operand is greater than or equal to second operand
(as set by CMP instruction). It is signed jump operation.
Algorithm:
if SF = OF, then jump
(ix) JL label: Short jump if first operand is less than second operand (as set by CMP
instruction). It is signed jump operation.
Algorithm:
if SF Å OF = 1, then jump
(x) JLE label: Short jump if first operand is less than or equal to second operand (as set
by CMP instruction). It is signed jump operation.
Algorithm:
if ((SF Å OF) + ZF) = 1, then jump
(xi) JNA label: Short jump if first operand is not above second operand (as set by CMP
instruction). It is unsigned jump operation.
Algorithm:
if CF = 1 or ZF = 1, then jump
(xii) JNAE label: Short jump if first operand is not above and not equal to second operand
(as set by CMP instruction). It is an unsigned operation.
Algorithm:
if CF = 1, then jump
(xiii) JNB label: Short jump if first operand is not below second operand (as set by CMP
instruction). It is unsigned jump operation.
Algorithm:
if CF = 0, then jump
Instructions Set of 8086 119
(xiv) JNBE label: Short jump if first operand is not below and not equal to second operand
(as set by CMP instruction). It is unsigned jump operation.
Algorithm:
if (CF = 0) and (ZF = 0), then jump
(xv) JNC label: Short jump if carry flag is set to 0.
Algorithm:
if CF = 0, then jump
(xvi) JNE label: Short jump if first operand is not equal to second operand (as set by CMP
instruction). It may be a signed or an unsigned jump operation.
Algorithm:
if ZF = 0, then jump
(xvii) JNG label: Short jump if first operand is not greater than second operand (as set by
CMP instruction). It is a signed jump operation.
Algorithm:
if ((SF Å OF) + ZF) = 1, then jump
(xviii) JNGE label: Short jump if first operand is not greater than and not equal to second
operand (as set by CMP instruction). It is a signed jump operation.
Algorithm:
if SF Å OF = 1, then jump
(xix) JNL label: Short jump if first operand is not less than second operand (as set by CMP
instruction). It is a signed jump operation.
Algorithm:
if SF = OF, then jump
(xx) JNLE label: Short jump if first operand is not less than and not equal to second
operand (as set by CMP instruction). It is a signed jump operation.
Algorithm:
if (SF = OF) and (ZF = 0), then jump
(xxi) JNO label: Short jump if not overflow.
Algorithm:
if OF = 0, then jump
(xxii) JNP label: Short jump if no parity (odd). only 8 low bits of result are checked. Set
by CMP, SUB, ADD, TEST, AND, OR, XOR instructions.
Algorithm:
if PF = 0, then jump
(xxiii) JNS label: Short jump if not signed (if positive). Set by CMP, SUB, ADD, TEST,
AND, OR, XOR instructions.
Algorithm:
if SF = 0, then jump
(xxiv) JNZ label: Short jump if not zero (not equal). Set by CMP, SUB, ADD, TEST,
AND, OR, XOR instructions.
Algorithm:
if ZF = 0, then jump
120 Microprocessor 8086Architecture, Programming and Interfacing