I have another question about printing.
The code below takes the value of var1 and var2 and prints it in edx:eax according to the format.
What if i want two different variables in one string?
The ("$interm db "%0.4f(squareroot)","+","%0.4f(squareroot2)",13,10,0") inst meant to be real, its just a way to show the format I am trying to achieve
.386
.model flat, stdcall
option casemap :none
includelib \masm32\lib\msvcrt.lib
sprintf proto C :vararg
includelib \masm32\lib\user32.lib
MessageBoxA proto :ptr,:ptr,:ptr,:DWORD
includelib \masm32\lib\kernel32.lib
ExitProcess proto :dword
.data
_title db "Result",13,10,0
$interm db "%0.4f","+","%0.4f",13,10,0
Aval REAL10 1.000
Bval REAL10 -2.000
Cval REAL10 19.000
_fourval REAL8 4.000
squareroot dq ?
squareroot2 dq ?
.code
main PROC
LOCAL szBuf[9]:byte
fld Bval ; [loads first instance of b]
fld Bval ; [loads second instance of b]
fmulp ; [b*b = b^2]
fld Aval ;[Load a (a*c)]
fld Cval ;[Load c (a*c)]
fmulp ;(a*c)
fmul _fourval ;[4*a*c]
fsubp;[b^2-4*a*c]
ftst ;compare ST(0) with 0.0
fstsw ax ;[store camparison results in ax]
fwait;wait
sahf ;transfer flags from AH register
jb _negative ;jump if <0
fsqrt ;sqrt(b^2-4*a*c)
jmp Finished
_negative:
fchs
fsqrt
Finished:
fstp squareroot
mov eax, dword ptr squareroot
mov edx, dword ptr [squareroot+4]
invoke sprintf, addr szBuf, offset $interm, eax, edx
invoke MessageBoxA, 0, addr szBuf, offset _title, 0
invoke ExitProcess, 0
main ENDP
END main, 0, addr szBuf, offset _title, 0
invoke ExitProcess, 0
Should print "123.5642+654.4321"
Assume you have squareroot = 123.5642 and sqareroot2 = 654.4321
Is there any website or book with documentation regarding this?
I'm not sure if the Intel manual is meant for beginners.