Develop a calculator in masm, Computer Engineering

Assignment:  develop a calculator in MASM.

Text chapters covered:  1 through 4, 5.4, 5.5, 6.3, 7.4

You will develop a "calculator" algorithm in MASM using reverse-polish notation (RPN).  RPN is an extremely useful technique to calculate algebraic expressions.  It is used by many compilers to process algebraic statements.  Your calculator will evaluate RPN expressions using INTEGER values only.

RPN is a postfix expression, meaning that the operation (add, subtract, etc.) follows the variables.  Contrast this to an algebraic expression where the operations are situated between the variables (this is called infix notation).  Here's an example of an RPN expression and its algebraic equivalent:

                        Algebraic equation:     E(A+B)/C-D

                        RPN equivalent:          AB+E*CD-/

To compute an RPN expression is a straightforward process using stacks.  Assume that the RPN expression is always presented as a character string.  The algorithm to do this is shown below.

1. If the character encountered is a variable, push the variable on the stack.

2. If the character encountered is a operator (+,-,*,/), pop the top two variables off the stack, perform the operation on them, then push the result back on the stack.

3. Continue steps 1 and 2 until the string is exhausted.  The last value on the stack is the final result.

Posted Date: 2/25/2013 1:55:35 AM | Location : United States







Related Discussions:- Develop a calculator in masm, Assignment Help, Ask Question on Develop a calculator in masm, Get Answer, Expert's Help, Develop a calculator in masm Discussions

Write discussion on Develop a calculator in masm
Your posts are moderated
Related Questions
What is virtual memory? How address mapping is done in cache memory? Elaborate your answer with examples.

How are interrupt handled by the operating system? The fundamental interrupt mechanism works as follows: The CPU hardware has wire called the interrupt-request line which


Define emulation. Given a computer with a particular instruction set, it is possible to explain additional machine instructions and execute them with extra micro routines. Emul

Question : Multimedia involves multiple modalities of text, audio, images, drawings, animation, and video (a) Describe three popular file formats for images (b) Most imag

Differentiate between Gateways and Bridges. A machine that connects a LAN to the Internet is termed as a gateway. The gateway machine is responsible for routing packets that ar

Conversioin of the decimal number 82.67 into Octal number ? Ans. The binary equivalent is (1010010.10101011) 2 of decimal number 82.67. After that convert each 3-bit binary in

What are the advantages of code optimization? Code optimization tends at enhancing the execution efficiency of a program. It is achieved in two manners. Redundancies in a progr

Q. What is Random Access Memory? We will discuss RAM as an example of sequential circuit. A memory unit is a collection of storage cells or flip flops along with associated cir

write a short note on the tri state ttl inverter