Starting from:

$30

Assignment 1 Solution




Make a program




Create an X86 program that does the following:

Input 2 integers

Computes and displays the sum of those two inputs

Computes and displays the product of those two inputted integers.

Make the program produce the same output as shown in the sample output.










Sample output




Welcome to Open source Assembly Programming




This program was built by Cindy Lin.

Please input the first integer: -8

You entered -8

Please input the second integer: 12

You entered 12

The sum of these two integers is 4.

The product of these two integers is -96.

The integer 5 will be returned to the calling program.




The main function received this number: 5.

Main will now return 0 to the operating system.

Bye







Notes about the sample output




The text with the rectangle is output from the assembly module. All other output is produced by the driver function.




Obviously, you should change the sample of the programmer to be your own name.




Your program is not expected to output text in bold. Bold is used here only to emphasize the section outputted by the assembly instructions.

Other important things




When this program is completed there will be three files. Together they are the program of Assignment 1. A “program” contains many files.




Create a name for this your first assembly program. For example, you could call it “Learning to do Arithmetic using Assembly”. You should think of an even better title. Create a folder with the same name as the title of your program. In this folder you put the three files of this assignment.




This assignment requires three files:

1. A “driver” file. You make write the driver in C or C++. That is your choice. The word “driver” is a generic term, that is, it is a term that applies to lots of things. Pick a name for this file. For example, “arithmetic.cpp” or “arithmetic.c”. You pick a nice name for the driver file.




2. An X86 assembly file. This is a function written in X86 and it is called from the driver program. This is where the real work is performed. This program inputs the data, computes the sum and product, and output the results. You pick a suitable name for this file. For example, “compute_sum_product.asm” You pick a name that sounds good to you. Don’t everyone use the same name.




3. A bash script file. It is recommended that this file have a short name because you will key in its name many times. The professor often calls it “run.sh” or even “r.sh”. You should use a similar or same short name. The job of this script file is to compile the two previously mentioned files, link them to create one executable file, and lastly load that newly created executable file. “Load” means run it.







When you are done




When your program works then test it with all kinds of inputs: small integers, negative integers, integers too large to fit in 32-bit storage, and so on. If you obtain correct results every time the email to me your program (3 files as attachments). I will test run your program on an Xubuntu 19.4 distro. I will email feedback to you about how well your program performed.




Email: holliday@fullerton.edu




If it doesn’t run in my distro then there is no feedback. If a midterm or final exam program does not run in my distro then the score is 0.




Do not send non-working programs. Instead, bring non-working programs to the lab hour (usually the second half of the 2-hour period) and get individual help so that you can move on toward completion of this homework.

More products