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
i want to develop traffic light system so which kind of software is needed to develop this project?

which uses BIOS interrupt INT 21 to read current system time and displays it on the top-left corner of screen.

Motorola 68000 Series : 68000microprocessor is a 16 bit processor that has addressing space of 65536 locations, each of which holds a 64-bits word; In order to address those lo

SHR : Shift Logical Right: This instruction performs bit-wise right shifts on the operand word or byte that might be reside in  a memory location or a register, by the specified c

INC: Increment : - This instruction increments the contents of the particular memory or register location by the value 1. All the condition code flags are affected except the carry

Opcode : The opcode generally appear in the first byte.but in a few instructions, a register objective is in the first byte and few other instructions may have their 3-bits of

Problems: 1. Write a single program. Each of the problems (2-4) should be written within a procedure. Your “main” procedure should call each procedure. Before calling each proc


SCAS : Scan String Byte or String Word:- This instruction scans a string of words or byte for an operand word or byte specified in the register AL or  register AX. The string i

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