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
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

OR: Logical OR: The OR instruction carries out the OR operation in the similar way as described in case of the AND operation. The restriction on source and destination operands ar

IMUL: Signed Multiplication: This instruction multiplies a signed byte by a signed bit in source operand e in the register AL or signed word in source operand by signed word in th

code, Assembly Language How to print strings in Right Triangle form?

;StrNCpyAsm - copy zero terminated string2 to zero terminated string1, ; but copy no more than count (parameter) characters ; or the length of string2, whi

You are to create an assembly program for the MSP430 that correctly measures the wind direction, to a precision of 45° (N, NW, W, SW, S, SE, E, NE), using the MSP430's ADC. Your

Write an account of your findings and produce a report containing all aspects of the above. Include a step-by-step 'simple User Guide' so that your program can be operated as inten

Interrupt When the CPU detects an interrupt signal, it stops activity of current and jumps to a special routine, known an interrupt handler. This handler then detects why the i

code to add two matrices

Program Translation Sequence Developing a software program to accomplish a particular task, the implementer chooses an appropriate language, develops the algorithm (a sequence