Recent from talks
Nothing was collected or created yet.
Tiny BASIC
View on Wikipedia| Tiny BASIC | |
|---|---|
| Designed by | Dennis Allison |
| First appeared | 1975 |
| Implementation language | IL (Interpretive Language) |
| License | Public domain |
| Dialects | |
| Denver Tiny BASIC, Enhanced 6800 Tiny BASIC, MINOL, National Industrial Basic Language, Palo Alto Tiny BASIC, 6800 Tiny BASIC, TBI68K, Tiny BASIC Extended | |
| Influenced by | |
| Dartmouth BASIC, 8008 BASIC | |
| Influenced | |
| Astro BASIC, Atari BASIC, Level I BASIC | |
Tiny BASIC is a family of dialects of the BASIC programming language that can fit into 4 or fewer KBs of memory. Tiny BASIC was designed by Dennis Allison and the People's Computer Company (PCC) in response to the open letter published by Bill Gates complaining about users pirating Altair BASIC, which sold for $150. Tiny BASIC was intended to be a completely free version of BASIC that would run on the same early microcomputers.
Tiny BASIC was released as a specification, not an implementation, published in the September 1975 issue of the PCC newsletter. The article invited programmers to implement it on their machines and send the resulting assembler language implementation back for inclusion in a series of three planned newsletters. Li-Chen Wang, author of Palo Alto Tiny BASIC, coined the term "copyleft" to describe this concept. The community response was so overwhelming that the newsletter was relaunched as Dr. Dobb's Journal, the first regular periodical to focus on microcomputer software. Dr. Dobb's lasted in print form for 34 years and then online until 2014, when its website became a static archive.
The small size and free source code made these implementations invaluable in the early days of microcomputers in the mid-1970s, when RAM was expensive and typical memory size was only 4 to 8 KB. While the minimal version of Microsoft's Altair BASIC would also run in 4 KB machines, it left only 790 bytes free for BASIC programs. More free space was a significant advantage of Tiny BASIC. To meet these strict size limits, Tiny BASIC dialects generally lacked a variety of features commonly found in other dialects, for instance, most versions lacked string variables, lacked floating-point math, and allowed only single-letter variable names.
Tiny BASIC implementations are still used today, for programming microcontrollers such as the Arduino.
History
[edit]Altair BASIC
[edit]
The earliest microcomputers, like the MITS Altair 8800, generally had no built-in input/output (I/O) beyond front-panel switches and LED lamps. Useful work generally required the addition of an I/O expansion card and the use of some form of terminal. At the time, video-based terminals were very expensive, costing much more than the computer, so many users turned to mechanical devices like the Teletype Model 33. The Model 33, like most teleprinters of the era, included a tape punch system intended to allow operators to pre-record their messages and then play them at "high speed", faster than most individuals could type the message live. For the early microcomputers, this provided a convenient computer data storage format, allowing the users to write programs to paper tape and distribute them to other users.[1]
The Homebrew Computer Club met for the first time in March 1975, and its members soon used the meetings to swap software on punched tape. At the June meeting, a tape containing a pre-release version of Altair BASIC disappeared. The tape was given to Steve Dompier, who passed it on to Dan Sokol, who had access to a high-speed tape punch. At the next meeting, 50 copies of Altair BASIC on paper tape appeared in a cardboard box.[2] When Ed Roberts, founder of MITS, learned of this, he stated "Anyone who is using a stolen copy of MITS BASIC should identify himself for what he is, a thief."[3] Bill Gates made this more formal, writing "An Open Letter to Hobbyists", complaining that "As the majority of hobbyists must be aware, most of you steal your software."[4]
Tiny BASIC
[edit]The complaint was not well received. Among the many responses, Bob Albrecht, another Homebrew member and founder of the People's Computer Company (PCC), felt the best response would be to produce their own BASIC that was completely free to use by anyone. He approached Dennis Allison, a member of the Computer Science faculty at Stanford University, to write a specification for a version of BASIC that would fit in 2 to 3 kilobytes of memory.[a] To aid porting, the design was based on an intermediate language (IL), an interpreter for the interpreter, which meant only a small portion of the total code had to be ported.
Allison's initial design was published in the September 1975 edition of the PCC newsletter, along with an Intel 8080 version of the IL interpreter. The article called on programmers to implement the design on their computer and send the resulting assembly language version back to the PCC. They stated their plans to publish three special newsletters containing these user-submitted versions, along with bug fixes, programs written in the new BASIC, and suggestions and enhancements. The concept gained further notice when it was republished in the January 1976 edition of the ACM Special Interest Group on Programming Languages.[5] Submissions poured in. Among the notable early versions was Tiny BASIC Extended by Dick Whipple and John Arnold which ran in 3K of RAM, added FOR...NXT loops, and allowed a single numeric array. They avoided the use of the IL and wrote it directly in machine code, using octal.[6]
The first of the three planned newsletters, with the title "Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte", was published in January 1976.[6] It starts with a note from Albrecht, under the penname "the dragon", suggesting that three editions would not be enough, and asked the readers if they would like to see it continue. It also reprinted the original article on Tiny BASIC from PCC, included the complete listing of Extended TB, and included a number of small BASIC programs including tips-and-tricks from Allison.[7] Response to the first issue was so impressive that the introduction to the second issue stated they had already decided to continue publishing the new newsletter under the simplified name Dr. Dobb's Journal. Over the next several issues, additional versions of the language were published, and similar articles began appearing in other magazines like Interface Age.
Spread
[edit]
By the middle of 1976, Tiny BASIC interpreters were available for the Intel 8080, the Motorola 6800 and MOS Technology 6502 processors. This was a forerunner of the free software community's collaborative development before the internet allowed easy transfer of files, and was an example of a free software project before the free software movement.[9] Computer hobbyists would exchange paper tapes, cassettes or even retype the files from the printed listings.[10]
Jim Warren, editor of Dr. Dobb's, wrote in the July 1976 ACM Programming Language newsletter about the motivations and methods of this successful project. He started with this: "There is a viable alternative to the problems raised by Bill Gates in his irate letter to computer hobbyists concerning 'ripping off' software. When software is free, or so inexpensive that it's easier to pay for it than to duplicate it, then it won't be 'stolen'." The Bill Gates letter was written to make software into products. The alternative method was to have an experienced professional do the overall design and then outline an implementation strategy. Knowledgeable amateurs would implement the design for a variety of computer systems. Warren predicted this strategy would be continued and expanded.[10]
The May 1976 issue of Dr. Dobbs has Li-Chen Wang's Palo Alto Tiny BASIC for the 8080. The listing begins with the title, author's name, and date but it also has "@COPYLEFT ALL WRONGS RESERVED".[11] A fellow Homebrew Computer Club member, Roger Rauskolb, modified and improved Wang's program and this was published in the December 1976 issue of Interface Age magazine.[8] Roger added his name and preserved the COPYLEFT Notice.
Description
[edit]Basic concepts
[edit]Tiny BASIC was designed to use as little memory as possible, and this is reflected in the paucity of features as well as details of its interpreter system. Early microcomputers lacked the RAM and secondary storage for a BASIC compiler, which was more typical of timesharing systems.
Like most BASICs of the era, Tiny Basic was interactive with the user typing statements into a command line. As microcomputers of the era were often used with teletype machines or "dumb" terminals, direct editing of existing text was not possible and the editor instead used takeout characters, often the backslash, to indicate where the user backed up to edit existing text.
If the user typed a statement into the command line the system examined it to see if it started with a number. If it did not, the line was immediately parsed and operated on, potentially generating output via PRINT. This was known as "direct mode".
If the line was entered with a leading number, the number was converted from decimal format, like "50", and converted to a 8-bit value, in this case, $32 hexadecimal. This number was used as an index into an array-like storage area where the rest of the line was stored in exactly the format it was typed. When the user typed LIST into the command line the system would loop over the array, convert the line number back to decimal format, and then print out the rest of the text in the line.
When a program was present in memory and the user types in the RUN command, the system enters "indirect mode". In this mode, a pointer is set to point to the first line of the program, for instance, 10 ($0Ahex). The original text for that line is then retrieved from the store and run as if the user had just typed it in direct mode. The pointer then advances to the next line and the process continues.
Formal grammar
[edit]The grammar is listed below in Backus–Naur form, almost exactly as it was specified in the Design Note.[12] In the listing, an asterisk ("*") denotes zero or more of the object to its left – except for the first asterisk in the definition of "term", which is the multiplication operator; parentheses group objects; and an epsilon ("ε") signifies the empty string. As is common in computer language grammar notation, the vertical bar ("|") distinguishes alternatives, as does their being listed on separate lines. The symbol "CR" denotes a carriage return (usually generated by a keyboard's "Enter" key). A BREAK from the console will interrupt execution of the program.
line ::= number statement CR | statement CR
statement ::= PRINT expr-list
IF expression relop expression THEN statement
GOTO expression
INPUT var-list
LET var = expression
GOSUB expression
RETURN
CLEAR
LIST
RUN
END
expr-list ::= (string|expression) (, (string|expression) )*
var-list ::= var (, var)*
expression ::= (+|-|ε) term ((+|-) term)*
term ::= factor ((*|/) factor)*
factor ::= var | number | (expression)
var ::= A | B | C ... | Y | Z
number ::= digit digit*
digit ::= 0 | 1 | 2 | 3 | ... | 8 | 9
relop ::= < (>|=|ε) | > (<|=|ε) | =
string ::= " ( |!|#|$ ... -|.|/|digit|: ... @|A|B|C ... |X|Y|Z)* "
Note that string wasn't defined in the Design Note.
This syntax, as simple as it was, added one innovation: GOTO and GOSUB could take an expression rather than just a line number, providing an assigned GOTO[13] rather than the switch statement of the GOTO/GOSUB ... OF ..., a structure then supported in HP Time-Shared BASIC and predating ON ... GOTO. The syntax allowing IF-THEN statement (as opposed to just a line number to branch to) was not yet supported in Dartmouth BASIC at this time but had been introduced by Digital[14] and copied by Microsoft.
Implementation in a virtual machine
[edit]The Design Note specified a virtual machine, in which the Tiny BASIC interpreter is itself run on a virtual machine interpreter. The designer's idea to use an application virtual machine goes back to Val Schorre (with META II, 1964) and Glennie (Syntax Machine). The choice of a virtual machine approach economized on memory space and implementation effort, although the BASIC programs run thereon were executed somewhat slowly.[15]
Dialects that used the virtual machine included Tiny BASIC Extended, Tom Pittman's Tiny BASIC[16] and NIBL. Other dialects such as Denver Tiny BASIC (DTB) and Palo Alto Tiny BASIC were direct interpreters. Some programmers, such as Fred Greeb with DTB, treated the IL (Interpretive Language) program as pseudocode for the algorithm to implement in assembly language; Denver Tiny BASIC did not use a virtual machine, but it did closely follow the IL program.
This is a representative excerpt from the 120-line IL program:
S1: TST S3,'GO' ;GOTO OR GOSUB?
TST S2,'TO' ;YES...TO, OR...SUB
CALL EXPR ;GET LABEL
DONE ;ERROR IF CR NOT NEXT
XFER ;SET UP AND JUMP
S3: TST S8,'PRINT' ;PRINT.
A common pattern in the program is to test for a keyword or part of a keyword, then act on that information. Each test is an assertion as to what is next in the line buffer. If the assertion fails, control jumps to a subsequent label (usually looking for a new keyword or token). Here the system advances its buffer cursor over any spaces and tests for GO and if it fails to find it then jumps to line S3. If it finds it, execution continues with the next IL command. In this case, the system next tests for TO, skipping to line S2 if it fails (a test for SUB, to see if this is instead a GOSUB command). If it passes, control continues; in this case, calling an IL subroutine that starts at label EXPR, which parses an expression. In Tiny BASIC, GOTO X*10+100 (a computed GO TO) is as legal as GOTO 100 and is the alternative to the ON-GOTO of larger BASIC implementations. The subroutine EXPR pushes the result of the expression onto the arithmetic stack (in this case, the line number). DONE verifies no other text follows the expression and gives an error if it does. XFER pops the number from the stack and transfers execution (GOes TO) the corresponding line number, if it exists.
The following table gives a partial list of the 32 commands of the virtual machine in which the first Tiny BASIC interpreter was written.[17]
- TST lbl, string
- If string matches the BASIC line, advance cursor over string and execute the next IL instruction; if the test fails, execute the IL instruction at the label lbl
- CALL lbl
- Execute the IL subroutine starting at lbl; save the IL address following the CALL on the control stack
- DONE
- Report a syntax error if after deleting leading blanks the cursor is not positioned to reach a carriage return
- XFER
- Test value at the top of the AE stack to be within range. If not, report an error. If so, attempt to position cursor at that line. If it exists, begin interpretation there; if not, report an error.
- JUMP lbl
- Continue execution of the IL at the label specified
- RTN
- Return to the IL location specified at the top of the control stack
- PRS
- Print characters from the BASIC text up to but not including the closing quotation mark
- PRN
- Print number obtained by popping the top of the expression stack
- SPC
- Insert spaces to move the print head to next zone
- NLINE
- Output a CRLF[18] to the printer
Tom Pittman, discussing the IL, says: "The TINY BASIC interpreter was designed by Dennis Allison as a recursive descent parser. Some of the elegant simplicity of this design was lost in the addition of syntactical sugar to the language but the basic form remains. The IL is especially suited to Recursive Descent parsing of TINY BASIC because of the general recursive nature of its procedures and the simplicity of the TINY BASIC tokens. The IL language is effectively optimized for the interpretation of TINY. Experience has shown that the difficulty of adding new features to the language is all out of proportion with the nature of the features. Usually it is necessary to add additional machine language subroutines to support the new features. Often the difficulty outweighs the advantages."[19]
Deviations from the design
[edit]Defining Tiny BASIC for the Homebrew Computer Club, Pittman wrote, "Tiny BASIC is a proper subset of Dartmouth BASIC, consisting of the following statement types only: LET, PRINT, INPUT, IF, GOTO, GOSUB, RETURN, END, CLEAR, LIST, RUN. Arithmetic is in 16-bit integers only with the operators + - * / and nested parentheses. There are only the 26 single letter variable names A, B, ...Z, and no functions. There are no strings or arrays... Tiny BASIC specifies line numbers less than 256."[20] He then went on to describe his implementation: "This language has been augmented to include the functions RND, USR, and PEEK and POKE, giving the user access to all his system components in the 6800 from the BASIC program."
Many implementers brought their own experiences with HP Time-Shared BASIC or DEC BASIC-PLUS to their designs and relaxed the formal Tiny BASIC language specification. Of the seven prominent implementations published by 1977:
- All added some sort of random number function, typically
RND(). Though not included in the specification, a newsletter article prior to the Design Note for Tiny BASIC requested only this function. - All enabled LET to be optional and most let expressions in assignment statements contain relational operators.
- All but 6800TB supported statement delimiters in lines, typically
:although TBX used$and PATB used;. - In IF statements, all but MINOL removed the need for expressions to contain relational operators (e.g.,
IF X THEN LET Y=Xwas valid). Implementations removed THEN altogether or made it optional or supported it only for implied GOTO. None supported ELSE clauses. - Many modified PRINT to support print zones, using
,to go to the next zone and;to not advance the cursor. - All but 6800TB and DTB added NEW.
- All but 6800TB and MINOL added a function to return memory size: TBX had SZE, DTB and PATB had SIZE, L1B had MEM, and NIBL had TOP.
- Four implementations added arrays, whether a single, undimensioned array in PATB and L1B or DIMensionable arrays in TBX and DTB.
- Four implementations added the REMark statement.
- Four implementations added the FOR loop: PATB, NIBL, and L1B offered FOR-TO-STEP/NEXT, while TBX did not support STEP and used the keyword NXT to end a loop.
- Only NIBL had any nod towards structured programming, with DO/UNTIL, despite Allison's lament in Issue 2 about problems with BASIC.
As an alternative to tokenization, to save RAM, TBX,[21] DTB,[22] and MINOL[23] truncated keywords: PR for PRINT, IN for INPUT, RET for RETURN. The full, traditional keywords were not accepted. In contrast, PATB allowed accepted traditional keywords but also allowed any keyword to be abbreviated to its minimal unique string, with a trailing period. For instance, PRINT could be typed P., although PR. and other variations also worked. This system was retained in Level I BASIC for the TRS-80, which used PATB, and was also later found in Atari BASIC and the BASIC of various Sharp Pocket Computers.[24]
Dialects
[edit]The most prominent dialects of Tiny BASIC were the original Design Note, Tiny BASIC Extended, Palo Alto Tiny BASIC, and 6800 Tiny BASIC. However, many other versions of Tiny BASIC existed.
List of prominent dialects
[edit]Tiny BASIC was first published in a newsletter offshoot of the People's Computer Company, a newsletter which became Dr. Dobb's Journal, a long-lived computing magazine. About ten versions were published in the magazine.
| Date published | Issue | Dialect | Author | Processor | Size |
|---|---|---|---|---|---|
| December 1975 | 1[25] | Design Note | Dennis Allison | N/A | N/A |
| February 1976 | 2[21] | Tiny BASIC Extended (TBX) | Dick Whipple & John Arnold | 8080 | 2.9K |
| March 1976 | 3[22] | Denver Tiny BASIC (DTB) | Fred Greeb | 8080 | 2.75K |
| March 1976 | 3[26] | 6800 Tiny BASIC (6800TB) | Tom Pittman | 6800 | 2K[27] |
| April 1976 | 4[23] | MINOL | Eric T. Mueller | 8080 | 1.75K |
| May 1976 | 5[28] | Palo Alto Tiny BASIC (PATB) | Li-Chen Wang | 8080 | 1.77K |
| November 1976 | 10[29] | National Industrial Basic Language (NIBL) | Mark Alexander & Steve Leininger | SC/MP | 4K |
| October 1980 | 49[30] | Enhanced 6800 Tiny BASIC | Robert Hudson | 6800 | N/A |
| February 1985 | 100[31] | TBI68K | Gordon Brandly | 68000 | N/A |
| January 2006 | 351[32] | Return of Tiny BASIC | Tom Pittman | N/A (C) | N/A |
TBX was also known as Texas Tiny BASIC.[33]
Both SCELBAL[34] and 6800 Tiny BASIC were announced in the magazine but did not publish their source code.
Palo Alto Tiny BASIC
[edit]| Palo Alto Tiny BASIC | |
|---|---|
| Developer | Li Chen Wang |
| First appeared | 1976 |
| License | Public domain |
| Dialects | |
| 3K Control Basic | |
| Influenced by | |
| Tiny BASIC Design Note, Tiny BASIC Extended | |
| Influenced | |
| Astro BASIC, Level I BASIC, Sharp PC-1211 BASIC | |
One of the most popular of the many versions of Tiny BASIC was Palo Alto Tiny BASIC, or PATB for short, by Li-Chen Wang. PATB first appeared in the May 1976 edition of Dr. Dobbs, written in a custom assembly language with non-standard mnemonics. This led to further ports that worked with conventional assemblers on the 8080.[24] The first version of the interpreter occupied 1.77 kilobytes of memory and assumed the use of a Teletype Machine (TTY) for user input/output. An erratum to the original article appeared in the June/July issue of Dr. Dobb's (Vol. 1, No 6). This article also included information on adding additional I/O devices, using code for the VDM video display by Processor Technology as an example.
Wang was one of the first to use the word copyleft. In Palo Alto Tiny BASIC's distribution notice, he had written "@COPYLEFT ALL WRONGS RESERVED".[35] Tiny BASIC was not distributed under any formal form of copyleft distribution terms, but was presented in a context where source code was being shared and modified. In fact, Wang had earlier contributed edits to Tiny BASIC Extended before writing his own interpreter.[21] He encouraged others to adapt his source code and publish their adaptions, as with Roger Rauskolb's version of PATB published in Interface Age.[8] He also published a third version in PCC's Reference Book of Personal and Home Computing.[36]
One of the most notable changes in PATB is the addition of the FOR...NEXT loop. In the original TB, loops could only be implemented using IF and GOTO. As in Microsoft BASIC, the upper and lower bounds of the loop were set on loop entry, and did not change during the loop, so if one of the bounds was based on a variable expression; changing the variable did not change the bound. The STEP modifier was optional, as in MS.[24]
Another significant change was the ability to place several statements on a single line. For reasons not explained, PATB used the semicolon ; to separate statements, rather than the already common colon :.
Other changes include the addition of a single numeric array, with the variable name @, STOP in addition to END, and the use of # for not-equals in comparisons, as opposed to <>.[24][b]
PATB used words for error messages instead of numbers. To reduce the amount of memory required, there were only three messages and they consisted of single words. The system would respond with WHAT? for syntax errors, HOW? for run-time errors like GOTOs to a line that didn't exist or numeric overflows, and SORRY for out-of-memory problems.[24]
Wang also wrote a STARTREK program in his Tiny BASIC that appeared in the July 1976 issue of the People's Computer Company Newsletter.[37][38]
He later adapted the language into 3K Control Basic for Cromemco, adding variable names of the form letter-digit (e.g., A0 to Z9), logic functions (AND(), OR(), XOR()), a CALL command to execute machine language routines, more PRINT-formatting options, and others (GET() and PUT() instead of PEEK and POKE; I/O port functions).[39]
Palo Alto Tiny BASIC was adapted for many other implementations, including Level I BASIC (1977), BASIC for the Sharp PC-1211 pocket computer (1980), and Astro BASIC (1982, by Jamie Fenton).[40]
MINOL
[edit]Written by a junior in high school, MINOL was the only implementation that didn't support the full Design Note, lacking operator precedence, having only three relational operators (<, =, #), omitting GOSUB and RETURN.
It only supported unsigned 8-bit precision (in contrast to signed 16-bit precision for every other implementation) and line numbers from 0 to 254.
No spaces were permitted except in strings; ! returns a random number, $ before an expression loads a string at that address; OS returns to operating system. Memory was addressable as if it were a two-dimensioned array of high and low bytes (e.g., "(0,0)" to "(255,255)"); CALL executes a machine language subroutine.[23]
Miscellaneous dialects
[edit]Many dialects appeared in various other publications.

Inspired by PCC's call for Tiny BASICs, Robert Uiterwyk wrote MICRO BASIC 1.3 for the SWTPC 6800 system), which SWTPC published in the June 1976 issue of the SWTPC newsletter. Uiterwyk had handwritten the language on a legal tablet. He later expanded the language to 4K, adding support for floating point; this implementation was unique among BASIC interpreters by using Binary Coded Decimal to 9 digits of precision, with a range up to 1099, and by being published for free as a "Floppy ROM" magazine insert. An 8K version added string variables and trigonometry functions. Both the 4K and 8K versions were sold by SWTPC. In January, 1978, Uiterwyk sold the rights of the source code to Motorola.[41][42]
Thomas F. Waitman wrote a Tiny BASIC in 1976 for the Hewlett-Packard HP-2640 and HP-2645 terminals (which used the Intel 8008 and 8080 processors), which was published in the Hewlett-Packard Journal.
Published in the December 1976 issue of Interface Age was LLL (Lawrence Livermore Laboratory) BASIC, the first draft of which was developed by Steve Leininger from Allison's specification before Leininger left National Semiconductor for Tandy Corporation. The final interpreter was developed by John Dickenson, Jerry Barber, and John Teeter at the University of Idaho on a contract with LLL. Taking 5K, it included a floating-point package, developed by David Mead, Hal Brand, and Frank Olken. The program was placed into the public domain by LLL, which developed the system under the auspices of the U.S. Energy Research and Development Administration.[43]
4K BASICs
[edit]Altair BASIC, 4K BASIC, could run within a 4 KB RAM machine, leaving only about 790 bytes free for program code.[44][45] The Tiny BASIC initiative started in response to the $150 charge for Altair 4K BASIC.
In 1975, Steve Wozniak joined the newly formed Homebrew Computer Club, which had fellow members Li-Chen Wang (Palo Alto Tiny BASIC) and Tom Pittman (6800 Tiny BASIC). Wozniak concluded that his machine would have to have a BASIC of its own, which would, hopefully, be the first for the MOS Technology 6502 processor. As the language needed 4 KB RAM, he made that the minimum memory for the design.[46] Integer BASIC was originally published on Compact Cassette in 1976.
In 1977, Radio Shack (as it was known then) released their first computer, the TRS-80, a Z80 system with Level I BASIC in a 4 KB ROM. Tandy-employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) interpreter for the SC/MP while employed at National Semiconductor. [29] Unable to take that source code with him, he adapted Li-Chen Wang's Palo Alto Tiny BASIC for the original prototype of the TRS-80 Model I. He extensively revised the interpreter, adding floating-point support, simple black-and-white graphics, and READ/DATA/RESTORE statements.[47]
Originally developed in 1979, Sinclair 4K BASIC, written by John Grant, used as its language definition the 1978 American National Standards Institute (ANSI) Minimal BASIC standard, but was itself an incomplete 4 KB implementation with integer arithmetic only.[48]
Microcontroller dialects
[edit]Tiny BASIC implementations have been adapted for processor control and for microcontrollers such as the Arduino:
- Stephen A. Ness wrote XYBASIC for the Mark Williams Company in 1977, a 4K integer implementation. The language was often used for process control applications.[49]
- Arduino BASIC – adapted from Gordon Brandly's 68000 Tiny BASIC, ported to C by Mike Field.
- TinyBasic Plus – adapted from Arduino BASIC by Scott Lawrence.[50]
- Half-Byte Tiny Basic – adapted from Arduino BASIC.[51]
- Tiny Basic on the micro:bit – adapted from Palo Alto Tiny BASIC.[52]
Later implementations
[edit]In 2002, Emmanuel Chailloux, Pascal Manoury and Bruno Pagano published a Tiny BASIC (lacking GOSUB/RETURN) in Developing Applications with Objective Caml as an example Objective Caml application.[53]
In 2013, Alex Yang published an implementation in Python.[54]
In 2019, Sergey Kuznetsov published a version in Ruby.[55]
Also in 2019, Oscar Toledo Gutierrez published bootBASIC, which fits in the 512 bytes of the boot sector of an 8086/8088 machine, making it the smallest BASIC implementation yet. To accomplish this, the language drops relational operators (IF statements work on nonzero values), limits lines of code to 19 characters or less, and doesn't update the display when backspace is pressed.[56] Additionally, it lacks GOSUB and RETURN but does include a RND function (without arguments, returning a value between 0 and 255).[57] The language uses an array to store program lines, requiring 20,000 bytes to do so.[58]
In 2023, Gordon Henderson published a Tiny Basic implementation in 6502 assembler. It is influenced by NIBL and can run in as little as 3.5 KB of ROM requiring at least 1 KB of RAM for data and program storage. It supports DO/UNTIL, FOR/NEXT, simple strings and memory PEEK/POKE (byte or 16-bit word), GOSUB/RETURN, CALL, RND with facilities for hexadecimal input and output.[59]
Dialects compared
[edit]The following table compares the language feature of Tiny BASIC implementations against other prominent BASICs that preceded them.
Date
Published |
Dialect | Programmer(s) | Processor | Type | INPUT | LET | GOTO | IF ...THEN | GOSUB | RETURN | END | RUN | LIST | CLEAR | NEW | REM | FOR/NEXT | READ / DATA / RESTORE | Added BASIC commands | Customizations | Expressions | relop | Functions | RND | Memory Function | Line numbers | Statement delimiter | Errors | Precision | Arithmetic | Variables | Arrays | Strings | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
October 1964
|
DTSS Dartmouth BASIC
(version 2)[60] |
(Dartmouth students) | GE-225 | Compile-and-go | N/A [!] | LET var = expression | PRINT expr-list { , / ; / } | GO TO number | IF expression relop expression THEN line-number | GOSUB number | RETURN | END | RUN | LIST--start | — | NEW [prompts for program name] | REM | FOR / TO / STEP / NEXT | READ, DATA | STOP | — | precedence, ^ | < <= = >= > <> | INT, SIN, COS, TAN, ATN, EXP, LOG, ABS, SQR, DEF FN | RND(0) 0..1 | — | 1 to 99999 | None | 22 defined | 9 digits | ±999,999,999; E notation base 2 -256 to +255 (E±76). | A–Z, A0–Z9 | DIM (one letter name, two dimensions); if omitted, assumed to go from 0 to 10; up to 1500 elements across all arrays | None (added in version 4) |
February 1970
|
DEC BASIC-8[61]
|
(DEC staff) | PDP-8 | Compile-and-go | INPUT var-list | LET var = expression | PRINT expr-list { , / ; / } | GO TO number | IF expression relop expression [THEN/GO TO] line-number | GOSUB number | RETURN | END | RUN | LIST (first (, last)) | — | NEW [prompts for program name] | REM | FOR / TO / STEP / NEXT | READ, DATA, RESTORE | STOP, OLD, SAVE, UNSAVE | DELETE (first (, last)), BYE | precedence, ^ | < <= = >= > <> | INT, SGN, SIN, COS, TAN, ATN, EXP, LOG, ABS, SQR, DEF FN | RND(0) 0..1 | — | 1 to 2045 | None | 23 defined | ? | ±134,217,727; 14E-38<N<1.7E38 | A–Z, AA–Z9 | DIM (one letter name, two dimensions) | None |
June 1974
|
UIUC BASIC[62]
|
Alfred Weaver, Michael Tindall, Ronald Danielson | 8008 | Interpreter | INPUT <variable> {, <variable>}* | LET var = formula | PRINT <string> / <formula> {, <string> / <formula>}* | GO TO number | IF expression THEN line-number | GOSUB number | RETURN | END | RUN | not documented | not documented | not documented | REM | FOR / TO / STEP / NEXT | — | DEF FN, STOP | — | precedence, ^ | < <= = >= > # AND OR NOT | FNA..Z, SIN, COS, LOG, SQR, EXP, ATN | — | — | 0 to 999 | None | not documented | 4-byte mantissa and 1-byte exponent [Datapoint 2200 floating-point arithmetic package] | not documented | A–Z, A0–Z9 | DIM (one letter name, three dimensions) | None |
| 1975 | Altair 4K BASIC[63]
|
Bill Gates, Paul Allen, Monte Davidoff | 8080 | Interpreter | INPUT ("string",) var-list | (LET) var = expression | PRINT expr-list { , / ; } | GOTO number | IF expression THEN line-number/statement | GOSUB number | RETURN | END | RUN | LIST (start) | — | NEW | REM | FOR / TO / STEP / NEXT | READ, DATA, RESTORE | STOP | — | precedence | < <= = >= > <> | ABS, INT, SGN, SQR, TAB, USR | RND(X) <0, new using X as seed; =0, repeat; >0, next | — | 1 to 65535 | : | 12 defined | 40-bit operand floating | ? | ? | DIM (one dimension) | None |
December 1975
|
Design Note[64]
|
Dennis Allison | — | Interpreter | INPUT var-list | LET var = expression | PRINT expr-list | GOTO expression | IF expression relop expression THEN statement | GOSUB expression | RETURN | END | RUN | LIST | [eq. to NEW] | — | — | — | — | — | — | precedence | < <= = >= > <> >< | None | None | — | 1 to 255 | None | 8 defined | 16-bit | ± 32767 | A–Z | None | None |
February 1976
|
Tiny BASIC Extended[65]
|
Dick Whipple & John Arnold | 8080 | Interpreter | IN | (LET) var = expression | ;} | GO TO | IF expression [no THEN] statement | GO SUB | RET | END | RUN | LST (first (, last)) | — | NEW | — | FOR-NXT (no STEP) | DTA (array LET) | — | — | precedence | < <= = >= > <> >< | TB() spaces in print | RN (random 0-10000) | SZE | 1 to 65535 | $ | 14 defined | 16-bit | ± 32767 | A–Z | DIM, 1- or 2-dimensions, 255x255 max | None |
March 1976
|
Denver Tiny BASIC[66]
|
Fred Greeb | 8080 | Interpreter | IN | (LET) var = expression | ;} | GOTO | IF expression [no THEN] statement | GOSUB | RET | END | RUN | LIST (first last) | [eq. to NEW] | — | — | — | — | TAPE [SAVE], LOAD | CLRS [CLS] | precedence | < <= = >= > <> >< | RND(0), RND(1) | SIZE | 2 to 255 | : | 20 defined | 16-bit | ± 32767 | A–Z, A1 to A6 to Z6 | DIM, 1 dimension | None | |
March 1976
|
6800 Tiny BASIC[66]
|
Tom Pittman | 6800 | Interpreter | INPUT (expression) var-list | LET var = expression | PRINT expr-list { , / ; } | GOTO expression | IF expression relop expression THEN statement | GOSUB expression | RETURN | END | RUN | LIST (first last) | [eq. to NEW] | — | REM | — | — | — | — | precedence | < <= = >= > <> >< | USR() | RND() | — | 1 to 65535 | None | 53 defined | 16-bit | ± 32767 | A–Z | None | None |
April 1976
|
MINOL[67]
|
Eric T. Mueller | 8080 | Interpreter | IN | (LET) var = expression | PR expr-list {;} | [GOTO 0 jumps back to start of direct statement] | IF expression relop expression ; statement | — | — | END | RUN | LIST | CLEAR [only variables] | NEW | — | — | — | — | No spaces permitted except in strings | No operator precedence | < = # | $ [CHR$] | ! [RND] | — | 1 to 254 | : | 6 defined | 8-bit | 0 to 255 | A–Z | (H,L) memory location | single char |
May 1976
|
Palo Alto Tiny BASIC[68]
|
Li-Chen Wang | 8080 | Interpreter | INPUT [(expression) var]* | (LET) var = expression | PRINT expr-list | GOTO expression | IF expression [no THEN] statement | GOSUB expression | RETURN | STOP | RUN | LIST (start) | — | NEW | REM | FOR / TO / STEP / NEXT | — | STOP | — | precedence | < <= = >= > # | ABS() | RND() | SIZE | 1 to 32767 | ; | 3 defined | 16-bit | ± 32767 | A–Z | @(1 array of 1 dimension) | None |
November 1976
|
NIBL[69]
|
Mark Alexander & Steve Leininger | SC/MP | Interpreter | INPUT ($)var | (LET) var = expression | PR/PRINT expr-list | GOTO expression | IF expression (THEN) statement | GOSUB expression | RETURN | END | RUN | LIST (start) | CLEAR [variables & stack] | NEW | REM | FOR / TO / STEP / NEXT | — | DO/UNTIL | Memory addressing (@ [PEEK/POKE], STAT, PAGE) | precedence | < <= = >= > <> | MOD(), AND, OR, NOT, | RND(A,Z) | TOP | 0 to 32767 | : | 13 four-char defined | 16-bit | ± 32767 | A–Z | memory addressing | INPUT$, PRINT$, $exp=exp
|
August 1977
|
Level I BASIC[70]
|
Steve Leininger | Z80 | Interpreter | INPUT (#digit) [(expression) var]* | (LET) var = expression | PRINT (#digit) expr-list | GOTO number | IF expression THEN statement | GOSUB number | RETURN | END | RUN (start) | LIST (start) | — | NEW | REM | FOR / TO / STEP / NEXT | READ, DATA, RESTORE | STOP, CONT, ON-GOTO/GOSUB | CLOAD, CSAVE, CLS, SET, RESET | precedence | < <= = >= > <> >< | ABS(), INT(), MEM, POINT(X,Y) | RND() | MEM | 1 to 32767 | : | 3 defined | 16-bit | ± 32767 | A–Z | A(1 array of 1 dimension) | A$, B$
|
June 1976
|
MICRO BASIC 1.3[71]
|
Robert Uiterwyk | 6800 | Interpreter | INPUT var-list | (LET) var = expression | PRINT expr-list { , / ; } | GOTO expression | IF expression relop expression THEN statement | GOSUB expression | RETURN | END | RUN | LIST (first (, last)) | — | NEW | — | FOR/TO/NEXT (no STEP) | — | TAB() | — | precedence | < <= = >= > <> >< | RND, SIZE | RND [returns 1-32762] | SIZE (statement that prints bytes used and bytes free) | 1 to 65535 | None | 17 defined | 16-bit [later BCD!] | ± 32767 | A–Z | DIM (two dimensions, max size of 255) | None |
June 1976
|
Mark Arnold & Nat Wadsworth | 8008 | Interpreter | INPUT var-list | (LET) var = expression | PRINT expr-list {, / ; / } | GOTO number | THEN statement | GOSUB number | RETURN | END | RUN | LIST | — | SCR[atch] | REM | FOR / TO / STEP / NEXT | — | SAVE, LOAD | UDF [USR] | precedence, ^ | < <= = >= > <> | INT, SGN, ABS, SQR, CHR [usable only in PRINT], TAB | RND(0) 0..1 | — | 1 to 999999 | None | 18 defined | 32-bit operand floating or fixed point | ±134,217,727; 14E-38<N<1.7E38 | ? | DIM (one letter name, one dimension; up to 4 arrays of up to 64 entries in total) | None | |
October 1976
|
Apple I BASIC[73]
|
Steve Wozniak | 6502 | Interpreter | INPUT ("string",) var-list | (LET) var = expression | PRINT expr-list { , / ; } | GOTO expression | IF expression relop expression THEN line-number/statement | GOSUB expression | RETURN | END | RUN (start) | LIST (first (, last)) | — | SCR | REM | FOR / TO / STEP / NEXT | — | AUTO, DEL, POKE | TAB (command), CALL | precedence | < <= = >= > <> # AND OR NOT MOD | SGN, ABS, PEEK(), LEN() | RND(X) 0..X (or X..0!) | HIMEM, LOMEM | 1 to 32767 | None [early version, then :] | 16 defined | 16-bit | ± 32767 | A–Z followed by any number of alphanumeric | DIM (one dimension) | dimensioned |
December 1976
|
LLL BASIC[74]
|
(University of Idaho staff) | 8080 | Interpreter | INPUT var-list | (LET) var = expression | PRINT expr-list { , / ;} | GO TO number | IF expression relop expression (THEN) statement | GO SUB number | RETURN | END | RUN | LIST | — | SCR | REM | FOR/TO/NEXT (no STEP) | — | STOP | CALL, GET(), PUT() | precedence | < <= = >= > <> >< | No RND? | — | 0 to 32767 | : | 14 defined | 32-bit operand floating point | ? | A–Z, A0–Z9 | DIM (integers only, one letter name, one dimension, max size of 255) | None | |
January 1980
|
Sinclair 4K BASIC[75]
|
John Grant | Z-80 | Interpreter | INPUT var | LET var = expression | PRINT expr-list { , / ;} | GO TO number | IF expression THEN statement | GO SUB number | RETURN | — | RUN (number) | LIST | CLEAR | NEW | REM | FOR/TO/NEXT (no STEP) | — | STOP | POKE | precedence | < = > | ABS, CHR$, CODE, PEEK, RND, STR$, TL$, USR | RND, RANDOMISE | — | 1 to 9999 | — | 10 defined | 16-bit integer | 16-bit integer | A–Z followed by any number of alphanumeric | DIM A-Z (integers only, one letter name, one dimension, max size of 255) | A$-Z$ |
See also
[edit]Notes
[edit]- ^ At the time, the most common memory size for the 8080 was 4 KB, which cost hundreds of dollars.
- ^ Hash was also used for not-equals in HP Time-Shared BASIC.
References
[edit]Citations
[edit]- ^ Lancaster, Don (1976). "TV Typewriter Cookbook" (PDF). pp. 210–211. Archived (PDF) from the original on 2022-10-09.
- ^ Manes & Andrews 1994, p. 81.
- ^ Roberts, H. Edward (October 1975). "Letter from the President". Computer Notes. 1 (5). Albuquerque NM.: MITS: 3–4. Archived from the original on March 23, 2012.
- ^ Manes & Andrews1994, p. 91.
- ^ Allison, Dennis (July 1976). "Design notes for TINY BASIC". SIGPLAN Notices. 11 (7). ACM: 25–33. doi:10.1145/987491.987494. S2CID 18819472.
- ^ a b "TB Code Sheet". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (1). December 1975.
- ^ Dobbs 1976, p. 5.
- ^ a b c Rauskolb, Roger (December 1976). "Dr. Wang's Palo Alto Tiny BASIC". Interface Age. 2 (1): 92–108. The source code begins with the following nine lines:
;********************************* ; ; TINY BASIC FOR INTEL 8080 ; VERSION 2.0 ; BY LI-CHEN WANG ; MODIFIED AND TRANSLATED ; TO INTEL MNEMONICS ; BY ROGER RAUSKOLB ; 10 OCTOBER,1976 ; @COPYLEFT ; ALL WRONGS RESERVED ; ;*********************************
- ^ "Open hardware: How and why it works". IBM.
The open software movement was founded by Dennis Allison in his release of Tiny BASIC in 1975
- ^ a b Warren, Jim C. (July 1976). "Correspondence". SIGPLAN Notices. 11 (7). ACM: 1–2. ISSN 0362-1340.
- ^ Wang, Li-Chen (May 1976). "Palo Alto Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (5): 12–25. Source code begins with the following six lines.
TINY BASIC FOR INTEL 8080 VERSION 1.0 BY LI-CHEN WANG 10 JUNE, 1976 @COPYLEFT ALL WRONGS RESERVED
The June date in the May issue is correct. The magazine was behind schedule, the June and July issues were combined to catch up. - ^ Allison, Dennis (1976). "Build Your Own BASIC". Dr. Dobb's Journal. Vol. 1, no. 1. p. 9.
- ^ Allison, Dennis (1976). "Quick Reference Guide for Tiny BASIC". Dr. Dobb's Journal. Vol. 1, no. 1. p. 6.
- ^ BASIC-PLUS Language Manual (PDF). Maynard, Massachusetts: Digital Equipment Corporation. 1972. pp. 3–13.
- ^ Allen, Dennis. "TINY BASIC". People's Computer Company. 4 (3).
- ^ Veit, Holger. "Tom Pittman's 6800 tiny BASIC". Retrieved 2 May 2017.
- ^ Dr. Dobb's Journal, Volume 1, Number 1, 1976, p. 12.
- ^ The
CRLFthere symbolizes a carriage return followed by a line feed. - ^ Pittman, Tom. "Tiny BASIC Experimenter's Kit". Retrieved August 9, 2020.
- ^ "TINY BASIC 6800" (PDF). Archived (PDF) from the original on 2022-10-09. Retrieved 13 Aug 2020.
- ^ a b c "Tiny BASIC Extended". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (2). February 1976.
- ^ a b "Denver Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (3). March 1976.
- ^ a b c "MINOL". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (4). April 1976.
- ^ a b c d e Rauskolb, Roger (December 1976). "Dr. Wang's Palo Alto Tiny BASIC" (PDF). Interface Age. pp. 92–108. Archived (PDF) from the original on 2022-10-09.
- ^ "Design Note". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (1). December 1975.
- ^ "6800 Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (3). March 1976.
- ^ "TINY BASIC User Manual+".
- ^ Wang, Li-Chen (May 1976). "Palo Alto Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (5): 12–25.
- ^ a b "NIBL". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (10). November 1976.
- ^ "Enhanced & Modified 6800 Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. October 1980.
- ^ "TBI68K". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. February 1985.
- ^ "Return of Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. January 2006.
- ^ "Texas Tiny BASIC (TBX) Marries TV-Cassette Operating System (TVCOS)". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (5): 28–31. May 1976.
- ^ a b Arnold, Mark; Wadsworth, Nat (February 1976). "SCELBAL – A Higher Level Language for 8008/8080 Systems". Dr. Dobb's Journal. pp. 30–53.
- ^ Wang, Li-Chen (May 1976). "Palo Alto Tiny BASIC". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (5): 12–25. (NB. Source code begins with the following six lines. "TINY BASIC FOR INTEL 8080; VERSION 1.0; BY LI-CHEN WANG; 10 JUNE, 1976; @COPYLEFT; ALL WRONGS RESERVED". The June date in the May issue is correct. The magazine was behind schedule, the June and July issues were combined to catch up.)
- ^ McCabe, Dwight [editor] (July 1, 1977). PCC's Reference Book of Personal and Home Computing (1st ed.). Menlo Park, CA: People's Computer Company. p. 248. ISBN 0-918790-02-6.
{{cite book}}:|first1=has generic name (help) - ^ "People's Computer Company" (PDF). Archived (PDF) from the original on 2022-10-09. Retrieved 25 December 2019.
- ^ Turnbull, Pete. "Startrek.asc". Archived from the original on 24 February 2021. Retrieved 25 December 2019.
- ^ "3K Control Basic Instruction Manual" (PDF). Cromemco. Archived from the original (PDF) on 2013-12-22. Retrieved 2013-02-18.
- ^ Ainsworth, Dick (1982). Astro BASIC. Astrocade, Inc. p. 3.
- ^ "Robert Uiterwyk's BASIC".
- ^ "Robert Uiterwyk's Micro Basic".
- ^ "Part 1 Of LLL 8080 BASIC Interpreter" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "4 Altair Language Systems". Altair BASIC.
- ^ Altair BASIC (PDF). MITS. 25 August 1975. Archived (PDF) from the original on 2022-10-09.
- ^ Wozniak, Steven (1 May 2014). "How Steve Wozniak Wrote BASIC for the Original Apple From Scratch". Gizmodo.
- ^ Welsh, David; Welsh, Theresa (2007). Priming the Pump: How TRS-80 Enthusiasts Helped Spark the PC Revolution. p. 7.
- ^ "ZX80 – 8K BASIC ROM UPGRADE".
- ^ Ness, Stephen. "XYBASIC". Ness Software. Retrieved 4 August 2020.
- ^ "TinyBasicPlus". GitHub.
- ^ "It's here! Half-Byte Tiny Basic 2 for Arduino and compatibles". 27 November 2014.
- ^ "Running Tiny Basic on the Micro: Bit". 28 March 2020.
- ^ Chailloux, Emmanuel; Manoury, Pascal; Pagano, Bruno (2002). Developing Applications with Objective Caml. France: O'Reilly. ISBN 2841771210.
- ^ "aleozlx/tinybasic". GitHub. Retrieved 2020-09-20.
- ^ "PaloAltoTinyBasic". Retrieved 2020-09-20.
- ^ Williams, Al (31 July 2019). "bootBASIC Fits Your Favorite Language in the Boot Sector". Hack A Day. Retrieved 26 March 2022.
- ^ Gutierrez, Oscar Toledo. "bootBASIC is a BASIC language in 512 bytes of x86 machine code". Github. Retrieved 26 March 2022.
- ^ Gutierrez, Oscar Toledo (27 July 2019). Programming Boot Sector Games. Lulu. p. 155. ISBN 978-0-359-76262-0.
- ^ Henderson, Gordon (2023). "A Tiny Basic for the 6502". Drogon Projects.
- ^ "BASIC" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "TSS/8 TIME-SHARING SYSTEM USER'S GUIDE". February 1970.
- ^ "A BASIC LANGUAGE INTERPRETER FOR THE INTEL 8008 MICROPROCESSOR". 1974.
- ^ "MITS ALTAIR BASIC REFERENCE MANUAL" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ a b "Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte".
- ^ "Interface Age".
- ^ "Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "Help for TRS-80 Level I BASIC".
- ^ "Robert Uiterwyk's MICRO BASIC". Archived from the original on 2012-02-05. Retrieved 2012-01-15.
- ^ "SCELBAL – A higher level language for 8008/8080 systems" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ "PRELIMINARY APPLE BASIC USERS MANUAL". October 1976.
- ^ "Interface Age" (PDF). Archived (PDF) from the original on 2022-10-09.
- ^ https://cdn.hackaday.io/files/1707077303528288/ZX80_OperatingManual.pdf.
{{cite web}}: Missing or empty|title=(help)
Bibliography
[edit]- "TB Code Sheet". Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. 1 (1). December 1975.
- Manes, Stephen; Andrews, Paul (1994). Gates: How Microsoft's Mogul Reinvented an Industry and Made Himself the Richest Man in America. New York: Touchstone, Simon and Schuster. ISBN 0-671-88074-8.
External links
[edit]- Tiny Basic User Manual and Experimenter's Kit – by Tom Pittman
- Robert Uiterwyk's BASIC Archived 2011-01-07 at the Wayback Machine and Robert Uiterwyk's Micro Basic Archived 2012-02-05 at the Wayback Machine – A MC6800 tiny BASIC later sold with the SWTPC 6800 computer
- MINOL – Erik Mueller's MINOL – Tiny BASIC with strings for Intel 8080
- Tiny BASIC – A version for the curses character screen handling library
- tinyBasic – An implementation written in iziBasic
- Tiny BASIC – A live web version, ported to Run BASIC from iziBasic
- Palo Alto BASIC less than in 500 lines – Example BASIC interpreter written in Ruby.
- TinyBasic – A port of Tom Pittman's TinyBasic C interpreter to Java, C# and Adobe Flex. Includes live web versions.
- TinyBASIC Windows – A Windows version of TinyBASIC
- Category:Tiny BASIC Tasks implemented in Tiny BASIC on rosettacode.org
- Category:Palo Alto Tiny BASIC Tasks implemented in Palo Alto Tiny BASIC on rosettacode.org
Tiny BASIC
View on GrokipediaHistorical Development
Predecessors and Catalysts
The MITS Altair 8800, introduced in January 1975 via a cover feature in Popular Electronics, marked the advent of the first commercially successful microcomputer, igniting widespread hobbyist enthusiasm for personal computing.[6] Equipped with an Intel 8080 processor and initially just 256 bytes of RAM—expandable to 4K bytes in typical configurations—the Altair imposed severe memory constraints that demanded highly compact software to be usable.[7] This hardware reality underscored the need for minimalistic interpreters capable of fitting within such limits, as users sought programmable machines beyond bare machine code entry via front-panel switches.[8] In July 1975, Bill Gates and Paul Allen delivered Altair BASIC, Microsoft's inaugural product, tailored for the Altair 8800 and distributed primarily on paper tape at prices starting at $150 for the 4K version, escalating for extended editions.[9] However, rampant unauthorized copying—estimated to outnumber paid copies by a factor of 10—prompted Gates' "An Open Letter to Hobbyists" in February 1976, published in outlets like Computer Notes, where he lambasted the practice as theft that undermined software development incentives.[10] Gates argued that without compensation, quality software for hobbyists would stagnate, clashing with the emergent free-sharing ethos of clubs like the Homebrew Computer Club.[5] These commercial pressures and hardware scarcities directly catalyzed the push for open alternatives like Tiny BASIC, as hobbyists, facing Altair BASIC's cost and the ethical debates it ignited, demanded accessible, compact programming environments that aligned with communal norms rather than proprietary models.[5] The Altair's post-launch surge in popularity, with thousands of kits sold, amplified this tension, fostering a movement for freely distributable code to democratize access amid the microcomputer boom.[8]Conception and Initial Design
In 1975, Dennis Allison of the People's Computer Company initiated the Tiny BASIC project to define a stripped-down dialect of BASIC capable of running in 2 to 4 kilobytes of memory, addressing the limitations of early microcomputers with scant RAM.[11] The effort responded to demands from hobbyists seeking an affordable, beginner-friendly language for personal systems, prioritizing essential functionality over the resource-intensive features of commercial BASIC variants like those from Microsoft.[5] Allison's design principles focused on empirical minimalism: retaining integer arithmetic, line-numbered statements, and rudimentary control flow via GOTO and conditional IF-THEN constructs, while excluding FOR-NEXT loops, arrays, subroutines, and floating-point support to ensure causal feasibility on low-end processors such as the Intel 8080 and MOS Technology 6502.[11] Line numbers were constrained to 1 through 255 for single-byte storage efficiency, with commands limited to basics like PRINT, INPUT, and LET for variable assignment, aiming to democratize programming without hardware vendor dependencies.[11] To validate the concept amid skepticism about compressing BASIC into such tight bounds, Allison prototyped the interpreter in a hardware-agnostic interpretive language (IL), enabling portability testing and community scrutiny before machine-specific ports.[12] This abstraction layer confirmed the design's viability through simulated execution, fostering open contributions rather than proprietary lock-in. Initial specifications appeared in the People's Computer Company newsletter in September 1975, challenging readers to implement and refine the dialect.[5]Publication and Early Challenges
The Tiny BASIC specification was outlined by Dennis Allison in the inaugural January 1976 issue of Dr. Dobb's Journal of Tiny BASIC Calisthenics & Orthodontia, building on Jim Warren's earlier challenge published in the September 1975 People's Computer Company newsletter to develop a BASIC interpreter under 2 KB for affordable microcomputers.[13] [14] Subsequent issues 2 through 6 of the journal, spanning 1976, featured partial specifications, implementation details, and reader-submitted code variants, fostering a collaborative rollout without a single authoritative version.[15] One of the first verified working implementations was Li-Chen Wang's Palo Alto Tiny BASIC for the Intel 8080, completed in late 1975 and published in the May 1976 issue (volume 1, number 5) of Dr. Dobb's Journal, fitting within approximately 1.2 KB of memory.[3] This version demonstrated empirical success in achieving the size constraint through aggressive assembly-level optimizations, including tokenized input and a compact virtual machine for statement dispatch. Early development faced hurdles inherent to low-level assembly coding on limited hardware, such as debugging arithmetic operations prone to overflow errors due to 8-bit integer limitations and the absence of robust testing environments, leading to runtime failures in edge cases like division or array indexing. Community-driven fixes, shared as annotated listings and errata in journal issues—for instance, corrections to Wang's code in volumes 1 numbers 6-7—enabled iterative refinements, highlighting the efficacy of decentralized debugging over formalized processes.[16] By the end of 1976, over 100 implementations had been submitted to Dr. Dobb's Journal and related outlets, underscoring small-scale, volunteer efforts' ability to produce functional software rivaling Microsoft's commercial BASIC in accessibility for hobbyists, with distributions amplified via newsletters like People's Computer Company and Kilobaud Microcomputing.[15] This grassroots approach prioritized code transparency, as exemplified by Wang's pioneering "copyleft" disclaimer reserving "all wrongs," which encouraged unrestricted modifications and adaptations.[3]Core Design and Specifications
Fundamental Principles and Constraints
Tiny BASIC was designed to function within the stringent memory limitations of 1970s microcomputers, targeting a total interpreter footprint of 2 to 4 kilobytes in ROM or RAM, separate from any host system overhead.[5] This constraint drove the exclusion of resource-intensive features, prioritizing a compact interpretive engine that could execute on hardware with as little as 4 KB total addressable memory.[17] Integer-only arithmetic formed the computational core, avoiding floating-point routines to minimize both storage requirements and runtime complexity, as integer operations sufficed for the simple calculations typical of beginner programs and games.[1][18] Fundamental to its operation is a line-oriented structure, where user input consists of numbered statements that are either stored in a program buffer for later execution or run immediately in direct mode, enabling straightforward editing via line renumbering or deletion.[19] Variable storage is restricted to 26 single-letter scalars (A through Z), each holding 16-bit signed integers, with no provisions for arrays, strings, or multi-level subroutines, which preserves memory by eliminating dynamic allocation and recursion overhead while favoring linear, imperative control flow accessible to novices.[1][18] This approach trades expressive power for reliability, as the absence of advanced data structures reduces opportunities for memory overruns or undefined behavior on constrained systems. In contrast to comprehensive BASIC dialects, Tiny BASIC deliberately forgoes built-in file handling like LOAD and SAVE, treating tape or peripheral I/O as non-essential add-ons rather than integral components, a pragmatic adaptation to the empirical scarcity of secondary storage in early hobbyist machines.[5] Such omissions ensured the interpreter's viability without assuming peripherals, focusing causal efficacy on core execution rather than peripheral dependencies.[17]Syntax and Command Set
Tiny BASIC programs consist of sequentially numbered lines, each optionally beginning with an integer line number ranging from 1 to 9999, followed by a statement or command. Statements are parsed via a recursive descent approach based on the formal grammar specified in the original design, ensuring minimal memory usage through tokenization of the approximately 20 keywords and operators into single-byte codes for compactness during interpretation. Variables are restricted to single uppercase letters A-Z, representing signed 16-bit integers typically in the range -32768 to 32767, with no support for arrays, strings as variables, or multi-letter names.[11] The core command set includes:- LET var = expression: Assigns the value of an expression to a variable; the LET keyword is optional in some parsers but required for formal compliance.
- PRINT expr-list: Outputs a comma- or semicolon-separated list of expressions or string literals, with commas advancing to the next tab stop and semicolons suppressing spacing.
- INPUT var-list: Prompts for and reads values into one or more variables, handling numeric input only.
- IF expression relop expression THEN statement: Conditionally executes a single statement (typically GOTO or PRINT) if the relational comparison holds.
- GOTO expression: Transfers control to the line number specified by the expression's value.
- GOSUB expression: Calls a subroutine at the specified line number, pushing the return address.
- RETURN: Returns from a GOSUB subroutine.
- END: Terminates program execution.
- CLEAR: Resets all variables to zero and clears the program.
- LIST: Displays the program source.
- RUN: Begins execution from the lowest line number.
<program> ::= <line>*
<line> ::= <number> <statement> | <direct command>
<statement> ::= LET <var> = <expression>
| PRINT <expr-list>
| INPUT <var-list>
| IF <expression> <relop> <expression> THEN <statement>
| GOTO <expression>
| GOSUB <expression>
| RETURN
| END
<expr-list> ::= <expression> ("," <expression>)*
<var-list> ::= <var> ("," <var>)*
<expression> ::= ["+"|"-"] <term> {("+"|"-") <term>}*
<term> ::= <factor> {("*"|"/") <factor>}*
<factor> ::= <var> | <number> | "(" <expression> ")"
<var> ::= "A"|"B"|...|"Z"
<number> ::= <digit>+
<relop> ::= "=" | "<" | ">" | "<=" | ">=" | "<>"
<digit> ::= "0"|"1"|...|"9"
<program> ::= <line>*
<line> ::= <number> <statement> | <direct command>
<statement> ::= LET <var> = <expression>
| PRINT <expr-list>
| INPUT <var-list>
| IF <expression> <relop> <expression> THEN <statement>
| GOTO <expression>
| GOSUB <expression>
| RETURN
| END
<expr-list> ::= <expression> ("," <expression>)*
<var-list> ::= <var> ("," <var>)*
<expression> ::= ["+"|"-"] <term> {("+"|"-") <term>}*
<term> ::= <factor> {("*"|"/") <factor>}*
<factor> ::= <var> | <number> | "(" <expression> ")"
<var> ::= "A"|"B"|...|"Z"
<number> ::= <digit>+
<relop> ::= "=" | "<" | ">" | "<=" | ">=" | "<>"
<digit> ::= "0"|"1"|...|"9"
Interpretive Language and Virtual Machine
Tiny BASIC implementations utilized an interpretive language (IL) as an intermediate layer to achieve hardware portability without requiring full rewrites in low-level assembly for each target processor. Originating from the People's Computer Company design in 1975, IL functioned as a compact, abstract instruction set comprising approximately 124 lines, interpreted by a small host runtime to execute BASIC statements through sequential token testing and subroutine calls. This setup formed a software-emulated virtual machine that abstracted CPU-specific details, such as register usage or addressing modes, into a unified evaluation framework.[20] The IL employed a threaded-code interpreter model with primitive opcodes including TST for testing input tokens against keywords (e.g., "GO" or "TO"), CALL for invoking subroutines handling arithmetic or I/O, XFER for unconditional jumps in control flow, and STORE for assigning values to variables. Supporting stack-based operations, it emulated PUSH and POP via cursor-managed buffers for expression evaluation, decoupling parsing logic from native instructions and enabling jumps, comparisons, and binary operations through dispatched routines. This stack machine approach processed BASIC expressions causally, evaluating operators in postfix-like order while maintaining a runtime stack for temporaries, thus verifying portability by executing identical IL sequences across architectures after minimal host adaptation.[20][21] No dedicated hardware virtual machine existed; instead, the IL provided a thin software abstraction layer optimized for expression parsing and statement dispatch, as demonstrated by its reuse in ports like the 6800 and 6502 variants where the core logic remained unchanged. The multilayered interpreter structure—BASIC statements interpreted via IL code run by a host dispatcher—yielded empirical portability advantages, reducing machine-specific assembly by expressing complex logic in IL pseudocode amenable to high-level debugging before final translation. In the Intel 8080 port by Li-Chen Wang in 1976, this facilitated a concise assembly footprint, with developers reporting assembler development in days and substantial code minimization (20-50% less low-level instructions versus direct coding) due to IL's optimized primitives for token scanning and stack management.[20][21][3]Implementations and Dialects
Foundational Dialects
The Palo Alto Tiny BASIC, developed by Li-Chen Wang in 1975 for the Intel 8080 microprocessor, represents one of the earliest complete implementations adhering closely to Dennis Allison's original specifications while introducing enhancements for practicality. Published in the May 1976 issue of Dr. Dobb's Journal, this dialect occupied approximately 1.77 kilobytes of memory and included minimal support for cassette tape input and output, enabling program storage on affordable media common in early microcomputer setups.[3][5] Wang's version emphasized portability and efficiency, with its source code released under a pioneering "copyleft" license stating "@ Copyleft, All Wrongs Reserved," which encouraged modifications and redistribution while inverting traditional copyright norms.[22] Another foundational dialect, MINOL (Minimal Intel 8080 Language), was authored by Erik Mueller and detailed in the April 1976 issue of Dr. Dobb's Journal. This variant strictly targeted the 2-kilobyte limit, achieving a footprint of 1.75 kilobytes through optimized assembly code tailored for the 8080's architecture, forgoing extraneous features in favor of core interpretive functionality. Unlike standard Tiny BASIC dialects, MINOL incorporated rudimentary string-handling capabilities—supporting string variables and basic operations—but restricted arithmetic to single-byte unsigned integers evaluated left-to-right, prioritizing memory conservation over full expression precedence.[23][16] Both dialects, verifiable through their published listings in Dr. Dobb's Journal, facilitated community scrutiny and iterative improvements, with readers submitting bug fixes and size optimizations that refined subsequent ports while maintaining compatibility with the interpretive language's abstract machine. These 8080-specific adaptations highlighted trade-offs in feature inclusion versus code density, setting precedents for dialect evolution without exceeding the stringent resource constraints of 1970s microcomputers.[16]Expanded and 4K Variants
Tom Pittman's implementation of Tiny BASIC for the 6502 microprocessor, released in 1976, represented an expanded dialect optimized for 4K RAM systems such as the KIM-1 single-board computer, incorporating integration with existing monitor routines for input/output while adding support for user-defined subroutines via USR calls and basic array handling to enhance programmability beyond core constraints.[18][24] This variant prioritized hobbyist utility, enabling direct machine code invocation and data structures that facilitated more complex applications like simple data processing tasks, though array dimensions remained limited to single indices to preserve memory efficiency.[18] Further extensions in Pittman's 6502 dialect included stubs for floating-point arithmetic, such as addition routines that could be integrated as user extensions, allowing handling of non-integer values in programs where integer precision sufficed for most operations but required occasional scaling for scientific computations.[25] These features traded minimal code bloat—typically under 500 bytes—for expanded expressiveness, with empirical tests on 6502-based setups confirming execution speeds adequate for interpretive loops up to 100 iterations per second on unexpanded hardware.[26] The 4K boundary enabled causal improvements in program capacity, permitting roughly twice the statement count of 2K predecessors (e.g., 80-120 lines versus 40-60), as larger token tables and variable storage reduced truncation errors in hobbyist benchmarks conducted on S-100 bus expansions with 6502 cards.[24] Distribution occurred primarily through cassette tapes and paper listings in periodicals, with Pittman's version sold for $5 on punch tape to support widespread adoption among early microcomputer builders.[27][28]Adaptations for Microcontrollers and Embedded Systems
Adaptations of Tiny BASIC for microcontrollers emerged in the late 1980s and 1990s, targeting low-resource platforms such as the Intel MCS-51 family, including the 8051 and 8052 variants, where interpreters were modified to fit within 2-4 KB of program memory. These ports stripped traditional console I/O assumptions, replacing them with direct hardware interactions like serial output or GPIO pin manipulation to suit bare-metal embedded applications without requiring a full terminal interface. For instance, a Tiny BASIC interpreter based on Palo Alto specifications was adapted for the MCS-51 family, enabling execution on single-chip devices with minimal external components.[29][30] In the microcontroller domain, implementations for 8-bit PIC devices, such as a 2015 port to the PIC16F1619, demonstrated the language's portability by integrating BASIC commands with on-chip peripherals like timers and ADCs, often fitting the core interpreter into under 2 KB of flash. Similarly, AVR-based systems, including Arduino-compatible boards, hosted dialects like Tiny BASIC Plus, which extended the original with microcontroller-specific extensions for pin control and sensor interfacing, compiling to approximately 3 KB in size to accommodate real-time tasks. These adaptations leveraged the interpreter's lightweight virtual machine, allowing hobbyists in the 2000s to prototype embedded projects—such as simple controllers—directly in BASIC rather than assembly or C.[31][32][33] The GOTO-centric control flow of Tiny BASIC proved advantageous in embedded contexts, enabling straightforward polling loops and interrupt service routines without the stack overhead of structured alternatives, which could strain the limited RAM (often 128-256 bytes) of devices like the 8051 or ATtiny AVRs. Ports to retro Z80 clones like the RC2014 in the 2010s further validated this resilience, with modified Tiny BASIC Plus variants running in constrained modular systems for educational and hobbyist experimentation. Output mechanisms shifted to hardware pins or UART for logging, bypassing keyboard input in favor of pre-loaded programs or serial commands, thus verifying the design's suitability for non-interactive, real-time environments.[34][35]Contemporary Reimplementations
A Python implementation of Tiny BASIC, shared on Reddit in September 2024, incorporates modern development aids including a debugger, linter, disk-based program loading and saving, extensive unit tests, and over 17,000 words of documentation, while fitting within the original memory constraints when virtualized.[36] This project underscores the dialect's viability for rapid prototyping and teaching interpreter design in high-level languages.[37] In August 2024, developer Troy Schrapel released a browser-based Tiny BASIC interpreter implemented in JavaScript, enabling execution of programs derived from 1970s dialects like Palo Alto Tiny BASIC directly via web standards without emulation overhead.[12] The tool supports interactive entry and runs on contemporary hardware, illustrating how Tiny BASIC's interpretive model translates efficiently to client-side scripting environments for nostalgic or educational use.[12] The Racket language ecosystem includes a#lang tinybasic module, introduced around 2022, which embeds Tiny BASIC syntax and semantics into Racket's module system for seamless integration with functional programming tools.[38] Users can execute Tiny BASIC programs via Racket's racket command or a dedicated REPL, with the implementation available as an installable package emphasizing language-oriented experimentation.[39]
Damian Gareth Walker's C-based Tiny BASIC project, initiated in the 2010s and refined with a 2019 release, extends the original by adding a compiler alongside the interpreter, supporting cross-platform builds and adherence to the sub-4K bytecode ethos even in virtual machines.[40] This facilitates deployment on embedded systems while providing man pages and sample programs, evidencing the design's robustness for minimal-resource verification against modern bloat.[41]
Such reimplementations, often hosted on GitHub, affirm Tiny BASIC's empirical efficiency in constrained virtual environments, driven partly by historical interest yet yielding practical interpreters that outperform equivalent subsets of verbose contemporary languages in code size and startup latency.[42]
Technical Features and Operations
Memory Efficiency Techniques
Tokenization in Tiny BASIC replaces verbose keywords with single-byte tokens upon program entry, significantly reducing storage requirements for source code; for instance, commands like PRINT are abbreviated and encoded as compact tokens such as "P.".[43][44] This approach, combined with binary storage of numbers, minimizes the footprint of user programs, enabling them to occupy nearly all available RAM beyond the interpreter's 2K core.[43] Variables are limited to 26 single-letter names (A-Z), each occupying fixed two-byte locations in memory starting at a designated base address like VARBGN (e.g., 0x139D in the 8080 implementation), which eliminates the need for dynamic symbol tables or hashing and permits direct register-based access during evaluation.[43][45] This direct mapping supports integer values from -32768 to 32767 and facilitates rapid arithmetic operations in the interpreter's expression evaluator.[45] Programs are stored as a contiguous, line-number-sorted list in text buffer memory (e.g., from TXTBGN at 0x1366 to TXTEND in 8080 variants), with no pointers or linking tables; execution proceeds by linearly scanning this buffer from the lowest line number, jumping via calculated offsets for control flow like GOTO.[43][45] This scan-based model avoids overhead from pre-linked structures, trading minor runtime lookup costs for maximal program space utilization in constrained environments.[45] The interpreter's core loop employs threaded dispatch via restart instructions (e.g., RST 1-7 on 8080 for subroutines), enabling efficient next-token fetching and reducing instruction decode cycles relative to fully subroutine-based designs.[43] Direct interpretation yields execution speeds roughly an order of magnitude below native assembly on the 8080 but outperforms less optimized BASICs under similar memory limits.[46][43]Execution Model
Tiny BASIC employs an interpretive loop structured as a continuous while loop that advances execution by setting the next program line and processing its statements sequentially. In direct mode, user inputs lacking line numbers are parsed and executed immediately after carriage return, facilitating interactive commands without program storage. Indirect mode, invoked by the RUN command, begins execution from the lowest stored line number, scanning tokenized program text in memory and dispatching each statement via opcode-like interpretation, with GOTO effecting jumps by locating the target line in the sorted list and chaining the pointer accordingly.[47][19] Execution state is maintained minimally with a single current-line pointer, a fixed table for 26 single-letter integer variables (A-Z, stored as 16-bit signed values), and a runtime stack for GOSUB/RETURN pairs to handle subroutine nesting. Implementations forgo stack overflow detection and other runtime bounds checks, emphasizing causal progression and low overhead at the expense of potential unchecked recursion. Variable access occurs via direct memory offsets, supporting rapid evaluation in expressions during statement dispatch.[47][19] Runtime errors, including syntax errors, division by zero, or invalid operations, trigger an immediate halt, error code display (e.g., numeric codes like 224 for specific faults), and reversion to direct mode without partial rollback, allowing manual recovery via commands like NEW. The RND function, when present, computes pseudorandom integers (0 to a specified range minus one) through a lightweight algorithm such as linear congruential generation, with some variants seeding from hardware timers to introduce variability while preserving deterministic fallback for reproducibility. This model prioritizes interpretive speed and minimal resource use, aligning with constraints of 1970s microcomputers.[47]Common Extensions and Deviations
Many implementations of Tiny BASIC introduced optional floating-point support, such as the MICRO BASIC 1.3 dialect, which used Binary Coded Decimal arithmetic for up to 9 digits of precision and exponents to 10^99, enabling non-integer calculations on systems requiring greater numerical range despite the added memory and execution overhead.[5] This extension diverged from the original integer-only design to accommodate applications like basic scientific computations on constrained hardware, though it increased interpreter size and slowed operations compared to integer math.[11] Print formatting enhancements, including the TAB function in statements like PRINT, appeared in dialects such as Altair 4K BASIC and Apple I BASIC, allowing column-aligned output for improved readability on early terminals without relying solely on repeated spaces.[5] These additions addressed limitations in text display on hardware like video terminals, where precise positioning aided debugging and data presentation, but required custom I/O handling in the interpreter loop. Array support via DIM statements emerged in expanded variants, including one-dimensional arrays in DTB and PATB (limited to a single array) and up to two dimensions (255x255 maximum) in TBX, facilitating data storage for simple simulations or lookups in 4K memory budgets.[5] Such features catered to users porting programs from fuller BASICs, driven by the need for structured data on microcomputers with slightly more RAM, though they consumed program space that could otherwise hold user code. The USR function for invoking machine code subroutines was incorporated in approximately 20-30% of early dialects, including 6800TB and COSMAC Tiny BASIC, where it accepted expressions for addresses and parameters (e.g., USR(3072, R, S) to pass values to registers and return results).[5][48] This enabled low-level hardware access, such as I/O or custom routines, motivated by processor-specific needs like register manipulation on RCA COSMAC chips, extending utility for embedded control while preserving the core interpretive model. Deviations often involved omissions for extreme minimalism, as in MINOL, which excluded GOSUB and RETURN to reduce code footprint in sub-2K environments, relying instead on GOTO for flow control.[5] Hardware constraints, such as limited RAM on 6800 or SC/MP processors, prompted these cuts, prioritizing bootable interpreters over subroutine capabilities.[5] While extensions like RND (added universally across seven prominent 1977 dialects) and REM (in four) boosted programmability for games and comments, they risked specification bloat; oversized attempts exceeding 4K, such as those piling on graphics for TV Typewriter-like displays, often failed to maintain portability and simplicity, underscoring the causal tension between feature utility and memory discipline.[5]Criticisms and Limitations
Inherent Design Trade-offs
Tiny BASIC's design emphasized extreme memory efficiency, occupying roughly 2 KB to fit within the 4 KB RAM typical of early microcomputers, necessitating the omission of floating-point arithmetic in favor of 16-bit integer-only operations. This compromise conserved significant code space and execution cycles but introduced precision losses in calculations requiring fractional results, such as divisions yielding non-integers, where outcomes truncate toward zero (e.g., 2/3 evaluates to 0).[49][50] Control flow depends on line-numbered statements with GOTO for branching and GOSUB/RETURN for subroutines lacking parameters or local variables, fostering unstructured programming prone to tangled logic without alternatives like FOR loops in initial variants or block-structured conditionals. Such limitations cap practical program scale at dozens of lines—often around 50 for simple tasks—given the tokenized storage demands in residual memory after interpreter and variable allocation, rendering complex algorithms infeasible.[50][51] Error handling remains primitive, issuing terse codes like "SN" for syntax errors or reprinting erroneous statements with a question mark, while runtime checks are sparse: arithmetic overflow goes undetected, and only division by zero halts execution explicitly, frequently culminating in interpreter crashes or erratic behavior on memory exhaustion or invalid references as observed in period listings and ports.[13][48][49] These trade-offs causally aligned with 1970s hardware constraints, enabling interactive programming where fuller BASIC dialects like Altair BASIC—requiring more space and offering greater free memory for code only in extended forms—could not, yet precluded scalable applications demanding precision, modularity, or robust diagnostics.[3]Programming Paradigms and Usability Issues
Tiny BASIC's reliance on theGOTO statement as the primary control mechanism fostered unstructured programming patterns, often resulting in "spaghetti code" characterized by tangled execution flows lacking clear entry and exit points.[22] This design, inherited from early BASIC dialects, prioritized simplicity in interpretation over modularity, making it difficult to decompose programs into reusable components or predict control paths without exhaustive tracing.[52] Edsger Dijkstra's 1968 critique of GOTO as harmful—arguing it obscures logical structure and impedes verification—applies acutely to Tiny BASIC, where the absence of advanced constructs like multi-level blocks amplified risks of infinite loops and opaque logic.[53] His broader condemnation of BASIC for "mutilating the intellect" through such primitives further underscores how Tiny BASIC's minimalism exacerbated these issues in resource-starved environments.[54]
Usability was further compromised by conventions like single-letter variable names and line-number-based addressing, which prioritized memory efficiency but severely limited readability and maintainability for anything beyond trivial scripts.[55] Programmers reported frequent debugging challenges, as these features obscured variable scopes and intent, leading to errors that were hard to isolate without manual simulation or paper tracing—common in hobbyist accounts of early microcomputer development.[56] Empirical evidence from implementations shows Tiny BASIC excelled for quick prototypes, such as simple games or calculators, but faltered in handling complex conditional logic or data processing, often prompting users to embed assembly code or abandon it for lower-level languages.
Despite these paradigm limitations, Tiny BASIC's constraints compelled programmers to adopt disciplined, concise coding practices, fostering an acute awareness of computational resources that contrasts with the permissive bloat in contemporary languages.[56] This enforced parsimony, while painful, trained habits of explicit state management and minimalism, arguably yielding transferable skills in efficiency-oriented domains like embedded systems.[58]
Debates on Software Distribution Models
The debates on software distribution models in the mid-1970s centered on the tension between commercial licensing and free sharing among hobbyists, with Bill Gates' February 3, 1976, Open Letter to Hobbyists articulating the pro-commercial position by equating unauthorized copying of Microsoft BASIC with theft and arguing it undermined incentives for software development.[10] Gates contended that without payment from users, firms like Micro-Soft could not recover investments in creating complex interpreters, a stance that causally contributed to Microsoft's later commercial dominance by establishing proprietary licensing as a viable path.[59] In counterpoint, the release of Li-Chen Wang's Palo Alto Tiny BASIC source code in the May 1976 issue of Dr. Dobb's Journal of Computer Calisthenics & Orthodontics exemplified the free-sharing model, distributed under an early "copyleft" notice encouraging unrestricted copying and modification.[60] This approach enabled numerous independent implementations and ports across various microcomputers without legal repercussions, as no lawsuits were pursued against derivatives despite their widespread dissemination, verifying the model's practicality for resource-constrained, non-commercial efforts.[4] Proponents of open distribution, including Dr. Dobb's editor Jim Warren, highlighted how sharing Tiny BASIC accelerated software availability and hobbyist experimentation, prioritizing broad access over intellectual property enforcement and fostering the microcomputer ecosystem's rapid growth. Analyses from the 2020s retrospectively position Tiny BASIC as a precursor to open-source practices, demonstrating that communal code dissemination could sustain innovation in niche domains without proprietary barriers.[4]Impact and Legacy
Role in Hobbyist Computing Revolution
Tiny BASIC advanced the hobbyist computing revolution of the mid-1970s by delivering a minimal yet functional programming environment suited to the resource constraints of nascent microcomputers, thereby enabling broader experimentation among enthusiasts lacking advanced expertise or substantial budgets. Implementations like Li-Chen Wang's Palo Alto Tiny BASIC for the Intel 8080, published in Dr. Dobb's Journal in May 1976, occupied approximately 2 KB of memory, allowing operation on entry-level systems such as the MITS Altair 8800—a kit-priced at $397 upon its 1975 debut—with modest RAM expansions totaling around $500 for basic usability.[3][61] This stood in stark contrast to commercial options like Microsoft BASIC, which required larger memory footprints and licensing fees, often deterring casual adoption amid the era's emphasis on cost-effective home assembly.[4] Its dissemination through hobbyist periodicals, including reprints in Interface Age by late 1976, spurred rapid adaptation and porting efforts that extended compatibility to dominant microprocessors like the MOS Technology 6502 and Motorola 6800.[3] Developers such as Tom Pittman produced versions for 6502-based boards like the KIM-1 and 6800 systems, fostering software ecosystems around standards like the S-100 bus and preempting bundled interpreters in subsequent consumer hardware, such as the Apple II's Integer BASIC.[62][24] These ports empirically amplified user engagement by obviating the need for proprietary ROM purchases or extensive hardware upgrades, thus causally linking Tiny BASIC to heightened participation in homebrew computing communities during 1976–1977.[5] While lauded for enhancing accessibility on affordable platforms, Tiny BASIC's architecture-specific optimizations inadvertently sustained dependence on proprietary microcomputer designs, as initial implementations presupposed particular CPU instruction sets; nevertheless, the proliferation of community-driven ports partially countered this by promoting interoperability across hardware variants.[24]Contributions to Open Code Sharing
The publication of Tiny BASIC source code in Dr. Dobb's Journal of Tiny BASIC Calisthenics & Orthodontia, starting in January 1976, established an early model for open code sharing among hobbyist programmers.[13] This journal, initially a newsletter from the People's Computer Company, printed complete assembly language listings of various Tiny BASIC implementations, enabling readers to enter, debug, and modify the code on their microcomputers.[63] Approximately ten dialects appeared in its pages, fostering collaborative improvements through reader-submitted variants and errata corrections.[5] Palo Alto Tiny BASIC, authored by Li-Chen Wang and published in the May 1976 issue, exemplified this sharing ethos with its header notice "@COPYLEFT ALL WRONGS RESERVED," an early satirical nod to encouraging unrestricted copying and adaptation over proprietary restrictions.[43] Lacking formal licensing, the code's distribution relied on implicit norms of reciprocity among contributors, yielding empirical success as unmodified and extended versions proliferated across platforms like the Intel 8080 without enforcement of intellectual property claims.[22] This approach rewarded individual ingenuity, as programmers iteratively refined the interpreter based on personal experimentation rather than imposed collective standards, contributing to a culture of merit-based code evolution.[5] By compiling and disseminating these variants—such as those documented in subsequent 1976 issues—the journal's model prefigured modern open-source practices, where public listings invited community-driven debugging and porting, distinct from commercial models like Microsoft BASIC that charged licensing fees.[64] The absence of legal barriers allowed rapid dissemination, with adaptations appearing in user groups and newsletters, demonstrating viable software development through voluntary sharing.[65]Enduring Influence and Modern Relevance
Tiny BASIC's design principles of extreme memory efficiency continue to inform minimal programming environments in the 21st century, particularly for resource-constrained embedded systems. Implementations such as antBASIC, tailored for Raspberry Pi hardware with added I/O instructions, demonstrate its adaptability to contemporary single-board computers for IoT scripting and prototyping.[66] Similarly, ports like slviajero's Tiny BASIC for Arduino, ESP, and STM32 microcontrollers achieve token execution speeds as low as 2 microseconds on modern platforms, enabling real-time control in hobbyist and educational embedded projects while fitting within kilobyte-scale footprints.[33] These examples empirically validate the interpreter's timeless compactness, with variants like basic1K occupying under 1 KB through tokenization optimizations, runnable on emulated or native low-end hardware.[67] Recent software ports extend Tiny BASIC's reach into educational tools, countering the resource inefficiency prevalent in many modern programming ecosystems by emphasizing constraint-driven development. In September 2024, John Robbins released tbp, a Python implementation featuring a linter, comprehensive unit testing via GitHub Actions, and extensive documentation exceeding 17,000 words, aimed at teaching core interpretive mechanics without bloat.[68][37] A browser-based interpreter, leveraging JavaScript for web accessibility, further supports retrocomputing emulation and introductory scripting as of August 2024, allowing users to experiment with original dialects interactively.[12] Such adaptations highlight causal benefits in pedagogy: by forcing programmers to operate within severe limits—e.g., integer-only variables and line-numbered code—they foster first-principles understanding of parsing, execution, and optimization, skills transferable to efficient code in bloated environments. While these uses underscore pedagogical strengths, Tiny BASIC's enduring relevance is tempered by inherent limitations, such as the absence of type safety, error handling, and modular structures, which can lead to brittle programs unsuitable for production without extensions.[69] Modern variants like TinyBasicPlus mitigate some issues via configurable device support but retain the core's simplicity, prioritizing footprint over robustness; this trade-off proves advantageous for bare-metal experimentation on devices like Micro:Bit but risks runtime errors in unvetted educational contexts.[42][70] Overall, its persistence in GitHub repositories and microcontroller projects affirms a niche role in promoting minimalist efficiency amid expansive software trends.[71]References
- https://www.[quora](/page/Quora).com/What-were-the-limitations-of-early-BASIC-that-caused-programmers-to-end-up-with-messy-code-structures
