Program to evaluate equation, Assembly Language

Write a program to evaluate the following expression.

You are to evaluate the following equation:

num1 - (input + num2) - (num3 + num4)

Input will be a hex number input by the user using Readhex. The input can be 1,2,3,4 or 5 hex digits. num1, num2, num3 and num4 are variables defined in the data section of your program.

When you evaluate the above expression you should follow the normal order of operations for evaluating a math expression. You should evaluate the expressions within the parenthesis first and then work left to right.

For example when you evaluate 7 - 3 - 2 you should work left to right so the answer is: 7 - 3 = 4 - 2 = 2. If you work from right to left you get the wrong answer: 3 - 2 = 1 and 7 - 1 = 6.

You must evaluate the above equation as it is and not simplify it. In other words you must evaluate: num1 - (input + num2) - (num3 + num4) not evaluate something like num1 - input - num2 - num3 - num4 etc.

Also do not reverse the order of the operations within the (). You must evaluate (input+num2) and (num3+num4) and not (num2+input) or (num4+num3). Later we will learn that the order of the operands is important as we write a program to evaluate any expression.

 

Posted Date: 3/18/2013 5:49:24 AM | Location : United States







Related Discussions:- Program to evaluate equation, Assignment Help, Ask Question on Program to evaluate equation, Get Answer, Expert's Help, Program to evaluate equation Discussions

Write discussion on Program to evaluate equation
Your posts are moderated
Related Questions
You are to write an assembly language program called subfaq.s that computes the generalized subfactorial function of nonnegative integer inputs i0 and n. The generalized subfactori

NEG: Negate:- The negate instruction forms the 2's complement of the particular destination in the instruction. For obtaining 2's complement, it subtracts the contents of destinat

code to add two matrices

assembly language program to find larges number in an array

Fourth  Generation Microprocessor : The single chip 32-bit microprocessor was introduced in 1981 by Intel as iAPX 432. The other 4th generation  microprocessors  were;  Hewlett

Write a MC68HC12 assembly language program to average ten 16-bit values that are stored starting at address $1100. Place the two-byte result at $1110. Use indexed addressing. Us

Write the structure of For…Next loop in VB.Net and also write a program to print integers from 1 to 10 on the console.

External System Bus Architecture : This is a 16 bit processor with 40 pins. It has twenty address pins and out of which sixteen are utilized as data pins. This concept of by us

how to store a bulk data in a external eeprom

Using the following table as a guide, write a program that asks the user to enter an integer test score between 0 and 100. The program should display the appropriate letter grade.