Can someone tell me what I am doing wrong in this program?
Write, assemble, and test a program to input 3 signed values (a, b, and c, in that order) and to calculate and
display the signed value of the expression b + 2(3a - 4c) + 5.
"call getVal ;AX = a (user input)
mov M1, AX ;M1 = a
call getVal ;AX = b (user input)
mov M2, AX ;M2 = b
call getVal ;AX = c (user input)
mov M3, AX ;M3 = c
call getVal ;AX = d (user input)
mov BX, AX ;BX = d
call getVal ;AX = x (user input)
mov CX, AX ;CX = x
mul BX ;DX:AX = AX*BX = x*d = dx (usually DX=0
mov DX,M3 ; DX=c
add Ax,Dx ;AX=c+dx
mul Cx ; Ax=(c + dx)x
mov DX,M2 ; DX=b
add AX ,Dx ; Ax=b + (c + dx)x
mul CX ;AX=(b + (c + dx)x)x
mov DX,M1 ; DX=a
add Ax,Dx ;Ax=a + (b + (c + dx)x)x
call putVal ;displays contents of AX, which is a + (b + (c + dx)x)x"
10 Months Ago
Related Article:determinant of N*N matrix
is a Assembly discussion thread by badguy that has 1 reply and was last updated 1 year ago.
What is the problem you are having? This looks like a legitimate assembly program fragment (assuming you are using EMU8086 or a DOS box of some sort), but not exactly a complete program. The biggest issue I can see is that it doesn't compute what your supposed to; this takes in five variables, not the three specified, and the formula it calculates does not match that in the problem statement.