8086 Assembly Language is a low-level programming language used for Intel 8086 microprocessors. It provides direct control over hardware and is fundamental in understanding system operations, memory management, and performance optimization. Assembly programming is widely used in embedded systems, reverse engineering, and optimization of critical performance sections in software. Additionally, integrating Assembly with C++ can enhance efficiency and provide a deeper understanding of how high-level languages interact with machine code.
8086 Assembly Language is a low-level programming language used for Intel 8086 microprocessors. It provides direct control over hardware and is fundamental in understanding system operations, memory management, and performance optimization. Assembly programming is widely used in embedded systems, reverse engineering, and optimization of critical performance sections in software. Additionally, integrating Assembly with C++ can enhance efficiency and provide a deeper understanding of how high-level languages interact with machine code.
New to 8086 assembly? Work through the theory series first. Each post builds on the previous one and links directly to the programs below that demonstrate each concept.
| ① | Memory Segmentation | Physical address formula, CS/DS/SS/ES, .COM vs .EXE, .MODEL sizes, protected mode |
| ② | Register Reference | All 14 registers, mandatory roles, FLAGS table, decision guide |
| ③ | Data & Assembler Directives | DB/DW/DD/DQ/DT/DUP/EQU, PROC/ENDP, macros, PUBLIC/EXTRN, 8087 FPU |
| ④ | BIU/EU Architecture | Pipeline, T-states, instruction timing table, I/O subsystem, 8087 bus interface |
| ⑤ | Addressing Modes | All EA modes with clock costs, string instructions, XLAT, segment overrides |
| ⑥ | Flag Register | All 9 flags, CF vs OF, BCD arithmetic, conditional jump reference, INTO |
| ⑦ | Stack Operations | PUSH/POP, CALL/RET, stack frames, calling conventions, C/Assembly interface |
| ⑧ | Interrupt System | IVT, ISR writing, DOS/BIOS services, INT 10h/13h/16h, TSR programs |
📄 Complete instruction reference (with clock counts): Complete 8086 Instruction Set
- EMU8086 (Windows, easiest): download from emu8086.com, open a .asm file, click Emulate → Run. Built-in MASM-compatible assembler. Best for beginners.
- DOSBox-X (cross-platform): install DOSBox-X, mount a folder as C:, copy MASM.EXE and LINK.EXE into it. Assemble with
MASM filename;then link withLINK filename;. - TASM / Turbo Assembler (DOS): same workflow as MASM. Use
TASM filenameandTLINK filename. - NASM on Linux: for 16-bit .COM files,
nasm -f bin program.asm -o program.com. Run under DOSBox-X. - Common first error: forgetting
MOV AX,@data / MOV DS,AXat the start of every .EXE program. See Memory Segmentation for why this is required.
Interesting 8086 and Mix (C++ and Assembly) Programs for reference:
Addition:
Performing addition of different-sized numbers, including handling carry overflow.
- 8086 Assembly Program for Addition of Two 8-bit Numbers
- 8086 MASM Assembly Program for Addition of Two 8-bit Numbers
- Mix (C++ and Assembly) Program to Add Two 8-bit Numbers
- 8086 Assembly Program to Add Two 16-bit Numbers
- 8086 Assembly Program to Add Two 16-bit Numbers with Carry Handling
- Mix (C++ and Assembly) Program to Add Two 16-bit Numbers
- Mix (C++ and Assembly) Program to Add Two 16-bit Numbers (With DAA)
Subtraction:
Executing subtraction of various bit-length numbers with and without carry adjustment.
- 8086 Assembly Program to Subtract Two 16 bit Numbers
- 8086 Assembly Program for Subtraction of Two 32 bit Numbers
- 8086 Assembly Program for Subtraction of Two 8 bit Numbers
- Mix (C++ and Assembly) Program to Subtract Two 8 bit Numbers
- Mix (C++ and Assembly) Program to Subtract Two 16 bit Numbers
- Mix (C++ and Assembly) Program to Subtract Two 16 bit Numbers (With DAS)
Multiplication:
Multiplication operations for different operand sizes, including signed and unsigned multiplication.
- 8086 Assembly Program to Multiply Two 16 bit Numbers
- 8086 Assembly Program to Multiply Two 32 bit Numbers
- 8086 Assembly Program for Multiplication of Two 8 bit Numbers
- Mix (C++ and Assembly) Program to Perform Signed & Unsigned Multiplication and Division
Division:
Performing division operations and handling quotient and remainder for different bit-length numbers.
- 8086 Assembly Program to Divide Two 16 bit Numbers
- 8086 Assembly Program for Division of Two 8 bit Numbers
- Mix (C++ and Assembly) Program to Perform Signed & Unsigned Multiplication and Division
Sorting:
Sorting an array of numbers in ascending and descending order.
- 8086 Assembly Program to Sort Numbers in Ascending Order
- 8086 Assembly Program to Sort Numbers in Descending Order
- Mix (C++ and Assembly) Program to Sort Numbers in Descending Order
- Mix (C++ and Assembly) Program to Sort Numbers in Ascending Order
Searching:
Finding an element in an array efficiently using Assembly and C++.
- 8086 Assembly Program to Search an Element in an Array
- Mix (C++ and Assembly) Program to Search an Element in an Array
String & Display Operations:
Handling string operations such as printing and palindrome checking.
- 8086 Assembly Program to Display String ‘hello’
- 8086 Assembly Program to Print ‘hello’ using 09H
- 8086 Assembly Program to Check if String is Palindrome or not
- Mix (C++ and Assembly) Program to Check if String is Palindrome or not
Data Conversion:
Converting numbers between Binary-Coded Decimal (BCD) and binary formats.
- 8086 Assembly Program to Convert BCD Number into Binary Format
- 8086 Assembly Program to Convert Binary Number into BCD Format
- Mix (C++ and Assembly) Program to Convert BCD Number into Binary Format
- Mix (C++ and Assembly) Program to Convert Binary Number into BCD Format
Logical & Bitwise Operations:
Performing bitwise manipulations and counting bits in numbers and strings.
- 8086 Assembly Program to Count Number of 0’s and 1’s from a Number
- 8086 Assembly Program to Count Number of 0’s and 1’s from a String
- Mix (C++ and Assembly) Program to Count Number of 0’s and 1’s
- 8086 Assembly Program for Bitwise Operations: AND, OR, XOR, and NOT
Array & Data Structure Operations:
Reversing arrays and working with basic data structures in Assembly.
- 8086 Assembly Program to Find Reverse of an Array
- Mix (C++ and Assembly) Program to Find Reverse of an Array
Comparison & Number Properties:
Performing comparisons and checking number properties such as parity and sign.
- Mix (Assembly and C++) Program to Find Greatest of Two Numbers
- Mix (C++ and Assembly) Program to Find Whether Number is Positive or Negative
- Mix (C++ and Assembly) Program to Find Whether Number is Odd or Even
- 8086 Assembly Program to Find Smallest Number from Given Numbers
- 8086 Assembly Program to Find Largest Number from Given Numbers
- Mix (C++ and Assembly) Program to Find Smallest Number from Given Numbers
- Mix (C++ and Assembly) Program to Find Largest Number from Given Numbers
- 8086 Assembly Program to Compute the Greatest Common Divisor (GCD) of Two 16-bit Numbers Using Euclidean Algorithm
Stack, Memory & System Operations:
Understanding system-level instructions such as interrupts, memory operations, and stack handling.
- Implementing JUMP, PUSH, POP, IN & OUT in Assembly Program on 8086
- Interrupting BIOS with 8086 Assembly Program
- Performing Block Transfer using Assembly Language
- Understanding DW and DB in 8086 Assembly
- Understanding INT 3h vs INT 21h in 8086 Assembly
Mathematical Computations:
Performing mathematical operations such as factorial, square, and cube calculations.
- 8086 Assembly Program to Calculate the Factorial of an Integer Using Loops and Registers
- Mix (C++ and Assembly) Program to Find Square/Cube/Factorial of a Number
- Mix Program in Assembly and C++ to Find Factorial of Number
- 8086 Assembly Program to Compute Factorial of an Integer Using Recursion
- 8086 Assembly Program to Generate the Fibonacci Sequence
Explore these 8086 and C++-Assembly programs to sharpen your low-level coding skills! 🚀 If you need additional examples, feel free to reach out! 😊
Floating-Point (8087 FPU):
Floating-point programs require an 8087 coprocessor or emulator. The complete 8087 instruction reference (FLD, FST, FADD, FMUL, FSQRT, FPTAN and more), register stack, and data formats are covered in Data Directives & 8087 FPU. The hardware interface (ESC opcode, BUSY pin, FWAIT synchronisation) is covered in BIU/EU Architecture. Worked floating-point program examples are planned.
Protected Mode (80286+):
Protected mode programs require an 80286 or later processor and cannot run under standard DOS without a DPMI host (like CWSDPMI or the DOS extender in Turbo Pascal / DJGPP). The full theory — selectors, descriptors, GDT/LDT, privilege rings, and the protected mode entry sequence — is covered in Memory Segmentation. Protected mode instruction reference (LGDT, LIDT, LMSW, ARPL, VERR/VERW, LAR, LSL) is in the Complete Instruction Set. Protected mode program examples are planned.
Macros & Multi-Module Programs:
Macro definitions (MACRO/ENDM, LOCAL, EXITM) and multi-module programming (PUBLIC, EXTRN, INCLUDE) are covered in Data & Assembler Directives. Multi-file project examples are planned.
Archive Links: 8086 Programs Archive, Mix (C++ and Assembly) Programs Archive
Category Archives: 8086, 8086 TASM, 8086 MASM, Mix (C++ and Assembly)