A comprehensive collection of 161 professionally documented 8086 Assembly programs, featuring an interactive web-based emulator, smart error detection, “Did you mean?” suggestions, and step-by-step debugging.
Microprocessor Lab · Source Code · Technical Specification · Live Demo
Authors · Overview · Features · Structure · Quick Start · Program Details · Roadmap · Best Practices · Specifications · Debugging · Resources · Contributing · Usage Guidelines · 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. All programs were developed, verified, and documented during my undergraduate studies (2018-2022) to master the 8086 architecture.
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
Emulation Environments
To achieve full execution fidelity, it is recommended to use the Emu8086 emulator or DOSBox with the TASM/MASM assembler suite. These environments provide comprehensive debugging capabilities, including real-time register monitoring and memory segment inspection, which are essential for mastering 16-bit architecture.
| Feature | Description |
|---|---|
| Instruction Implementation | Practical demonstrations of Arithmetic 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 |
| File System Operations | File creation, deletion, and read/write operations using DOS 21h interrupts |
| Graphics Programming | Video mode configuration, pixel drawing, and shape rendering (Lines/Rectangles) |
| Data Conversion | Low-level conversion logic for Hex-BCD, Binary, Octal, and ASCII transformations |
| 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 |
| Array Processing | Element Summation, Reversal, Min/Max finding, and Deletion logic |
| Bitwise Logic | Implementation of AND, OR, XOR, Shift, and Rotate operations |
| Control Structures | Logic flow control using Loops, Jumps, and Conditional Branching |
| Data Structures | Implementation of LIFO (Stack) and FIFO (Queue) data structures |
| Mathematical Computation | Logic for Factorial, Fibonacci, GCD, Series, and Prime Number verification |
| Matrix Operations | Matrix Addition and Transpose logic using multi-dimensional array simulation |
| Pattern Generation | Logic for generating Pyramids, Diamonds, and Geometric patterns |
| String Manipulation | Operations for Palindrome check, Length calculation, and Case conversion |
| System Utilities | Helper modules for Screen clearing, Delays, Date display, and Sound generation |
| Console I/O | Input/Output logic for Characters, Strings, Decimal, and Hexadecimal numbers |
- Architecture → Intel 8086 (16-bit)
- Assembler → MASM / TASM Syntax Compatibility
- Emulator → Emu8086
- Language → Assembly (ASM)
8086-ASSEMBLY-LANGUAGE-PROGRAMS/
│
├── docs/ # Formal Documentation
│ └── SPECIFICATION.md # Technical Architecture & Specification
│
├── Source Code/ # 8086 Assembly Programs (161 Files)
│ ├── Addressing Modes/ # Comprehensive Addressing Modes Reference (1)
│ ├── Arithmetic/ # Basic Math: Add, Sub, Mul, Div, BCD (14)
│ ├── Array Operations/ # Sum, Min/Max, Deletion, Insertion (7)
│ ├── Bitwise Operations/ # AND, OR, XOR, Shifts, Rotates (8)
│ ├── Control Flow/ # Loops, If-Else, Switch-Case, Jumps (7)
│ ├── Conversion/ # Hex-BCD, Binary, Octal, ASCII, 7-Seg (11)
│ ├── Data Structures/ # Stack (LIFO) & Queue (FIFO) (2)
│ ├── Expression/ # Factorial, Fibonacci, GCD, Power (13)
│ ├── External Devices/ # Traffic Lights, Stepper Motor, I/O (9)
│ ├── File Operations/ # Create, Read, Write, Delete (DOS) (4)
│ ├── Flags/ # Carry, Parity, Zero, Sign, Overflow (5)
│ ├── Graphics/ # VGA Mode, Line, Rectangle, Pixel (4)
│ ├── Input Output/ # Read/Display Dec, Hex, Binary (4)
│ ├── Interrupts/ # BIOS (INT 10h/16h) & DOS (INT 21h) (8)
│ ├── Introduction/ # Hello World, Syntax Demo, Time (15)
│ ├── Macros/ # Conditional, Nested, Parameters (4)
│ ├── Mathematics/ # LCM, Square Root, Perfect, Armstrong (5)
│ ├── Matrix/ # Matrix Addition & Transpose (2)
│ ├── Memory Operations/ # Block Transfer, Compare, Fill (4)
│ ├── Patterns/ # Pyramids, Triangles, Diamond (4)
│ ├── Procedures/ # Recursion, Parameters, Local Vars (5)
│ ├── Searching/ # Binary Search, Linear Search (4)
│ ├── Simulation/ # Fire Alarm, Water Level, Defect (3)
│ ├── Sorting/ # Bubble, Selection, Insertion (5)
│ ├── Stack Operations/ # String Reverse, Swap, Push/Pop (3)
│ ├── String Operations/ # Length, Reverse, Palindrome (5)
│ └── Utilities/ # Delays, Password, Sound, Clear (5)
│
├── .gitattributes # Git Configuration
├── .gitignore # Git Ignore Rules
├── CITATION.cff # Citation Metadata
├── codemeta.json # Project Metadata (JSON-LD)
├── LICENSE # MIT License
├── README.md # Main Documentation
└── SECURITY.md # Security Policy & Posture- Operating System: Windows 7, 8, 10, or 11 is required for native Emu8086 support.
- Emulator Software: The Emu8086 microprocessor emulator is required to assemble and execute the code.
- Alternative Environments: For macOS or Linux users, a virtualization layer (e.g., Wine, VM) or DOSBox with an assembler (TASM/MASM) is necessary.
Warning
Architectural Constraints & Safety
These programs are designed for the Intel 8086 (16-bit) architecture. Executing them in modern 64-bit operating systems without proper emulation (e.g., DOSBox) may lead to system crashes or undefined behavior due to direct memory access and interrupt usage. Always use a sandboxed 16-bit environment.
Run programs instantly in your browser without any installation.
- Open the Live Demo: 8086 Assembly Emulator
- Select a Program: Browse the sidebar library containing 161+ programs.
- Run or Step: Fast-forward execution or debug line-by-line.
For a full native experience with hardware access (requires Windows).
Prerequisites
- OS: Windows 7/8/10/11
- Software: Emu8086 (Required for native execution)
- Linux/macOS: Use DOSBox or Wine
Setup
-
Clone the Repository
git clone https://github.com/Amey-Thakur/8086-ASSEMBLY-LANGUAGE-PROGRAMS.git
-
Open in Emulator
- Launch Emu8086.
- Open any
.asmfile from theSource Code/directory.
-
Assemble and Run
- Click Emulate to compile.
- Use Run or Single Step to execute.
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 |
Suggested progression for mastering 8086 assembly using this repository:
| Level | Phase | Modules to Study | Key Concepts |
|---|---|---|---|
| 1 | Foundations | Introduction • Addressing Modes |
Syntax (MOV, DB/DW), Memory Segments, Direct/Indirect Addressing |
| 2 | Core Logic | Arithmetic • Bitwise Operations • Flags |
Binary Math (ADD, SUB, MUL, DIV), Logic Gates (AND, OR, XOR), CPU Status Flags |
| 3 | Control Flow | Control Flow • Conversion • String Operations |
Looping (LOOP, JZ), Conditional Branching, Hex/BCD Conversion, String Manipulation |
| 4 | Modular Design | Procedures • Macros • Stack Operations |
Stack Management (PUSH/POP), Subroutines, Code Reusability (MACRO) |
| 5 | System Level | Interrupts • File Operations • External Devices |
DOS/BIOS Interrupts (INT 21h, INT 10h), File I/O, Hardware Simulation |
| Principle | Implementation Strategy | Architectural Rationale |
|---|---|---|
| Documentation | Inline Annotation: Comment logical blocks rather than individual instructions (e.g., ; Check parity vs ; TEST AL, 1). |
Mitigates the inherent opacity of low-level machine directives and enhances maintainability. |
| Labeling | Semantic Identifiers: Use descriptive labels (calculate_sum:) instead of generic tokens (L1:). |
Improves control flow legibility and facilitates efficient debugging. |
| Modularity | Procedural Abstraction: Encapsulate logic within PROC definitions and MACRO expansions. |
Reduces code redundancy and promotes a structured, hierarchical program design. |
| State Safety | Register Preservation: Systematically PUSH and POP registers across procedure calls. |
Prevents volatile state corruption and ensures referential transparency between routines. |
| Segmentation | Memory Isolation: Explicitly delineate DATA, CODE, and STACK segments. |
Prevents memory access violations and ensures rigorous structural organization. |
The following table details the primary BIOS and DOS interrupt vectors utilized within this repository, indexed by their functional hexadecimal codes.
| Interrupt Vector | Service Code (AH) |
Operational Semantics | Implementation Syntax |
|---|---|---|---|
DOS API (INT 21h) |
01h |
Standard Input Read: Reads a character from STDIN and echoes to STDOUT. |
MOV AH, 01h; INT 21h |
DOS API (INT 21h) |
02h |
Standard Output Write: Writes a specific character (in DL) to STDOUT. |
MOV AH, 02h; MOV DL, 'A'; INT 21h |
DOS API (INT 21h) |
09h |
String Output: Writes a $-terminated string (pointed to by DX) to STDOUT. |
MOV AH, 09h; LEA DX, MSG; INT 21h |
DOS API (INT 21h) |
4Ch |
Process Termination: Safely terminates the current process and returns control to the OS. | MOV AH, 4Ch; INT 21h |
BIOS Video (INT 10h) |
00h |
Video Mode Control: Sets the video display mode (e.g., VGA 13h) via register AL. |
MOV AH, 00h; MOV AL, 13h; INT 10h |
BIOS Video (INT 10h) |
0Eh |
Teletype Output: Writes a character (in AL) to the active page in Teletype mode. |
MOV AH, 0Eh; MOV AL, 'X'; INT 10h |
BIOS Keyboard (INT 16h) |
00h |
Keystroke Retrieval: Blocks execution until a key is pressed, returning the scan code. | MOV AH, 00h; INT 16h |
A structured guide to diagnosing and resolving non-deterministic behaviors and assembler errors.
| Error Condition | Root Cause Analysis | Resolution Strategy |
|---|---|---|
| Operand Size Mismatch | Type Incompatibility: Attempting to operate on disparate data widths (e.g., MOV AX, BL) without casting. |
Ensure operand bit-width parity. Use explicit type matching, e.g., MOV AX, BX (16-bit) or MOV AL, BL (8-bit). |
| Unresolved Symbol | Declaration Void: Referencing a label or variable identifier not defined within the accessible DATA or CODE scope. |
Verify symbol definitions. Instantiate variables using appropriate directives (DB, DW) prior to instruction reference. |
| Non-Terminating Loop | Control Logic Failure: The Loop Counter register (CX) fails to converge to zero, or is unwittingly mutated. |
Validate LOOP logic. Ensure strict monotonicity of CX decrement and avoid side-effect mutations within the iterative body. |
| String Termination Fault | Buffer Overrun: The string output routine (INT 21h/09h) continues reading memory past the intended buffer. |
Enforce string termination. Append the DOS-standard $ delimiter to all string definitions to signal End-of-String. |
Essential tools and documentation for 8086 programming:
- Documentation: Intel 8086 Datasheet (PDF)
- Reference: x86 Instruction Set Reference
- Tools: ASCII Table | Online Hex Converter
- Emulator: 8086.js Web Emulator
This repository maintains a rigorous fork-and-pull collaboration model. Contributions that enhance the codebase's educational value and technical precision are highly appreciated.
-
Fork the Repository Replicate the repository to your personal remote namespace.
-
Initialize Feature Branch
git checkout -b feature/Optimization
-
Snapshot Changes Stage and record changes with semantic messaging:
git commit -m 'Refactor: Optimize loop logic' -
Push to Origin Upload the branch to your remote origin:
git push origin feature/Optimization
-
Submit Pull Request Initiate a formal code review process for integration.
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 repository and all linked academic content are made available under the MIT License. See the LICENSE file for complete terms.
Note
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.
Connect: GitHub · LinkedIn · ORCID
Grateful acknowledgment 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 and 16-bit CISC operations.
Special thanks to the mentors and peers whose encouragement, discussions, and support contributed meaningfully to this learning journey.
Authors · Overview · Features · Structure · Quick Start · Program Details · Roadmap · Best Practices · Specifications · Debugging · Resources · Contributing · Usage Guidelines · License · About · Acknowledgments
Computer Engineering (B.E.) - University of Mumbai
Semester-wise curriculum, laboratories, projects, and academic notes.

