Exceptions in 8086

Posted By on September 21, 2014

Download PDF
Privilege level of 80386 and 80486
8086 Assembly Language Program-16 Bit multiplication for unsigned numbers


When executing in real-mode, the following exceptions are supported:

Exception Vector Condition
Division by Zero
Attempting to execute a DIV or an IDIV instruction with a divisor which equals zero.
Debug / Single Step
Used in conjunction with the debug registers to indicate a breakpoint hit. The processor also issues this interrupt after executing every instruction when the TRAP flag is set.
The INT 3 instruction generates this exception. Since the opcode of this instruction is only one byte long, it is often used by debuggers to set a breakpoint in application code. The debugger needs only to replace the first byte of the instruction with the INT 3 opcode (11001100b) and wait for the breakpoint exception to occur. After the exception handler resumes execution and before returning to the debugged application, the debugger sets the INT 3 opcode to the previously overwritten byte and issues an IRET (interrupt return) instruction.
When performing arithmetic instructions with signed operands, the processor set the OF flag to indicate an overflow. The INTO instruction tests this flag and if it is set – generates an exception.
Bounds Check
The BOUND instruction is used to verify that an array index does not exceed a certain limit. If the limit is exceeded, an exception is generated.
Invalid Opcode
Occurs when the processor executes one of the reserved opcodes or uses the LOCK prefix improperly. Can also indicate an invalid operand following an opcode.
Device Not Available
Attempting to execute a floating-point instruction when there is no coprocessor installed. The EM bit of the CR0 register can be cleared to disable this exception.
Double Fault
An interrupt occurs which has no corresponding entry in the IVT or a second exception is generated while the processor is executing a previously activated exception handler.
Stack Exception
Stack operation exceeds offset FFFFh or a selector pointing to a non-present segment is loaded into SS.
CS, DS, ES, FS, GS Segment Overrun
Word memory access at offset FFFFh or an attempt to execute past the end of the code segment.
Floating-Point Error
An error with the numeric coprocessor (Divide-by-Zero, Underflow, Overflow…).

Table 2 – Real-Mode exceptions

Other exceptions exist only in Virtual 8086 Mode:

Exception Vector Condition
Invalid Task State Segment
Indicates that one of the checks made during a task switch failed.
Segment Not Present
Loading one of the segment registers with a selector to a segment marked as not-present.
Page Fault
Accessing a supervisor page from user privileged code or attempting to access a page which is marked as not-present.
Alignment Check
Memory access to an unaligned memory location (can only occur while executing ring 3 code).


Privilege level of 80386 and 80486
8086 Assembly Language Program-16 Bit multiplication for unsigned numbers

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com