Growing up, I taught myself to program BASIC on the TRS-80 Level I, then the Bally Astrocade and the Tandy Pocket Computer. At the time, I didn’t realize that all three were based on Palo Alto Tiny BASIC. PATB itself was inspired by the People’s Computer Company (PCC) “Build Your Own BASIC” project, created by Dennis Allison.
What amazes me about Allison’s design spec is how streamlined it is: he defined his own programming language, IL (Interpretive Language), and specified his Tiny BASIC interpreter in just 124 lines of code!
Back in 2017, I wrote an implementation of IL in LowRes Coder, an iOS BASIC app. With that app discontinued, I wanted to share my implementation in a browser BASIC. Naturally, after my lack of luck with Google’s wwwBASIC, I chose the better fork of it, the BASIC Anywhere Machine.
My language is for the most part as specified by Allison. It meets most of the original Tiny BASIC specification, though error messages are different and print zones aren’t supported. It adds RND(), ASC(), and a single array A().
LINE FORMAT AND EDITING
* Lines without numbers executed immediately
* Lines with numbers appended to program
* Line numbers must be 1 to 255
* Line number alone (empty line) deletes line
* Blanks are not significant, but key words must contain no unneeded blanks
EXECUTION CONTROL
CLEAR delete all lines and data
RUN run program
LIST list program
EXPRESSIONS
Operators
Arithmetic
+ –
* /
Relational
> >=
< <=
= <>, ><
Precedence
()
Functions
ASC(“C”) – returns the ASCII value of the character, which itself is a constant
RND(X) – returns 1 to X
VARIABLES
A…Z (26 only)
Single array A(0) to A(230)
All arithmetic is modulo 2^15
(+/- 32767)
INPUT / OUTPUT
PRINT X,Y,Z
PRINT “A STRING”
PRINT “THE ANSWER IS “, X
INPUT X – if a string is entered instead of a number, returns the ASCII value of the first character
INPUT X,Y,Z
ASSIGNMENT STATEMENTS
LET X=3
LET X= -3+5*Y
LET N = RND(10)
LET A(X) = A(X-1)*2
CONTROL STATEMENTS
GOTO 35
GOTO X+10
GOSUB X+35
GOSUB 50
RETURN
IF X > Y THEN GOTO 30
IF A = ASC(“N”) THEN END
NOTES
If a string is entered at an input statement, it returns the ASCII value of the first character, enabling code like:
200 PRINT "PLAY AGAIN?"
210 INPUT A
220 IF A=ASC("Y") THEN GOTO 10
If you enter “OLD 1” it will load a countdown program (“OLD” being the opposite of “NEW” and part of the time-sharing system for BASIC back in 1964). And “OLD 2” will load a simple guessing game.
LINK
You can use the interpreter here.
You must be logged in to post a comment.