source: trunk/minix/lib/i386/em/em_fif4.s@ 11

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

Minix 3.1.2a

File size: 692 bytes
Line 
1.sect .text; .sect .rom; .sect .data; .sect .bss
2.define .fif4
3
4 .sect .text
5.fif4:
6 mov bx,sp
7 flds 8(bx)
8 fmuls 12(bx) ! multiply
9 fld st ! 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 fstps (bx)
35 fstps 4(bx)
36 wait
37 ret
Note: See TracBrowser for help on using the repository browser.