Line | |
---|
1 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
2 | .define .fef8
|
---|
3 |
|
---|
4 | .sect .text
|
---|
5 | .fef8:
|
---|
6 | ! this could be simpler, if only the
|
---|
7 | ! fxtract instruction was emulated properly
|
---|
8 | mov bx,sp
|
---|
9 | mov ax,12(bx)
|
---|
10 | and ax,0x7ff00000
|
---|
11 | je 1f ! zero exponent
|
---|
12 | shr ax,20
|
---|
13 | sub ax,1022
|
---|
14 | mov cx,ax ! exponent in cx
|
---|
15 | mov ax,12(bx)
|
---|
16 | and ax,0x800fffff
|
---|
17 | or ax,0x3fe00000 ! load -1 exponent
|
---|
18 | mov dx,8(bx)
|
---|
19 | mov bx,4(bx)
|
---|
20 | mov 4(bx),dx
|
---|
21 | mov 8(bx),ax
|
---|
22 | mov (bx),cx
|
---|
23 | ret
|
---|
24 | 1: ! we get here on zero exp
|
---|
25 | mov ax,12(bx)
|
---|
26 | and ax,0xfffff
|
---|
27 | or ax,8(bx)
|
---|
28 | jne 1f ! zero result
|
---|
29 | mov bx,4(bx)
|
---|
30 | mov (bx),ax
|
---|
31 | mov 4(bx),ax
|
---|
32 | mov 8(bx),ax
|
---|
33 | ret
|
---|
34 | 1: ! otherwise unnormalized number
|
---|
35 | mov cx,12(bx)
|
---|
36 | and cx,0x800fffff
|
---|
37 | mov dx,cx
|
---|
38 | and cx,0x80000000
|
---|
39 | mov ax,-1021
|
---|
40 | 2:
|
---|
41 | test dx,0x100000
|
---|
42 | jne 1f
|
---|
43 | dec ax
|
---|
44 | shl 8(bx),1
|
---|
45 | rcl dx,1
|
---|
46 | or dx,cx
|
---|
47 | jmp 2b
|
---|
48 | 1:
|
---|
49 | and dx,0x800fffff
|
---|
50 | or dx,0x3fe00000 ! load -1 exponent
|
---|
51 | mov cx,8(bx)
|
---|
52 | mov bx,4(bx)
|
---|
53 | mov (bx),ax
|
---|
54 | mov 8(bx),dx
|
---|
55 | mov 4(bx),cx
|
---|
56 | ret
|
---|
Note:
See
TracBrowser
for help on using the repository browser.