I am having two issues with my Assembly code. According to the guidelines, I must do all of this using floating point operation. With that said, it seems like I am not getting the correct answer from this, and I don't know what is wrong. The function is as follows: y=3x^3+2.7x^2-74x+6.3. I have to give X, and it is suppose to go into this function and output Y.
The code is also suppose to end when I type N, but it keeps giving me a floating point error.
EDIT: I figured out my problem with the function, however whenever I type N it doesn't jump down and end my code.
input REAL8 ? ; user input
result REAL8 ? ; result of calculation
three REAL8 3.0 ; constant
twoSeven REAL8 2.7 ; constant
seventyFour REAL8 74.0 ; constant
sixThree REAL8 6.3 ; constant
prompt BYTE "Enter an Integer or n to quit",0dh,0ah,0
again BYTE "Would you like to go again? Y/N?", 0dh, 0ah, 0
no BYTE "N",0dh,0ah,0
rprompt BYTE "The result of the calculation is ",0
.code
main PROC
result_loop:
finit ; initialize the floating point stack
mov edx,OFFSET prompt ; address of message
call WriteString ; write prompt
call ReadFloat ; read the input value
fst input ; save input of user
fmul three ; multiplies by three
fadd twoSeven ; Adds by 2.7
fmul input ; multiplies by the input
fsub seventyFour ; subtracts 74
fmul input ; multiplies by input
fadd sixThree ; adds by three
fst result ; puts value in area
mov edx,OFFSET rprompt ; address of message
call WriteString ; write prompt
call WriteFloat ; writes the result
call CrLf ; prints new line
mov edx, OFFSET again
call WriteString
Call ReadString
cmp edx, 'n' ; compares the input to n
je end_if ; jumps if its equal to n
jmp result_loop ; jumps back to the top
end_if: ; end statment
call WaitMsg ;
exit ;
main ENDP
END main