88 lines
1.1 KiB
Plaintext
88 lines
1.1 KiB
Plaintext
/* Set 80387 floating point hardware rounding precision */
|
|
|
|
.file "setprec.387"
|
|
.text
|
|
.align 2
|
|
|
|
.globl _sprec
|
|
_sprec:
|
|
pushl %ebp
|
|
movl %esp,%ebp
|
|
pushl %eax
|
|
subl $4,%esp
|
|
fstcw (%esp)
|
|
fwait
|
|
movl (%esp),%eax
|
|
andl $0xfcff,%eax
|
|
movl %eax,(%esp)
|
|
fldcw (%esp)
|
|
popl %eax
|
|
popl %eax
|
|
leave
|
|
ret
|
|
|
|
.align 2
|
|
|
|
.globl _dprec
|
|
_dprec:
|
|
pushl %ebp
|
|
movl %esp,%ebp
|
|
pushl %eax
|
|
subl $4,%esp
|
|
fstcw (%esp)
|
|
fwait
|
|
movl (%esp),%eax
|
|
/* andl $0xfcff,%eax */
|
|
/* exception on overflow */
|
|
andl $0xfcf7,%eax
|
|
orl $0x200,%eax
|
|
movl %eax,(%esp)
|
|
fldcw (%esp)
|
|
popl %eax
|
|
popl %eax
|
|
leave
|
|
ret
|
|
|
|
.align 2
|
|
|
|
.globl _ldprec
|
|
_ldprec:
|
|
pushl %ebp
|
|
movl %esp,%ebp
|
|
pushl %eax
|
|
subl $4,%esp
|
|
fstcw (%esp)
|
|
fwait
|
|
movl (%esp),%eax
|
|
orl $0x300,%eax
|
|
movl %eax,(%esp)
|
|
fldcw (%esp)
|
|
popl %eax
|
|
popl %eax
|
|
leave
|
|
ret
|
|
|
|
|
|
.globl _getprec
|
|
_getprec:
|
|
pushl %ebp
|
|
movl %esp,%ebp
|
|
subl $4,%esp
|
|
fstcw (%esp)
|
|
fwait
|
|
movl (%esp),%eax
|
|
leave
|
|
ret
|
|
|
|
.globl _setfpu
|
|
_setfpu:
|
|
pushl %ebp
|
|
movl %esp,%ebp
|
|
movl 8(%ebp),%eax
|
|
pushl %eax
|
|
fldcw (%esp)
|
|
fwait
|
|
movl %ebp,%esp
|
|
popl %ebp
|
|
ret
|