TinyBASIC
   HOME

TheInfoList



OR:

Tiny BASIC is a family of
dialects A dialect is a variety of language spoken by a particular group of people. This may include dominant and standardized varieties as well as vernacular, unwritten, or non-standardized varieties, such as those used in developing countries or iso ...
of the
BASIC programming language Basic or BASIC may refer to: Science and technology * BASIC, a computer programming language * Basic (chemistry), having the properties of a base * Basic access authentication, in HTTP Entertainment * ''Basic'' (film), a 2003 film * Basic, on ...
that can fit into 4 or fewer KBs of
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembe ...
. Tiny BASIC was designed by
Dennis Allison Dennis Allison is a lecturer at Stanford University, a position he has held since 1976. Allison was a founding member of the People's Computer Company. Allison in 1975 wrote a specification for a microcomputer interpreter for the BASIC progr ...
and the
People's Computer Company People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fi ...
(PCC) in response to the
open letter An open letter is a Letter (message), letter that is intended to be read by a wide audience, or a letter intended for an individual, but that is nonetheless widely distributed intentionally. Open letters usually take the form of a letter (mess ...
published by
Bill Gates William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
complaining about users pirating
Altair BASIC Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
, which sold for $150. Tiny BASIC was intended to be a completely free version of BASIC that would run on the same
early microcomputers Early may refer to: Places in the United States * Early, Iowa, a city * Early, Texas, a city * Early Branch, a stream in Missouri * Early County, Georgia * Fort Early, Georgia, an early 19th century fort Music * Early B, stage name of Jamaican d ...
. 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 In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
implementation back for inclusion in a series of three planned newsletters. Li-Chen Wang, author of Palo Alto Tiny BASIC, coined the term "
copyleft Copyleft is the legal technique of granting certain freedoms over copies of copyrighted works with the requirement that the same rights be preserved in derivative works. In this sense, ''freedoms'' refers to the use of the work for any purpose, ...
" to describe this concept. The community response was so overwhelming that the newsletter was relaunched as ''
Dr. Dobb's Journal ''Dr. Dobb's Journal'' (often shortened to ''Dr. Dobb's'' or DDJ) was a monthly magazine published in the United States by UBM Technology Group, part of UBM. It covered topics aimed at computer programmers. When launched in 1976, DDJ was the fi ...
'', 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 Ram, ram, or RAM most commonly refers to: * A male sheep * Random-access memory, computer memory * Ram Trucks, US, since 2009 ** List of vehicles named Dodge Ram, trucks and vans ** Ram Pickup, produced by Ram Trucks Ram, ram, or RAM may also ref ...
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 A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable input/output peripherals. Pro ...
such as the
Arduino Arduino () is an Italian open-source hardware and open-source software, software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardwar ...
.


History


Altair BASIC

The earliest
microcomputer A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (P ...
s, like the MITS
Altair 8800 The Altair 8800 is a microcomputer introduced in 1974 by Micro Instrumentation and Telemetry Systems (MITS) based on the Intel 8080 CPU. It was the first commercially successful personal computer. Interest in the Altair 8800 grew quickly after i ...
, generally had no built-in
input/output In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
(I/O) beyond front-panel switches and
LED A light-emitting diode (LED) is a semiconductor device that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. The color of the light (corresp ...
lamps. Useful work generally required the addition of an I/O
expansion card In computing, an expansion card (also called an expansion board, adapter card, peripheral card or accessory card) is a printed circuit board that can be inserted into an electrical connector, or expansion slot (also referred to as a bus sl ...
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 Teletype Model 33 is an electromechanical teleprinter designed for light-duty office use. It is less rugged and cost less than earlier Teletype models. The Teletype Corporation introduced the Model 33 as a commercial product in 1963, after ...
. The Model 33, like most
teleprinter A teleprinter (teletypewriter, teletype or TTY) is an electromechanical device that can be used to send and receive typed messages through various communications channels, in both point-to-point (telecommunications), point-to-point and point- ...
s 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 Computer data storage or digital data storage is a technology consisting of computer components and Data storage, recording media that are used to retain digital data. It is a core function and fundamental component of computers. The cent ...
format, allowing the users to write programs to paper tape and distribute them to other users. The
Homebrew Computer Club The Homebrew Computer Club was an early computer hobbyist group in Menlo Park, California, which met from March 1975 to December 1986. The club had an influential role in the development of the microcomputer revolution and the rise of that aspec ...
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 Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
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. 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."
Bill Gates William Henry Gates III (born October 28, 1955) is an American businessman and philanthropist. A pioneer of the microcomputer revolution of the 1970s and 1980s, he co-founded the software company Microsoft in 1975 with his childhood friend ...
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."


Tiny BASIC

The complaint was not well received. Among the many responses, Bob Albrecht, another Homebrew member and founder of the
People's Computer Company People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fi ...
(PCC), felt the best response would be to produce their own BASIC that was completely free to use by anyone. He approached
Dennis Allison Dennis Allison is a lecturer at Stanford University, a position he has held since 1976. Allison was a founding member of the People's Computer Company. Allison in 1975 wrote a specification for a microcomputer interpreter for the BASIC progr ...
, a member of the Computer Science faculty at
Stanford University Leland Stanford Junior University, commonly referred to as Stanford University, is a Private university, private research university in Stanford, California, United States. It was founded in 1885 by railroad magnate Leland Stanford (the eighth ...
, to write a specification for a version of BASIC that would fit in 2 to 3 kilobytes of memory. To aid
porting In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally desig ...
, the design was based on an
intermediate language An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
(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 The Intel 8080 is Intel's second 8-bit computing, 8-bit microprocessor. Introduced in April 1974, the 8080 was an enhanced successor to the earlier Intel 8008 microprocessor, although without binary compatibility.'' Electronic News'' was a week ...
version of the IL interpreter. The article called on programmers to implement the design on their computer and send the resulting
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
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. 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 Octal (base 8) is a numeral system with eight as the base. In the decimal system, each place is a power of ten. For example: : \mathbf_ = \mathbf \times 10^1 + \mathbf \times 10^0 In the octal system, each place is a power of eight. For ex ...
. 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. 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. 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

By the middle of 1976, Tiny BASIC interpreters were available for the
Intel 8080 The Intel 8080 is Intel's second 8-bit computing, 8-bit microprocessor. Introduced in April 1974, the 8080 was an enhanced successor to the earlier Intel 8008 microprocessor, although without binary compatibility.'' Electronic News'' was a week ...
, the Motorola 6800 and
MOS Technology 6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit computing, 8-bit microprocessor that was desi ...
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 The free software movement is a social movement with the goal of obtaining and guaranteeing certain freedoms for user (computing), software users, namely the freedoms to run, study, modify, and share copies of software. Software which meets thes ...
. Computer hobbyists would exchange paper tapes, cassettes or even retype the files from the printed listings. 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 Product may refer to: Business * Product (business), an item that can be offered to a market to satisfy the desire or need of a customer. * Product (project management), a deliverable or set of deliverables that contribute to a business solution ...
. 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. 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 Copyleft is the legal technique of granting certain freedoms over copies of copyrighted works with the requirement that the same rights be preserved in derivative works. In this sense, ''freedoms'' refers to the use of the work for any purpose, ...
ALL WRONGS RESERVED". A fellow
Homebrew Computer Club The Homebrew Computer Club was an early computer hobbyist group in Menlo Park, California, which met from March 1975 to December 1986. The club had an influential role in the development of the microcomputer revolution and the rise of that aspec ...
member, Roger Rauskolb, modified and improved Wang's program and this was published in the December 1976 issue of ''Interface Age'' magazine. 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
;
;*********************************
Roger added his name and preserved the COPYLEFT Notice.


Description


Basic concepts

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 Computer data storage or digital data storage is a technology consisting of computer components and Data storage, recording media that are used to retain digital data. It is a core function and fundamental component of computers. The cent ...
for a BASIC
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
, 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 . 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,
hexadecimal Hexadecimal (also known as base-16 or simply hex) is a Numeral system#Positional systems in detail, positional numeral system that represents numbers using a radix (base) of sixteen. Unlike the decimal system representing numbers using ten symbo ...
. This number was used as an index into an
array An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
-like storage area where the rest of the line was stored in exactly the format it was typed. When the user typed 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 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 (). 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

The grammar is listed below in
Backus–Naur form In computer science, Backus–Naur form (BNF, pronounced ), also known as Backus normal form, is a notation system for defining the Syntax (programming languages), syntax of Programming language, programming languages and other Formal language, for ...
, almost exactly as it was specified in the Design Note. 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 A carriage return, sometimes known as a cartridge return and often shortened to CR, or return, is a control character or mechanism used to reset a device's position to the beginning of a line of text. It is closely associated with the line feed ...
(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: and could take an expression rather than just a line number, providing an assigned GOTO rather than the
switch statement In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map. Switch statements function ...
of the , a structure then supported in
HP Time-Shared BASIC HP Time-Shared BASIC (HP TSB) is a BASIC, BASIC programming language Interpreter (computing), interpreter for Hewlett-Packard's HP 2100#HP 2000, HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as th ...
and predating . The syntax allowing (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 and copied by Microsoft.


Implementation in a virtual machine

The Design Note specified a
virtual machine In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
, in which the Tiny BASIC
interpreter Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
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 META II is a Domain-specific language, domain-specific programming language for writing compilers. It was created in 1963–1964 by Dewey Val Schorre at University of California, Los Angeles (UCLA). META II uses what Schorre called ''Syntax (progr ...
, 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. Dialects that used the virtual machine included Tiny BASIC Extended, Tom Pittman's Tiny BASIC 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 In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
for the
algorithm In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
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 and if it fails to find it then jumps to line . If it finds it, execution continues with the next IL command. In this case, the system next tests for , skipping to line if it fails (a test for , to see if this is instead a command). If it passes, control continues; in this case, calling an IL subroutine that starts at label , which parses an expression. In Tiny BASIC, (a computed GO TO) is as legal as and is the alternative to the ON-GOTO of larger BASIC implementations. The subroutine pushes the result of the expression onto the arithmetic stack (in this case, the line number). verifies no other text follows the expression and gives an error if it does. 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. ; : If ''string'' matches the BASIC line, advance cursor over and execute the next IL instruction; if the test fails, execute the IL instruction at the label ''lbl'' ; : Execute the IL subroutine starting at ; save the IL address following the CALL on the control stack ; : Report a syntax error if after deleting leading blanks the cursor is not positioned to reach a carriage return ; : 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. ; : Continue execution of the IL at the label specified ; : Return to the IL location specified at the top of the control stack ; : Print characters from the BASIC text up to but not including the closing quotation mark ; : Print number obtained by popping the top of the expression stack ; : Insert spaces to move the print head to next zone ; : Output a CRLF to the printer Tom Pittman, discussing the IL, says: "The TINY BASIC interpreter was designed by Dennis Allison as a
recursive descent parser In computer science, a recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar. Thus t ...
. 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."


Deviations from the design

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." 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 HP Time-Shared BASIC (HP TSB) is a BASIC, BASIC programming language Interpreter (computing), interpreter for Hewlett-Packard's HP 2100#HP 2000, HP 2000 line of minicomputer-based time-sharing computer systems. TSB is historically notable as th ...
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 . Though not included in the specification, a newsletter article prior to the Design Note for Tiny BASIC requested only this function. * All enabled 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 statements, all but MINOL removed the need for expressions to contain relational operators (e.g., was valid). Implementations removed altogether or made it optional or supported it only for implied . None supported clauses. * Many modified to support print zones, using to go to the next zone and to not advance the cursor. * All but 6800TB and DTB added . * All but 6800TB and MINOL added a function to return memory size: TBX had , DTB and PATB had , L1B had , and NIBL had . * Four implementations added arrays, whether a single, undimensioned array in PATB and L1B or ensionable arrays in TBX and DTB. * Four implementations added the ark statement. * Four implementations added the loop: PATB, NIBL, and L1B offered , while TBX did not support and used the keyword to end a loop. * Only NIBL had any nod towards structured programming, with , despite Allison's lament in Issue 2 about problems with BASIC. As an alternative to tokenization, to save RAM, TBX, DTB, and MINOL truncated keywords: for , for , for . 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, could be typed , although and other variations also worked. This system was retained in
Level I BASIC Level I BASIC is a dialect of the BASIC programming language that shipped with the first TRS-80, the TRS-80 Model I. Background Tandy employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) BASIC int ...
for the
TRS-80 The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
, which used PATB, and was also later found in
Atari BASIC Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers. Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant way ...
and the BASIC of various
Sharp Pocket Computers Sharp or SHARP may refer to: Acronyms * SHARP (helmet ratings) (Safety Helmet Assessment and Rating Programme), a British motorcycle helmet safety rating scheme * Self Help Addiction Recovery Program, a charitable organisation founded in 199 ...
.


Dialects

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

Tiny BASIC was first published in a newsletter offshoot of the
People's Computer Company People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fi ...
, a newsletter which became ''
Dr. Dobb's Journal ''Dr. Dobb's Journal'' (often shortened to ''Dr. Dobb's'' or DDJ) was a monthly magazine published in the United States by UBM Technology Group, part of UBM. It covered topics aimed at computer programmers. When launched in 1976, DDJ was the fi ...
'', a long-lived computing magazine. About ten versions were published in the magazine. TBX was also known as Texas Tiny BASIC. Both
SCELBAL SCELBAL, short for SCientific ELementary BAsic Language, is a version of the BASIC programming language released in 1976 for the SCELBI and other early Intel 8008 and 8080-based microcomputers like the Mark-8. Later add-ons to the language included ...
and 6800 Tiny BASIC were announced in the magazine but did not publish their source code.


Palo Alto Tiny 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 In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
with non-standard mnemonics. This led to further ports that worked with conventional assemblers on the 8080. The first version of the interpreter occupied 1.77
kilobyte The kilobyte is a multiple of the unit byte for Computer data storage, digital information. The International System of Units (SI) defines the prefix ''kilo-, kilo'' as a multiplication factor of 1000 (103); therefore, one kilobyte is 1000&nbs ...
s of memory and assumed the use of a Teletype Machine (TTY) for user
input/output In computing, input/output (I/O, i/o, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, such as another computer system, peripherals, or a human operator. Inputs a ...
. 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 Processor Technology Corporation was a personal computer company founded in April 1975, by Gary Ingram and Bob Marsh in Berkeley, California. Their first product was a 4K byte RAM board that was compatible with the MITS Altair 8800 computer but ...
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". 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. He encouraged others to adapt his source code and publish their adaptions, as with Roger Rauskolb's version of PATB published in '' Interface Age''. He also published a third version in ''PCC's Reference Book of Personal and Home Computing''. 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 and . As in
Microsoft BASIC Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first v ...
, 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 modifier was optional, as in MS. 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 , in addition to , and the use of for not-equals in comparisons, as opposed to . 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 for syntax errors, for run-time errors like GOTOs to a line that didn't exist or numeric overflows, and for out-of-memory problems. Wang also wrote a ''
STARTREK ''Star Trek'' is an American science fiction media franchise created by Gene Roddenberry, which began with the series of the same name and became a worldwide pop-culture phenomenon. Since its creation, the franchise has expanded into var ...
'' program in his Tiny BASIC that appeared in the July 1976 issue of the ''
People's Computer Company Newsletter People's Computer Company (PCC) was an organization, a newsletter (the ''People's Computer Company Newsletter'') and, later, a quasiperiodical called the ''Dragonsmoke''. PCC was founded and produced by Dennis Allison, Bob Albrecht and George Fire ...
''. He later adapted the language into 3K Control Basic for
Cromemco Cromemco, Inc. was a Mountain View, California microcomputer company known for its high-end Z80-based S-100 bus computers and peripherals in the early days of the personal computer revolution. The company began as a partnership in 1974 between ...
, 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). Palo Alto Tiny BASIC was adapted for many other implementations, including
Level I BASIC Level I BASIC is a dialect of the BASIC programming language that shipped with the first TRS-80, the TRS-80 Model I. Background Tandy employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) BASIC int ...
(1977), BASIC for the
Sharp PC-1211 The Sharp PC-1211 is the first pocket computer ever released, marketed by Sharp Corporation in March 1980. The computer was powered by two 4-bit computing, 4-bit CPUs laid out in power-saving CMOS circuitry. One acted as the main CPU, the other dea ...
pocket computer A pocket computer is a class of handheld computer characterized by very short displays (typically accommodating only one or a handful of lines of text) and calculator-style alphanumeric keypads. Pocket computers occupy a small footprint, allowin ...
(1980), and Astro BASIC (1982, by Jamie Fenton).


MINOL

Written by a junior in high school, MINOL was the only implementation that didn't support the full Design Note, lacking
operator precedence In mathematics and computer programming, the order of operations is a collection of rules that reflect conventions about which operations to perform first in order to evaluate a given mathematical expression. These rules are formalized with a ...
, having only three relational operators (<, =, #), omitting and . 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; 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)"); executes a machine language subroutine.


Miscellaneous dialects

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 The SWTPC 6800 Computer System, simply referred to as SWTPC 6800, is an early microcomputer developed by the Southwest Technical Products Corporation and introduced in 1975. It was built around the Motorola 6800 microprocessor, from which it gets ...
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 In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used for ...
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 Trigonometry () is a branch of mathematics concerned with relationships between angles and side lengths of triangles. In particular, the trigonometric functions relate the angles of a right triangle with ratios of its side lengths. The fiel ...
functions. Both the 4K and 8K versions were sold by SWTPC. In January, 1978, Uiterwyk sold the rights of the source code to
Motorola Motorola, Inc. () was an American multinational telecommunications company based in Schaumburg, Illinois. It was founded by brothers Paul and Joseph Galvin in 1928 and had been named Motorola since 1947. Many of Motorola's products had been ...
. 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 Lawrence Livermore National Laboratory (LLNL) is a federally funded research and development center in Livermore, California, United States. Originally established in 1952, the laboratory now is sponsored by the United States Department of Ene ...
) BASIC, the first draft of which was developed by Steve Leininger from Allison's specification before Leininger left
National Semiconductor National Semiconductor Corporation was an United States of America, American Semiconductor manufacturing, semiconductor manufacturer, which specialized in analogue electronics, analog devices and subsystems, formerly headquartered in Santa Clara, ...
for
Tandy Corporation Tandy Corporation was an American family-owned Retail, retailer based in Fort Worth, Texas that made leather goods, operated the RadioShack chain, and later built personal computers. Tandy Leather was founded in 1919 as a leather supply store ...
. The final interpreter was developed by John Dickenson, Jerry Barber, and John Teeter at the
University of Idaho The University of Idaho (U of I, or UIdaho) is a public land-grant research university in Moscow, Idaho, United States. Established in 1889 and opened three years later, it was the state's sole university for 71 years, until 1963. The un ...
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.


4K BASICs

Altair BASIC Altair BASIC is a discontinued interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product (as Micro-Soft), distributed by MITS under a contract. Altair B ...
, 4K BASIC, could run within a 4 KB RAM machine, leaving only about 790 bytes free for program code. 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 The Homebrew Computer Club was an early computer hobbyist group in Menlo Park, California, which met from March 1975 to December 1986. The club had an influential role in the development of the microcomputer revolution and the rise of that aspec ...
, which had fellow members Li-Chen Wang (Palo Alto Tiny BASIC) and Tom Pittman (6800 Tiny BASIC). Wozniak concluded that his
machine A machine is a physical system that uses power to apply forces and control movement to perform an action. The term is commonly applied to artificial devices, such as those employing engines or motors, but also to natural biological macromol ...
would have to have a BASIC of its own, which would, hopefully, be the first for the
MOS Technology 6502 The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit computing, 8-bit microprocessor that was desi ...
processor. As the language needed 4 KB RAM, he made that the minimum memory for the design.
Integer BASIC Integer BASIC is a BASIC interpreter written by Steve Wozniak for the Apple I and Apple II computers. Originally available on Cassette tape, cassette for the Apple I in 1976, then included in Read-only memory, ROM on the Apple II from its release ...
was originally published on
Compact Cassette The Compact Cassette, also commonly called a cassette tape, audio cassette, or simply tape or cassette, is an analog magnetic tape recording format for audio recording and playback. Invented by Lou Ottens and his team at the Dutch company ...
in 1976. In 1977,
Radio Shack RadioShack (formerly written as Radio Shack) is an American electronics retailer that was established in 1921 as an amateur radio mail-order business. Its parent company was purchased by Tandy Corporation in 1962, which shifted its focus from ma ...
(as it was known then) released their first computer, the
TRS-80 The TRS-80 Micro Computer System (TRS-80, later renamed the Model I to distinguish it from successors) is a desktop microcomputer developed by American company Tandy Corporation and sold through their Radio Shack stores. Launched in 1977, it is ...
, a
Z80 The Zilog Z80 is an 8-bit microprocessor designed by Zilog that played an important role in the evolution of early personal computing. Launched in 1976, it was designed to be software-compatible with the Intel 8080, offering a compelling altern ...
system with
Level I BASIC Level I BASIC is a dialect of the BASIC programming language that shipped with the first TRS-80, the TRS-80 Model I. Background Tandy employee Steve Leininger had written the first draft of the NIBL (National Industrial Basic Language) BASIC int ...
in a 4 KB ROM.
Tandy Tandy may refer to: Companies * Tandy Corporation (1919–2000), a leather supply company which became the RadioShack Corporation in 2000 ** Hinckley-Tandy Leather Company, name used from 1919 to 1956 ** TRS-80 Color Computer, rebranded as Tandy C ...
-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 National Semiconductor Corporation was an United States of America, American Semiconductor manufacturing, semiconductor manufacturer, which specialized in analogue electronics, analog devices and subsystems, formerly headquartered in Santa Clara, ...
. 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 statements. Originally developed in 1979, Sinclair 4K BASIC, written by John Grant, used as its language definition the 1978
American National Standards Institute The American National Standards Institute (ANSI ) is a private nonprofit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organiz ...
(ANSI) Minimal BASIC standard, but was itself an incomplete 4 KB implementation with integer arithmetic only.


Microcontroller dialects

Tiny BASIC implementations have been adapted for processor control and for
microcontrollers A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable input/output peripherals. Pro ...
such as the
Arduino Arduino () is an Italian open-source hardware and open-source software, software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. Its hardwar ...
: * 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. * 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. * Half-Byte Tiny Basic – adapted from Arduino BASIC. * Tiny Basic on the micro:bit – adapted from Palo Alto Tiny BASIC.


Later implementations

In 2002, Emmanuel Chailloux, Pascal Manoury and Bruno Pagano published a Tiny BASIC (lacking /) in ''Developing Applications with Objective Caml'' as an example Objective Caml application. In 2013, Alex Yang published an implementation in
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
. In 2019, Sergey Kuznetsov published a version in
Ruby Ruby is a pinkish-red-to-blood-red-colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapph ...
. 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. Additionally, it lacks GOSUB and RETURN but does include a RND function (without arguments, returning a value between 0 and 255). The language uses an array to store program lines, requiring 20,000 bytes to do so. 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.5KB of ROM requiring at least 1KB 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.


Dialects compared

The following table compares the language feature of Tiny BASIC implementations against other prominent BASICs that preceded them.


See also

*
BASIC interpreter A BASIC interpreter is an Interpreter (computing), interpreter that enables users to enter and run programs in the BASIC programming language, language and was, for the first part of the microcomputer era, the default Application software, applica ...
*
Copyleft Copyleft is the legal technique of granting certain freedoms over copies of copyrighted works with the requirement that the same rights be preserved in derivative works. In this sense, ''freedoms'' refers to the use of the work for any purpose, ...
*
Dartmouth BASIC Dartmouth BASIC is the original version of the BASIC programming language. It was designed by two professors at Dartmouth College, John G. Kemeny and Thomas E. Kurtz. With the underlying Dartmouth Time-Sharing System (DTSS), it offered an interac ...


Notes


References


Citations


Bibliography

* *


External links


''Tiny Basic User Manual''
an
''Experimenter's Kit''
– b
Tom Pittman


an

– A MC6800 tiny BASIC later sold with the
SWTPC 6800 The SWTPC 6800 Computer System, simply referred to as SWTPC 6800, is an early microcomputer developed by the Southwest Technical Products Corporation and introduced in 1975. It was built around the Motorola 6800 microprocessor, from which it gets ...
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 i
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.

– A port o
Tom Pittman's TinyBasic C interpreter
to
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, C# and
Adobe Flex Apache Flex, formerly Adobe Flex, is a software development kit (SDK) for the development and deployment of cross-platform rich web applications based on the Adobe Flash platform. Initially developed by Macromedia and then acquired by Adobe Syste ...
. Includes live web versions.
TinyBASIC Windows
– A Windows version of TinyBASIC
Tiny BASIC
Tasks implemented in Tiny BASIC o
rosettacode.org

Palo Alto Tiny BASIC
Tasks implemented in Palo Alto Tiny BASIC o
rosettacode.org
{{BASIC Microcomputer software BASIC interpreters Copyleft BASIC programming language family Programming languages created in 1975