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
Memory Segmentation : The  memory in an 8086/8088  based system is organized as segmented memory. In this scheme, the whole physically available memory can be divided into a n

The 486 Introduced in the year 1989 the 80486 did not feature any radically new processor technology. Instead, it joints a 386 processor, a cache memory controller and a math c

8088  Timing System Diagram The 8088 address/data  bus is divided  in 3 parts (a) the lower 8 address/data  bits, (b) the middle 8 address bits, and (c) the upper 4 status/

a pseudo-code to add username and password combination up to a limit of 10

INT N : Interrupt Type N:- In the interrupt structure of 8086/8088, 256 interrupts are distinct equivalent to the types from OOH to FFH. When an instruction INT N is executed,

Linking a program The DOS linking program LINK.EXE links the different object modules of function library routines and source program to produce an integrated executable code o

ROR : Rotate Right without Carry: This instruction rotates the contents of destination operand to the bit-wise right either by one or by the count specified in register CL, exclud

Write a program that defines symbolic constants for all of the days of the week

The definitions of the bits in ICWI are following: Always set to the value 1. It directs the received byte to ICWI as oppose to OCW2 or OCW3. Which also utilize the even addr

Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of ax register