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

Why cmos circuits are extensively used for On-chip computers, CMOS circuits...

CMOS circuits are extensively used for ON-chip computers mainly because of their extremely ? Ans. Since CMOS circuits have large packing density, so these are extensively use

Explain problem-oriented and procedure-oriented language, Explain differenc...

Explain difference between Problem-oriented and procedure-oriented language. Problem-oriented and procedure-oriented language: The programming languages which can be utilized

Operating system, explain network operating system and design issues?

explain network operating system and design issues?

Spcc, Disadvantages of macro processor

Disadvantages of macro processor

Fetching a word from memory - computer architecture, Fetching a word from m...

Fetching a word from memory: CPU transfers the address of the needed information word to the memory address register (MAR). Address of the needed word is transferred to the pr

Explain random-access semiconductor memories, Q. Explain Random-access Sem...

Q. Explain Random-access Semiconductor Memories Q. What is Basic memory cell? Explain Two Dimension Memory Organization with diagram.

Binary constraints, Binary Constraints: Alternatively unary constraint...

Binary Constraints: Alternatively unary constraints specify that a particular variable can take certain values that basically restricts the domain for that variable thus shoul

Functional requirements of a control unit, Q. Functional Requirements of a ...

Q. Functional Requirements of a Control Unit? Let's first try to define functions that a control unit should perform in order to get things to happen. However in order to defin

Translate assembly language program to machine , A useful exercise in under...

A useful exercise in understanding assembly language and its relation to machine language is to take a short assembly language program and translate it to machine language by hand.

What are prefetch instructions, What are prefetch instructions? Prefetc...

What are prefetch instructions? Prefetch instructions are those instructions which can be inserted into a program either by the programmer or by the compiler.

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