Write a program named numfun.asm that uses several procedures, some internal, some external.

The program will allow the user to enter a list of numbers in base 10. The number of values to be entered will be entered by the user when the program starts.

After the user enters the numbers, the program will display the numbers in reverse order in hexadecimal, binary, and decimal, separated by the tab character.

Finally, the sum of the numbers will be shown.

The stack will serve as your storage area (making reversing the order of input values easy and eliminating the need to allocate an array of unknown size). Basically, you will determine how many numbers the user will input, run a loop that many times to get the numbers, and push them onto the stack as they are entered.

When the loop terminates, you will begin another loop that pops the data from the stack, printing the required information for each number as it is removed. You must also calculate the sum as the numbers are processed (unless you do this during input).

Three procedures (in addition to main) are required.

1) A procedure to display a number (the number is passed in EAX as an argument) in hex, binary, and decimal. The tab character (ASCII value 9) must be output between these values.

2) A procedure to just output a tab character (and preserve registers). No arguments are needed.

3) A procedure to prompt the user, accept an integer as input, and return the integer in EAX. The address of the prompt message will be passed to this procedure in EDX. You will call this procedure using at least two different prompt messages passed into this procedure: One to prompt initially for the number of numbers, and one to prompt for the next number to be entered. So the SAME procedure will to handle both scenarios.

Your procedures should not alter any registers unless a return value is expected.

Remember to document the program, as well as each procedure, as required by the Coding and Documentation Standards (the description of the program in the program header must include explanation of the input and output).

Sample Output

In this example, the user enters 4 for the number of values and then entering the integers 1, 1024, 13, and -100 when prompted. The program then displays the output and sum.
How many numbers do you want to enter? 4
Enter an integer: -1
Enter an integer: 1024
Enter an integer: 13
Enter an integer: -100
FFFFFF9C 1111 1111 1111 1111 1111 1111 1001 1100 -100
0000000D 0000 0000 0000 0000 0000 0000 0000 1101 +13
00000400 0000 0000 0000 0000 0000 0100 0000 0000 +1024
FFFFFFFF 1111 1111 1111 1111 1111 1111 1111 1111 -1
The sum is: +936
Press any key to continue . . .

Call the author’s Crlf procedure so that each prompt appears on a new line, the sum is printed on a new line, and the system’s terminal message is also on a new line. Also be sure to print a label (even if just one word “Sum = “) before printing the sum.

The problem document will contain:
• Algorithm(s) , stated as pseudo-code (C, C++, Pascal, or Java-like code, without strictly adhering to the syntax of the language).
• A test plan and results.
The test plan must include a list (preferably in table format) of the input you used to test the program and the output you expected (expected output), and the output you actually got (actual output).

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

TAB = 9 ; ASCII code for Tab
string1 byte "How many numbers do you want to enter? ",0
string2 byte "Enter an integer: ",0
string3 byte "The sum is: ",0
count dword ?
space byte " ",0
sum dword 0h
val1 DWORD ?

main PROC
mov edx, OFFSET string1
call Prompt
mov count,eax;
mov ecx,count
mov edx, OFFSET string2

call Prompt...
$90.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats