Author Topic: FPU shortcuts/behavior.  (Read 4789 times)


  • Member
  • *****
  • Posts: 1217
FPU shortcuts/behavior.
« on: December 06, 2012, 02:10:54 AM »

   In another posting, I mentioned some defaul behavior
of MASM with regard to FPU instructions.  There are some
instructions that have a shortcut form.  To refesh my
memory, I coded up the ones that look likely to be useful.

   And a few other tests as well, just to test some coding
standards.  Note that the ones that cause an error prevent
an object file being created.

Code: [Select]
Microsoft (R) Macro Assembler Version 6.14.8444     12/05/12 08:50:08
FPU Question      Page 2 - 1


 0005  9B DC C1         FADD    ST(1),ST
 0008  9B DE C1         FADDP   ST(1),ST        ; Same as FADD no operand form.
 000B  9B DE C1         FADD

 000E  9B D8 C1         FADD    ST,ST(1)        ; Shows you can muck about with operand order.
        FADDP   ST,ST(1)        ; Shows you have to POP the stack top only.
fpubit.asm(43) : error A2070: invalid instruction operands
 0011  9B DE C0         FADDP   ST,ST           ; What you end up with if you ignore error.
        FADD    ST(2),ST(1)     ; Shows you have to use the stack top.
fpubit.asm(45) : error A2070: invalid instruction operands
 0014  9B DC C2         FADD    ST(2),ST

 0017  9B DC E9         FSUB    ST(1),ST
 001A  9B DE E9         FSUBP   ST(1),ST        ; Same as FSUB no operand form.
 001D  9B DE E9         FSUB

 0020  9B DC E1         FSUBR   ST(1),ST
 0023  9B DE E1         FSUBRP  ST(1),ST        ; Same as FSUBR no operand form.
 0026  9B DE E1         FSUBR

 0029  9B DC C9         FMUL    ST(1),ST
 002C  9B DE C9         FMULP   ST(1),ST        ; Same as FMUL no operand form.
 002F  9B DE C9         FMUL

 0032  9B DC F9         FDIV    ST(1),ST
 0035  9B DE F9         FDIVP   ST(1),ST        ; Same as FDIV no operand form.
 0038  9B DE F9         FDIV

 003B  9B DC F1         FDIVR   ST(1),ST
 003E  9B DE F1         FDIVRP  ST(1),ST        ; Same as FDIVR no operand form.
 0041  9B DE F1         FDIVR

 0044  9B D8 D1         FCOM    ST(1)
 0047  9B D8 D9         FCOMP   ST(1)           ; Not the same as the FCOM no operand form.
 004A  9B D8 D1         FCOM
 004D  9B D8 D9         FCOMP

   I hope this is useful to others.  Tested with versions 3.0,
5.0, and 6.14.  I believe that many other assemblers also
follow these defaults.


Steve N.


  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: FPU shortcuts/behavior.
« Reply #1 on: December 06, 2012, 02:56:50 AM »
Raymond covers most, if not all, of these in his tutorial
they just aren't all in one place
the detail for each instruction mentions the default and MASM behaviour