1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881
|
Bywater BASIC Interpreter/Shell, version 2.10
---------------------------------------------
Copyright (c) 1993, Ted A. Campbell
for bwBASIC version 2.10, 11 October 1993
CONTENTS:
1. DESCRIPTION
2. TERMS OF USE
3. QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS
4. GENERAL NOTES ON USAGE
5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS
6. PREDEFINED VARIABLES
7. UNIMPLEMENTED COMMANDS AND FUNCTIONS
and AGENDA FOR DEVELOPMENT
8. THE STORY OF BYWATER BASIC
9. COMMUNICATIONS
The author wishes to express his thanks to Mr. David MacKenzie,
who assisted in the development Unix installation and configuration
for this version.
1. DESCRIPTION
The Bywater BASIC Interpreter (bwBASIC) implements a large
superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
and a significant subset of the ANSI Standard for Full BASIC
(X3.113-1987) in C. It also offers shell programming facilities
as an extension of BASIC. bwBASIC seeks to be as portable
as possible.
bwBASIC can be configured to emulate features, commands, and
functions available on different types of BASIC interpreters;
see the file INSTALL for further installation information.
The interpreter is fairly slow. Whenever faced with a choice
between conceptual clarity and speed, I have consistently chosen
the former. The interpreter is the simplest design available,
and utilizes no system of intermediate code, which would speed
up considerably its operation. As it is, each line is interpreted
afresh as the interpreter comes to it.
bwBASIC implements one feature not available in previous BASIC
interpreters: a shell command can be entered interactively at the
bwBASIC prompt, and the interpreter will execute it under a
command shell. For instance, the command "dir *.bas" can be
entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
it will be executed as from the operating system command line.
Shell commands can also be given on numbered lines in a bwBASIC
program, so that bwBASIC can be used as a shell programming
language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
offer further shell-processing capabilities.
2. TERMS OF USE:
This version of Bywater BASIC is released under the terms of the
GNU General Public License (GPL), which is distributed with this
software in the file "COPYING". The GPL specifies the terms
under which users may copy and use the software in this distribution.
A separate license is available for commercial distribution,
for information on which you should contact the author.
3. QUICK REFERENCE LIST OF COMMANDS AND FUNCTIONS
Be aware that many of these commands and functions will not be
available unless you have set certain flags in the header files
(see the expanded reference section below for dependencies).
ABS( number )
ASC( string$ )
ATN( number )
CALL subroutine-name
CASE ELSE | IF partial-expression | constant
CHAIN [MERGE] file-name [, line-number] [, ALL]
CHDIR pathname
CHR$( number )
CINT( number )
CLEAR
CLOSE [[#]file-number]...
CLS
COMMON variable [, variable...]
COS( number )
CSNG( number )
CVD( string$ )
CVI( string$ )
CVS( string$ )
DATA constant[,constant]...
DATE$
DEF FNname(arg...)] = expression
DEFDBL letter[-letter](, letter[-letter])...
DEFINT letter[-letter](, letter[-letter])...
DEFSNG letter[-letter](, letter[-letter])...
DEFSTR letter[-letter](, letter[-letter])...
DELETE line[-line]
DIM variable(elements...)[variable(elements...)]...
DO NUM|UNNUM
DO [WHILE expression]
EDIT
ELSE
ELSEIF
END IF | FUNCTION | SELECT | SUB
ENVIRON variable-string = string
ENVIRON$( variable-string )
EOF( device-number )
ERASE variable[, variable]...
ERL
ERR
ERROR number
EXP( number )
FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
FILES filespec$
FUNCTION
FOR counter = start TO finish [STEP increment]
GET [#] device-number [, record-number]
GOSUB line | label
GOTO line | label
HEX$( number )
IF expression THEN [statement [ELSE statement]]
INKEY$
INPUT [# device-number]|[;]["prompt string";]list of variables
INSTR( [start-position,] string-searched$, string-pattern$ )
INT( number )
KILL file-name
LEFT$( string$, number-of-spaces )
LEN( string$ )
LET variable = expression
LINE INPUT [[#] device-number,]["prompt string";] string-variable$
LIST line[-line]
LOAD file-name
LOC( device-number )
LOCATE line, column
LOF( device-number )
LOG( number )
LOOP [UNTIL expression]
LSET string-variable$ = expression
MERGE file-name
MID$( string$, start-position-in-string[, number-of-spaces ] )
MKD$( number )
MKDIR pathname
MKI$( number )
MKS$( number )
NAME old-file-name AS new-file-name
NEW
NEXT [counter]
OCT$( number )
ON variable GOTO|GOSUB line[,line,line,...]
ON ERROR GOSUB line
OPEN "O"|"I"|"R", [#]device-number, file-name [,record length]
file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
OPTION BASE number
POS
PRINT [# device-number,][USING format-string$;] expressions...
PUT [#] device-number [, record-number]
QUIT
RANDOMIZE number
READ variable[, variable]...
REM string
RESTORE line
RETURN
RIGHT$( string$, number-of-spaces )
RMDIR pathname
RND( number )
RSET string-variable$ = expression
RUN [line][file-name]
SAVE file-name
SELECT CASE expression
SGN( number )
SIN( number )
SPACE$( number )
SPC( number )
SQR( number )
STOP
STR$( number )
STRING$( number, ascii-value|string$ )
SUB subroutine-name
SWAP variable, variable
SYSTEM
TAB( number )
TAN( number )
TIME$
TIMER
TROFF
TRON
VAL( string$ )
WEND
WHILE expression
WIDTH [# device-number,] number
WRITE [# device-number,] element [, element ]....
4. GENERAL NOTES ON USAGE:
4.a. Interactive Environment
An interactive environment is provided if the flag INTERACTIVE
is defined as TRUE in bwbasic.h, so that a line with a
line number can be entered at the bwBASIC prompt and it will be
added to the program in memory.
Line numbers are not strictly required, but are useful if the
interactive environment is used for programming. For longer
program entry one might prefer to use an ASCII text editor, and
in this case lines can be entered without numbers. One can use
DO NUM and DO UNNUM to number or unnumber lines. See also the
documentation below for the pseudo-command EDIT.
4.b. Naming Conventions
Command names and function names are not case sensitive,
so that "Run" and "RUN" and "run" are equivalent and "abs()"
and "ABS()" and "Abs()" are equivalent. HOWEVER, variable
names ARE case sensitive in bwbASIC, so that "d$" and "D$"
are different variables. This differs from some BASIC
implementations where variable names are not case sensitive.
Variable names can use any alphabetic characters, the period
and underscore characters and decimal digits (but not in the
first position). They can be terminated with '#' or '!' to
allow Microsoft-type names, even though the precision is
irrelevant to bwBASIC.
4.c. Numerical Constants
Numerical constants may begin with a digit 0-9 (decimal), with
the "&H" or "&h" (hexadecimal) or the "&o" or "&O" (octal).
Decimal numbers may terminated with 'E', 'e', 'D', or 'd'
followed by an exponent number to denote exponential notation.
Decimal constants may also be terminated by the '#' or '!'
to comply with Microsoft-style precision terminators, although
the precision specified will be irrelevant to bwBASIC.
4.d. Command-Line Execution
A filename can be specified on the command line and will be
LOADed and RUN immediately, so that the command line
bwbasic prog.bas
will load and execute "prog.bas".
4.e. Program Storage
All programs are stored as ASCII text files.
4.f. TRUE and FALSE
TRUE is defined as -1 and FALSE is defined as 0 in the default
distribution of bwBASIC. These definitions can be changed by
those compiling bwBASIC (see file BWBASIC.H).
4.g. Assignments
Assignment must be made to variables. This differs from some
implementations of BASIC where assignment can be made to a
function. Implication: "INSTR( 3, x$, y$ ) = z$" will not
work under bwBASIC.
4.h. Operators and Precedence
bwBASIC recognizes the following operators, with their level
of precedence given (1 = highest):
^ 1 exponentiation
* 2 multiplication
/ 2 division
\ 3 integer division
+ 5 addition
- 5 subtraction
= 6 equality or assignment
MOD 4 modulus (remainder) arithmetic
<> 7 inequality
< 8 less than
> 9 greater than
<= 10 less than or equal to
=< 10 less than or equal to
>= 11 greater than or equal to
=> 11 greater than or equal to
NOT 12 negation
AND 13 conjunction
OR 14 disjunction
XOR 15 exclusive or
IMP 16 implication
EQV 17 equivalence
4.h. Numerical Precision (NOT)
bwBASIC utilizes numbers with only one level of precision. If
the flag NUMBER_DOUBLE is defined as TRUE in bwbasic.h, the
precision implemented will be that of the C "double" data type;
otherwise (default) the precision will be that of the C "float"
type. At a number of points there are commands (or pseudo-
commands) that seem to recognize Microsoft-style precision
distinctions, but for the most part these are just work-around
aliases to allow Microsoft-style programs to be run.
5. EXPANDED REFERENCE FOR COMMANDS AND FUNCTIONS
The "Dependencies" listed in the following reference materials
refers to flags that must be set to TRUE in bwbasic.h for the
associated command or function to be implemented. These flags
are as follows:
(core) Commands and Functions in any implementation of
bwBASIC; these are the ANSI Minimal BASIC core
INTERACTIVE Commands supporting the interactive programming
environment
COMMON_CMDS Commands beyond ANSI Minimal BASIC which are common
to Full ANSI BASIC and Microsoft BASICs
COMMON_FUNCS Functions beyond the ANSI Minimal BASIC core, but
common to both ANSI Full BASIC and Microsoft-style
BASIC varieties
UNIX_CMDS Commands which require Unix-style directory and
environment routines not specified in C
STRUCT_CMDS Commands related to structured programming; all
of these are part of the Full ANSI BASIC standard
ANSI_FUNCS Functions unique to ANSI Full BASIC
MS_CMDS Commands unique to Microsoft BASICs
MS_FUNCS Functions unique to Microsoft BASICs
------------------------------------------
Function: ABS( number )
Description: ABS returns the absolute value of the argument 'number'.
Dependencies: (core)
------------------------------------------
Function: ASC( string$ )
Description: ASC returns the ASCII code for the first letter in
the argument string$.
Dependencies: MS_FUNCS
------------------------------------------
Function: ATN( number )
Description: ATN returns the arctangent value of the argument 'number'
in radians.
Dependencies: (core)
------------------------------------------
Command: CALL subroutine-name
Description: CALL calls a named subroutine (see SUB and END SUB).
Dependencies: STRUCT_CMDS
------------------------------------------
Command: CASE ELSE | IF partial-expression | constant
Description: CASE introduces an element of a SELECT CASE statement
(see SELECT CASE). CASE IF introduces a conditional
SELECT CASE element, and CASE ELSE introduces a
default SELECT CASE element.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: CHAIN [MERGE] file-name [, line-number] [, ALL]
Description: CHAIN passes control to another BASIC program.
Variables declared COMMON (q.v.) will be passed
to the new program.
Dependencies: COMMON_CMDS
------------------------------------------
Command: CHDIR pathname$
Description: CHDIR changes the current directory to that indicated
by the argument pathname$.
Dependencies: UNIX_CMDS
------------------------------------------
Function: CHR$( number )
Description: CHR$ returns a one-character string with the character
corresponding to the ASCII code indicated by argument
'number'.
Dependencies: COMMON_FUNCS
------------------------------------------
Function: CINT( number )
Description: CINT returns the truncated integer for the argument
'number'.
Dependencies: MS_FUNCS
------------------------------------------
Command: CLEAR
Description: CLEAR sets all numerical variables to 0, and all
string variables to null.
Dependencies: COMMON_CMDS
------------------------------------------
Command: CLOSE [[#]file-number]...
Description: CLOSE closes the file indicated by file-number
(see OPEN).
Dependencies: COMMON_CMDS
------------------------------------------
Command: CLS
Description: CLS clears the display screen (IBM and compatibles
only as of version 2.10).
Dependencies: IMP_IQC and IMP_CMDLOC
------------------------------------------
Command: CMDS
Description: CMDS is a debugging command that prints a list
of all implemented bwBASIC commands.
Dependencies: DEBUG
------------------------------------------
Command: COMMON variable [, variable...]
Description: COMMON designates variables to be passed to a CHAINed
program (see CHAIN).
Dependencies: COMMON_CMDS
------------------------------------------
Function: COS( number )
Description: COS returns the cosine of the argument 'number'
in radians.
Dependencies: (core)
------------------------------------------
Function: CSNG( number )
Description: CSNG is a pseudo-function that has no effect under
bwBASIC. It replicates a Microsoft-type command
that would convert the 'number' to single-precision.
Dependencies: MS_FUNCS
------------------------------------------
Function: CVD( string$ )
Description: CVD converts the argument string$ into a bwBASIC
number (precision is irrelevant in bwBASIC since
bwBASIC numbers have only one precision).
Implementation-Specific Notes:
CVD(), CVI(), CVS(), MKI$(), MKD$(), MKS$(): These functions
are implemented, but are dependent on a) the sizes for integer,
float, and double values on particular systems, and b) how
particular versions of C store these numerical values. The
implication is that data files created using these functions
on a DOS-based microcomputer may not be translated correctly
by bwBASIC running on a Unix-based computer. Similarly, data
files created by bwBASIC compiled by one version of C may not be
readable by bwBASIC compiled by another version of C (even under
the same operating system). So be careful with these.
Dependencies: MS_FUNCS
------------------------------------------
Function: CVI( string$ )
Description: CVI converts the argument string$ into a bwBASIC
number (precision is irrelevant in bwBASIC since
bwBASIC numbers have only one precision; see also
the note on CVD).
Dependencies: MS_FUNCS
------------------------------------------
Function: CVS( string$ )
Description: CVI converts the argument string$ into a bwBASIC
number (precision is irrelevant in bwBASIC since
bwBASIC numbers have only one precision; see also
the note on CVD).
Dependencies: MS_FUNCS
------------------------------------------
Command: DATA constant[,constant]...
Description: DATA stores numerical and string constants to be
accessed by READ (q.v.).
Dependencies: (core)
------------------------------------------
Function: DATE$
Description: DATE$ returns the current date based on the computer's
internal clock as a string in the form "YYYY-MM-DD".
As implemented under bwBASIC, DATE$ cannot be used for
assignment (i.e., to set the system date).
Note: bwBASIC presently (v2.10) does not allow assignment
to a function.
Dependencies: COMMON_FUNCS
------------------------------------------
Command: DEF FNname(arg...)] = expression
Description: DEF defines a user-written function. This function
corresponds to Microsoft-type implementation, although
in bwBASIC DEF is a working equivalent of FUNCTION.
Dependencies: (core)
------------------------------------------
Command: DEFDBL letter[-letter](, letter[-letter])...
Description: DEFDBL declares variables with single-letter names
as numerical variables (precision is irrelevant in
bwBASIC).
Dependencies: MS_CMDS
------------------------------------------
Command: DEFINT letter[-letter](, letter[-letter])...
Description: DEFINT declares variables with single-letter names
as numerical variables (precision is irrelevant in
bwBASIC).
Dependencies: MS_CMDS
------------------------------------------
Command: DEFSNG letter[-letter](, letter[-letter])...
Description: DEFSNG declares variables with single-letter names
as numerical variables (precision is irrelevant in
bwBASIC).
Dependencies: MS_CMDS
------------------------------------------
Command: DEFSTR letter[-letter](, letter[-letter])...
Description: DEFSTR declares variables with single-letter names
as string variables.
Dependencies: MS_CMDS
------------------------------------------
Command: DELETE line[-line]
Description: DELETE deletes program lines indicated by the
argument(s). If you want to use DELETE for non-
numbered programs, first use DO NUM, then DELETE,
then DO UNNUM.
Dependencies: INTERACTIVE
------------------------------------------
Command: DIM variable(elements...)[variable(elements...)]...
Description: DIM specifies variables that have more than one
element in a single dimension, i.e., arrayed
variables.
Note: As implemented under bwBASIC, DIM accepts only
parentheses as delimiters for variable fields.
(Some BASICs allow the use of square brackets.)
Dependencies: (core)
------------------------------------------
Command: DO NUM|UNNUM
Description: DO NUM numbers all lines in a program. The first
line is given the number 10, and subsequent lines
are numbered consecutively in multiples of 10. DO
UNNUM removes all line numbers from a program.
NOTE that these functions do nothing to line
numbers, e.g., following a GOSUB or GOTO statement;
these commands cannot be used as a replacement for
RENUM (available in some systems, but not bwBASIC).
With these commands, however, one can develop
unnumbered programs by entering new lines with numbers,
then running DO UNNUM to remove the line numbers.
Together with LOAD and SAVE (q.v.) one can use
bwBASIC as a primitive text editor.
Dependencies: INTERACTIVE
------------------------------------------
Command: DO [WHILE expression]
Description: DO implements a number of forms of program loops.
DO...LOOP simply loops; the only way out is by
EXIT; DO WHILE...LOOP loops while "expression" is
true (this is equivalent to the older WHILE-WEND
loop, also implemented in bwBASIC); DO...LOOP UNTIL
loops until the expression following UNTIL is true.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: EDIT
Description: EDIT is a pseudo-command which calls the text editor
specified in the variable BWB.EDITOR$ to edit the
program in memory. After the call to the text editor,
the (edited) program is reloaded into memory. The user
normally must specific a valid path and filename in
BWB.EDITOR$ before this command will be useful.
Dependencies: COMMON_CMDS
------------------------------------------
Command: ELSE
Description: ELSE introduces a default condition in a multi-line IF
statement.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: ELSEIF
Description: ELSEIF introduces a secondary condition in a multi-
line IF statement.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: END IF | FUNCTION | SELECT | SUB
Description: END IF ends a multi-line IF statement. END FUNCTION
ends a multi-line function definition. END SELECT
ends a SELECT CASE statement. END SUB ends a multi-
line subroutine definition.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: ENVIRON variable-string$ = string$
Description: ENVIRON sets the environment variable identified by
variable-string$ to string$.
It might be noted that this differs from the implementation
of ENVIRON in some versions of BASIC, but bwBASIC's ENVIRON
allows BASIC variables to be used on either side of the equals
sign. Note that the function ENVIRON$() is different from the
command, and be aware of the fact that in some operating systems
an environment variable set within a program will not be passed
to its parent shell.
Dependencies: UNIX_CMDS
------------------------------------------
Function: ENVIRON$( variable-string$ )
Description: ENVIRON$ returns the environment variable associated with
the name variable-string$.
Dependencies: MS_FUNCS
------------------------------------------
Function: EOF( device-number )
Description: EOF returns TRUE (-1) if the device associated with
device-number is at the end-of-file, otherwise it
returns FALSE (0).
Dependencies: MS_FUNCS
------------------------------------------
Command: ERASE variable[, variable]...
Description: ERASE eliminates arrayed variables from a program.
Dependencies: COMMON_CMDS
------------------------------------------
Function: ERL
Description: ERL returns the line number of the most recent error.
Dependencies: MS_FUNCS
------------------------------------------
Function: ERR
Description: ERR returns the error number of the most recent error.
Note that if PROG_ERRORS has been defined when bwBASIC is
compiled, the ERR variable will not be set correctly upon
errors. It only works when standard error messages are used.
Dependencies: MS_FUNCS
------------------------------------------
Command: ERROR number
Description: ERROR simulates an error, i.e., displays the message
appropriate for that error. This command is helpful
in writing ON ERROR GOSUB routines that can identify
a few errors for special treatment and then ERROR ERR
(i.e., default handling) for all others.
Dependencies: COMMON_CMDS
------------------------------------------
Command: EXIT [FOR]
Description: EXIT by itself exits from a DO...LOOP loop;
EXIT FOR exits from a FOR...NEXT loop.
Dependencies: STRUCT_CMDS
------------------------------------------
Function: EXP( number )
Description: EXP returns the exponential value of 'number'.
Dependencies: (core)
------------------------------------------
Command: FIELD [#] device-number, number AS string-variable$ [, number AS string-variable$...]
Description: FIELD allocates space in a random file buffer for device
indicated by device-number, allocating 'number' bytes
and assigning the bytes at this position to the variable
string-variable$.
Dependencies: COMMON_CMDS
------------------------------------------
Command: FILES filespec$
Description: FILES is a pseudocommand that invokes the directory program
specified in the variable BWB.FILES$ with the argument
filespec$. Normally, the user must set this variable
before FILES can be used. E.g., for PC-type computers,
BWB.FILES$ = "DIR"
will work, for Unix machines,
BWB.FILES$ = "ls -l"
etc.
Dependencies: COMMON_CMDS
------------------------------------------
Command: FNCS
Description: CMDS is a debugging command that prints a list
of all pre-defined bwBASIC functions.
Dependencies: DEBUG
------------------------------------------
Command: FUNCTION
Description: FUNCTION introduces a function definition, normally
ending with END FUNCTION. In bwBASIC, FUNCTION and
DEF are working equivalents, so either can be used
with single-line function definitions or with multi-
line definitions terminated by END FUNCTION.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: FOR counter = start TO finish [STEP increment]
Description: FOR initiates a FOR-NEXT loop with the variable
'counter' initially set to 'start' and incrementing
in 'increment' steps (default is 1) until 'counter'
equals 'finish'.
Dependencies: (core)
------------------------------------------
Command: GET [#] device-number [, record-number]
Description: GET reads the next record from a random-access file
or device into the buffer associated with that file.
If record-number is specified, the GET command reads the
specified record.
Dependencies: COMMON_CMDS
------------------------------------------
Command: GOSUB line | label
Description: GOSUB initiates a subroutine call to the line (or label)
specified. The subroutine must end with RETURN.
Dependencies: (core), but STRUCT_CMDS for labels
------------------------------------------
Command: GOTO line | label
Description: GOTO branches program execution to the specified line
(or label).
Dependencies: (core), but STRUCT_CMDS for labels
------------------------------------------
Function: HEX$( number )
Description: HEX$ returns a string giving the hexadecimal (base 16)
value for the 'number'.
Dependencies: MS_FUNCS
------------------------------------------
Command: IF expression THEN [statement [ELSE statement]]
Description: IF evaluates 'expression' and performs the THEN
statement if it is true or (optionally) the
ELSE statement if it is FALSE. If STRUCT_CMDS
is set to TRUE, bwBASIC allows multi-line IF
statements with ELSE and ELSEIF cases, ending
with END IF.
Dependencies: (core), STRUCT_CMDS for multi-line IF statements
------------------------------------------
Function: INKEY$
Description: INKEY$ reads the status of the keyboard, and a single
keypress, if available. If a keypress is not available,
then INKEY$ immediately returns a null string ("").
Currently (v2.10) implemented in bwx_iqc.c only.
Dependencies: IMP_IQC and IMP_CMDLOC
------------------------------------------
Command: INPUT [# device-number]|[;]["prompt string";]list of variables
Description: INPUT allows input from the terminal or a device
specified by device-number. If terminal, the "prompt
string" is output, and input is assigned to the
appropriate variables specified.
bwBASIC does not support the optional feature of INPUT
that suppresses the carriage-return and line-feed at the end
of the input. This is because C alone does not provide for any
means of input other than CR-LF-terminated strings.
Dependencies: (core)
------------------------------------------
Function: INSTR( [start-position,] string-searched$, string-pattern$ )
Description: INSTR returns the position at which string-pattern$
occurs in string-searched$, beginning at start-position.
As implemented in bwBASIC, INSTR cannot be used for
assignments.
Note: bwBASIC presently (v2.10) does not allow assignment
to a function.
Dependencies: MS_FUNCS
------------------------------------------
Function: INT( number )
Description: INT returns the largest integer less than or equal to
the argument 'number'. NOTE that this is not a "truncated"
integer function, for which see CINT.
Dependencies: (core)
------------------------------------------
Command: KILL file-name$
Description: KILL deletes the file specified by file-name$.
Dependencies: UNIX_CMDS
------------------------------------------
Function: LEFT$( string$, number-of-spaces )
Description: LEFT$ returns a substring a string$ with number-of-spaces
from the left (beginning) of the string). As implemented
under bwBASIC, it cannot be used for assignment.
Dependencies: MS_FUNCS
------------------------------------------
Function: LEN( string$ )
Description: LEN returns the length in bytes of string$.
Dependencies: COMMON_FUNCS
------------------------------------------
Command: LET variable = expression
Description: LET assigns the value of 'expression' to the variable.
As currently implemented, bwBASIC supports implied LET
statements (e.g., "X = 4.5678" at the beginning of
a line or line segment, but does not support assignment
to multiple variables (e.g., "x, y, z = 3.141596").
Dependencies: (core)
------------------------------------------
Command: LINE INPUT [[#] device-number,]["prompt string";] string-variable$
Description: LINE INPUT reads entire line from the keyboard or a file
or device into string-variable$. If input is from the
keyboard (stdin), then "prompt string" will be printed
first. Unlike INPUT, LINE INPUT reads a whole line,
not stopping for comma-delimited data items.
Dependencies: COMMON_CMDS
------------------------------------------
Command: LIST line[-line]
Description: LIST lists program lines as specified in its argument.
Dependencies: INTERACTIVE
------------------------------------------
Command: LOAD file-name
Description: LOAD loads an ASCII BASIC program into memory.
Dependencies: INTERACTIVE
------------------------------------------
Function: LOC( device-number )
Description: LOC returns the next record that GET or PUT statements
will use.
Dependencies: MS_FUNCS
------------------------------------------
Command: LOCATE line, column
Description: LOCATE addresses trhe curor to a specified line and
column. Currently (v2.10) implemented in bwx_iqc.c only.
Dependencies: IMP_IQC and IMP_CMDLOC
------------------------------------------
Function: LOF( device-number )
Description: LOF returns the length of a file (specified by device-number)
in bytes.
Dependencies: MS_FUNCS
------------------------------------------
Function: LOG( number )
Description: LOG returns the natural logarithm of the argument 'number'.
Dependencies: (core)
------------------------------------------
Command: LOOP [UNTIL expression]
Description: LOOP terminates a program loop: see DO.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: LSET string-variable$ = expression
Description: LSET transfers data from 'expression' to the left-hand
side of a string variable or random access buffer field.
Dependencies: COMMON_CMDS
------------------------------------------
Command: MERGE file-name
Description: MERGE adds program lines from 'file-name' to the program
in memory. Unlike LOAD, it does not clear the program
currently in memory.
Dependencies: COMMON_CMDS
------------------------------------------
Function: MID$( string$, start-position-in-string[, number-of-spaces ] )
Description: MID$ returns a substring of string$ beginning at
start-position-in-string and continuing for
number-of-spaces bytes.
Dependencies: MS_FUNCS
------------------------------------------
Command: MKDIR pathname$
Description: MKDIR creates a new directory path as specified by
pathname$.
Dependencies: UNIX_CMDS
------------------------------------------
Function: MKD$( number )
Description: MKD$, MKI$, and MKS$ are all equivalent in bwBASIC.
They convert the numerical value 'number' into a string
which can be stored in a more compressed form in a file
(especially for random file access). Since bwBASIC does
not recognize differences in precision, these commands
are effectively equivalent.
Dependencies: MS_FUNCS
------------------------------------------
Function: MKI$( number )
Description: Equivalent to MKD$ (q.v.)
Dependencies: MS_FUNCS
------------------------------------------
Function: MKS$( number )
Description: Equivalent to MKD$ (q.v.).
Dependencies: MS_FUNCS
------------------------------------------
Command: NAME old-file-name AS new-file-name
Description: NAME renames an existing file (old-file-name) as
new-file-name.
Dependencies: UNIX_CMDS
------------------------------------------
Command: NEW
Description: NEW deletes the program in memory and clears all
variables.
Dependencies: INTERACTIVE
------------------------------------------
Command: NEXT [counter-variable]
Description: NEXT comes at the end of a FOR-NEXT loop; see FOR.
Dependencies: (core)
------------------------------------------
Function: OCT$( number )
Description: OCT$ returns a string giving the octal (base 8)
representation of 'number'.
Dependencies: MS_FUNCS
------------------------------------------
Command: ON variable GOTO|GOSUB line[,line,line,...]
Description: ON either branches (GOTO) or calls a subroutine
(GOSUB) based on the rounded value of variable;
if it is 1, the first line is called, if 2, the second
line is called, etc.
Dependencies: (core)
------------------------------------------
Command: ON ERROR GOSUB line|label
Description: ON ERROR sets up an error handling subroutine. See
also ERROR.
Dependencies: COMMON_CMDS, STRUCT_CMDS for labels
------------------------------------------
Command: OPEN "O"|"I"|"R", [#]device-number, file-name [,record length]
file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
Description: OPEN allocates random access memory for access to a disk
file or other device. Note that two quite different forms
of the OPEN statement are supported. In the first form,
"O" (note that these letters must be encased in quotation
marks) denotes sequential output, "I" denotes sequential
input, and "R" denotes random-access input and output.
Once OPEN, any number of operations can be performed
on a device (see WRITE #, INPUT #, PRINT #, etc.).
Dependencies: COMMON_CMDS
------------------------------------------
Command: OPTION BASE number
Description: OPTION BASE sets the lowest value for array subscripts,
either 0 or 1.
Dependencies: (core)
------------------------------------------
Function: POS
Description: POS returns the current cursor position in the line.
Dependencies: COMMON_FUNCS
------------------------------------------
Command: PRINT [# device-number,][USING format-string$;] expressions...
Description: PRINT outputs text to the screen or to a file or device
specified by device-number. In the current implementation
of bwBASIC, expressions to be printed must be separated by
the comma (tabbed output), the semicolon (immediate
sequential output) or the plus sign (immediate sequential
output by string concatenation). Expressions separated
by blanks or tabs are not supported. If USING is specified,
a number of formatting marks may appear in the format
string:
! prints the first character of a string
\\ prints 2+x characters of a string, where x =
the number of spaces between the backslashes
& variable-length string field
# represents a single digit in output format for
a number
. decimal point in a number
+ sign of a number (will output + or -)
- trailing minus after a number
** fill leading spaces with asterisks
$$ output dollar sign in front of a number
^^ output number in exponential format
_ output next character literally
As currently implemented, the exponential format
will be that used by the C compiler.
Dependencies: (core), COMMON_FUNCS for USING
------------------------------------------
Command: PUT [#] device-number [, record-number]
Description: PUT outputs the next available record or the record
specified by record-number to the file or device
denoted by device-number.
Dependencies: COMMON_CMDS
------------------------------------------
Command: QUIT
Description: QUIT is a synonym for SYSTEM; with INTERACTIVE
environment, it exits the program to the
operating system (or the calling program).
Dependencies: INTERACTIVE
------------------------------------------
Command: RANDOMIZE number
Description: RANDOMIZE seeds the random number generator (see RND).
Under bwBASIC, the TIMER function (q.v.) can be used
to supply a 'number' seed for the random number
generator.
Dependencies: (core)
------------------------------------------
Command: READ variable[, variable]...
Description: READ reads values from DATA statements and assigns these
values to the named variables. Variable types in a READ
statement must match the data types in DATA statements
as they are occurred. See also DATA and RESTORE.
Dependencies: (core)
------------------------------------------
Command: REM string
Description: REM allows remarks to be included in a program. As
currently implemented, the entire line following
REM is ignored by the interpreter (thus, even if
MULTISEG_LINES is set, a REM line will not be able
to find a segment delimiter (":") followed by another
line segment with command. bwBASIC does not currently
implement the Microsoft-style use of the single quotation
mark to denote remarks.
Dependencies: (core)
------------------------------------------
Command: RESTORE line
Description: RESTORE resets the line and position counters for DATA
and READ statements to the top of the program file or
to the beginning of the specified line. (Currently this
must be a line number.)
Dependencies: (core)
------------------------------------------
Command: RETURN
Description: RETURN concludes a subroutine called by GOSUB.
Dependencies: (core)
------------------------------------------
Function: RIGHT$( string$, number-of-spaces )
Description: RIGHT$ returns a substring a string$ with number-of-spaces
from the right (end) of the string). As implemented
under bwBASIC, it cannot be used for assignment.
Dependencies: MS_FUNCS
------------------------------------------
Command: RMDIR pathname
Description: RMDIR deletes the directory path indicated by pathname.
Dependencies: UNIX_CMDS
------------------------------------------
Function: RND( number )
Description: RND returns a pseudo-random number. The 'number' value
is ignored by bwBASIC if supplied. The RANDOMIZE
command (q.v.) reseeds the random-number generator.
Dependencies: (core)
------------------------------------------
Command: RSET string-variable$ = expression
Description: RSET transfers data from 'expression' to the right-hand
side of a string variable or random access buffer field.
Dependencies: COMMON_CMDS
------------------------------------------
Command: RUN [line][file-name$]
Description: RUN executes the program in memory. If a file-name$ is
supplied, then the specified file is loaded into memory
and executed. If a line number is supplied, then execution
begins at that line.
Dependencies: INTERACTIVE
------------------------------------------
Command: SAVE file-name$
Description: SAVE saves the program in memory to file-name$. bwBASIC
only saves files in ASCII format.
Dependencies: INTERACTIVE
------------------------------------------
Command: SELECT CASE expression
Description: SELECT CASE introduces a multi-line conditional selection
statement. The expression given as the argument to SELECT
CASE will be evaluated by CASE statements following. The
SELECT CASE statement concludes with an END SELECT
statement.
As currently implemented, CASE statements may be followed
by string values, but in this case only simple comparisons
(equals, not equals) can be performed.
Dependencies: STRUCT_CMDS
------------------------------------------
Function: SGN( number )
Description: SGN returns the sign of the argument 'number', +1
for positive numbers, 0 for 0, and -1 for negative numbers.
Dependencies: (core)
------------------------------------------
Function: SIN( number )
Description: SIN returns the sine of the argument 'number'
in radians.
Dependencies: (core)
------------------------------------------
Function: SPACE$( number )
Description: SPACE$ returns a string of blank spaces 'number'
bytes long.
Dependencies: MS_FUNCS
------------------------------------------
Function: SPC( number )
Description: SPC returns a string of blank spaces 'number'
bytes long.
Dependencies: MS_FUNCS
------------------------------------------
Function: SQR( number )
Description: SQR returns the square root of the argument 'number'.
Dependencies: (core)
------------------------------------------
Command: STOP
Description: STOP interrupts program execution. As implemented under
bwBASIC, STOP issues a SIGINT signal.
Dependencies: (core)
------------------------------------------
Function: STR$( number )
Description: STR$ returns a string giving the decimal (base 10)
representation of the argument 'number'.
Dependencies: COMMON_FUNCS
------------------------------------------
Function: STRING$( number, ascii-value|string$ )
Description: STRING$ returns a string 'number' bytes long consisting
of either the first character of string$ or the character
answering to the ASCII value ascii-value.
Dependencies: MS_FUNCS
------------------------------------------
Command: SUB subroutine-name
Description: SUB introduces a named, multi-line subroutine. The
subroutine is called by a CALL statement, and concludes
with an END SUB statement.
Dependencies: STRUCT_CMDS
------------------------------------------
Command: SWAP variable, variable
Description: SWAP swaps the values of two variables. The two variables
must be of the same type (either numerical or string).
Dependencies: COMMON_CMDS
------------------------------------------
Command: SYSTEM
Description: SYSTEM exits from bwBASIC to the calling program or
(more usually) the operating system.
Dependencies: INTERACTIVE
------------------------------------------
Function: TAB( number )
Description: TAB outputs spaces until the column indicated by
'number' has been reached.
Dependencies: (core)
------------------------------------------
Function: TAN( number )
Description: TAN returns the tangent of the argument 'number'
in radians.
Dependencies: (core)
------------------------------------------
Function: TIME$
Description: TIME$ returns the current time based on the computer's
internal clock as a string in the form "HH-MM-SS".
As implemented under bwBASIC, TIME$ cannot be used for
assignment (i.e., to set the system time).
Note: bwBASIC presently (v2.10) does not allow assignment
to a function.
Dependencies: COMMON_FUNCS
------------------------------------------
Function: TIMER
Description: TIMER returns the time in the system clock in seconds
elapsed since midnight.
Dependencies: MS_FUNCS
------------------------------------------
Command: TROFF
Description: TROFF turns of the trace facility; see TRON.
Dependencies: COMMON_CMDS
------------------------------------------
Command: TRON
Description: TRON turns on the trace facility. This facility will print
each line number in square brackets as the program is
executed. This is useful in debugging programs with
line numbers. To debug an unnumbered program with
TRON, call DO NUM first, but remember to call DO UNNUM
before you save the program later.
Dependencies: COMMON_CMDS
------------------------------------------
Function: VAL( string$ )
Description: VAL returns the numerical value of the string$.
Dependencies: COMMON_FUNCS
------------------------------------------
Command: VARS
Description: VARS is a debugging command which prints a list of
all variables defined which have global scope.
Dependencies: DEBUG
------------------------------------------
Command: WEND
Description: WEND concludes a WHILE-WEND loop; see WHILE.
Dependencies: COMMON_CMDS
------------------------------------------
Command: WHILE expression
Description: WHILE initiates a WHILE-WEND loop. The loop ends with
WEND, and execution reiterates through the loop as
long as the 'expression' is TRUE (-1).
Dependencies: COMMON_CMDS
------------------------------------------
Command: WIDTH [# device-number,] number
Description: WIDTH sets screen or device output to 'number'
columns. device-number specifies the device
or file for output.
Dependencies: COMMON_CMDS
------------------------------------------
Command: WRITE [# device-number,] element [, element ]....
Description: WRITE outputs variables to the screen or to a file
or device specified by device-number. Commas
are inserted between expressions output, and strings
are enclosed in quotation marks.
Dependencies: COMMON_CMDS
------------------------------------------
6. PREDEFINED VARIABLES
BWB.EDITOR$
BWB.FILES$
BWB.PROMPT$
BWB.IMPLEMENTATION$
The commands EDIT and FILES are pseudo-commands that launch
shell programs named in the variables BWB.EDITOR$ and BWB.FILES$,
respectively. The default values for these variables can
be changed in bwbasic.h (DEF_EDITOR and DEF_FILES), or they
can be changed on the fly by the user. An idea might be to
initialize these variables in "profile.bas" for specific
implementations; for instance, BWB.FILES$ might be defined as
"ls -l" on Unix systems or "dir" on DOS systems.
The preset variable BWB.PROMPT$ can be used to set the prompt
string for bwBASIC. Again, it is suggested that a user-
selected prompt can be set up in a "profile.bas" to be
initialized each time bwBASIC starts. Note that special
characters can be added to the prompt string, e.g.,
BWB.PROMPT$ = "Ok"+CHR$(10)
will give an "Ok" prompt followed by a linefeed.
The preset variable BWB.IMPLEMENTATION$ will return "TTY" for
the bwx_tty implementation and will return "IQC" for the
IBM PC or Compatibles with QuickC (bwx_iqc) implementation.
This may be useful in determining which commands and functions
(specifically CLS, LOCATE, and INKEY$) may be available.
7. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT
There are some items not implemented that have been so long
a part of standard BASICs that their absence will seem surprising.
In each case, though, their implementation would require opera-
ting-system-specific functions or terminal-specific functions
that cannot be universally provided. Some specific examples:
CLOAD Relies on CP/M or MSDOS conventions for binary
executable files.
CONT See RESUME below (programmer ignorance?).
DEF USR Relies on CP/M or MSDOS conventions for binary
executable files.
FRE() The ability to report the amount of free memory
remaining is system-specific due to varying patterns
of memory allocation and access; consequently this
ability is not present in ANSI or earlier versions
of C and this function is not available in bwBASIC.
INPUT$() C by itself is not able to read unechoed keyboard
input, and can read keyboard input only after a
Carriage-Return has been entered.
INP Calls to hardware ports, like machine-language
routines, are highly system-specific and cannot
be implemented in C alone.
LLIST See LPRINT below.
LPOS See LPRINT below.
LPRINT and LLIST, etc., require access to a printer device,
and this varies from one system to another. Users
might try OPENing the printer device on their own
operating system (e.g., "/dev/lp" on Unix systems,
or "PRN" under DOS) and see if printing can be done
from bwBASIC in this way.
NULL In this case, I am convinced that NULL is no longer
necessary, since very few printers now require NULLs
at the end of lines.
OUT See INP above (calls to hardware ports).
PEEK() PEEK and POKE enabled earlier BASICs to address
particular memory locations. Although bwBASIC
could possibly implement this command (POKE) and
this function (PEEK()), the limitation would be
highly limited by the different systems for
memory access in different systems.
POKE see PEEK() above.
RENUM Since unnumbered lines can be entered and
executed under bwBASIC, it would not be
possible to implement a RENUM routine.
Instead, bwBASIC uses DO NUM and DO UNNUM.
RESUME Is this possible under C? If so, I
simply have failed to figure it out yet.
Mea culpa (but not maxima).
USR See CALL and DEF USR above (machine language
subroutines).
VARPTR See PEEK and POKE above.
WAIT See INP and OUT above.
There are other commands, functions, and implementation details
that I am working on, and which are on the agenda list for future
versions of bwBASIC. These agenda include:
PARACT i.e., the ability to execute PARallel ACTions. This
is described in ANSI BASIC, although I have not seen it
implemented before. It will offer a rough, non-
preemptive form of multitasking within the scope
of a BASIC program. Programmers will note points at which
there are already hooks for PARACT in bwBASIC.
XMEM PC-type computers need to be able to use extended
memory. If we could use extended memory for program
lines, variables, and function definitions, we could
write much longer programs. This would entail,
however, a fairly serious rewriting of the program
to utilize memory handles for these storage features
instead of direct memory pointers.
Windows The addition of memory handles in addition to the
non-preemptive execution of program lines (in a
crude form, already present) will make it possible
to develop implementations for Windows and perhaps
for other graphical user interfaces. But what form
should this take? I have in mind presently a BASIC
that would run in the background, appearing only
as an icon in the GUI space, with pop-up editors
and output windows. Thus, the interpreted language
would serve a purpose something like 'cron' (a task
scheduler) under Unix systems. You may have some
reflections that would help me in this.
Graphics Here we face fairly critical differences in different
styles and implementations of graphics, e.g., between
GWBASIC, ANSI BASIC, VisualBASIC, etc. But it's
possible that Graphics commands and functions could
be added. These would all be implementation-specific.
The ANSI Standard for full BASIC does not specify which particular
commands or functions must be implemented, and in fact the standard
is very robust. Perhaps no implementation of BASIC would ever
include all of the items, but some ANSI commands and functions which
remain unimplemented are:
ACCESS
ANGLE
AREA
ARITHMETIC
ARRAY
ASK
BSTR
BVAL
CEIL
CELLS
CLIP
COLLATE
CONNECT
COSH
DATUM
DEBUG
DECIMAL
DECLARE
DEGREES
DEVICE
DISCONNECT
DISPLAY
DOT
DRAW
ERASE
EVENT
EXCEPTION
GRAPH
HANDLER
IMAGE
KEY
LCASE
LINES
LOG10
LOG2
MAT
MIX
MULTIPOINT
OUTIN
OUTPUT
PARACT
PICTURE
PIXEL
PLOT
POINTS
RADIANS
RECEIVE
RENUMBER
REWRITE
ROTATE
ROUND
SEIZE
SEND
SHIFT
SINH
TANH
TIMEOUT
TRACE
TRANSFORM
TRUNCATE
UBOUND
UCASE
VIEWPORT
WAIT
VIEWPORT
ZONEWIDTH
8. THE STORY OF BYWATER BASIC
This program was originally begun in 1982 by my grandmother, Mrs.
Verda Spell of Beaumont, TX. She was writing the program using
an ANSI C compiler on an Osborne I CP/M computer and although my
grandfather (Lockwood Spell) had bought an IBM PC with 256k of
RAM my grandmother would not use it, paraphrasing George Herbert
to the effect that "He who cannot in 64k program, cannot in 512k."
She had used Microsoft BASIC and although she had nothing against
it she said repeatedly that she didn't understand why Digital
Research didn't "sue the socks off of Microsoft" for version 1.0
of MSDOS and so I reckon that she hoped to undercut Microsoft's
entire market and eventually build a new software empire on
the North End of Beaumont. Her programming efforts were cut
tragically short when she was thrown from a Beaumont to Port
Arthur commuter train in the summer of 1986. I found the source
code to bwBASIC on a single-density Osborne diskette in her knitting
bag and eventually managed to have it all copied over to a PC
diskette. I have revised it slightly prior to this release. You
should know, though, that I myself am an historian, not a programmer.
9. COMMUNICATIONS:
email: tcamp@delphi.com
|