|
|
1.1 root 1: ////////
2: /
3: / Intel 8086 C runtime.
4: / Store binary exponent, return mantissa.
5: / SMALL model.
6: /
7: ////////
8:
9: .globl _fpac_
10: .globl frexp_
11: .globl dzero
12:
13: EXPBIAS = 0x80
14:
15: ////////
16: /
17: / double frexp(dd, xp) double dd; int *xp;
18: / Store binary exponent via xp, return mantissa.
19: /
20: ////////
21:
22: frexp_:
23: push si
24: push di
25: push bp
26: mov bp, sp
27:
28: mov bx, 16(bp) / xp to BX
29: mov ax, 14(bp) / Get most significant bits
30: rol ax, $1 / Get exponent in 1 reg
31: orb ah, ah / Is exponent 0?
32: jnz L0 / No
33: call dzero / Yes, zero _fpac_
34: mov (bx), ax / and store 0 through xp
35: jmp L1
36:
37: L0: movb cl, ah
38: subb ch, ch
39: sub cx, $EXPBIAS / signed
40: mov (bx), cx / *xp = exp
41:
42: movb ah, $EXPBIAS / zero exponent
43: ror ax, $1 / back in place
44: mov _fpac_+6, ax
45: mov ax, 12(bp)
46: mov _fpac_+4, ax
47: mov ax, 10(bp)
48: mov _fpac_+2, ax
49: mov ax, 8(bp)
50: L1: mov _fpac_, ax
51:
52: pop bp
53: pop di
54: pop si
55: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.