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
Enumerate the Design reusability of VHDL VHDL.  Functions  and  Procedures  may  be  placed  in  a  package  so  that  they  are  available  to  any design-unit which wishes t

You are required to use software of your choice (spreadsheet, database, statistical package etc) to analyze the provided SAP security audit log data ( Userdata.xls ), generate appr

Q. Describe Critical Directive in FORTAN? The critical directive permits one thread executes associated structured block. When one or more threads attain critical directive the

Q. Block Diagram of a Microcomputer System? Before going on to consider the I/O sub/systems of a computer, let's discuss how a digital computer system can be realized by a micr

A Canvas object gives access to a Graphics object by its paint() method.

When a database developer uses Hybrid OLAP it seperates the data among relational and specialized storage. In some certain modifications a HOLAP database may store vast amounts of

Explain briefly Dead code Elimination of the commonly used code optimization techniques Dead code Elimination: Code which is unreachable or which does not influence the pr

Explain the T Flip Flop? The toggle, or T, flip-flop is the bistable device that changes state on command from a common input terminal.   Truth Table

The term addressing mode is a technique of stating the input and output of an instruction; it is termed the effective address. There are 6 effective addresses in the 68HC11 set of

Engineering Applications A number of the engineering applications are: 1. Simulations of artificial ecosystems  2. Airflow circulation over aircraft components Airflow