Older Version Newer Version

ddharing ddharing Aug 22, 2007

This is a feature update to Carl's port of Tiny Basic. There is also a version for Run Basic which is posted in the Run Basic wikispace. The main purpose of this release was to add enough features to Tiny Basic to run the Sieve benchmark. Here are the new features: # Added **seconds** and **ms** functions for benchmarking purposes. In Run Basic, however, if you use the **seconds** function, it will still display milliseconds. Try "print seconds". # Added one array to the interpreter environment. In addition to the numeric variables "a" through "z", there is also the numeric array "a(1)" through "a(7001). There is an existing bug in the range checking which will be fixed later. Range checking works for assignment, but not for printing. # For LB4 only, LOAD, SAVE and AutoRun are fixed. I also added KILL and DIR commands for file management. For the Run Basic release, this code is just commented out. I will post results of the Sieve benchmark test in the Liberty Basic forum and on my blog. Needless to say that Tiny Basic is a lot slower than Run Basic or Liberty Basic. Regardless, it has a lot of potential as an embedded interpreter in a Run Basic or Liberty Basic application. Best of all, it's fun to play with! Enjoy! David den Haring. [[http://denharing.blogspot.com/|Simple Computing]] Blog [[code format="vbnet"]] 'TinyBasic.bas ' tinyBasic v1.1 - A very small and simple BASIC interpreter written in ' Run BASIC. WARNING: For uber geeks only. :-p ' Copyleft 2005 by Laurent DUVEAU ' http://www.aldweb.com/ ' an iziBasic sample program ' Ported to Run BASIC by Carl Gundel and Scott McLaughlin ' http://www.libertybasic.com ' Version 1.1 (Will run on Liberty Basic 4.03 and Run Basic 2.27) ' by David den Haring (8/15/2007) ' The purpose of this release is to add enough features to Tiny Basic in order to run the Sieve benchmark. ' Added a fixed array accessible from the interpreter (i.e. a() ) ' Added the functions "seconds" and "ms" or "milliseconds" for benchmarking purposes ' (LB4) Fixed LOAD and SAVE commands because it's tiring to have to type in the Sieve program by hand all the time. I'm having flashbacks to my VIC-20 before the Datasette (i.e. cassette tape storage) ' (LB4) Added DIR and KILL commands for file management. DIR has no parameters. KILL works like LOAD and SAVE. ' (LB4) Fixed AutoRun feature. If file tinyBas0 exists, it will be loaded and run automatically when the interpreter starts. ' A temp ' B temp ' C character index in line ' E line number for error msg ' I temp (loops) ' L number of lines. Index into A$ array ' N number ' S expression stack index ' T temp ' V variable index ' A$ temp ' B$ temp ' C$ character ' D$ single statement ' E$ error message ' G$ string code (") ' H$ HALT code (Line Feed) ' I$-R$ Help ' Z$=A$(26) statement input DIM A$(125) ' [27-125] = 99 program lines DIM A(82) ' [27-52] = 26 variables ' [53-82] = 30 items math stack ArraySize = 7001 'Size of user array DIM Array(ArraySize) 'Fixed-sized array available to user program DIM info$(10, 10) A$(9)="BYE, CLEAR, CLS, END" A$(10)="HELP, MEM, NEW, RUN, DIR" A$(11)="GOTO | LOAD | SAVE | KILL <exp>" A$(12)="IF <exp> THEN <statement>" A$(13)="INPUT <var>" A$(14)="[LET] <var>=<exp>" A$(15)="LIST [<exp>|PAUSE]" A$(16)="PRINT <exp|str>[,<exp|str>][;]" A$(17)="REM <any>" A$(18)=&qu [[code]]