Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add and Multiply. 1

Status
Not open for further replies.

RagnarokD1

Programmer
Jun 15, 2003
2
0
0
US
I'm trying to add and multiply. EX: [N1+N2*N3]

First multiply N2 and N3.
Second add N1 and the result of N2*N3.
BTW this is on Assembly Language MASM.

Here is some of the code for perform calculation section.

mov ax,N2
mul bl
mov ax,N3
mov X1,ax
add ax,N1
mov Sum,ax ;save the result

But the code doesn't work. I need help badly here.
 
Try this:

mov ax,N2
mov bx,N3
mul bx
add ax,N1
mov Sum,ax ;save the result

Hope that helps

-- AirCon --
 
I think I misunderstood your question a little :)
I'll try again.

First multiply N2 and N3.
Second add N1
Third add the result of N2*N3

Is that what you want ?
Here it is:

mov ax,N2
mov bx,N3
mul bx
add ax,ax
add ax,N1
mov Sum,ax ;save the result


-- AirCon --
 
Aircon Thx a lot the first one is right. Thx a bunch. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top