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
Why WAP gateways are used? The Wireless Application Protocol Gateway is a very unique product giving semi -automatic redirection of HTML documents to WAP compatible mobile phon

Write a 'C' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number

SUPER COMPUTER The upper end of state of art mainframe machine is the supercomputer. These  are  the  fastest  machines  in  terms  of  processing  speed  and  use multiprocess

Discuss the advantages of store program control (SPC) automation in telephone switching. Advantages of SPC: (i) Simple to control (ii) Simple to maintain (iii) Fine-

Q. Show the Memory Hierarchy of computer system ? Memory in a computer system is essential for storage and subsequent retrieval of instructions and data. A computer system uses

Data Mining is an analytic method designed to explore data and then to validate the findings by applying the detected patterns to latest subsets of data.  The ultimate goal of dat

? Object: The interaction among objects takes place in a system. An object is depicted by a rectangle with the name of the object, preceded by a colon and underline. ? Relation

Evaluation Functions for Cutoff Search - artificial intelligent Evaluation functions guess the score that may be guaranteed if a specific world state is reached. In chess, such

Q. How to calculate register indirect addressing? The effective address of operand in this technique is calculated as: EA= (R) and D = (EA)  Address capability of regi

Mathematical Simulation and Modeling Applications The tasks including modeling and mathematical simulation require a lot of parallel processing. Three basic formalisms in model