Assembly Language Programming

Program Assignment #1

Write an assembly language program that evaluates the function f(x,y,z) = x-y+z for any single digit integers x, y, and z. You are to input the values for the variables as three characters (no space between the digits).

Your program must display a question mark on the screen as a prompt and accept exactly three characters as input. The integers entered are to be echoed on the screen as soon as their keypress is detected. The user will press exactly 3 keys and then the result will be displayed.

Input and output must be similar to the example below in which the user has entered 2, 4, and 7 for x, y and z. The program then displays the function call and result on the next line.

?247
f(2,4,7)=5

You must use a DOS interrupt function to get the input and to display most of the output. You are to assume the input is legal (2 digits). You will need to convert from ASCII to a 16-bit integer for calculations and output. Make sure everything works for negative answers. Be sure to include appropriate documentation (for example, your name, date, class, and a description of the program being written) and remember to document most of the lines of the program.

To print the calculated answer, use one of the author's library functions. The function you need to call is Writeint_signed (p 118). This is the only function you may call from the author's library. See the sample program on the subsequent pages of the text for more information about using Writeint_signed. In addition, you may consult the book's web site. You might try getting the sample program to run before trying your own.

Name your source and executable with the first 4 letters of your last name and a 1 indicating the program number. Turn in a printed copy of your program - it must look nice, so be careful about formatting it. Also email the executable version and your source code zipped together in a single zip archive (see the course index for a zip program if needed) and attached to a mail message. The subject line of the message must include the words: "Assembly Language Program 1". Try to make the return address correct as well!