Prepared by Lin Jensen , Bishop's University, for CSc 116 Assembly Language class.
This is a brief list of som basic float instructions for the csc116 class, in case anyone wants
to use floating point arithmetic.
The intel floating point coprocessor contains 8 registers, which are
internally 80 bits. Load and store instructions exist to transfer
either 32-bit "single" or 64-bit "double" values.
The most interesting thing about these registers is that they are
organized as a STACK, which is not to be confused with the normal
stack in memory.
finit ;initialize the coprocessorLoads "push" a number on this stack, stores "pop" the top of this stack, as indicated by the suffix p.
fld source ; pushes the real number in sourceConversions from/to integer are handled during load and store:
fstp destination ; pops the top into the destination, as a real number
fild integer_source ; converts source to a real and pushes it
fistp integer_dest ; pops top, converts to integer and stores in destination
faddComparisons compare the top two numbers on the stack. You can remove one or both if you like
fsub
fsubr ; reverses the order of operands (it matters for subtract)
fmul
fdiv
fdivr
fcom ; compare
fcomp ; compare and pop one
fcompp ; compare and pop both
fldz ; 0.0 on top of stack
fld1 ; 1.0 on top of stack
fldpi ; 3.1415..... on stack
fsqrt ; top replaced with its square root
fsin
fcos ; same for trig function
fwait ; processor waits for coprocessor to finish operations