Site hosted by Angelfire.com: Build your free website today!


Callee for a C++ to return roots of a quadratic function


.386

.model FLAT, C

include irvine32.inc;

includelib irvine32.lib


.data 

inA real4 0.0

inB real4 0.0

inC real4 0.0

rt1 dword ?

rt2 dword ?

ffgs word ?

num0 dword 0

nun1 dword -1

num2 dword 2

num4 dword 4

temp real4 ?

.code

main proc

call readint

mov inA, eax

call readint

mov inB, eax

call readint

mov inC, eax

call rotc

pop ebp

ret

main endp


rotc proc

finit

fld inC

fld inB

fld inA

fld inB

fmulp st(2), st(0)

fmul 

fmul st(0), st(2)

fsubp st(1), st(0)

ficom num0

fstsw ffgs

and ffgs, 0100010100000000b

cmp ffgs, 0000000100000000b

je complex

fsqrt

fld inA

fild nun1

fmul

fst temp

fsub st(0), st(1)

fld temp

fadd st(0), st(2)

fld inA

fild num2

fmul

fdiv st(1), st(0)

fdivp st(2), st(0)

fstp temp

mov eax, dword ptr temp

mov edi, rt1

mov [edi], eax

fstp temp

mov eax,dword ptr temp

mov edi,rt2

mov [edi],eax

xor eax,eax

jmp fin

cpn: mov eax, FFFFh

fin: ret

rotc endp


END

end main