Mercurial > hg > index.cgi
diff README.txt @ 120:1c1a0150fdda
Add documentation of bytecode and parsing scheme
Instead of the Color Basic style of minimal encoding of the program, lwbasic
is going to use a full bytecode encoding and raise syntax errors are parse
time. This requires a substantially different approach compared to the more
na?ve approach previously implemented.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 31 Dec 2023 17:42:39 -0700 |
parents | 663d8e77b579 |
children |
line wrap: on
line diff
--- a/README.txt Fri Dec 29 01:40:39 2023 -0700 +++ b/README.txt Sun Dec 31 17:42:39 2023 -0700 @@ -4,6 +4,8 @@ intended to mess with the interpreter internals are unlikely to work, and, in fact, may be completely detrimental. +Additional detailed documentation can be found under docs/. + There are two versions of LWBasic. One is for the Coco 1 and 2. The other is for the Coco 3. The primary differences between the two are in the startup code and features that rely on the existence of Coco 3 hardware. The @@ -48,27 +50,16 @@ Numbers ======= -LWBasic has three numeric types: a 32 bit signed integer, stored as two's -complement, a decimal floating point type stored in packed BCD with -10 digits of precision and a base 10 exponent range of -63 to +63, and a -double precision decimal floating point type with 20 decimal digits of -precision and a base 10 exponent range from -2047 to +2047. +LWBasic has two numeric types: a 32 bit signed integer, stored as two's +complement and a decimal floating point type stored in packed BCD with +10 digits of precision and a base 10 exponent range of -63 to +63 The BCD format using 48 bits is stored as follows: -Offset Size Content +Offset Bits Content 0 1 Sign bit - 1 for negative 1 7 Decimal exponent with a bias of 64; 0 indicates a value of 0 -8 40 10 BCD digits of the significand - -*** Planned but not implememted -The BCD double format using 96 bits is stored as follows: - -Offset Size Content -0 1 sign bit - 1 for negative -1 3 <reserved> -4 12 Decimal exponent with a bias of 2048; 0 indicates value of 0 -16 80 20 BCD digits of the significand +8 40 10 packed BCD digits of the significand It is worth noting the reason for using the BCD format instead of binary floating point. Because interactions with the computer are typically in base