source: trunk/minix/lib/i386/em/em_fif8.s@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 696 bytes
RevLine 
[9]1.sect .text; .sect .rom; .sect .data; .sect .bss
2.define .fif8
3
4 .sect .text
5.fif8:
6 mov bx,sp
7 fldd 8(bx)
8 fmuld 16(bx) ! multiply
9 fld st ! and copy result
10 ftst ! test sign; handle negative separately
11 fstsw ax
12 wait
13 sahf ! result of test in condition codes
14 jb 1f
15 frndint ! this one rounds (?)
16 fcom st(1) ! compare with original; if <=, then OK
17 fstsw ax
18 wait
19 sahf
20 jbe 2f
21 fisubs (one) ! else subtract 1
22 jmp 2f
231: ! here, negative case
24 frndint ! this one rounds (?)
25 fcom st(1) ! compare with original; if >=, then OK
26 fstsw ax
27 wait
28 sahf
29 jae 2f
30 fiadds (one) ! else add 1
312:
32 fsub st(1),st ! subtract integer part
33 mov bx,4(bx)
34 fstpd (bx)
35 fstpd 8(bx)
36 wait
37 ret
Note: See TracBrowser for help on using the repository browser.