Open In App

8086 Instruction Set

Last Updated : 20 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The 8086 instruction set is key to understanding the Intel 80 coding pattern and its significant significance as a path-making chip among x patterns. Unveiled in 1978, it brought innovation into computing by having the ability to provide better overall performance and memory attributes than earlier devices. This article investigates the details behind the 8086 instruction set as well its additives of it in matters of class, addressing modes key command and assembly language programming extensions complexes regarding challenges and further advantages.

8086 Instruction Set

The Intel 8086 is a 16-bit microprocessor that was introduced in 1978. It is the first processor of the x86 family. The instruction set architecture of the 8086 CPU consists of instructions that a processor can execute. The 8086 instruction set is characterized by its versatility and efficiency, allowing programmers to write code for a wide range of applications. Instructions are encoded in binary format and organized into different categories based on their functionality. These instructions encompass various operations, including data movement, arithmetic and logic operations, control flow instructions, and input/output operations. Below is an overview of the 8086 instruction set.

Classification of Instructions set

Data Movement Instructions

Instructions

Definition/Meaning

MOV

Transfer data from source to destination.

XCHG

Swap the contents of two registers or a register and a memory location.

PUSH

Push data onto the stack.

POP

Pop the data from the stack.

LEA

Load Effective Address (loads the address of a memory operand into a register).

Arithmetic Instructions

Instructions

Definition/Meaning

ADD, SUB, ADC, SBB

Sum, difference, sum with carry, difference with borrow.

INC, DEC:

Increment, decrement.

MUL, IMUL, DIV, IDIV:

Multiplication and division (unsigned and signed).

Logic Instructions

Instructions

Definition/Meaning

AND, OR, XOR, NOT

Bitwise logical operations.

TEST

Bitwise AND operation modifies flags while operands remain unchanged.

SHL, SHR, SAL, SAR

Shift left, shift right (logical and arithmetic).

ROL, ROR, RCL, RCR

Left rotate, right rotate (with carry).

Control Transfer Instructions

Instructions

Definition/Meaning

JMP

Absolute jump to a specified address.

JC, JNC, JZ, JNZ, JS, JNS, JO, JNO

Conditional branching on the flags.

CAL

Call a subroutine.

RET

Return from subroutine.

INT

Software interrupt.

IRET

Interrupt return.

String Instructions

Instructions

Definition/Meaning

MOVSB, MOVSW

Transfer byte or word from source to destination (used in string manipulation).

CMPSB, CMPSW:

Compare byte or word string operands.

SCASB, SCASW

Scan byte or word string operands.

LODSB, LODSW

Get a byte or word from memory into the accumulator.

Input/Output Instructions

Instructions

Definition/Meaning

IN

Input from port.

OUT

Output to port.

Flag Control Instructions

Instructions

Definition/Meaning

CLC, STC, CMC

Set, clear, complement flags on CY.

CLD, STD

Set direction flag.

CLI, STI

Clr int flag.

HLT:

Halt processor execution.

Other Instructions

Instructions

Definition/Meaning

NOP

No operation.

WAIT

Await external event.

ESC

Jump to external coprocessor.

Process Control Instructions

  • Process Control Instructions are used to control the order execution in a program and in processes. They comprise of instruction for branching, looping, and calling functions or subroutines.
  • In other words, the instruction set changes the sequence of instruction executing, therefore, it allows to change the program flow. Include commands for conditional jump, unconditional jump, subroutine calls among others.

Instruction

Definition/Meaning

Branching Instructions

Branching Instruction that transfers the flow of execution onto certain conditions or unconditional transfers to the part of the program.

Looping Instructions

Instruction that can be used to repeatedly execute a block of code either conditionally or unconditionally.

Subroutine Instructions

Subroutine Instructions are used to call and return from subroutine to enhance code modularity and reusability.

Unconditional Jumps

Unconditional Jumps Included in the program flow are the instructions that unconditionally jump to a predetermined location without taking any condition in to account.

Conditional Jumps

Conditional Jumps Conditionals that moves the control flow to a specific address depending on the truth value of a condition.

Subroutine Calls

Jump Commands Instructions that are responsible for transferring control to a subroutine, enabling task execution, while promoting code modularity and reusability.

