ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1157 lines
45 KiB

  1. Bywater BASIC Interpreter, version 3.20
  2. ---------------------------------------------
  3. Copyright (c) 1993, Ted A. Campbell
  4. for bwBASIC version 2.10, 11 October 1993
  5. Copyright (c) 2014-2015, Howatd Wulf, AF5NE
  6. for bwBASIC version 3.00, 12 May 2015
  7. Copyright (c) 2015-2016, Howatd Wulf, AF5NE
  8. for bwBASIC version 3.10, 27 July 2016
  9. Copyright (c) 2016-2017, Howatd Wulf, AF5NE
  10. for bwBASIC version 3.20, 4 June 2017
  11. CONTENTS:
  12. 1. DESCRIPTION
  13. 2. TERMS OF USE
  14. 3. QUICK REFERENCE LIST OF COMMANDS, FUNCTIONS AND OPERATORS
  15. 4. GENERAL NOTES ON USAGE
  16. 5. PREDEFINED VARIABLES
  17. 6. UNIMPLEMENTED COMMANDS AND FUNCTIONS
  18. and AGENDA FOR DEVELOPMENT
  19. 7. THE STORY OF Bywater BASIC
  20. 8. COMMUNICATIONS
  21. 9. EXPANDED REFERENCE FOR COMMANDS, FUNCTIONS AND OPERATORS
  22. The author wishes to express his thanks to Mr. David MacKenzie,
  23. who assisted in the development Unix installation and configuration
  24. for this version.
  25. 1. DESCRIPTION
  26. The Bywater BASIC Interpreter (bwBASIC) implements a large superset
  27. of the ANSI Standard for Minimal BASIC (X3.60-1978) and a significant
  28. subset of the ANSI Standard for Full BASIC (X3.113-1987), and many
  29. classic BASIC dialects in C.
  30. bwBASIC can be configured to enable commands, functions, operators
  31. and punctuation characters available in many classic dialects of BASIC;
  32. these are controlled by various OPTION commands. bwBASIC does not attempt
  33. bug-level compatibility with any particular BASIC dialect nor does it
  34. currently support graphics. bwBASIC seeks to be as portable as possible.
  35. The interpreter is fairly slow. Whenever faced with a choice
  36. between conceptual clarity and speed, I have consistently chosen the
  37. former. The interpreter is the simplest design available, and
  38. utilizes no system of intermediate code, which could speed up
  39. considerably its operation. As it is, each line has only one
  40. command. Multi-statement lines are internally broken into distinct
  41. lines as they are loaded.
  42. 2. TERMS OF USE:
  43. This version of Bywater BASIC is released under the terms of the
  44. GNU General Public License (GPL), which is distributed with this
  45. software in the file "COPYING". The GPL specifies the terms under
  46. which users may copy and use the software in this distribution.
  47. A separate license is available for commercial distribution,
  48. for information on which you should contact the author.
  49. 3. QUICK REFERENCE LIST OF COMMANDS, FUNCTIONS AND OPERATORS
  50. The complete list of over 500 commands, functions and operators is
  51. in the file "ALL.txt" in the DOCS directory. Documentation for each
  52. BASIC dialect is in the other text files in the DOCS directory.
  53. A BASIC dialect is a selection of commands, functions, operators,
  54. punctuation characters and other behaviors. The OPTION VERSION
  55. command is used to choose a specific BASIC dialect. Additional
  56. OPTION commands are available to fine-tune the behavior.
  57. In bwBASIC, any function can be executed as a command. For example,
  58. the function "OUT(X, Y)" can be executed as the command "OUT X, Y".
  59. You can overload functions by parameter signature (the number
  60. and types of parameters), and user defined functions can replace
  61. any instrinsic function, including INP, OUT, PEEK, POKE, and WAIT.
  62. 4. GENERAL NOTES ON USAGE:
  63. 4.a. Interactive Environment
  64. An interactive environment is provided if the flag INTERACTIVE
  65. is defined as TRUE in bwBASIC.h, so that a line with a
  66. line number can be entered at the bwBASIC prompt and it will be
  67. added to the program in memory.
  68. Line numbers are not strictly required, but are useful if the
  69. interactive enviroment is used for programming. For longer
  70. program entry one might prefer to use an ASCII text editor, and
  71. in this case lines can be entered without numbers. See also the
  72. documentation below for the pseudo-command EDIT, in section 5.
  73. 4.b. Naming Conventions
  74. Command, function, label, and variable names are not case sensitive,
  75. so that "Run" and "RUN" and "run" are equivalent.
  76. The characters allowed in variable names depends upon the specific
  77. BASIC dialect selected with the OPTION VERSION command. Usually,
  78. variable names can use any alphabetic characters, the period
  79. and underscore characters and decimal digits (but not in the
  80. first position) and they can be terminated with the various numeric
  81. type characters (!,@,#,%,&,~) or the string type character ($).
  82. 4.c. Numerical Constants
  83. Numerical constants may begin with a digit 0-9 (decimal), with
  84. the "&H" or "&h" (hexadecimal) or the "&o" or "&O" (octal).
  85. Numerical constants may include 'E' or 'e' followed by an
  86. exponent number to denote exponential notation. Numerical
  87. constants may also be terminated by the various numeric type
  88. characters (!,@,#,%,&,~).
  89. 4.d. Command-Line Execution
  90. A filename can be specified on the command line and will be
  91. loaded and executed immediately, so that the command line
  92. bwBASIC prog.bas
  93. will load and execute "prog.bas". If a program is executed
  94. from the command line, control is returned to the operating
  95. system when the program terminates.
  96. 4.e. Program Storage
  97. All programs are stored as ASCII text files.
  98. 4.f. TRUE and FALSE
  99. TRUE is defined as -1 and FALSE is defined as 0 in the default
  100. distribution of bwBASIC. Alhtough these definitions can be changed
  101. by those compiling bwBASIC (see file bwBASIC.h), any other values
  102. are not supported.
  103. 4.g. Assignments
  104. Assignment must be made to variables. This differs from some
  105. implementations of BASIC where assignment can be made to a
  106. function. Implication: "INSTR( 3, x$, y$ ) = z$" will not
  107. work under bwBASIC. The command "MID$(X$,...) = ..." is
  108. implemented and should be used instead.
  109. Some BASIC dialects allow the multiple variable assignments,
  110. such as:
  111. 100 LET A = B = C = 0
  112. In bwBASIC, only the first '=' is considered an assignment.
  113. All other '=' are considered comparison operators. To resolve
  114. this issue, use commas to seperate the variables, such as:
  115. 100 LET A, B, C = 0
  116. If these statements are only used to initialize the variable
  117. values, then they may not needed in bwBASIC, since all numeric
  118. variables are initialized to zero (0) and all string variables
  119. are initialized to the empty string ("").
  120. 4.h. Operators and Precedence
  121. The available operators are determined by the OPTION VERSION
  122. setting. bwBASIC recognizes many operators, with their level of
  123. precedence fixed. The precedence levels chosen for the various
  124. operators in bwBASIC were selected to be compatible with many
  125. dialects of BASIC. If your application requires a specific order
  126. of evaluation, then use parentheses.
  127. The collating sequence (ASCII, EBCDIC, and so on) is determined
  128. by the C compiler. As a consequenece, the results of string
  129. comparisons may vary. A simple check for collating sequence is
  130. shown in the following example:
  131. 100 REM Purpose: Verify collating sequence (sort order)
  132. 110 REM Author: Howard Wulf, AF5NE
  133. 120 REM Date: 2015-11-28
  134. 130 REM
  135. 200 IF "1" < "A" THEN 300
  136. 210 PRINT "EBCDIC"
  137. 220 GOTO 999
  138. 300 PRINT "ASCII"
  139. 999 END
  140. 4.i. Numerical Precision (NOT)
  141. bwBASIC utilizes numbers with only one level of precision.
  142. All numbers are internally represented using a C double.
  143. The various numeric type suffix characters (!,@,#,%,&,~),
  144. just like the string type suffix character ($), are part
  145. of the variable name.
  146. This version also supports type declarations, such as:
  147. 100 DIM X AS INTEGER
  148. 110 FUNCTION ABC( X AS INTEGER ) AS INTEGER
  149. 120 LET ABC = X * 2
  150. 130 END FUNCTION
  151. For each type character there is an equivalent type declaration.
  152. Type Equivalent
  153. Char declaration
  154. ==== ===========
  155. $ STRING
  156. # DOUBLE
  157. ! SINGLE
  158. @ CURRENCY
  159. & LONG
  160. % INTEGER
  161. ~ BYTE
  162. However, combining both a type suffix character and a type
  163. declaration in the same statement is not supported.
  164. 100 DIM A$ AS INTEGER ' this is not supported
  165. The type of a variable is used to range-check the values.
  166. This allows many programs to run correctly, but does not
  167. handle all possible cases. The current implementation is not
  168. complete for all possible uses of numeric type declarations.
  169. In the current version, the type of numeric values is used
  170. to select the appropriate operation. As a consequence,
  171. integer division is used when dividing two integer values.
  172. The MOD and \ operators use the rounded integer values of
  173. their parameters and return a rounded integer result.
  174. Within an expression, the result of an operation is promoted
  175. to the greater of:
  176. the type of the left parameter,
  177. the type of the right parameter, and
  178. the type required to hold the result.
  179. In bwBASIC, numeric constants are DOUBLE by default. If you
  180. wish to coerce a numeric constant, then add the appropriate
  181. numeric type character immediately after the numeric digits.
  182. Many BASIC dialects that allow numeric constants to have a
  183. numeric type character adopt this convention.
  184. 4.j. OPTION VERSION and so on
  185. OPTION commands change how a BASIC program is parsed. All OPTION commands
  186. should be in "profile.bas" so they are effective when a BASIC program
  187. is loaded. The first OPTION command should be OPTION VERSION to select a
  188. specific BASIC dialect. Additional OPTION commands fine-tune the available
  189. commands, functions, operators, punctuation characters and so on to support
  190. programs written in many different BASIC dialects. All other OPTION commands
  191. must follow the OPTION VERSION command. Conflicting and pathological OPTION
  192. combinations are not supported.
  193. The OPTION VERSION command selects a specific BASIC dialect.
  194. OPTION VERSION "BYWATER" ' Bywater BASIC 3
  195. OPTION VERSION "BYWATER-2" ' Bywater BASIC 2
  196. OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC
  197. OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M
  198. OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC
  199. OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC
  200. OPTION VERSION "ECMA-116" ' ANSI Full BASIC
  201. OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC
  202. OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt
  203. OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition
  204. OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition
  205. OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC
  206. OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC
  207. OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC
  208. OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix
  209. OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC
  210. OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC
  211. OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX
  212. OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS
  213. OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC
  214. OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC
  215. OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC
  216. OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1
  217. OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX
  218. For example, MOD is a function in OPTION VERSION "ECMA-116",
  219. MOD is an operator in OPTION VERSION "MBASIC", and
  220. MOD is a valid variable name in OPTION VERSION "CALL/360".
  221. The OPTION VERSION command also sets the following OPTION commands:
  222. OPTION STRICT ON | OFF
  223. OPTION ANGLE DEGREES | RADIANS | GRADIANS
  224. OPTION BUGS ON | OFF
  225. OPTION LABELS ON | OFF
  226. OPTION COMPARE BINARY | DATABASE | TEXT
  227. OPTION BASE integer
  228. OPTION RECLEN integer
  229. OPTION COVERAGE ON | OFF
  230. OPTION TRACE ON | OFF
  231. OPTION ERROR GOTO | GOSUB
  232. OPTION DATE "format"
  233. OPTION TIME "format"
  234. OPTION PUNCT COMMENT "char"
  235. OPTION PUNCT STATEMENT "char"
  236. OPTION PUNCT PRINT "char"
  237. OPTION PUNCT IMAGE "char"
  238. OPTION PUNCT INPUT "char"
  239. OPTION USING DIGIT "char"
  240. OPTION USING COMMA "char"
  241. OPTION USING PERIOD "char"
  242. OPTION USING PLUS "char"
  243. OPTION USING MINUS "char"
  244. OPTION USING EXRAD "char"
  245. OPTION USING DOLLAR "char"
  246. OPTION USING FILLER "char"
  247. OPTION USING LITERAL "char"
  248. OPTION USING FIRST "char"
  249. OPTION USING ALL "char"
  250. OPTION USING LENGTH "char"
  251. OPTION PUNCT QUOTE "char"
  252. OPTION PUNCT STRING "char"
  253. OPTION PUNCT DOUBLE "char"
  254. OPTION PUNCT SINGLE "char"
  255. OPTION PUNCT CURRENCY "char"
  256. OPTION PUNCT LONG "char"
  257. OPTION PUNCT INTEGER "char"
  258. OPTION PUNCT BYTE "char"
  259. OPTION PUNCT LPAREN "char"
  260. OPTION PUNCT RPAREN "char"
  261. OPTION PUNCT FILENUM "char"
  262. OPTION PUNCT AT "char"
  263. The commands, functions, operators and settings for each BASIC dialect
  264. is documented in the text files in the DOCS directory.
  265. OPTION DISABLE COMMAND
  266. Disable a specific command.
  267. OPTION DISABLE FUNCTION
  268. Disable a specific function.
  269. OPTION DISABLE OPERATOR
  270. Disable a specific operator.
  271. OPTION ENABLE COMMAND
  272. Enable a specific command.
  273. OPTION ENABLE FUNCTION
  274. Enable a specific function.
  275. OPTION ENABLE OPERATOR
  276. Enable a specific operator.
  277. OPTION ERROR GOSUB
  278. The program will GOSUB to the error handler.
  279. The error handler exits with the RETURN command.
  280. OPTION ERROR GOTO
  281. The program will GOTO to the error handler.
  282. The error handler exits with the RESUME command.
  283. OPTION LABELS OFF
  284. Disables textual labels.
  285. OPTION LABELS ON
  286. Enables textual labels.
  287. Regardless of the OPTION LABELS setting, statements of the form
  288. IF x THEN label
  289. are not allowed, instead use the form
  290. IF x THEN GOTO label
  291. The reason for this rule is because
  292. IF x THEN y
  293. is considered to be the same as
  294. IF x THEN
  295. y
  296. END IF
  297. where "y" is a command, function, or subroutine. Many BASIC dialects
  298. that allow textual labels adopt this convention.
  299. OPTION ROUND controls how floating point values are converted to
  300. whole number values. OPTION ROUNG MATH rounds toward the nearest
  301. whole number, with halves rounding up to the next larger whole number,
  302. as commonly expected by many scientific applications. OPTION ROUND
  303. BANK rounds halves to the even whole numbers, as commonly expected
  304. by many financial applications. OPTION ROUND TRUNCATE truncates to
  305. the next smaller whole number, as commonly expected by many
  306. applications written for an integer BASIC. The selected rounding
  307. method is used whenever a whole number is required, including:
  308. a) selection value for ON ... GOTO and ON ... GOSUB
  309. b) any function parameter requiring a whole number
  310. c) array subscripts and dimensions
  311. d) string positions and lengths
  312. e) CINT() and similar
  313. The OPTION ROUND command does not change the results of INT() or FIX().
  314. The default rounding method is OPTION ROUND BANK.
  315. A comparison of the different OPTION ROUND settings upon the results of CINT()
  316. BANK MATH TRUNCATE
  317. X int(X) fix(X) cint(X) cint(X) cint(X)
  318. -2.0 -2 -2 -2 -2 -2
  319. -1.6 -2 -1 -2 -2 -1
  320. -1.5 -2 -1 -2 -2 -1
  321. -1.4 -2 -1 -1 -1 -1
  322. -1.0 -1 -1 -1 -1 -1
  323. -0.6 -1 0 -1 -1 0
  324. -0.5 -1 0 0 -1 0
  325. -0.4 -1 0 0 0 0
  326. 0.0 0 0 0 0 0
  327. 0.4 0 0 0 0 0
  328. 0.5 0 0 0 1 0
  329. 0.6 0 0 1 1 0
  330. 1.0 1 1 1 1 1
  331. 1.4 1 1 1 1 1
  332. 1.5 1 1 2 2 1
  333. 1.6 1 1 2 2 1
  334. 2.0 2 2 2 2 2
  335. The OPTION BUGS command determines the behavior of a number of BASIC keywords.
  336. BASIC programs which rely on these behaviors are non-portable and non-standard.
  337. I have considered several different names for this command, but have not yet
  338. thought of a better short name.
  339. OPTION BUGS ON disables the ANSI/ECMA/ISO standard behavior:
  340. FOR ... ' values are evaluated left-to-right
  341. GOTO X OF ... ' an invalid value for X falls thru without ERROR
  342. GOSUB X OF ... ' an invalid value for X falls thru without ERROR
  343. ON X GOTO ... ' an invalid value for X falls thru without ERROR
  344. ON X GOSUB ... ' an invalid value for X falls thru without ERROR
  345. X = VAL("X") ' returns zero without ERROR
  346. INPUT X ' empty string returns zero without ERROR
  347. INPUT X$ ' empty string returns "" without ERROR
  348. INPUT X$ ' allows unquoted character strings
  349. variable names ' period and underscore are allowed
  350. variable types ' the type characters #!@&% are allowed
  351. PRINT "a" X ' string concatenation is implied
  352. 1.2% is 1 ' the type characters #!@&% are allowed
  353. 1D1 is ERROR ' 'D' is not allowed as exponent seperator
  354. OPTION BUGS OFF enables the ANSI/ECMA/ISO standard behavior:
  355. FOR ... ' values are evaluated according to standard
  356. GOTO X OF ... ' an invalid value for X is an ERROR
  357. GOSUB X OF ... ' an invalid value for X is an ERROR
  358. ON X GOTO ... ' an invalid value for X is an ERROR
  359. ON X GOSUB ... ' an invalid value for X is an ERROR
  360. X = VAL("X") ' raises an illegal function call (ERROR 5)
  361. INPUT X ' empty string retries input
  362. INPUT X$ ' empty string retries input
  363. INPUT X$ ' unquoted character strings retries input
  364. variable names ' period and underscore are not allowed
  365. variable types ' the type characters #!@&% are not allowed
  366. PRINT "a";X ' string concatenation is not implied
  367. 1.2% is ERROR ' the type characters #!@&% are not allowed
  368. 1D1 is ERROR ' 'D' is not allowed as exponent seperator
  369. 4.k. ERROR handling
  370. bwBASIC implements a simplified error handling strategy.
  371. Errors are seperated into two categories:
  372. a) Fatal errors. These errors include:
  373. - Unknown command
  374. - FOR without NEXT
  375. - NEXT without FOR
  376. - WHILE without WEND
  377. - WEND without WHILE
  378. - and so on.
  379. The program is scanned prior to running and if any of these errors is
  380. detected, then the program is not allowed to run. If these errors
  381. occur as the result of a DELETE or MERGE in a running program, then the
  382. program is terminated.
  383. b) Non-fatal errors. If an error handler exists, then it is executed,
  384. otherwise the default behaivor is performed. The correct action to
  385. take in an error handler depends upon the specific application.
  386. - Overflow (ERROR 6)
  387. - the default behavior is to display a warning message.
  388. - Division by zero (ERROR 11)
  389. - the default behavior is to display a warning message.
  390. - String too long (ERROR 15)
  391. - the default behavior is to display a warning message.
  392. - All other non-fatal errors
  393. - the default behavior is to terminate the program.
  394. bwBASIC 2.61 used ON ERROR GOSUB for error trapping.
  395. This version defaults to ON ERROR GOTO instead.
  396. 4.l. Implementation rules for functions and commands
  397. In many BASIC dialects, keywords are seperated into three distinct groups:
  398. Commands, Statements, and Functions. In bwBASIC, keywords are seperated
  399. into only two groups: Commands and Functions. A keyword documented as a
  400. Command or Statament in a specific BASIC dialect may have been implemented
  401. in bwBASIC as a Function. This is merely an implementation decision, which
  402. may change in the future. Each keyword should only be used as described in
  403. the reference document. The following rules are considered when deciding
  404. whether a BASIC keyword is implemented as a command or a function:
  405. a) If the keyword requires significant parsing,
  406. then it is implemented as a command. An example is "PRINT".
  407. b) If the keyword requires access to variables BYREF,
  408. then it is implemented as a command. An example is "SWAP".
  409. c) If the keyword changes the flow of control,
  410. then it is implemented as a command. An example is "GOTO".
  411. d) A function may be used as though it were a command,
  412. but a command cannot be used as though it were a function.
  413. e) The BASIC program can redefine a function,
  414. but the BASIC program cannot redefine a command.
  415. f) The BASIC program can overload a function,
  416. but the BASIC program cannot overload a command.
  417. g) Other than semantics, there is no practical difference
  418. between a BASIC function and a BASIC subroutine. The
  419. return value of a BASIC subroutine, when called as a
  420. function, is zero. Calling a BASIC function as if it
  421. were a subroutine simply discards the return value.
  422. These rules were chosen to maintain compatibility with
  423. many BASIC dialects.
  424. An example of the results of the above rules is "OUT".
  425. Since "OUT" is implemented as a function, you may:
  426. a) call it as a subroutine like this:
  427. 100 OUT X, Y
  428. b) call it as a function like this:
  429. 100 LET N = OUT( X, Y ) ' N = 0
  430. c) redefine it as a subroutine like this:
  431. SUB OUT( X, Y )
  432. REM ...
  433. END SUB
  434. d) redefine it as a function like this:
  435. FUNCTION OUT( X, Y )
  436. REM ...
  437. END FUNCTION
  438. e) overload it using subroutines like these:
  439. SUB OUT( X, Y )
  440. REM ...
  441. END SUB
  442. SUB OUT( X, A$ )
  443. REM ...
  444. END SUB
  445. SUB OUT( A$, X )
  446. REM ...
  447. END SUB
  448. SUB OUT( A$, B$ )
  449. REM ...
  450. END SUB
  451. f) overload it using functions like these:
  452. FUNCTION OUT( X, Y )
  453. REM ...
  454. END FUNCTION
  455. FUNCTION OUT( X, A$ )
  456. REM ...
  457. END FUNCTION
  458. FUNCTION OUT( A$, X )
  459. REM ...
  460. END FUNCTION
  461. FUNCTION OUT( A$, B$ )
  462. REM ...
  463. END FUNCTION
  464. 4.m. Reference documentation
  465. bwBASIC is preconfigured to support a number of specific BASIC dialects which were
  466. implemented using the following references, however bwBASIC does not attempt to be
  467. bug-level compatible and does not implement non-portable design choices. A manual
  468. for each dialect is in the DOCS directory to make you aware that a specific keyword
  469. is implemented, however you should refer to the reference document for a proper
  470. understanding of how to use each keyword. There are many other good books which
  471. describe these BASIC dialects in detail.
  472. OPTION VERSION "BYWATER" ' Bywater BASIC 3
  473. MANUAL:
  474. BYWATER.TXT
  475. OPTION VERSION "BYWATER-2" ' Bywater BASIC 2
  476. MANUAL:
  477. BYWATER-2.TXT
  478. NOT IMPLEMENTED:
  479. DO NUM, DO UNNUM
  480. NOTES:
  481. SUB MAIN is not automatically called.
  482. CALL requires parentheses around the function/subroutine parameters,
  483. so instead of
  484. CALL abc 1, 2, 3
  485. use
  486. CALL abc( 1, 2, 3 )
  487. OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC
  488. MANUAL:
  489. CALL-360.TXT
  490. NOT IMPLEMENTED:
  491. MAT PRINT USING.
  492. NOTES:
  493. The APPENDIXES are implementation specific and are not supported.
  494. OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M
  495. MANUAL:
  496. CBASIC-II.TXT
  497. ADDITIONAL INFORMATION:
  498. "CBASIC Language Reference Manual, 2nd Edition"
  499. by Diigital Research
  500. (c) 1982, Diigital Research
  501. http://bitsavers.trailing-edge.com/pdf/digitalResearch/cb80/
  502. CBASIC_Language_Reference_Manual_Oct82.pdf
  503. NOT IMPLEMENTED:
  504. CONSTAT%, CONCHAR% and compiler directives.
  505. NOTES:
  506. The APPENDIXES are implementation specific and are not supported.
  507. The %INCLUDE directive is implemented, but only supports literal
  508. unquoted filesnames without drive or directory, such as:
  509. %INCLUDE LIBRARY.BAS
  510. Note that the %INCLUDE directive is executed as a file is being loaded,
  511. and as a result the %INCLUDE does not appear in the resulting listing.
  512. Machine language functions and commands are not supported.
  513. The parsing of command line parameters is implementation defined.
  514. The specification of an array in a COMMON statement is the same as
  515. the specification in a DIM statement.
  516. The SIZE() function assumes 1024 bytes and does not support wild-cards;
  517. if the file does not exist then SIZE() returns zero, otherwise SIZE()
  518. returns the number of 1024 bytes blocks required to contain the file;
  519. an existing file of zero bytes returns a value of 1.
  520. OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC
  521. MANUAL:
  522. DARTMOUTH.TXT
  523. NOTES:
  524. The APPENDICES are implementation specific and are not supported.
  525. Sections 4.2 and 4.3 are implementation specific and are not supported.
  526. Lines containing data to be READ must have a line number and a DATA command.
  527. NOT IMPLEMENTED:
  528. Card punch codes are not supported, use a comma or semicolon instead.
  529. OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC
  530. MANUAL:
  531. ECMA-55.TXT
  532. NOTES:
  533. The APPENDICES are implementation specific and are not supported.
  534. DIM is an executed statement in bwBASIC.
  535. This is a design decision to support the following example.
  536. 100 INPUT "How many?"; N
  537. 110 DIM A$(N)
  538. OPTION VERSION "ECMA-116" ' ANSI Full BASIC
  539. MANUAL:
  540. ECMA-116.TXT
  541. NOT IMPLEMENTED:
  542. Graphic commands, chapters 11 thru 15.
  543. NOTES:
  544. The APPENDICES are implementation specific and are not supported.
  545. WORK-IN-PROGRESS.
  546. OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC
  547. MANUAL:
  548. GCOS.TXT
  549. NOT IMPLEMENTED:
  550. HPS, LIN, RESTORE*, RESTORE$, VPS and binary files.
  551. NOTES:
  552. The APPENDIXES are implementation specific and are not supported.
  553. Local variables in a multiline DEF are declared using DIM.
  554. Line numbers are not written to, nor read from, data files.
  555. FILES does not support passwords.
  556. Literal values for file names are not supported, use string values instead.
  557. This is a design decision to support the following:
  558. 100 INPUT "Which files?"; A$, B$, C$
  559. 110 FILES A$, B$, C$
  560. OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt
  561. MANUAL:
  562. HAARDT.TXT
  563. NOT IMPLEMENTED:
  564. BBC syntax, use ANSI syntax instead.
  565. ON ERROR statement(s) is not supported, use ON ERROR GOTO instead.
  566. ON ERROR OFF, use ON ERROR GOTO 0 instead.
  567. MAT REDIM, OPTION RUN, OPTION STOP, TRUNCATE, UNNUM and XREF.
  568. DEC$(X,A$), ENVIRON$(X), FIND$(A$[,X]) and INSTR(A$,B$,X,Y).
  569. NOTES:
  570. POS and TAB are 1-based instead of 0-based.
  571. ON ERROR GOTO 0 does not cause any error to occur, instead
  572. ON ERROR GOTO 0 removes the current error handler and clears
  573. ERL, ERR and ERROR$.
  574. OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition
  575. MANUAL:
  576. HANDBOOK1.TXT
  577. NOT IMPLEMENTED:
  578. Abbreviated commands (such as A.) and graphic commands.
  579. NOTES:
  580. The APPENDICES are implementation specific and are not supported.
  581. The ERR function returns different values.
  582. OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition
  583. MANUAL:
  584. HANDBOOK2.TXT
  585. NOT IMPLEMENTED:
  586. Abbreviated commands (such as A.) and graphic commands.
  587. NOTES:
  588. The APPENDICES are implementation specific and are not supported.
  589. The ERR function returns different values.
  590. OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC
  591. NOT IMPLEMENTED:
  592. FREEZE, UNFREEZE, LOCK, UNLOCK, STEP
  593. NOTES:
  594. The APPENDICES are implementation specific and are not supported.
  595. PRINT #-1 is sent to the printer.
  596. INPUT #-1 is an ERROR.
  597. OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC
  598. MANUAL:
  599. MARK-I.TXT
  600. ADDITIONAL REFERENCE:
  601. "Time-Sharing Service BASIC LANGUAGE EXTENSIONS Reference Manual"
  602. by Time-Sharing Service, Information Service Department, General Electric
  603. (c) 1968, General Electric Company and Trustees of Dartmouth College
  604. http://www.bitsavers.org/pdf/ge/MarkI_Timesharing/
  605. 802207A_Time-SharingServiceBASICLanguageExtensionsReferenceManual_Feb1968.pdf
  606. NOTES:
  607. The APPENDIXES are implementation specific and are not supported.
  608. NOT IMPLEMENTED:
  609. A series of variables seperated by equal signs is not supported,
  610. use a series of variables seperated by commas instead.
  611. Literal values for file names are not supported, use string values instead.
  612. This is a design decision to support the following:
  613. 100 INPUT "Which files?"; A$, B$, C$
  614. 110 FILES A$, B$, C$
  615. CALL, to execute another compiled program, is not supported, use SHELL instead.
  616. OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC
  617. MANUAL:
  618. MARK-II.TXT
  619. ADDITIONAL INFORMATION:
  620. "Basic Software Library" (Volumes 1 to 8)
  621. by R. W. Brown
  622. (c) 1977, Scientific Research Inst.
  623. NOT IMPLEMENTED:
  624. HPS, LIN, RESTORE*, RESTORE$, VPS and binary files.
  625. NOTES:
  626. The APPENDIXES are implementation specific and are not supported.
  627. Local variables in a multiline DEF are declared using DIM.
  628. Line numbers are not written to, nor read from, data files.
  629. Literal values for file names are not supported, use string values instead.
  630. This is a design decision to support the following:
  631. 100 INPUT "Which files?"; A$, B$, C$
  632. 110 FILES A$, B$, C$
  633. FILES does not support passwords.
  634. OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix
  635. MANUAL:
  636. MBASIC.TXT
  637. NOTES:
  638. The APPENDICES are implementation specific and are not supported.
  639. The ERR function returns different values.
  640. Specifying "D" in the exponent is not supported, instead use "E".
  641. OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC
  642. MANUAL:
  643. PDP-8.TXT
  644. NOT IMPLEMENTED:
  645. NO RUBOUTS, RUBOUTS
  646. NOTES:
  647. The APPENDICES are implementation specific and are not supported.
  648. OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC
  649. MANUAL:
  650. PDP-11.TXT
  651. NOTES:
  652. The APPENDICES are implementation specific and are not supported.
  653. OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX
  654. MANUAL:
  655. RBASIC.TXT
  656. NOT IMPLEMENTED:
  657. "+" command, COMPILE, CVT$, CVTF$, CVT$%, CVT$F
  658. NOTES:
  659. The APPENDICES are implementation specific and are not supported.
  660. The ERR function returns different values.
  661. OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS
  662. MANUAL:
  663. RSTS-11.TXT
  664. ADDITIONAL INFORMATION:
  665. "BASIC-PLUS Language Manual : for use with RSTS-11 (PDP-11 Resource Time-Sharing System)"
  666. by Digital Equipment Corporation
  667. (c) 1972, Digital Equipment Corporation
  668. http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/V04/
  669. DEC-11-ORBPA-A-D_BASIC-PLUS_LangMan_Oct72.pdf
  670. ADDITIONAL INFORMATION:
  671. "PDP-11 : BASIC-PLUS Language Manual"
  672. by Digital Equipment Corporation
  673. (c) 1975, Digital Equipment Corporation
  674. http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsts/V06/
  675. DEC-11-ORBPB-A-D_BASIC-PLUS_LangMan_Jul75.pdf
  676. NOT IMPLEMENTED:
  677. HELLO, RENAME, REPLACE, COMPILE, LENGTH, TAPE, KEY, ASSIGN, DEASSIGN.
  678. FOR ... WHILE, FOR ... UNTIL, statement modifiers.
  679. NOTES:
  680. The APPENDIXES are implementation specific and are not supported.
  681. The ERR function returns different values.
  682. The statemnet NAME ... AS does not support the <protection> specifier.
  683. OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC
  684. MANUAL:
  685. SYSTEM-360.TXT
  686. ADDITIONAL INFORMATION:
  687. "IBM System/360 0S(TS0) ITF:BASIC Terminal User's Guide"
  688. by International Business Machines Corporation
  689. (c) 1971, International Business Machines Corporation
  690. http://bitsavers.org/pdf/ibm/360/os/tso/
  691. SC28-6840-0_TSO_ITF_BASIC_Terminal_UG_Apr71.pdf
  692. NOT IMPLEMENTED:
  693. MAT PRINT USING.
  694. NOTES:
  695. The APPENDIXES are implementation specific and are not supported.
  696. OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC
  697. MANUAL:
  698. SYSTEM-370.TXT
  699. NOT IMPLEMENTED:
  700. MAT PRINT USING.
  701. NOTES:
  702. The APPENDIXES are implementation specific and are not supported.
  703. OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC
  704. MANUAL:
  705. TRS-80.TXT
  706. NOT IMPLEMENTED:
  707. CMD, SET EOF, cassette I/O.
  708. NOTES:
  709. The APPENDICES are implementation specific and are not supported.
  710. The ERR function returns different values.
  711. For the TRS-80 Model I use "WIDTH 16,64" in "profile.bas".
  712. For the TRS-80 Model III use "WIDTH 16,64" in "profile.bas".
  713. For the TRS-80 Model 4 use "WIDTH 24,80" in "profile.bas".
  714. bwBASIC requires a space around all keywords, so the LINEINPUT
  715. command must be written as LINE INPUT, and so on.
  716. PRINT #-1 is sent to the printer.
  717. INPUT #-1 is an ERROR.
  718. OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1
  719. MANUAL:
  720. VINTAGE.TXT
  721. NOTES:
  722. The APPENDICES are implementation specific and are not supported.
  723. OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX
  724. MANUAL:
  725. XBASIC.TXT
  726. NOT IMPLEMENTED:
  727. "+" command, COMPILE, CVT$, CVTF$, CVT$%, CVT$F
  728. NOTES:
  729. The APPENDICES are implementation specific and are not supported.
  730. The ERR function returns different values.
  731. 5. PREDEFINED VARIABLES - no longer exist
  732. BWB.EDITOR$
  733. BWB.FILES$
  734. BWB.PROMPT$
  735. BWB.IMPLEMENTATION$
  736. These preset variables no longer exist in bwBASIC. They have
  737. been replaced with OPTION EDIT, OPTION FILES and OPTION PROMPT
  738. commands.
  739. The commands EDIT and FILES are pseudo-commands that launch
  740. shell programs set by OPTION EDIT and OPTION FILES commands,
  741. respectively. The default values for these commands can
  742. be changed in bwBASIC.h (DEF_EDITOR and DEF_FILES), and they
  743. can be changed on the fly by the user. It is expected that
  744. the user will add the appropriate commands to "profile.bas"
  745. for their specific implementation; OPTION FILES "ls -l" on Unix
  746. systems and OPTION FILES "dir" on DOS systems.
  747. The command OPTION PROMPT can be used to set the prompt
  748. string for bwBASIC. Again, it is suggested that a user-
  749. selected prompt can be set up in a "profile.bas" to be
  750. initialized each time bwBASIC starts. Note that special
  751. characters can be added to the prompt string, e.g.,
  752. OPTION PROMPT "Ok"+CHR$(10)
  753. will give an "Ok" prompt followed by a linefeed.
  754. In previous versions, the preset variable BWB.IMPLEMENTATION$
  755. would return "TTY" (IMP_IDSTRING) for the bwx_tty implementation.
  756. In previous versions of bwBASIC, the existance of the keywords CLS,
  757. COLOR and LOCATE were determined at compile and BWB.IMPLEMENTATION$
  758. was used at runtime to determine whether these keywords existed.
  759. In the current version, these keywords always exist and are now
  760. controlled at runtime using the OPTION TERMINAL commands. With
  761. OPTION TERMINAL NONE these keywords output nothing.
  762. 6. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT
  763. There are some items not implemented that have been so long
  764. a part of some BASIC dialects that their absence may seem surprising.
  765. In each case, though, their implementation would require
  766. operating-system-specific functions or terminal-specific functions
  767. that cannot be universally provided. Some specific examples are
  768. detailed below.
  769. INP reads a value from a hardware port. In the current version,
  770. using INP() will generate ERROR 73. It is expected that you will
  771. provide a suitable implementation for your specific application.
  772. For example:
  773. FUNCTION INP( X )
  774. REM Return whatever value your application requires
  775. INP = 0
  776. END FUNCTION
  777. OUT writes a value to a hardware port. In the current version,
  778. using OUT() will generate ERROR 73. It is expected that you will
  779. provide a suitable implementation for your specific application.
  780. For example:
  781. SUB OUT( X, Y )
  782. REM do whatever your application requires
  783. END SUB
  784. PEEK reads a value from a memory location. In the current version,
  785. using PEEK() will generate ERROR 73. It is expected that you will
  786. provide a suitable implementation for your specific application.
  787. For example:
  788. FUNCTION PEEK( X )
  789. REM Return whatever value your application requires
  790. PEEK = 0
  791. END FUNCTION
  792. POKE writes a value to a memory location. In the current version,
  793. using POKE() will generate ERROR 73. It is expected that you will
  794. provide a suitable implementation for your specific application.
  795. For example:
  796. SUB POKE( X, Y )
  797. REM do whatever your application requires
  798. END SUB
  799. WAIT reads a value from a hardware port. In the current version,
  800. using WAIT() will generate ERROR 73. It is expected that you will
  801. provide a suitable implementation for your specific application.
  802. For example:
  803. SUB WAIT( X, Y )
  804. REM do whatever your application requires
  805. END SUB
  806. SUB WAIT( X, Y, Z )
  807. REM do whatever your application requires
  808. END SUB
  809. USR executes a machine code routine. In the current version,
  810. using USR() will generate ERROR 73. It is expected that you will
  811. provide a suitable implementation for your specific application.
  812. For example:
  813. FUNCTION USR( ... )
  814. REM Return whatever value your application requires
  815. USR = 0
  816. END FUNCTION
  817. VARPTR reads a value from a memory location. In the current version,
  818. using VARPTR() will generate ERROR 73. It is expected that you will
  819. provide a suitable implementation for your specific application.
  820. For example:
  821. FUNCTION VARPTR( ... )
  822. REM Return whatever value your application requires
  823. VARPTR = 0
  824. END FUNCTION
  825. There are other commands, functions, and implementation details
  826. that I am working on, and which are on the agenda list for future
  827. versions of bwBASIC. These agenda include:
  828. PARACT i.e., the ability to execute PARallel ACTions. This
  829. is described in ANSI BASIC, although I have not seen it
  830. implemented before. It will offer a rough, non-preemptive
  831. form of multitasking within the scope of a BASIC program.
  832. Programmers will note that the global My pointer provides
  833. one possible hook mechanism for PARACT in bwBASIC. In the
  834. interim, you might use the "ON TIMER" command to implement
  835. a simple multitasking BASIC program.
  836. XMEM PC-type computers usually are able to use extended
  837. memory. If we could use extended memory for program
  838. lines, variables, and function defitions, we could
  839. write much longer programs. This would entail,
  840. however, a fairly serious rewriting of the program
  841. to utilize memory handles for these storage features
  842. instead of direct memory pointers. In the interim,
  843. you might use a "DOS Extender" which hooks calloc()
  844. and free() to enable transparent access to EMS or XMS
  845. memory.
  846. Windows The addition of memory handles in addition to the
  847. non-preemptive execution of program lines (in a
  848. crude form, already present) will make it possible
  849. to develop implementations for Windows and perhaps
  850. for other graphical user interfaces. But what form
  851. should this take? I have in mind presently a BASIC
  852. that would run in the background, appearing only
  853. as an icon in the GUI space, with pop-up editors
  854. and output windows. Thus, the interpreted language
  855. would serve a purpose something like 'cron' (a task
  856. scheduler) under Unix systems. You may have some
  857. reflections that would help me in this.
  858. Graphics Here we face fairly critical differences in different
  859. styles and implementations of graphics, e.g., between
  860. GWBASIC, ANSI BASIC, VisualBASIC, etc. But it's
  861. possible that Graphics commands and functions could
  862. be added. These would all be OPTION VERSION specific.
  863. In the interim, you might consider using ReGIS or Tektronix
  864. graphics (ESC codes) with xterm.
  865. The ANSI Standard for full BASIC does not specify which particular
  866. commands or functions must be implemented, and in fact the standard
  867. is very robust. Perhaps no implementation of BASIC would ever
  868. include all of the items, but some ANSI commands and functions which
  869. remain unimplemented are:
  870. ACCESS
  871. AREA
  872. ARRAY
  873. ASK
  874. BSTR
  875. BVAL
  876. CELLS
  877. CLIP
  878. COLLATE
  879. CONNECT
  880. DATUM
  881. DEBUG
  882. DECLARE
  883. DEVICE
  884. DISCONNECT
  885. DISPLAY
  886. DOT
  887. DRAW
  888. ERASE
  889. EVENT
  890. EXCEPTION
  891. GRAPH
  892. HANDLER
  893. IMAGE
  894. KEY
  895. LINES
  896. MIX
  897. MULTIPOINT
  898. OUTIN
  899. OUTPUT
  900. PARACT
  901. PICTURE
  902. PIXEL
  903. PLOT
  904. POINTS
  905. RECEIVE
  906. RENUMBER
  907. REWRITE
  908. ROTATE
  909. SEIZE
  910. SEND
  911. SHIFT
  912. TIMEOUT
  913. TRACE
  914. TRANSFORM
  915. VIEWPORT
  916. WAIT
  917. VIEWPORT
  918. ZONEWIDTH
  919. 7. THE STORY OF Bywater BASIC
  920. This program was originally begun in 1982 by my grandmother, Mrs.
  921. Verda Spell of Beaumont, TX. She was writing the program using
  922. an ANSI C compiler on an Osborne I CP/M computer and although my
  923. grandfather (Lockwood Spell) had bought an IBM PC with 256k of
  924. RAM my grandmother would not use it, paraphrasing George Herbert
  925. to the effect that "He who cannot in 64k program, cannot in 512k."
  926. She had used Microsoft BASIC and although she had nothing against
  927. it she said repeatedly that she didn't understand why Digital
  928. Research didn't "sue the socks off of Microsoft" for version 1.0
  929. of MSDOS and so I reckon that she hoped to undercut Microsoft's
  930. entire market and eventually build a new software empire on
  931. the North End of Beaumont. Her programming efforts were cut
  932. tragically short when she was thrown from a Beaumont to Port
  933. Arthur commuter train in the summer of 1986. I found the source
  934. code to bwBASIC on a single-density Osborne diskette in her knitting
  935. bag and eventually managed to have it all copied over to a PC
  936. diskette. I have revised it slightly prior to this release. You
  937. should know, though, that I myself am an historian, not a programmer.
  938. 8. COMMUNICATIONS:
  939. email: tcamp@delphi.com
  940. 9. EXPANDED REFERENCE FOR COMMANDS, FUNCTIONS AND OPERATORS
  941. bwBASIC provides a simple "HELP" command to refresh your memory
  942. regarding the appropriate syntax for a specific command or function.
  943. In the DOCS directory are text files which provide brief descriptions
  944. of every intrinsic command, function and operator available in BASIC
  945. dialect available in bwBASIC; these files are not intented to be an
  946. authoritative or exhaustive reference. Refer to the reference document
  947. for each dialect for details regarding each keyword.
  948. THE END