Project 3 - Intel ASM Programming
DAT 2343 - Fall 2001
Synopsis
- From the given program
description, write your own pseudo-code algorithm.
- Implement your pseudo-code algorithm using Intel Assembly Language.
- Assemble
your program into a .COM format executable and test it.
- Hand in an envelope containing a diskette with
three files, and two printouts.
Write the pseudo-code algorithm and Intel Assembler program that solves the following
problem. Use the language of the problem; do not write anonymous code
with inappropriate variable names and comments.
- Your program should begin by outputting the full text of your
standard multi-line Assignment
Submission Label (Name, EMail, etc.). Make it look good on the
screen.
- On a new line, output a prompt string asking for the input of three
vacation days.
Make the prompt language relevant to the problem being solved. (Do not
say only "Enter three characters".)
- You are to input three single, unsigned bytes (using the DOS
keyboard input service) that represent vacation days.
Each byte is a code that stands for a vacation day. The
three bytes may arrive in any order, and they may have any values
possible for an unsigned byte, including non-ASCII values.
- On a new line, output the three unsigned bytes in descending order
from largest to smallest.
- On a new output line, output all the non-vacation days (bytes) between the first vacation day (the smallest
byte of the three) and the
last vacation day (the largest byte of the three). As you print
all the non-vacation days (bytes), you must arrange not to print out the middle
day (byte) of the three, as it is also a vacation day. You must print out
all the non-vacation days (bytes) from the smallest day (byte) up to the
largest day (byte),
skipping over the middle vacation day (byte).
Here's another way to express the same problem (though it does not use the
correct language of the above problem):
- Output a text string.
- Prompt for some input.
- Read three bytes.
- Output the three bytes sorted in descending order, from largest to
smallest.
- Output all the bytes between the smallest and the
largest byte,
except the byte that is the middle byte of the three. (Do
not output the largest or the smallest either!) Output the bytes in ascending order, skipping over the middle
byte.
The program algorithm 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. You will hand in both your
chosen algorithm and your implementation of it in Intel assembly
language. Duplicate submissions will constitute Academic
Fraud; share your ideas, not your algorithm or your source code.
Sample Input and Output
The Assignment Label 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: !!!
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 25 lines long. I
tested the logic of my pseudo-code by turning it into a C program that was
about 40 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 70 instructions, plus comment lines, data, and segment
details. Yours may differ.)
Intel/DOS Assembly Language Notes
- Assembly language variable names and labels must start with a letter, may not
contain blanks, and must not be any reserved
word. (These are the same rules used in most programming
languages.)
- When writing mnemonic assembly language code using labels, ensure that
all labels used have defined locations. You may insert labels that
are never actually used, for commenting purposes; but, do this sparingly
as it can confuse people who read your code. (Why is there a label
on this instruction if it is never used?)
- You can't use the same name for two different variables and/or
labels. All names must be unique. (These are the same rules used in most programming
languages.)
- Labels on code have colons. Labels on data don't.
-
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.
Assembly, Testing, and Debugging
Download the freeware Arrow
Assembler. Assemble,
Link, run, test, and debug your program. You can trace
your program by loading it into DOS DEBUG and using "t" (Trace)
or "p" (Proceed) DEBUG commands.
Submit a diskette and print-outs according to the Hand
In format given below.
Testing and Marking
I will be testing your program with many different inputs. Approximately
half your mark is awarded based on your ability to handle all of my test cases
- be brutal and thorough in your own testing. The other half of the mark
comes from adhering to project specifications and good programming practice.
Remember that you can use DOS command-line redirection to feed characters
into your program for testing, and to save output for examination after a test
run:
C:\> myprogram <input >output
C:\> type output
I
tested the logic of my code by turning it into a C program that was
about 40 lines long. You can try running it here
to see if you get the same output for a given input.
Summary: Hand in 2 text files and a .COM file on one labelled diskette; 2 printouts on paper.
Submit your Project diskette and print-outs in a labelled, unsealed, but closed
envelope. (If you seal an envelope, it becomes useless as an envelope
after I unseal it!) Put the diskette behind the print-out papers
when you close the envelope, so that it won't fall out.
Create and include in the envelope a copy of a labelled diskette containing
two text files and a .COM file (keep a backup copy):
- File 1: A text file named P3.TXT containing my Assignment
Submission label information followed by your pseudo-code algorithm.
- File 2: A text file named P3.ASM containing my Assignment
Submission label information (as a comment) followed by the Intel Assembly
Language instructions of your program in standard three-column (plus
comments) format. (For full marks, make sure your columns line up.) I will run this
file through the assembler to verify
it; make sure it assembles properly.
- File 3: A binary executable file in .COM format named P3.COM that is your
assembled and working program.
Print both the P3.TXT and P3.ASM text files from the
diskette on paper and include the two printouts in the envelope:
- Printout 1: Print a clear paper copy of your P3.TXT
file for submission in the envelope along with your diskette.
- 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.
For full marks:
- Follow my Assignment
Submission Standards. Put labels on everything, including the
diskette!
- Both the text files on the diskette must be plain text only.
Plain text is readable in Windows Wordpad (text format), Notepad, or DOS EDIT (or
Unix/Linux vi, or Macintosh Teach Text). Check the format of your files before you
submit them. Do not submit Word, WordPerfect, or HTML documents.
- 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. Watch out for
Windows hidden extensions; marks will be deducted for files named with
double extensions such as P3.TXT.TXT. Consult your Windows
documentation for details on turning off hidden file extensions.
- 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.
|