Addressing Modes

The addressing modes of computer architecture are the various ways in which operand(s) of an instruction are specified. These modes define how the processor finds the data it needs to execute a command. The Intel 8086 microprocessor has support for many addressing modes, each granting flexibility in addressing memory and registers at the same time.

Below are the main addressing modes supported by the 8086

Immediate Addressing

  • In case of immediate addressing, the operand is a constant value or immediate data that is part of the instruction itself.
  • Example: MOV AX, 1234h – copies value 1234h into AX.

Register Addressing

  • In register addressing, the operand is placed in one of the CPU registers.
  • Example: MOV AX, BX – moves the contents of register BX into register AX.

Direct Addressing

  • In direct addressing, the operand’s address is directly specified in the instruction itself.
  • Example: MOV AX, [1234h] – displaces register AX with the data stored at the memory location 1234h.

Indirect Addressing

  • In indirect addressing, the address of the operand is stored in a register or memory location, and the data is at that address.
  • Example: MOV AX, [BX] – copies the data pointed to by a 16-bit signed offset relative to a 16-bit register with data type of pointer into a 16-bit register with data type of integer.

Indexed Addressing

  • In indexed addressing, the operand’s address is obtained by computing the offset together with a base address stored in a register.
  • Example: MOV AX, [BX+SI] – Moves the data located at the address formed by adding the contents of BX and SI registers into register AX.

Based Addressing

  • Like indexed addressing, but the base address is added to the offset in the instruction.
  • Example: MOV AX, [1234h+SI] – loads register AX with data from the address that is 1234h added with SI.

Based Indexed Addressing

  • Combines based and listed addressing modes, in which an offset is introduced to a base deal with stored in a sign in, and an index sign in is used to in addition regulate the address.
  • Example: MOV AX, [BX DI 10h] – movements the facts positioned on the cope with shaped through adding the contents of BX, DI, and an instantaneous offset of 10h into sign up AX.

Key Instructions in the 8086 Instruction Set

The Intel 8086 microprocessor has a wealthy coaching set architecture (ISA) with loads of commands catering to different responsibilities.

Here are some key instructions in the 8086 instruction set along side information on their capability and utilization:

MOV (Move)

  • Syntax: MOV destination, supply
  • Description: The MOV preparation transfers statistics from a supply operand to a destination operand. The source and destination operands may be registers, memory places, or instantaneous values.
  • Example: MOV AX, BX – Moves the contents of sign in BX into sign up AX.

ADD (Addition)

  • Syntax: ADD destination, supply
  • Description: The ADD instruction adds the source operand to the destination operand and shops the bring about the vacation spot operand.
  • Example: ADD AX, BX – Adds the contents of register BX to register AX and shops the result in sign up AX.

SUB (Subtraction)

  • Syntax: SUB destination, supply
  • Description: The SUB preparation subtracts the source operand from the destination operand and shops the bring about the vacation spot operand.
  • Example: SUB AX, BX – Subtracts the contents of register BX from register AX and stores the result in sign up AX.

INC (Increment)

  • Syntax: INC operand
  • Description: The INC instruction increments the value of the operand by using one.
  • Example: INC AX – Increments the fee of register AX via one.

DEC (Decrement)

  • Syntax: DEC operand
  • Description: The DEC coaching decrements the fee of the operand by using one.
  • Example: DEC AX – Decrements the value of register AX via one.

CMP (Compare)

  • Syntax: CMP operand1, operand2
  • Description: The CMP training plays a subtraction among operand1 and operand2, but it does now not save the result. It only updates the flags sign up primarily based on the result of the comparison.
  • Example: CMP AX, BX – Compares the content.

PUSH

  • PUSH stores the value from a register or memory location in the top of a stack. It is used to pass parameters to subroutines or store the registers’ values.
  • The code implicates a transition of the AX register data to the stack. Following the stacking, the stack pointer is decremented to point to the new top of the stack.

POP

  • POP instruction carries out the operation of storing the topmost value of the stack into a register, a memory location or a stack. In this case, it serves for bringing the last values already applied to the stack.
  • This instruction is used to pop the highest value from the stack and load it into the AX register. Upon completion, the value that was formerly pushed onto the stack is transferred into AX, while the stack pointer (SP) is increased to point to the new top of the stack

