Skip to content

Commit f7ed8bc

Browse files
committed
Float Point Atari OS
1 parent 0810396 commit f7ed8bc

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

samples/a8/fp/test_fp_os.pas

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
uses crt, fp;
2+
3+
var
4+
t, s: TString;
5+
6+
fp0, fp1: FloatOS;
7+
8+
fp2: FloatOS = ($c0,$31,$00,$00,$00,$00);
9+
10+
x: integer;
11+
12+
13+
begin
14+
15+
x:=-31;//897;
16+
_itofp(x, fp2);
17+
18+
_fptoa(fp2, s);
19+
20+
writeln(s);
21+
22+
23+
t:='13.145'#0;
24+
25+
_atofp(t, fp0); // ascii -> fp0
26+
27+
_fptoa(fp0, s); // fp0 -> ascii
28+
29+
writeln(s);
30+
31+
32+
t:='65535'#0;
33+
_atofp(t, fp0); // ascii -> fp0
34+
t:='137'#0;
35+
_atofp(t, fp1); // ascii -> fp1
36+
37+
_fpdiv(fp0, fp1, fp2); // fp0 / fp1 -> fp2
38+
_fptoa(fp2, s); // fp2 -> ascii
39+
40+
writeln(s);
41+
42+
43+
x:=_fptoi(fp2);
44+
writeln(x);
45+
46+
47+
48+
49+
_fpmul(fp0, fp1, fp2); // fp0 * fp1 -> fp2
50+
_fptoa(fp2, s); // fp2 -> ascii
51+
52+
writeln(s);
53+
54+
55+
_fpadd(fp0, fp1, fp2); // fp0 + fp1 -> fp2
56+
_fptoa(fp2, s); // fp2 -> ascii
57+
58+
writeln(s);
59+
60+
61+
_fpsub(fp0, fp1, fp2); // fp0 - fp1 -> fp2
62+
_fptoa(fp2, s); // fp2 -> ascii
63+
64+
writeln(s);
65+
66+
67+
repeat until keypressed;
68+
69+
end.

0 commit comments

Comments
 (0)