A comprehensive collection of professionally documented 8086 Assembly Language programs, covering arithmetic, logic, data structures, and hardware simulation.
👥 Authors · 📖 Overview · ✨ Features · 📁 Structure · 💾 Program Details · ⚙️ Prerequisites · 🗺️ Roadmap · 🌟 Best Practices · 📌 Quick Reference · 🔧 Troubleshooting · 🔗 Resources · 🤝🏻 Contributing · 📦 Execution Steps · 🚀 Usage · 📜 License · ℹ️ About · 🙏🏻 Acknowledgments
The 8086 Assembly Language Programs repository is a curated collection of low-level assembly code designed to verify and strengthen the understanding of the 8086 microprocessor architecture. It demonstrates the practical implementation of instruction sets, memory management, and hardware simulation using the Emu8086 emulator.
Note
This repository contains 161 professionally documented programs covering every aspect of 8086 assembly programming.
This repository represents a comprehensive archive of hands-on coding experiments. The primary motivation for creating and maintaining this archive is simple yet profound: to preserve knowledge for continuous learning and future reference.
As a computer engineer, understanding the underlying hardware-software interface is crucial for low-level system design and performance optimization. This repository serves as my intellectual reference point: a resource I can return to for relearning concepts, reviewing methodologies, and strengthening understanding when needed.
Why this repository exists:
- 💾 Knowledge Preservation: To maintain organized access to tested assembly programs beyond the classroom.
- 🔄 Continuous Learning: To support lifelong learning by enabling easy revisitation of fundamental 8086 concepts.
- 📝 Academic Documentation: To authentically document my learning journey through 8086 assembly programming.
- 🤝 Community Contribution: To provide a structured and verified code reference for fellow engineering students.
Tip
All programs in this repository were developed, verified, and documented during my undergraduate studies (2018-2022) to master the 8086 architecture.
| Feature | Description |
|---|---|
| Instruction Implementation | Practical demonstrations of Arithmetic, Logical, String, and Transfer instruction sets |
| System Interfacing | Direct hardware simulation for Traffic Lights, Stepper Motors, and LED Displays |
| Memory Management | Implementation of various 8086 Addressing Modes and Stack pointer operations |
| Algorithm Design | Low-level implementation of Sorting (Bubble/Selection) and Binary Search algorithms |
| Modular Programming | Usage of Macros (MACRO) and Procedures (PROC) for structured code reusability |
| Interrupt Handling | Utilization of DOS (INT 21h) and BIOS (INT 10h) interrupts for System I/O |
- 📦 Architecture → Intel 8086 (16-bit)
- 🔧 Assembler → MASM / TASM Syntax Compatibility
- 💻 Emulator → Emu8086
- ⚙️ Language → Assembly (ASM)
8086-ASSEMBLY-LANGUAGE-PROGRAMS/
│
├── Addressing Modes/ # Comprehensive Addressing Modes Reference
├── Arithmetic/ # Basic Math (Add, Sub, Mul, Div, BCD)
├── Array Operations/ # Sum, Min/Max, Deletion, Insertion
├── Bitwise Operations/ # AND, OR, XOR, Shifts (SHL/SHR), Rotates
├── Control Flow/ # Loops, If-Else, Switch-Case, Jumps
├── Conversion/ # Hex-BCD, Binary, Octal, ASCII, 7-Segment
├── Data Structures/ # Stack (LIFO) & Queue (FIFO) Implementations
├── Expression/ # Factorial, Fibonacci, GCD, Power, Series
├── External Devices/ # Traffic Lights, Stepper Motor, Keyboard, Mouse
├── File Operations/ # Create, Read, Write, Delete Files (DOS)
├── Flags/ # Carry, Parity, Zero, Sign, Overflow Flags
├── Graphics/ # VGA Mode, Line, Rectangle, Pixel Drawing
├── Input Output/ # Read/Display Decimal, Hex, Binary Numbers
├── Interrupts/ # BIOS (INT 10h/16h) & DOS (INT 21h) Interrupts
├── Introduction/ # Hello World, Syntax Demo, System Time
├── Macros/ # Conditional Macros, Nested Macros, Parameters
├── Mathematics/ # LCM, Square Root, Perfect Number, Armstrong
├── Matrix/ # Matrix Addition & Transpose Operations
├── Memory Operations/ # Block Transfer, Compare, Fill, Scan
├── Patterns/ # Pyramids, Triangles, Diamond Shapes
├── Procedures/ # Recursion, Parameters, Local Variables
├── Searching/ # Binary Search, Linear Search, Char Count
├── Simulation/ # Fire Alarm, Water Level, Defect Detection
├── Sorting/ # Bubble, Selection, Insertion, Asc/Desc Sorts
├── Stack Operations/ # String Reverse, Swap, Push/Pop Demos
├── String Operations/ # Length, Reverse, Palindrome, Case Conv.
├── Utilities/ # Delays, Password Input, Sound, Clear Screen
│
├── LICENSE # MIT License
└── README.md # Project Documentation
Important
Click on each section below to expand and view all programs with direct links to source code.
📁 Addressing Modes (1 Program)
| Program | Topic | Description | Code |
|---|---|---|---|
comprehensive_8086_addressing_modes_reference.asm |
Addressing | Comprehensive reference guide demonstrating all 8086 addressing modes. | View |
🧮 Arithmetic (14 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
add_array_of_bytes_from_memory.asm |
Addition | Algorithm to calculate the sum of an array of bytes stored in memory. | View |
addition_16bit_packed_bcd.asm |
BCD Math | Implementation of 16-bit addition for packed Binary Coded Decimal (BCD) numbers. | View |
addition_16bit_simple.asm |
Addition | Basic implementation of 16-bit addition using general-purpose registers. | View |
addition_16bit_with_carry_detection.asm |
Addition | 16-bit addition logic that specifically checks and handles the Carry Flag. | View |
addition_8bit_with_user_input.asm |
I/O Addition | Interactive program to accept two 8-bit numbers from the user and display their sum. | View |
calculate_sum_of_first_n_natural_numbers.asm |
Series Sum | Calculates the sum of the first N natural numbers using iterative loops. | View |
count_set_bits_in_16bit_binary.asm |
Bit Count | Algorithm to count the number of set bits (1s) in a 16-bit binary number. | View |
decimal_adjust_after_addition_demo.asm |
DAA Logic | Demonstration of the DAA instruction to correct BCD addition results. | View |
division_16bit_dividend_by_8bit_divisor.asm |
Division | Performs division of a 16-bit dividend by an 8-bit divisor. | View |
generate_multiplication_table_for_number.asm |
Iteration | Generates and displays the multiplication table for a given number. | View |
multiplication_8bit_unsigned.asm |
Multiplication | Standard 8-bit unsigned multiplication using the MUL instruction. | View |
signed_addition_and_subtraction_demo.asm |
Signed Math | Demonstration of arithmetic operations on signed integers using IDIV/IMUL checks. | View |
subtraction_8bit_with_user_input.asm |
I/O Subtraction | Interactive 8-bit subtraction requiring input conversion from ASCII to numeric. | View |
swap_two_numbers_using_registers.asm |
Swapping | Efficient value swapping between two registers without using stack memory. | View |
📦 Array Operations (7 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
calculate_sum_of_array_elements.asm |
Traversal | Iterates through an array to calculate the total sum of all elements. | View |
copy_block_of_data_between_arrays.asm |
Data Transfer | Copies a block of data from a source array to a destination array in memory. | View |
count_odd_and_even_numbers_in_array.asm |
Counting | Scans an array to count the total number of odd and even integers. | View |
delete_element_from_array_by_index.asm |
Deletion | Removes an element at a specific index and shifts remaining elements to fill the gap. | View |
find_maximum_element_in_array.asm |
Search | Linearly searches an array to identify the maximum value. | View |
find_minimum_element_in_array.asm |
Search | Linearly searches an array to identify the minimum value. | View |
insert_element_into_array_at_index.asm |
Insertion | Inserts a new element at a specified index, shifting existing elements to the right. | View |
🔌 Bitwise Operations (8 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
bitwise_and_logic_demonstration.asm |
Logic (AND) | Demonstration of the AND instruction for masking bits. | View |
bitwise_logical_shift_left_and_multiplication.asm |
Shift (SHL) | Uses logical left shift to perform efficient multiplication by powers of 2. | View |
bitwise_logical_shift_right_and_division.asm |
Shift (SHR) | Uses logical right shift to perform efficient division by powers of 2. | View |
bitwise_not_ones_complement_demonstration.asm |
Logic (NOT) | Demonstrates the NOT instruction to calculate the 1's complement of a value. | View |
bitwise_or_logic_demonstration.asm |
Logic (OR) | Demonstration of the OR instruction for setting specific bits. | View |
bitwise_rotate_left_circular_shift.asm |
Rotate (ROL) | Implementation of circular left shift (Rotate Left) preserving bit information. | View |
bitwise_rotate_right_circular_shift.asm |
Rotate (ROR) | Implementation of circular right shift (Rotate Right) preserving bit information. | View |
bitwise_xor_logic_demonstration.asm |
Logic (XOR) | Demonstration of Exclusive OR logic, often used for toggling bits. | View |
🔀 Control Flow (7 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
conditional_branching_and_status_flags.asm |
Branching | Demonstrates conditional jumps (JZ, JNZ, JC) based on CPU flag states. | View |
for_loop_counter_iteration_pattern.asm |
Iteration | Implements a standard for-loop checking a counter for a fixed number of iterations. | View |
if_then_else_conditional_logic_structure.asm |
Branching | Implements classic If-Then-Else logic using comparison and jump instructions. | View |
loop_instruction_cx_register_control.asm |
Iteration | Demonstrates the hardware LOOP instruction which uses the CX register. | View |
switch_case_multiway_branching_logic.asm |
Switch-Case | Implements multi-way branching similar to a switch-case statement. | View |
unconditional_jump_and_program_redirection.asm |
JMP | Demonstrates unconditional jumps (JMP) to redirect program execution flow. | View |
while_loop_pre_test_conditional_iteration.asm |
Iteration | Implements a pre-test while loop where the condition is checked before execution. | View |
🔄 Conversion (11 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
celsius_fahrenheit_temperature_converter.asm |
Formula | Converts temperature readings between Celsius and Fahrenheit scales. | View |
convert_decimal_to_binary_representation.asm |
Base Conversion | Converts a decimal integer into its binary string representation. | View |
convert_decimal_to_octal_representation.asm |
Base Conversion | Converts a decimal integer into its octal string representation. | View |
convert_hexadecimal_to_decimal_string.asm |
Base Conversion | Converts a Hexadecimal value to its equivalent Decimal ASCII string. | View |
convert_hexadecimal_to_packed_bcd.asm |
Base Conversion | Converts a Hexadecimal value into Packed Binary Coded Decimal format. | View |
convert_packed_bcd_to_hexadecimal.asm |
Base Conversion | Converts a Packed BCD value back into its Hexadecimal equivalent. | View |
hex_to_seven_segment_decoder_lookup.asm |
Decoding | Converts Hex digits to 7-segment display control codes using a lookup table. | View |
reverse_digits_of_integer_value.asm |
Reversal | Separates and reverses the individual digits of an integer value. | View |
string_comparison_lexicographical_check.asm |
Comparison | compares two strings lexicographically to check for equality. | View |
string_copy_using_manual_loop_iteration.asm |
Copy | Copies a string from source to destination using a manual byte-by-byte loop. | View |
string_copy_using_movsb_instruction.asm |
Copy | Optimizes string copying using the dedicated MOVSB hardware instruction. | View |
📚 Data Structures (2 Programs)
| Program | Data Structure | Description | Code |
|---|---|---|---|
queue.asm |
Queue | Implementation of a FIFO (First-In-First-Out) queue using arrays. | View |
stack_array.asm |
Stack | Implementation of a LIFO (Last-In-First-Out) stack using arrays. | View |
🔢 Expression (13 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
average_of_array.asm |
Statistics | Calculates the arithmetic mean of a set of numbers stored in an array. | View |
calculator.asm |
Arithmetic | Basic calculator simulating Add, Subtract, Multiply, and Divide operations. | View |
check_even_odd.asm |
Logic | Determines if a number is even or odd by checking the least significant bit. | View |
count_vowels.asm |
String Processing | Scans an input string to count the number of vowels present. | View |
count_words.asm |
String Processing | Counts the number of words in a sentence by detecting spaces. | View |
factorial.asm |
Recursion/Loop | Calculates the factorial of a given number using iterative logic. | View |
fibonacci.asm |
Series Generation | Generates the Fibonacci sequence up to a specified Nth term. | View |
gcd_two_numbers.asm |
Euclidean Algorithm | Finds the Greatest Common Divisor (GCD) of two numbers. | View |
power.asm |
Exponentiation | Calculates the result of a base number raised to a given power (X^Y). | View |
prime_number_check.asm |
Primality Test | Algorithms to determine if a provided integer is a prime number. | View |
reverse_array.asm |
Reversal | Reverses the elements of an array in-place without auxiliary storage. | View |
string_concatenation.asm |
Processing | Joins two separate strings into a single concatenated string. | View |
substring_search.asm |
Search | Searches for the presence of a target substring within a larger string. | View |
🖲️ External Devices (9 Programs)
| Program | Simulation | Description | Code |
|---|---|---|---|
keyboard.asm |
I/O | Interfacing code to handle keyboard input interrupts. | View |
led_display_test.asm |
Output | Simulation code to toggle LEDs on an external output port. | View |
mouse.asm |
I/O | Interfacing code to detect mouse clicks and coordinates. | View |
robot.asm |
Control | Simulation of simple robot arm movement instructions. | View |
stepper_motor.asm |
Motor Control | Generates the correct bit pulses to rotate a stepper motor. | View |
thermometer.asm |
Sensor | Simulates reading digital values from a temperature sensor. | View |
timer.asm |
Clock | Configures the 8253/8254 Programmable Interval Timer (PIT). | View |
traffic_lights.asm |
Traffic Light | Simulates a basic Traffic Light Control system sequence. | View |
traffic_lights_advanced.asm |
Traffic Light | Advanced traffic control logic including pedestrian usage. | View |
📂 File Operations (4 Programs)
| Program | Interrupt | Description | Code |
|---|---|---|---|
create_file.asm |
INT 21h | Uses DOS interrupts to create a new file on the disk. | View |
delete_file.asm |
INT 21h | Uses DOS interrupts to delete a specified file from the disk. | View |
read_file.asm |
INT 21h | Reads content from an existing file into a memory buffer. | View |
write_file.asm |
INT 21h | Writes string data from a buffer into a file on disk. | View |
🚩 Flags (5 Programs)
| Program | Flag Name | Description | Code |
|---|---|---|---|
carry_flag.asm |
Carry Flag (CF) | Demonstrates operations that set or clear the Carry Flag. | View |
overflow_flag.asm |
Overflow Flag (OF) | Demonstrates signed arithmetic overflow conditions. | View |
parity_flag.asm |
Parity Flag (PF) | Checks parity (number of set bits) of the result. | View |
sign_flag.asm |
Sign Flag (SF) | Demonstrates how negative results affect the Sign Flag. | View |
zero_flag.asm |
Zero Flag (ZF) | Demonstrates operations resulting in zero to set the Zero Flag. | View |
🎨 Graphics (4 Programs)
| Program | Video Mode | Description | Code |
|---|---|---|---|
colored_text.asm |
Text Mode | Displays text with various background and foreground colors. | View |
draw_line.asm |
VGA Mode | Implements the Bresenham or DDA algorithm to draw lines. | View |
draw_pixel.asm |
VGA Mode | Demonstrates how to write to video memory to plot a single pixel. | View |
draw_rectangle.asm |
VGA Mode | Loops logic to draw a rectangle shape on the screen. | View |
⌨️ Input Output (4 Programs)
| Program | I/O Type | Description | Code |
|---|---|---|---|
display_binary.asm |
Output | Routines to display a 16-bit number in Binary format. | View |
display_decimal.asm |
Output | Routines to display a 16-bit number in Decimal format. | View |
display_hex.asm |
Output | Routines to display a 16-bit number in Hexadecimal format. | View |
read_number.asm |
Input | Logic to read multi-digit numbers from the keyboard. | View |
⚡ Interrupts (8 Programs)
| Program | Interrupt | Description | Code |
|---|---|---|---|
bios_cursor_position.asm |
INT 10h | Manipulating the cursor position using BIOS services. | View |
bios_keyboard.asm |
INT 16h | Reading keystrokes using BIOS keyboard services. | View |
bios_system_time.asm |
INT 1Ah | Reading the system clock count using BIOS time services. | View |
bios_video_mode.asm |
INT 10h | Switching between Text and Video modes using BIOS. | View |
dos_display_char.asm |
INT 21h/02h | Displaying a single ASCII character using DOS functions. | View |
dos_display_string.asm |
INT 21h/09h | Displaying a '$' terminated string using DOS functions. | View |
dos_read_char.asm |
INT 21h/01h | Reading a single character from Standard Input. | View |
dos_read_string.asm |
INT 21h/0Ah | Buffered string input from Standard Input via DOS. | View |
👋 Introduction (15 Programs)
| Program | Topic | Description | Code |
|---|---|---|---|
data_definition_demo.asm |
Syntax | Demonstration of DB, DW, DD, and other data directives. | View |
display_characters.asm |
Output | Basic program to print a sequence of characters. | View |
display_string_direct.asm |
Video Memory | Writing directly to Video RAM at segment B800h. | View |
display_system_time.asm |
System | Fetching and formatting system time for display. | View |
hello_world_dos.asm |
Basics | classic Hello World program using DOS INT 21h. | View |
hello_world_interrupt.asm |
Interrupts | Understanding the interrupt vector table for output. | View |
hello_world_procedure.asm |
Procedures | Structuring Hello World code into a reusable procedure. | View |
hello_world_procedure_advanced.asm |
Procedures | Advanced procedure usage with stack frame setup. | View |
hello_world_string.asm |
Strings | Variable declaration and string printing. | View |
hello_world_vga.asm |
Graphics | Printing Hello World in VGA graphical mode. | View |
keyboard_wait_input.asm |
Input | Looping program that waits for specific key input. | View |
mov_instruction_demo.asm |
Instructions | In-depth demonstration of the MOV data transfer instruction. | View |
print_alphabets.asm |
Loops | Printing the alphabet using loop constructs. | View |
procedure_demo.asm |
Structure | Generic template for procedure-based programming. | View |
procedure_multiplication.asm |
Algorithm | Encapsulating multiplication logic within a procedure. | View |
📝 Macros (4 Programs)
| Program | Feature | Description | Code |
|---|---|---|---|
conditional_macros.asm |
Conditional Assembly | Macros that generate code based on assembly-time conditions. | View |
macro_with_parameters.asm |
Parameters | Defining macros that accept arguments for flexible code generation. | View |
nested_macros.asm |
Nesting | Defining macros describing other macros (Macros within Macros). | View |
print_string_macro.asm |
Macro Definition | A reusable macro to simplify printing strings via DOS. | View |
📐 Mathematics (5 Programs)
| Program | Mathematics | Description | Code |
|---|---|---|---|
armstrong_number.asm |
Number Theory | Program to check if a number satisfies the Armstrong property. | View |
lcm.asm |
LCM | Calculating the Least Common Multiple of two integers. | View |
perfect_number.asm |
Number Theory | Checking if a number is a Perfect Number (sum of divisors). | View |
square_root.asm |
Roots | Algorithm to compute the integer square root of a number. | View |
twos_complement.asm |
Binary Math | manually calculating the 2's complement of a binary number. | View |
▦ Matrix (2 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
matrix_addition.asm |
Matrix | Element-wise addition of two 2D matrices. | View |
matrix_transpose.asm |
Matrix | Swapping rows and columns to generate a matrix transpose. | View |
💾 Memory Operations (4 Programs)
| Program | Operation | Description | Code |
|---|---|---|---|
block_copy.asm |
Transfer | Efficiently copying large blocks of memory (Block Transfer). | View |
memory_compare.asm |
Comparison | Comparing two blocks of memory for equality. | View |
memory_fill.asm |
Initialization | Filling a block of memory with a specific constant value. | View |
memory_scan.asm |
Search | Scanning a memory range for a specific byte value. | View |
💠 Patterns (4 Programs)
| Program | Pattern Type | Description | Code |
|---|---|---|---|
diamond_pattern.asm |
Geometric | Logic to print a symmetrical diamond star pattern. | View |
inverted_triangle.asm |
Geometric | Logic to print an inverted triangle of stars. | View |
number_pyramid.asm |
Numeric | Logic to print a pyramid of incrementing numbers. | View |
triangle_pattern.asm |
Geometric | Logic to print a standard right-angled star triangle. | View |
🧩 Procedures (5 Programs)
| Program | Concept | Description | Code |
|---|---|---|---|
basic_procedure.asm |
CALL/RET | Introduction to defining and calling basic procedures. | View |
local_variables.asm |
Stack Frame | Managing local variables within a procedure using the stack (BP). | View |
nested_procedures.asm |
Nesting | Demonstration of a procedure calling another procedure. | View |
procedure_parameters.asm |
Parameters | Passing arguments to procedures using registers and stack. | View |
recursive_factorial.asm |
Recursion | Implementing the Factorial function using self-calling procedures. | View |
🔍 Searching (4 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
binary_search.asm |
Binary Search | Efficient O(log n) search on a sorted array. | View |
character_occurrences_count.asm |
Frequency | Counting how many times a char appears in a string. | View |
linear_search.asm |
Linear Search | Standard O(n) scan through an array to find a value. | View |
search_element_array.asm |
Search | Basic implementation of finding an element in a list. | View |
🔥 Simulation (3 Programs)
| Program | Simulation | Description | Code |
|---|---|---|---|
fire_monitoring_system.asm |
Sensor System | Simulating a fire alarm trigger based on temperature input. | View |
garment_defect.asm |
Quality Control | Simulating a defect detection system in a manufacturing line. | View |
water_level_controller.asm |
Control System | Simulating a water tank level controller (Overflow/Refill). | View |
📊 Sorting (5 Programs)
| Program | Algorithm | Description | Code |
|---|---|---|---|
array_ascending.asm |
Sorting | Sorting an array of numbers in Ascending order. | View |
array_descending.asm |
Sorting | Sorting an array of numbers in Descending order. | View |
bubble_sort.asm |
Bubble Sort | Implementation of the Bubble Sort algorithm. | View |
insertion_sort.asm |
Insertion Sort | Implementation of the Insertion Sort algorithm. | View |
selection_sort.asm |
Selection Sort | Implementation of the Selection Sort algorithm. | View |
📚 Stack Operations (3 Programs)
| Program | Operation | Description | Code |
|---|---|---|---|
push_pop.asm |
Basic Ops | Demonstration of PUSH and POP instructions. | View |
reverse_string_stack.asm |
Application | Using the Stack's LIFO property to reverse a string. | View |
swap_using_stack.asm |
Application | Using the Stack to swap two values. | View |
🧵 String Operations (5 Programs)
| Program | Operation | Description | Code |
|---|---|---|---|
palindrome_check.asm |
Verification | Checking if a string reads the same forwards and backwards. | View |
string_length.asm |
Calculation | Counting the number of characters in a string. | View |
string_reverse.asm |
Transformation | Reversing the character order of a string in memory. | View |
to_lowercase.asm |
Conversion | Converting all uppercase characters in a string to lowercase. | View |
to_uppercase.asm |
Conversion | Converting all lowercase characters in a string to uppercase. | View |
🛠️ Utilities (5 Programs)
| Program | Utility | Description | Code |
|---|---|---|---|
beep_sound.asm |
Audio | Generating a beep sound using the internal speaker. | View |
clear_screen.asm |
Screen | Routine to clear the DOS console screen. | View |
delay_timer.asm |
Timing | Generating a precise execution delay loop. | View |
display_date.asm |
System | Fetching and displaying the current system date. | View |
password_input.asm |
Security | Reading password input while masking characters (e.g., *). | View |
Warning
System Requirements: Ensure your environment meets these requirements before running the programs.
| Component | Requirement |
|---|---|
| 🖥️ Windows | Windows 7, 8, 10, or 11 (Emu8086 native support) |
| 🍎 Mac/Linux | DOSBox with TASM/MASM or Emu8086 via Wine / VM |
| 💻 Emulator | Emu8086 (Recommended for Windows) |
| ✏️ Text Editor | VS Code (Optional, for syntax highlighting) |
Suggested progression for mastering 8086 assembly using this repository:
- Basics (Level 1): Start with
Introductionto understand syntax (MOV, variables) andAddressing Modes. - Logic (Level 2): Move to
Arithmetic,Bitwise Operations, andFlagsto grasp data manipulation. - Control (Level 3): Master
Control Flow(loops/jumps) andConversionlogic. - Advanced (Level 4): Tackle
Procedures,Macros, andStack Operationsfor modular code. - System (Level 5): Explore
Interrupts,File Operations, andExternal Devicesfor real-world interaction.
Writing maintainable assembly code is an art. Follow these principles used in this repository:
- Consistent Commenting: Assembly is cryptic. Comment every logical block, not just instructions (e.g.,
; Check if divisible by 2instead of; Compare AX with 0). - Meaningful Labels: Use descriptive labels like
calculate_sum:orhandle_error:instead of genericL1:,NEXT:. - Modular Design: Break complex tasks into
PROC(Procedures) orMACROs to reduce redundancy. - Register Preservation: Always
PUSHregisters onto the stack before modifying them in a procedure, andPOPthem back before returning. - Data Segmentation: Clearly separate your
DATA,CODE, andSTACKsegments to avoid memory overlaps.
A handy cheat sheet of the most frequently used interrupts in this repository:
| Interrupt | Function (AH) | Description | Usage Example |
|---|---|---|---|
| INT 21h | 01h |
Read Single Character | MOV AH, 01h; INT 21h |
| INT 21h | 02h |
Print Single Character | MOV AH, 02h; MOV DL, 'A'; INT 21h |
| INT 21h | 09h |
Print String (ends with $) |
MOV AH, 09h; LEA DX, MSG; INT 21h |
| INT 21h | 4Ch |
Terminate Program | MOV AH, 4Ch; INT 21h |
| INT 10h | 00h |
Set Video Mode | MOV AH, 00h; MOV AL, 13h; INT 10h |
| INT 10h | 0Eh |
Teletype Output | MOV AH, 0Eh; MOV AL, 'X'; INT 10h |
| INT 16h | 00h |
Read Key Press (Wait) | MOV AH, 00h; INT 16h |
| Issue | Possible Cause | Solution |
|---|---|---|
| "Wrong parameters" | Mismatched operand sizes (e.g., MOV AX, BL) |
Ensure both operands are 8-bit or 16-bit. Use MOV AX, BX or MOV AL, BL. |
| "Undefined symbol" | Variable not declared in DATA segment |
Define variables using DB (byte) or DW (word) before usage. |
| Infinite Loop | Counter register (CX) not decrementing |
Ensure LOOP or DEC CX is used correctly. Avoid modifying CX inside the loop body unnecessarily. |
| Garbage Output | Missing string terminator | Ensure all strings displayed via INT 21h/09h end with a $ character. |
Essential tools and documentation for 8086 programming:
- Documentation: Intel 8086 Datasheet (PDF)
- Reference: x86 Instruction Set Reference
- Tools: ASCII Table | Online Hex Converter
- Emulator: Emu8086 Documentation
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/NewAlgorithm) - Commit your Changes (
git commit -m 'Add some NewAlgorithm') - Push to the Branch (
git push origin feature/NewAlgorithm) - Open a Pull Request
-
Clone the Repository:
git clone https://github.com/Amey-Thakur/8086-ASSEMBLY-LANGUAGE-PROGRAMS.git
-
Open in Emulator:
- Launch Emu8086
- Click
Openand navigate to the desired.asmfile (e.g.,Arithmetic/addition_16bit_simple.asm)
-
Assemble and Run:
- Click the
emulatebutton to compile - Use the
RunorSingle Stepcontrols to execute the code and observe register changes
- Click the
Note
This repository is openly shared to support learning and knowledge exchange across the academic community.
For Students
Use these programs as reference materials for understanding assembly logic, instruction syntax, and modular programming. Code is heavily commented to facilitate self-paced learning.
For Educators
The programs may serve as practical lab examples or supplementary teaching resources for Microprocessor courses (CSC501/CSL501). Attribution is appreciated when utilizing content.
For Researchers
The documentation and organization may provide insights into academic resource curation and educational content structuring.
This project is licensed under the MIT License - see the LICENSE file for details.
Summary: You are free to share and adapt this content for any purpose, even commercially, as long as you provide appropriate attribution to the original author.
Copyright © 2021 Amey Thakur
Created & Maintained by: Amey Thakur
Academic Journey: Bachelor of Engineering in Computer Engineering (2018-2022)
Institution: Terna Engineering College, Navi Mumbai
University: University of Mumbai
This repository represents a comprehensive collection of 8086 assembly programs developed, verified, and documented during my academic journey. All content has been carefully organized to serve as a valuable resource for mastering low-level system architecture.
Special thanks to the faculty members of the Department of Computer Engineering at Terna Engineering College for their guidance and instruction in Microprocessors. Their clear teaching and continued support helped develop a strong understanding of low-level system architecture.
Special thanks to the peers whose discussions and support contributed meaningfully to this learning experience.
👥 Authors · 📖 Overview · ✨ Features · 📁 Structure · 💾 Program Details · ⚙️ Prerequisites · 🗺️ Roadmap · 🌟 Best Practices · 📌 Quick Reference · 🔧 Troubleshooting · 🔗 Resources · 🤝🏻 Contributing · 📦 Execution Steps · 🚀 Usage · 📜 License · ℹ️ About · 🙏🏻 Acknowledgments
Computer Engineering (B.E.) - University of Mumbai
Semester-wise curriculum, laboratories, projects, and academic notes.
