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

Describe about physical systems, Q. Describe about Physical Systems? Ph...

Q. Describe about Physical Systems? Physical Systems are tangible entities which may be dynamic or static.   Computer Systems, Buildings,Vehicles etc. are illustrations of p

What are the pros and cons of on-line documentation, Question 1: You wa...

Question 1: You want to perform the task of setting an alarm on your mobile phone. You can assume that the alarm option is accessible from the main menu of your phone. (a) P

Performance of computer system, Performance of computer system: Comput...

Performance of computer system: Computer performance is frequently described in terms of clock speed (usually in MHz or GHz). It refers to the cycles per second of the main cl

What is a binary tree, What is a binary tree? A binary tree 'T' is desc...

What is a binary tree? A binary tree 'T' is described as A finite set of elements, known as nodes, such that: either (i) or (ii) happens: (i) T is empty (known as the 'nu

Breifly explain memory-to-memory architecture, Memory-to-Memory Architectur...

Memory-to-Memory Architecture The pipelines can access vector operands intermediate and final results straight in main memory. This necessitates the higher memory bandwidth. Fu

Functions of an operating system, a) In multitasking Operating Systems, th...

a) In multitasking Operating Systems, there are two types of multitasking such as the "Preemptive Multitasking" and the "Cooperative Multitasking". Describe the two mentioned mult

What is dot pitch of a CRT, Q. What is Dot Pitch of a CRT? Dot Pitch of...

Q. What is Dot Pitch of a CRT? Dot Pitch of a CRT is the distance between phosphor dots of same colour. In Trinitron screens, the term Slot Pitch is used in place of Dot Pitch

Explain vector-scalar instructions, Vector-Scalar Instructions In this ...

Vector-Scalar Instructions In this category, when combination of vector and scalar are fetched and stored in vector register. These instructions are referred with the subsequen

Illustrate about fifth generation electronic computers, Fifth Generation (1...

Fifth Generation (1984-1990) The advancement of the next generation of computer systems is characterized majorly by the acceptance of parallel processing.  Until this time para

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