POPA

  • Instruction POPA knocks values out of stack frame in a defined order and puts them into general-purpose registers. It isn’t the counterpart of the PUSHA command.
  • This indicates deserving values from stack to registers (DI, SI, BP upward to AX) using the stack system. Next, EAX, ECX, and EDX registers are holding the original value that has been saved onto the stack in the opposite order.

PUSHA

  • The PUSHA instruction of the pushes the values of general-purpose registers to the stack in that order. Saving temporary register values before the subroutine changes and restoring them later is also a part of it.
  • This instruction loads values into the stack from AX and upwards, including CX, DX, and ending with DI. Following every register write, the corresponding value is pushed on the stack and the stack pointer (SP) is decremented.

Assembly Language Programming with the 8086

  • 8086 Architecture Familiarization:Study the architecture of the 8086 CPU which includes its registers, memory organization, instruction set, and addressing modes.
  • Development Environment Setup:Get assembler (NASM, MASM) installed and configured and emulator or hardware (DOSBox, Bochs) in place and make assembly language programs of your own to write, compile, and test.
  • Writing Programs Using Mnemonics:Write assembly language programs in the 8086 computer using instructions, data representation, control structures, and interrupt handling.
  • Debugging and Testing:Debug programs using methods such as single stepping, register and memory content inspection, and utilize debuggers or emulators to assure proper functioning.
  • Optimization and Documentation:Optimize performance and efficiency of programs by minimizing instruction count and memory access while maximizing using registers. Document programs in details using comments and variable descriptions for clarity and maintenance.

8086 Instruction Set Extensions

The 8086 education set has numerous extensions and enhancements added in next processors in the x86 family. These extensions add new instructions and talents to the simple 8086 instruction set. Here’s an in depth clarification of some of the important thing extensions:

8086/8088 Instructions Extensions

  • The 8086/8088 processors had been the first members of the x86 family. Although that they had a restrained instruction set as compared to later processors, they laid the inspiration for next trends.
  • Key extensions blanketed aid for numerous addressing modes, arithmetic, common sense, manipulate transfer, and string operations.

80286 Instructions Extensions

  • The 80286 processor, added in 1982, delivered several upgrades to the training set.
  • Protected mode: The 80286 introduced a brand new running mode known as protected mode, which furnished assist for digital memory, multitasking, and reminiscence safety.
  • New commands: Instructions which include BOUND, ENTER, LEAVE, and SALC have been added, together with improvements to present commands like the shift and rotate instructions.

80386 Instructions Extensions

  • The 80386 processor, brought in 1985, in addition expanded the instruction set and abilities of the x86 architecture.
  • 32-bit addressing and statistics: The 80386 brought help for 32-bit addressing and facts operations, allowing access to more reminiscence and larger information types.
  • New commands: Instructions which include BSF, BSR, CMPXCHG, INVD, WBINVD, and others had been delivered, providing enhanced capability for responsibilities like bit manipulation, atomic operations, and cache manipulate.

80486 Instructions Extensions

  • The 80486 processor, added in 1989, persevered the fashion of adding new instructions and features to the x86 structure.
  • Integrated floating-point unit (FPU): The 80486 included a built-in floating-factor unit, supplying hardware guide for floating-factor mathematics operations.
  • New instructions: Instructions consisting of CMPXCHG8B, CPUID, and others have been introduced, offering additional capability for atomic operations, CPU identity, and greater.

Pentium Instructions Extensions

  • The Pentium processor, introduced in 1993, delivered massive upgrades to the x86 structure.
  • Superscalar structure: The Pentium featured a superscalar architecture capable of executing a couple of commands simultaneously, enhancing overall performance.
  • MMX generation: The Pentium delivered MMX (Multi-Media Extensions) generation, which introduced SIMD (Single Instruction, Multiple Data) commands for advanced multimedia and signal processing performance.

Later Extensions

  • Subsequent x86 processors, which include the Pentium Pro, Pentium II, Pentium III, Pentium four, and later models, persisted to introduce new commands, improvements, and features, which include SSE (Streaming SIMD Extensions), AVX (Advanced Vector Extensions), and more.

