Mercurial > hg > Members > kono > os9 > sbc09
comparison basic/README.txt @ 57:2088fd998865
sbc09 directry clean up
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Jul 2018 16:07:12 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
56:4fa2bdb0c457 | 57:2088fd998865 |
---|---|
1 BASIC AND FLOATING POINT ROUTINES FOR THE 6809 | |
2 ============================================== | |
3 | |
4 sbc09 stands for Lennart Benschop 6809 Single Board Computer. | |
5 It contains a assembler and simulator for the Motorola M6809 processor. | |
6 | |
7 copyleft (c) 1994-2014 by the sbc09 team, see AUTHORS for more details. | |
8 license: GNU General Public License version 2, see LICENSE for more details. | |
9 | |
10 | |
11 | |
12 FLOATING POINT ROUTINES FOR THE 6809 | |
13 ------------------------------------ | |
14 | |
15 They are intended to be used with the sbc09 system. These routines | |
16 should be fairly portable to any 6809-based system. | |
17 | |
18 As it is an unfinished program (intended to become a full-featured | |
19 BASIC interpreter one day), I never released it before and I almost | |
20 forgot about it. Fortunately it was still on a backup CD-R that I | |
21 made in 2001. | |
22 | |
23 | |
24 FILES | |
25 - - - | |
26 | |
27 makeflot.c Conversion tool to convert floatnum.src to floatnum.inc | |
28 | |
29 floatnum.inc Floating point constants to be included in main program. | |
30 floatnum.src Same constants, but not converted to binary. | |
31 | |
32 fbasic.asm RPN calculator with floating point (just to test the FP routines. | |
33 This was intended to be part of a larger Basic interpreter, | |
34 but this was never finished). | |
35 | |
36 basic.asm Tiny Basic | |
37 basic.txt Tiny Basic instructions | |
38 | |
39 It was originally planned to turn this into a full-fledged BASIC | |
40 interpreter (maybe somewhat like BBC Basic), but this never | |
41 happened. It is now a rudimentary RPN calculator, just to test the | |
42 floating point routines. Each number or command needs to be on a separate | |
43 line. | |
44 | |
45 | |
46 | |
47 | |
48 MAKE THE PROGRAMS | |
49 - - - - - - - - - | |
50 | |
51 Simple: | |
52 | |
53 make | |
54 | |
55 | |
56 Or in single steps: | |
57 | |
58 compile the helper tool ... | |
59 | |
60 ./makeflot <floatnum.src >floatnum.inc | |
61 | |
62 | |
63 assemble the FP calculator ... | |
64 | |
65 ./a09 fbasic.asm | |
66 | |
67 | |
68 assemble Tiny Basic (integer only) ... | |
69 | |
70 ./a09 basic.asm | |
71 | |
72 | |
73 | |
74 | |
75 RUN THE PROGRAMS | |
76 - - - - - - - - | |
77 | |
78 | |
79 Start the board simulator | |
80 | |
81 ../v09 | |
82 | |
83 You should see the prompt "Welcome to BUGGY version 1.0" | |
84 | |
85 Type the command | |
86 | |
87 xl400 | |
88 | |
89 Press the escape character Control-] | |
90 (e.g. on Linux for a german style keyboard Control+AltGr+9) | |
91 | |
92 Then you see the v09> prompt. | |
93 | |
94 Type the command | |
95 | |
96 ufbasic | |
97 | |
98 Now the file "fbasic" will be uploaded to the board. | |
99 | |
100 Type the command | |
101 | |
102 g400 | |
103 | |
104 Now you can type floating point numbers and commands (RPN style), each | |
105 on a different line, like this | |
106 | |
107 2 | |
108 3 | |
109 * | |
110 6.00000000E+00 | |
111 | |
112 1 | |
113 0 | |
114 / | |
115 | |
116 The last calculation breaks back to the monitor. | |
117 | |
118 The following commands are available (see the source): | |
119 + - * / (the normal arithmetic operators). | |
120 = compare top two numbers on stack (and leave them), show < = or > | |
121 i round to integer (round to -Inf, like BASIC INT() function). | |
122 q square root | |
123 s sin | |
124 c cos | |
125 t tan | |
126 a atan | |
127 l ln | |
128 e exp | |
129 d duplicate number on stack | |
130 x exchange top numbers on stack. | |
131 r remove top of stack. | |
132 | |
133 | |
134 | |
135 IMPLEMENTATION NOTES | |
136 - - - - - - - - - - | |
137 | |
138 This is a 40-bit float, like many microcomputers of the 80s had, | |
139 including the Commodore 64, the ZX-Spectrum, the BBC and others. It | |
140 has an 8-bit exponent and a 32-bit mantissa (with hidden leading bit). | |
141 The basic operations (including square root) should be as accurate as | |
142 can be expected. | |
143 | |
144 It does not do IEEE-754 features, such as Infinity, NaN, +/-zero and | |
145 subnormal numbers, but appears to work quite reasonably. | |
146 | |
147 Trig functions deviate a few places in the 9th decimal. In particular | |
148 sin(pi/2) shows as 9.99999998E-01 instead of 1.00000000E+00. I | |
149 consider this acceptable and consistent with what could be expected. | |
150 | |
151 The Log function deviates a few places in the 8th decimal. LN(5) appears to | |
152 be about worst-case. I find this a bit disappointing. | |
153 | |
154 2 | |
155 l | |
156 5 | |
157 l | |
158 + | |
159 e | |
160 | |
161 should show exactly 10, but it shows 9.99999970E+00 instead. This is | |
162 not caused by the exp function, but by the log of 5 (as I checked with | |
163 Python). | |
164 | |
165 |