Updated: 2003-09-23 11:46

# Project 3 - Intel ASM Programming

## DAT 2343 - Fall 2000

### Synopsis

1. From the given program description, write your own pseudo-code algorithm.
2. Implement your pseudo-code algorithm using Intel Assembly Language.
3. Assemble your program into a .COM format executable and test it.
4. Hand in an envelope containing a diskette with three files, and two printouts.

### Program Description and Sample Input

Write the pseudo-code algorithm and Intel Assembler program that solves the following problem:

Your program should begin by outputting your name and your Algonquin email address.  Next, output a prompt string asking for input.  Make the prompt language relevant to the following problem being solved:

You are to input three character bytes that represent vacation days.  Each character stands for a day.  The three characters may arrive in any order, and they may have any values possible for a character byte.  On a new line, output the three characters in descending order from largest to smallest.  Then, on a new output line, output all the non-vacation days (characters) between the first vacation day (the smallest character of the three) and the last vacation day (the largest character of the three).  As you print all the non-vacation days (characters), you must arrange not to print out the middle day (character) of the three, as it is also a vacation day.  You must print out all the non-vacation days (characters) from the smallest day (character) up to the largest day (character), skipping over the middle vacation day (character).

Here's another way to express the same problem:

2. Prompt for some input.  Use language in the prompt that relates to the problem being solved.
3. Your program should read three bytes (characters) and store them in memory.
4. Output the three bytes sorted in descending order, from largest to smallest.
5. On a new output line, output all the characters between the smallest and the largest character, except the character that is the middle character of the three.  (Do not output the largest or the smallest either!)  Output the characters in ascending order, skipping over the middle character.

The method you choose to produce the output is entirely up to you.  The internals of the algorithm are not specified; you simply have to produce output that matches the given specifications.

#### Sample Input and Output

The name and address output, and the prompts to enter input, are not shown in these sample examples.  Only the core problem inputs and outputs are given.

```Input:  ADK
Output: KDA
BCEFGHIJ```
```Input:  lsp
Output: spl
mnoqr```
```Input:  926
Output: 962
34578```
```Input:  @A@
Output: A@@```
```Input:  !!!
Output: !!!```

### Pseudo-Code and Intel Assembler

Write a pseudo-code algorithm that implements the given program specifications.  Pick proper names for your variables.  Use good names that reflect the functions of the variables in the original problem. You will be handing this in.  (My pseudo-code was about 30 lines long.  I tested the logic of my pseudo-code by turning it into a C program that was about 35 lines long.  You can try running it here.)

Translate your pseudo-code into Intel Assembly language instructions.  Pay attention to the details of your algorithm and the placement of each statement.  Do not optimize your assembly code!  (My resulting assembly language program was about 56 instructions, plus data and segment details.  Yours may differ.)

Use the DOS interrupt services for all your input and output.

For full marks, you must add meaningful comments to your assembler code, explaining how the code actually implements the problem solution.  (Do not add comments that merely echo what each assembler instruction does!)  You will be handing this in.

Submit a diskette and print-outs according to the Hand In format given below.

### Hand In

Summary: Hand in 2 text files and a .COM file on one labelled diskette; 2 printouts on paper.

Submit your Project in a labelled, unsealed, but closed envelope.  (If you seal an envelope, it becomes useless as an envelope after I unseal it!)

Create and include in the envelope a copy of a labelled diskette containing two text files and a .COM file:

1. File 1: A P3.TXT text file containing my Assignment Submission label information followed by your pseudo-code algorithm.
2. File 2: A P3.ASM text file containing my Assignment Submission label information (as a comment) followed by the Intel Assembly Language instructions of your program.  (Make sure the columns line up!)  I will run this file through the assembler to verify it; make sure it assembles properly!
3. File 3: A P3.COM binary executable file that is your assembled and working program.

Print both the P3.TXT and P3.ASM text files from the diskette and include the two printouts in the envelope:

1. Printout 1: Print a clear paper copy of your P3.TXT file for submission in the envelope along with your diskette.
2. Printout 2: Print a clear paper copy of your P3.ASM file for submission in the envelope along with your diskette.

Please keep master copies of the diskette and printouts; don't hand in your only copies.  Ensure that the documents print neatly - pay attention to margins and indentation.  Full marks are only given for clearly-formatted output.  Since you will ensure that each file begins with an Assignment Submission Label as a comment, you don't need a labelled cover page for the printout.  Just print the two files.

#### Text Files

For full marks:

1. Follow my Assignment Submission Standards.  Put labels on everything, including the diskette!
2. Both the text files on the diskette must be plain text only.  Plain text is readable in Windows Wordpad, Notepad, or DOS EDIT (or Unix/Linux vi).  Check the format of your files before you submit them.  Do not submit Word, WordPerfect, or HTML documents.
3. Use the exact file names given.  No variation in spelling is accepted.  The automated program I use to mark these assignments will not find misspelled file names on your diskette.  Do not place files in a subdirectory on the diskette.
4. Ensure that the documents print neatly - pay attention to margins, line length, and consistent indentation.  Align the columns carefully.

## Problems?

As with all questions and comments on course content, please post any problems you encounter to the course discussion news group.

 Web Author: Ian! D. Allen idallen@idallen.ca      Updated: 2003-09-23 11:46 Support free and non-commercial Internet. This site works best in Any Browser, a campaign for non-specific WWW. This work is licensed under a Creative Commons License.