source: trunk/minix/lib/i86/em/em_dvi4.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.2 KB
Line 
1.define .dvi4
2
3yl=6
4yh=8
5xl=10
6xh=12
7
8.text
9.dvi4:
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 mov di,dx
17 cmp dx,ax
18 jne 7f
19 and dx,dx
20 jge 1f
21 neg bx
22 je 7f
231:
24 xor dx,dx
25 mov cx,xl(si)
26 mov ax,xh(si)
27 and ax,ax
28 jge 2f
29 neg ax
30 neg cx
31 sbb ax,dx
32 not di
332:
34 div bx
35 xchg ax,cx
36 div bx ! cx = high abs(result), ax=low abs(result)
379:
38 and di,di
39 jge 1f
40 neg cx
41 neg ax
42 sbb cx,#0
431:
44 ! cx is high order result
45 ! ax is low order result
46 mov dx,cx
47 pop di
48 pop si
49 ret 8 ! result in ax/dx
50
517:
52 push dx ! sign of y
53 mov di,ax
54 xor bx,bx
55 and di,di
56 jge 1f
57 neg di
58 neg yl(si)
59 sbb di,bx
601:
61 mov ax,xl(si)
62 mov dx,xh(si)
63 and dx,dx
64 jge 1f
65 neg dx
66 neg ax
67 sbb dx,bx
68 not -2(si)
691:
70 mov cx,#16
711:
72 shl ax,#1
73 rcl dx,#1
74 rcl bx,#1
75 cmp di,bx
76 ja 3f
77 jb 2f
78 cmp yl(si),dx
79 jbe 2f
803:
81 loop 1b
82 jmp 1f
832:
84 sub dx,yl(si)
85 sbb bx,di
86 inc ax
87 loop 1b
881:
89 pop di ! di=sign of result,ax= result
90 jmp 9b
Note: See TracBrowser for help on using the repository browser.