source: trunk/minix/lib/i86/em/em_rmi4.s@ 9

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

Minix 3.1.2a

File size: 1.1 KB
Line 
1.define .rmi4
2.text
3
4yl=6
5yh=8
6xl=10
7xh=12
8
9.rmi4:
10 push si
11 push di
12 mov si,sp ! copy of sp
13 mov bx,yl(si)
14 mov ax,yh(si)
15 cwd
16 cmp dx,ax
17 jne 7f
18 and dx,dx
19 jge 1f
20 neg bx
21 je 7f
221:
23 xor dx,dx
24 mov cx,xl(si)
25 mov ax,xh(si)
26 and ax,ax
27 jge 2f
28 neg ax
29 neg cx
30 sbb ax,dx
312:
32 div bx
33 xchg ax,cx
34 div bx ! dx= result(low), 0=result(high)
35 xor bx,bx
369:
37 cmp xh(si),#0
38 jge 1f
39 neg bx
40 neg dx
41 sbb bx,#0
421:
43 ! bx is high order result
44 ! dx is low order result
45 mov ax,dx
46 mov dx,bx ! result in ax/dx
47 pop di
48 pop si
49 ret 8
50
517:
52 mov di,ax
53 xor bx,bx
54 and di,di
55 jge 1f
56 neg di
57 neg yl(si)
58 sbb di,bx
591:
60 mov ax,xl(si)
61 mov dx,xh(si)
62 and dx,dx
63 jge 1f
64 neg dx
65 neg ax
66 sbb dx,bx
671:
68 mov cx,#16
691:
70 shl ax,#1
71 rcl dx,#1
72 rcl bx,#1
73 cmp di,bx
74 ja 3f
75 jb 2f
76 cmp yl(si),dx
77 jbe 2f
783:
79 loop 1b
80 ! dx=result(low), bx=result(high)
81 jmp 9b
822:
83 sub dx,yl(si)
84 sbb bx,di
85 inc ax
86 loop 1b
871:
88 ! dx=result(low), bx=result(high)
89 jmp 9b
Note: See TracBrowser for help on using the repository browser.