Develop a calculator in masm, Computer Engineering

Assignment Help:

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.


Related Discussions:- Develop a calculator in masm

What is meant by a field, What is meant by a field The consecutive nonw...

What is meant by a field The consecutive nonwhite space characters that define a data item collectively define a field. It is possible  to limit the number of such characters b

What is a size category, What is a Size Category? The Size category ve...

What is a Size Category? The Size category verifies the probable space needs of the table in the database.

Difference among msgbox statement and msgboxq function, MsgBox is a built i...

MsgBox is a built in VB function which shows a Message Box and MsgBoxQ is a function definite by the user.

Fuzzy logic - artificial intelligence, Fuzzy set theory provides a means fo...

Fuzzy set theory provides a means for modeling the kind of uncertainty associated with vagueness, with imprecision, and/or with a lack of information regarding a particular element

What features are needed to implement top down parsing, The features are ne...

The features are needed to implement top down parsing are? Ans. Source string marker, Prediction making mechanism and also matching and backtracking mechanism features are need

Intelligent systems assignment, This logbook should be used to record decis...

This logbook should be used to record decisions, ideas, work done by your group on this assignment. Each group should keep one logbook, which must be submitted along with your sour

What is a verification point?, A verification point is a point in a script ...

A verification point is a point in a script that you make to confirm the state of an object across builds of the application-under-test.

How to change default drive in dos, Q. How to Change Default Drive in dos? ...

Q. How to Change Default Drive in dos? To modify a default drive type the new drive letter followed by colon (:) and then press Enter.  For example, if the default drive is A a

Give example of stack using encapsulation of OOA, Give example of stack usi...

Give example of stack using encapsulation of OOA An example of the Stack.  A Stack abstraction provides methods like pop (), push (), isEmpty(), isFull(). The Stack can be i

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd