; sc/25.1.91
TITLE pow87
.386
.387
.MODEL small
ASSUME es:DGROUP
PUBLIC _pow87
.DATA
.DATA?
;$CW DW 2 DUP (?)
.CONST
eins DD 1.0
.CODE
_pow87 PROC
; b = 8
; e = 16
;
; fstcw $CW+2
fld QWORD PTR [esp+12]
; mov ax, $CW+2
; or ah, 00000011B
; mov $CW, ax
fld QWORD PTR [esp+4]
ftst
fstsw ax
; fldcw $CW
fwait
sahf
ja SHORT $Ypos
fucompp
fldz
; fldcw $CW+2
ret
ALIGN 4
$Ypos:
fyl2x
fld st
frndint
fxch
fsub st, st(1)
f2xm1
fadd eins
fscale
fstp st(1)
; fldcw $CW+2
ret
ALIGN 4
_pow87 ENDP
END |