SIMPLY FPU

by Raymond Filiatreault

Copyright 2003





CONTENTS



INTRODUCTION

The FPU, also known as a co-processor, used to be an option when the first PCs came on the market. Modern PCs are now all provided with a co-processor. Although the original PC-XT has evolved considerably over the years, the FPU itself has not changed appreciably during that same period. Apart from a few minor instructions having been added, the main improvement has been the extended range of some of the existing instructions.

The entire set of assembler instructions for the FPU is relatively small and could be memorized rapidly. Learning which parameter(s) can be used with each instruction should take only slightly longer. The main difficulty is in developing sound programming techniques to avoid some of the pitfalls peculiar to the FPU.

The main purpose of this document is to show that using the FPU can be relatively easy with minimal effort. Once the basics have been mastered, any computation however complex can be performed.

The first chapter describes the internals of the FPU and how they function. Some of this knowledge is an absolute necessity to use the FPU properly or help later in understanding the outcome of some of the instructions. This is followed by a chapter describing the various data types which can be used with some of the instructions, including a detailed review of the floating point data formats.

The FPU instructions are then discussed in detail in the following chapters which regroup them according to some "biased" criteria. Although some description of each instruction is available in the Fphelp.hlp file provided with MASM32, a more in-depth review is provided with more tangible examples of their usage.

The final chapter provides a fully commented example of a semi-complex computation.

It should be noted that this document has been prepared according to the syntax used by MASM. Although most other assemblers/compilers should have a similar syntax for the FPU instruction mnemonics, their syntax may differ for the addressing mode of memory variables. It is also known that some of the instructions used without explicit parameters are not supported by some of the other assemblers/compilers.

Any comment or suggestion aimed at improving this document will be given due consideration. Those can be sent to:

rayfil@hotmail.com

Please use "Simply FPU" in the subject line to help its retrieval from the ever increasing SPAM.