Question: Program#2: Lab0x02-StoneAgeCalculator.asm What do you do if your number system has only one symbol, a pebble? Write a simple calculator program in which the user
Program#2: Lab0x02-StoneAgeCalculator.asm
What do you do if your number system has only one symbol, a pebble?
Write a simple calculator program in which the user enters numbers as rows of "pebbles" (lowercase 'o').
The calculator should maintain and display a "running result" which is used in the next computation.
The calculator should do 8-bit, unsigned integer operations.
If there is overflow, the calculator should give an error message and reset the running result to zero.
The user should be able to enter any of these symbols as operations:
+
-
*
/
% (modulor, or "remainder" operator
x (exit the program)
The only valid input characters should be "o+-*/%x" and the newline character.
Any other input character should result in your program giving an error message, but leave the running total unchanged.
Numbers are displayed as rows of 'o' characters (lowercase O)
Running result is displayed like this:
=ooooooooooo
A zero running result would look like:
=
The user enters calculations like this:
+oooo
meaning "plus 4"
%ooooooo
meaning "modulo 7"
The calculation is applied to the current running result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
