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).
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).
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.INCLUDE Irvine32.inc
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 ?
mov edx, OFFSET string1
mov edx, OFFSET string2
By purchasing this solution you'll be able to access the following files: