SIMPLY FPU
by Raymond Filiatreault

Copyright 2003
Latest revision August 2009


CONTENTS

            Introduction

Chap. 1     Description of FPU Internals

Chap. 2     Data types used by the FPU and addressing modes

Chap. 3     Instructions related to the FPU internals

Chap. 4     Data transfer instructions - REAL numbers

Chap. 5     Data transfer instructions - integers

Chap. 6     Data transfer instructions - packed decimals

Chap. 7     Comparison instructions

Chap. 8     Arithmetic instructions - with REAL numbers

Chap. 9     Arithmetic instructions - with integer numbers

Chap. 10    Trigonometric instructions

Chap. 11    Logarithmic and exponential instructions

Chap. 12    Other instructions

Chap. 13    Commented example

Appendix 1  Alphabetical list of FPU instructions


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 (after removing the NOSPAM):

rayfilNOSPAM@hotmail.com

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