Challenges faced

  • Limited Addressing Range:One of the major issues with the 8086 instruction set is its limited addressing range. It can only access directly 1 MB of memory, which can be a problem for modern computing tasks requiring more RAM.
  • Complexity of Memory Management:Managing memory in 8086 architecture, specifically in real mode, can be confusing and tedious. Developers should handle segment registers and offsets to access memory, which may cause mistakes and ineffectiveness.
  • Lack of High-Level Abstractions:The instruction set of the 8086 lacks lots of the high-level abstractions commonly found in modern architectures. This absence also makes special tasks, like complex arithmetic operations or data manipulation, difficult and not so efficient.
  • Limited Instruction Set Extensions:The x86 instruction set of the 8086 processor does not have many advanced instructions and extensions as later x86 processors. Such restrictions can become an obstacle in the optimization of the performance and can make some tasks complicated to implement effectively.
  • Interrupt Handling Complexity:It can be very complex to manage interrupts in 8086 architecture speeds in real mode. Developers have to take care of interrupt vectors, interrupts priority and context switching manually, which makes the code more complex and potentially has errors.

Advantages

  • Backward Compatibility:The 8086 instruction set keeps backward compatibility with previous Intel microprocessors like the 8080 and 8085. This compatibility permits for clean migration of software from older structures to more recent ones based at the 8086 architecture.
  • Rich Instruction Set:The 8086 instruction set gives a huge variety of commands for appearing various duties, together with mathematics operations, records movement, control float, and string manipulation. This richness permits programmers to put in writing efficient and flexible meeting language programs.
  • Flexible Addressing Modes:The 8086 structure supports multiple addressing modes, which includes instant, check in, direct, indirect, listed, and based totally addressing modes. This flexibility permits programmers to get admission to reminiscence and operands in exceptional methods, enhancing application efficiency and flexibility.
  • Efficient Memory Management:Despite its boundaries, the 8086 structure functions efficient memory management competencies, such as segmentation and offset addressing. Segmentation allows for logical partitioning of reminiscence, even as offset addressing enables direct get right of entry to to memory locations inside a section.
  • Widespread Adoption:The 8086 Instruction set has been widely followed and used in diverse packages, starting from personal computer systems to embedded systems and industrial automation. Its reputation has caused tremendous help, documentation, and a big surroundings of gear and software libraries.

Conclusion

The set 8086 preparation remains a fundamental detail in computing history. Modulo its age, it remains relevant because of its robustness, flexibility, and wide-spread adoption. The set of instructions provided by the 8086 format offer programmers the flexibility to write green assembly language programs for numerous software. Then, the microarchitecture addresses several drawbacks such as the limited addressing of memory and weak functions which are defined in modern processors. Consequently, the x86 family will deliver the future features.

FAQs on 8086 Instruction Set

What many are the instructions reflecting 8086 microprocessor?

  • Data Transfer Instructions: Data transfer between operands is their major function.
  • Arithmetic Instructions: Do simple computation such as addition, subtraction, and multiplication.
  • Bit Manipulation Instructions: Working with individual bits in the data.
  • String Instructions: Translate data into plain language.
  • Program Execution Transfer Instructions: Control program flow(branching and looping).
  • Processor Control Instructions: Control processor behavior.
  • Iteration Control Instructions: Used with the loops.
  • Interrupt Instructions: Intercept interrupts and exceptions.

What are the types of commands related to data transfers in the 8086 instruction set?

  • MOV: The instruction is used to transfer data from a source operand to a destination operand.
  • PUSH: TRANSFER the word to the top of the stack.
  • POP: A word from the stack is pulled out.
  • XCHG: Transferring the data from one place to another.
  • IN and OUT: Shuttle data between the accumulator and input/output ports.

Which are the rules used for arithmetic operations in the 8086 instruction set?

  • ADD: Increases bites or word count.
  • SUB: Bites  bytes or words.
  • INC: Increment bytes or word by a byte or word.
  • DEC: Speed up the process from a byte to a word.
  • MUL and IMUL: Do multiplication.
  • DIV and IDIV: / division.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads