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

Integrated services digital network service, Whole idea of ISDN is to digit...

Whole idea of ISDN is to digitize the telephone network to permit transmission of video, audio and text over existing telephone lines. The purpose of ISDN is to provide fully integ

What is usb, What is USB USB (UNIVERSAL SERIAL BUS) is intended to conn...

What is USB USB (UNIVERSAL SERIAL BUS) is intended to connect peripheral devices like mouse, keyboards, modems and sound cards to microprocessor through a serial data path and

What are the update types possible, What are the update types possible? ...

What are the update types possible? The following update types are possible: Update type A: The matchcode data is updated asynchronously to database changes. Update

Constant current sources, Constant Current Sources An ideal constant c...

Constant Current Sources An ideal constant current source delivers a given current to a circuit regardless of the voltage required to do so. . Constant current supplies are r

What are the various layers of a file system, What are the various layers o...

What are the various layers of a file system? The file system is composed of lots of dissimilar levels. Each level in the design uses the characteristic of the lower levels to

Networking, how to connect a home network

how to connect a home network

What are types of applets, There are two different parts of applets. Truste...

There are two different parts of applets. Trusted Applets and Untrusted applets. Trusted Applets are applets with predefined security and Untrusted Applets are applets without any

Describe distributed object model, Question 1 Give a brief explanation on m...

Question 1 Give a brief explanation on message oriented middleware Question 2 Describe Distributed object model Question 3 Explain File systems in a distributed computing Env

What a header script can specify in cgi, A header in CGI script can specify...

A header in CGI script can specify? A header into CGI script can give format of document and New location of perticular the document.

Can you define a field without a data element, Can you define a field witho...

Can you define a field without a data element? Yes.  If you require specifying no data element and thus no domain for a field, you can enter data type and field length and a sh

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