8086 logo

8086 Programs

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.

📚 Architecture & Theory — Start Here

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 SegmentationPhysical address formula, CS/DS/SS/ES, .COM vs .EXE, .MODEL sizes, protected mode
Register ReferenceAll 14 registers, mandatory roles, FLAGS table, decision guide
Data & Assembler DirectivesDB/DW/DD/DQ/DT/DUP/EQU, PROC/ENDP, macros, PUBLIC/EXTRN, 8087 FPU
BIU/EU ArchitecturePipeline, T-states, instruction timing table, I/O subsystem, 8087 bus interface
Addressing ModesAll EA modes with clock costs, string instructions, XLAT, segment overrides
Flag RegisterAll 9 flags, CF vs OF, BCD arithmetic, conditional jump reference, INTO
Stack OperationsPUSH/POP, CALL/RET, stack frames, calling conventions, C/Assembly interface
Interrupt SystemIVT, ISR writing, DOS/BIOS services, INT 10h/13h/16h, TSR programs

📄 Complete instruction reference (with clock counts): Complete 8086 Instruction Set

⚙ Getting Started — Run Your First Program
  • 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 with LINK filename;.
  • TASM / Turbo Assembler (DOS): same workflow as MASM. Use TASM filename and TLINK 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,AX at 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.

Subtraction:

Executing subtraction of various bit-length numbers with and without carry adjustment.

Multiplication:

Multiplication operations for different operand sizes, including signed and unsigned multiplication.

Division:

Performing division operations and handling quotient and remainder for different bit-length numbers.

Sorting:

Sorting an array of numbers in ascending and descending order.

Searching:

Finding an element in an array efficiently using Assembly and C++.

String & Display Operations:

Handling string operations such as printing and palindrome checking.

Data Conversion:

Converting numbers between Binary-Coded Decimal (BCD) and binary formats.

Logical & Bitwise Operations:

Performing bitwise manipulations and counting bits in numbers and strings.

Array & Data Structure Operations:

Reversing arrays and working with basic data structures in Assembly.

Comparison & Number Properties:

Performing comparisons and checking number properties such as parity and sign.

Stack, Memory & System Operations:

Understanding system-level instructions such as interrupts, memory operations, and stack handling.

Mathematical Computations:

Performing mathematical operations such as factorial, square, and cube calculations.

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)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.