8086 ALPs Source Code


Displays a line of text on the terminal screen

Displaying a two digit number

Prints a two digit number from a memory location in Data Segment on the screen. Assumes just a two digit decimal number to be present in the memory location

Accepting two digit number

Accepting a 2 digit number. The number entered by the user is expected in HEX format. Only capital letters (A-F) are supported for numbers (10-15). Small letters to represent (10-15) are not supported in this program. The number is accepted one digit at a time,with MSB digit first.

Count number of negative numbers in array

Counts the number of negative number in the array stored in the memory in data segement. Assumes the numbers stored in HEX format.Outputs the count in HEX format

Overlapped and non-overlapped block transfer of elements

Program for non-overlapped and overlapped block transfer of array elements.Takes the array elements from the user and also the number of elements to be overlapped in overlapped transfer.Block transfer here, refers to moving of block of data within the memory to a different location.In non-overlapped transfer we move the data to a completely new location. It is easily accomplished by copying the data using two pointers, one data byte at a time.In overlapped transfer the data block is shifted slightly from the present position,thus, some of the starting elements may overlap with the old position of the last elements in the array. They are therefore copied in reverse order

Calculating average of N numbers in 8086 ALP

Calculating average(mean) in 8086 assembly language.
The program takes input from the user in HEX format and displays the average of N numbers in the form of quotient and remainder after dividing the sum by total numbers.

The program only expects 8-bit numbers and assumes that the total would be less than 256(decimal)

Counting number of spaces in string in 8086 ALP

Counting number of spaces in a given string in 8086 Assembly Language.
The program prompts the user for an input string, compares every character with space character and displays the number of space character in the string.

Reversing a string in 8086 ALP

Reversing a given string in 8086 Assembly Language.
The program prompts the user for an input string, reverses and displays it.

To find the reverse,we just copy the string from one memory location to another in reverse order and display it.
We first copy the first two bytes of the string array as it is in the new string,since they remain same for the reversed string. Then we position the SI pointer to the end of the given string and copy character by character in the new string in reverse order.
Finally the new string is displayed,which is the reverse of the original string.

Checking for palindrome in 8086 ALP

Palindrome check for a given string in 8086 Assembly language.
The program prompts the user for a string and checks whether the given string is a palindrome and displays the appropriate message.

String length calculation in 8086 ALP

Finding the length of a given string in 8068 Assembly Language.
The program prompts the user for an input string and displays its length.
The string array has the following structure in 8086:

0th byte->size
1st byte->length of string
from 2nd byte->actual string

We therefore use the 1st byte of the array to find the length of the string and display it,as shown in the code below.

Concatenation of strings in 8086 ALP

Concatenation of strings in 8086 Assembly Language.
The program takes two strings from the user and concatenates the two strings into one and displays it.

For concatenation the second string is copied at the end of the first string.
The first string array should have enough memory to accommodate the length of the second string.

String operations(using menu) in 8086 Assembly Language(ALP)

String operations in 8086 ALP using case structure(menu driven) This program demonstrates implementation of menu driven program using string operations such as calculating length of a string, counting number of spaces in a string,reversing a string,etc in 8086 Assembly language.

The program displays a menu to the user and performs action as per the user input.

Simulating copy command of DOS in 8086 Assembly language

Simulating copy command of DOS in 8086 assembly language This program shows an implementation of copy command of DOS in 8086 Assembly language.
The program expects two arguments:

copy1 file1 file2

Here copy1 is the name of the program. file1 is the existing file from which we wish to copy data to file2. The program assumes that file2 does not exist. If it exists,it simply overwrites it without any warning.

1)The program first reads in the file names from the command line via PSP.
2)It then opens the first file,i.e. file1 and stores its handle in a variable.
3)Create a new file for copying the data, file2.Exit the program if error occurs.
4)Open file2,if error opening file, exit the program.
5)Read data from file1 in a buffer (here buffer is of size 100 bytes) and write in file2,untill end of file is reached. If at any point error occurs, exit the program immediately.
6)Close both the files,when writing is complete.

This program is a very basic implementation of copy command and can only do one thing.It cannot accept file names with spaces, and very limited error checking has been done.