Intel 8086 programs
A collection of educational assembly programs for the Intel 8086 microprocessor. Study string processing, character handling, text analysis, mathematical operations and other algorithms.
1.
Capitalizing the first letter of each word in a string
Converting the first letter of each word to uppercase using ASCII code analysis and word boundary detection
2.
Counting all vowels in a string
An algorithm for counting vowels in a string using a comparison table and a loop
3.
Counting all words in a given string
Determining the word count by counting transitions from a space to a non-space character using state flags
4.
Whether two characters appear next to each other in a string
Searching for a given sequence of two consecutive characters
5.
Whether a given string is a palindrome
Checking a string for a palindrome by comparing characters from the start and the end using indexed addressing and conditional jumps
6.
Removing a specific character from a given string
Removing all occurrences of a given character by shifting the remaining characters and correcting the string length using REP MOVSB
7.
Determining the string length
Calculating the string length by counting characters up to the terminating zero using the SCASB instruction or a loop
8.
Comparing two strings
Lexicographic comparison of two strings using the CMPSB string instructions and determining the result from the flags
9.
Joining two strings
Concatenating two strings by copying the second string to the end of the first using MOVSB instructions and correcting the length
10.
Replacing spaces in a string with a specific character
Replacing all spaces in a string with a given character using a loop, conditional jumps and buffer handling
11.
Replacing vowels in a string with an underscore
Finding vowels and replacing them with the '_' character while keeping the other characters and the string case
12.
Using a far pointer for a function call
A demonstration of working with far pointers and intersegment function calls in the 8086 architecture
13.
Printing a number in binary form
Converting a number to binary representation and printing it on the screen using bit operations and shifts
14.
Whether two characters occur equally often in a string
Checking that two given characters occur equally often in a string by counting and comparing the results
15.
Finding numbers in a string and calculating their sum
Extracting numeric values from a string, converting them from ASCII to binary form and calculating the total sum
16.
Whether a string is a title-case string
Checking whether a string matches the title format (each word starts with an uppercase letter) by analysing the case
17.
Inserting a space when an uppercase character follows a lowercase one
Processing camelCase strings: inserting a space before an uppercase letter that follows a lowercase one using case analysis
Programs using functions from the Handyfar.lib library
18.
The first 10 natural numbers
A program that prints the first 10 natural numbers using a loop and formatted output
19.
The sum of the first 10 natural numbers
Calculating and printing the sum of the first 10 natural numbers, accumulating the result in a variable
20.
Numbers from 100 to 200 divisible by 9
Finding numbers between 100 and 200 that are multiples of 9 and calculating their sum using division and remainder checking
21.
Three-digit numbers made of 1, 2, 3, 4
Generating all possible three-digit numbers from the digits 1, 2, 3, 4 without repetitions using nested loops
22.
The first N natural numbers and their sum
Reading the number n from the user, printing the first n natural numbers and calculating their sum
23.
Prime number check
Checking whether the entered number is prime by dividing it by all numbers from 2 to n-1
24.
Factorial of a number
Calculating the factorial of n by multiplying the numbers from 1 to n in sequence
25.
GCD of two numbers
An implementation of the Euclidean algorithm for finding the greatest common divisor of two numbers
26.
Sum of odd numbers
Printing the first n odd numbers and calculating their sum using the formula 2k-1
27.
Sum of even numbers
Printing the first n even numbers and calculating their sum using the formula 2k
28.
Power of a number
Raising a number to a given power by repeated multiplication
29.
Factors of a number
Finding all divisors of a number by checking the remainder of division by all numbers from 1 to n
30.
Multiplication table
Printing the multiplication table for a given number from 1 to 9
31.
Counting characters in a string
Counting the number of periods, commas, spaces and uppercase letters in a given string
32.
Printing a one-dimensional array
Printing the elements of a one-dimensional array using a loop and indexing
33.
Array in reverse order
Printing the array elements in reverse order using indexing from the end to the start
34.
Maximum array element
Finding the maximum element in an array by comparing each element with the current maximum
35.
Printing a two-dimensional array
Printing the elements of a two-dimensional array using nested loops over rows and columns
36.
Array input and output
Reading array elements from the keyboard and then printing them on the screen
37.
Sum of array elements
Calculating the sum of all array elements, accumulating the result in a variable
38.
Array copying
Copying all elements from one array into another using a loop
39.
Array sorting and squaring
Sorting the array with the bubble method and squaring each element
40.
Array of strings
Printing an array of strings with a zero delimiter, each string on a new line
41.
Coordinate structure
Defining a POINT structure with three fields, filling it in and printing the values
42.
Counting bits
Counting the number of set bits in a number using shifts and checking the CF flag
43.
Sum of two numbers
Calculating the sum of two numbers; if they are equal, returning triple the sum
44.
Difference from 51
Calculating the absolute difference between a number and 51, tripled if the number is greater than 51
45.
Checking two numbers
Checking whether one of the numbers is 30 or their sum is 30
46.
Multiple of 3 or 7
Checking whether a number is a multiple of 3 or 7 using division and remainder checking
47.
Same last digit
Checking that two numbers have the same last digit by dividing by 10 and comparing the remainders
48.
The sequence 1, 2, 3
Searching for the sequence 1, 2, 3 in an array of integers
49.
Three equal numbers in a row
Searching for three equal numbers in a row in an array
50.
Multiple of 13 or not
Checking whether a number is a multiple of 13 or leaves a remainder of 1 when divided by 13
51.
Same rightmost digit
Checking whether at least two of three numbers have the same last digit
52.
First or last element
Checking whether the first array element equals any other element
53.
Array of real numbers
Printing an array of double-precision floating-point numbers (DQ)
54.
Area of a circle
Calculating the area of a circle with the formula πr² using the coprocessor
55.
Volume of a sphere
Calculating the volume of a sphere with the formula (4/3)πr³ using the coprocessor stack
56.
Area of a triangle
Calculating the area of an equilateral triangle with the formula (√3/4)a²
57.
3x3 matrix traversal
Traversing and printing the elements of a 3x3 matrix using nested loops
58.
Matrix addition
Element-wise addition of two 2x2 matrices, storing the result in a third matrix