1: / C library-- floating output
2:
3: .globl pfloat
4: .globl pscien
5: .globl fltused
6:
7: .globl _ndigit
8: .globl ecvt
9: .globl fcvt
10:
11: fltused: / force loading
12: pfloat:
13: mov r0,_ndigit
14: tst r2
15: bne 1f
16: mov $6,_ndigit
17: 1:
18: movf (r4)+,fr0
19: jsr pc,fcvt
20: tst r1
21: beq 1f
22: movb $'-,(r3)+
23: 1:
24: tst r2
25: bgt 1f
26: movb $'0,(r3)+
27: 1:
28: mov r2,r1
29: ble 1f
30: 2:
31: movb (r0)+,(r3)+
32: sob r1,2b
33: 1:
34: mov _ndigit,r1
35: beq 1f
36: movb $'.,(r3)+
37: 1:
38: neg r2
39: ble 1f
40: 2:
41: dec r1
42: blt 1f
43: movb $'0,(r3)+
44: sob r2,2b
45: 1:
46: tst r1
47: ble 2f
48: 1:
49: movb (r0)+,(r3)+
50: sob r1,1b
51: 2:
52: rts pc
53:
54: pscien:
55: mov r0,_ndigit
56: tst r2
57: bne 1f
58: mov $6,_ndigit
59: 1:
60: movf (r4)+,fr0
61: jsr pc,ecvt
62: tst r1
63: beq 1f
64: movb $'-,(r3)+
65: 1:
66: movb (r0)+,(r3)+
67: movb $'.,(r3)+
68: mov _ndigit,r1
69: dec r1
70: ble 1f
71: 2:
72: movb (r0)+,(r3)+
73: sob r1,2b
74: 1:
75: movb $'e,(r3)+
76: dec r2
77: mov r2,r1
78: bge 1f
79: movb $'-,(r3)+
80: neg r1
81: br 2f
82: 1:
83: movb $'+,(r3)+
84: 2:
85: clr r0
86: div $10.,r0
87: add $'0,r0
88: movb r0,(r3)+
89: add $'0,r1
90: movb r1,(r3)+
91: rts pc
Defined functions
fltused
declared in line
5; defined in line
11; used 1 times
pfloat
declared in line
3; defined in line
12; used 5 times
pscien
declared in line
4; defined in line
54; used 5 times