Objective: To develop a calculator program to perform simple math operations using the Pep/8 simulator.
Operations: Addition +
The equations should be entered by the user using prefix notation. That is, the operator should be entered first, followed by the two operands. The program should loop until the user enters a 'q' or 'Q' for the operator. If a 'q' or 'Q' is entered, the user should not be prompted to enter the operands. Each operation is also required to be contained within a subroutine.
All math operations use integer math. That means that integers ARE NOT rounded up. Example: 9/2 = 4
All integers are signed. Integers entered by the user may be positive or negative. Results may be positive or negative as well.
Use CHARI to get the operation. Use DECI to get the operands. Use DECO to print the result. Assume that user will type in correct input for the operator and operands.
If an overflow occurs, print "error." Recall that the range of a 16 bit signed integer is -32768 to 32767.
Print a linefeed and some dashes between execution sweeps. Print a space between the operands. Print an equal sign before the result
Sample Input (There is one space between each input)
+ 3 6 - 3 6 / 50 3 / 50 3 * 7 10000 * -3 3 * -3 -3 - -3 -3 q
Make sure your program works with this type of input.
Sample Output would look like this
+ 3 6 = 9
- 3 6 = -3
/ 50 3 = 16
* 7 10000 = error
* -3 3 = -9
* -3 -3 = 9
- -3 -3 = 0
Submit your program electronically. Submit the .pep source code file. It is not necessary to submit the listing.
I would suggest getting one subroutine working at a time. Addition and subtraction should be rather easy to implement, but multiplication, division, may require a little bit of thought and some prior design. It is also a good idea to use labels to represent your variables. Write and test your program in parts. Do not write the entire program and expect it to work the first time.
Be sure not to Branch out of a subroutine using a branch. You want to make sure you are CALLed into a subroutine and RET0 out of the subroutine.
How are you going to handle multiplying a positive times a negative?
Be sure to test all cases of + - / * with cases of positive and negative operands.
****Will pay for if done by 11:00pm tonight******
*****If not, by 11:00pm 11/7/13*******
5 freelancers estão ofertando em média $340 para esse trabalho
hi, I am an electronic engineering udergraduate from sri lanka who can get done ur project easily. I have worked wih many assembly language platforms. thankz
Can be using simulator as you want, and source code for compiling with MASM or NASM or FASM the code can by 16 and 64 bits as well... Using Intel 8086 Instructions.