Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Tiny BASIC

From Wikipedia, the free encyclopedia
BASIC programming languages designed for under 4 KB
Tiny BASIC
Designed byDennis Allison
First appeared1975
Implementation languageIL (Interpretive Language)
LicensePublic 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 ofdialects of theBASIC programming language that can fit into 4 or fewerKBs ofmemory. Tiny BASIC was designed byDennis Allison and thePeople's Computer Company (PCC) in response to theopen letter published byBill Gates complaining about userspiratingAltair BASIC, which sold for $150. Tiny BASIC was intended to be a completely free version of BASIC that would run on the sameearly 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 resultingassembler 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 asDr. 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, whenRAM 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 lackedstring variables, lackedfloating-point math, and allowed only single-letter variable names.

Tiny BASIC implementations are still used today, for programmingmicrocontrollers such as theArduino.

History

[edit]

Altair BASIC

[edit]
A paper tape containing the expanded 8K version of Microsoft BASIC

The earliestmicrocomputers, like theMITSAltair 8800, generally had no built-ininput/output (I/O) beyond front-panel switches andLED lamps. Useful work generally required the addition of an I/Oexpansion card and the use of some form ofterminal. At the time, video-based terminals were very expensive, costing much more than the computer, so many users turned to mechanical devices like theTeletype Model 33. The Model 33, like mostteleprinters of the era, included atape 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 convenientcomputer data storage format, allowing the users to write programs to paper tape and distribute them to other users.[1]

TheHomebrew 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 ofAltair 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] WhenEd 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 thePeople's Computer Company (PCC), felt the best response would be to produce their own BASIC that was completely free to use by anyone. He approachedDennis Allison, a member of the Computer Science faculty atStanford University, to write a specification for a version of BASIC that would fit in 2 to 3 kilobytes of memory.[a] To aidporting, the design was based on anintermediate 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 anIntel 8080 version of the IL interpreter. The article called on programmers to implement the design on their computer and send the resultingassembly 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 theACM 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, addedFOR...NXT loops, and allowed a single numeric array. They avoided the use of the IL and wrote it directly in machine code, usingoctal.[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 nameDr. Dobb's Journal. Over the next several issues, additional versions of the language were published, and similar articles began appearing in other magazines likeInterface Age.

Spread

[edit]
Monospaced font reads "Tiny basic for Intel 8080, version 2.0 by Li-Chen Wang, modified and translated to Intel mnemonics by Roger Rausklob, 10 October 1976. @ Copyleft, All Wrongs Reserved."
The use of "Copyleft; All Wrongs Reserved" in 1976[8]

By the middle of 1976, Tiny BASIC interpreters were available for theIntel 8080, theMotorola 6800 andMOS 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 thefree software movement.[9] Computer hobbyists would exchange paper tapes, cassettes or even retype the files from the printed listings.[10]

Jim Warren, editor ofDr. Dobb's, wrote in the July 1976ACMProgramming 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 irateletter 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 intoproducts. 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 ofDr. Dobbs hasLi-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 fellowHomebrew Computer Club member, Roger Rauskolb, modified and improved Wang's program and this was published in the December 1976 issue ofInterface Age magazine.[8] Roger added his name and preserved the COPYLEFT Notice.

Description

[edit]

Basic concepts

[edit]
See also:BASIC interpreters

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 itsinterpreter system. Early microcomputers lacked the RAM andsecondary storage for a BASICcompiler, 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 viaPRINT. 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,$32hexadecimal. This number was used as an index into anarray-like storage area where the rest of the line was stored in exactly the format it was typed. When the user typedLIST 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 theRUN 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 inBackus–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 acarriage return (usually generated by a keyboard's "Enter" key). A BREAK from the console will interrupt execution of the program.

line::=numberstatementCR|statementCRstatement::=PRINTexpr-listIFexpressionrelopexpressionTHENstatementGOTOexpressionINPUTvar-listLETvar=expressionGOSUBexpressionRETURNCLEARLISTRUNENDexpr-list::=(string|expression)(,(string|expression))*var-list::=var(,var)*expression::=(+|-|ε)term((+|-)term)*term::=factor((*|/)factor)*factor::=var|number|(expression)var::=A|B|C...|Y|Znumber::=digitdigit*digit::=0|1|2|3|...|8|9relop::=<(>|=)|>(<|=)|=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 andGOSUB could take an expression rather than just a line number, providing anassigned GOTO[13] rather than theswitch statement of theGOTO/GOSUB ... OF ..., a structure then supported inHP Time-Shared BASIC and predatingON ... GOTO. The syntax allowingIF-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 avirtual machine, in which the Tiny BASICinterpreter is itself run on a virtual machine interpreter. The designer's idea to use an application virtual machine goes back to Val Schorre (withMETA 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 aspseudocode for thealgorithm 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:TSTS3,'GO';GOTO OR GOSUB?TSTS2,'TO';YES...TO, OR...SUBCALLEXPR;GET LABELDONE;ERROR IF CR NOT NEXTXFER;SET UP AND JUMPS3:TSTS8,'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 forGO and if it fails to find it then jumps to lineS3. If it finds it, execution continues with the next IL command. In this case, the system next tests forTO, skipping to lineS2 if it fails (a test forSUB, to see if this is instead aGOSUB command). If it passes, control continues; in this case, calling an IL subroutine that starts at labelEXPR, which parses an expression. In Tiny BASIC,GOTO X*10+100 (a computed GO TO) is as legal asGOTO 100 and is the alternative to the ON-GOTO of larger BASIC implementations. The subroutineEXPR 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]

TSTlbl,string
Ifstring matches the BASIC line, advance cursor overstring and execute the next IL instruction; if the test fails, execute the IL instruction at the labellbl
CALLlbl
Execute the IL subroutine starting atlbl; 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.
JUMPlbl
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 arecursive 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 withHP Time-Shared BASIC orDEC 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, typicallyRND(). Though not included in the specification, a newsletter article prior to the Design Note for Tiny BASIC requested only this function.
  • All enabledLET to be optional and most let expressions in assignment statements containrelational operators.
  • All but 6800TB supported statement delimiters in lines, typically: although TBX used$ and PATB used;.
  • InIF statements, all but MINOL removed the need for expressions to contain relational operators (e.g.,IFXTHENLETY=X was valid). Implementations removedTHEN altogether or made it optional or supported it only for impliedGOTO. None supportedELSE clauses.
  • Many modifiedPRINT to support print zones, using, to go to the next zone and; to not advance the cursor.
  • All but 6800TB and DTB addedNEW.
  • All but 6800TB and MINOL added a function to return memory size: TBX hadSZE, DTB and PATB hadSIZE, L1B hadMEM, and NIBL hadTOP.
  • Four implementations added arrays, whether a single, undimensioned array in PATB and L1B orDIMensionable arrays in TBX and DTB.
  • Four implementations added theREMark statement.
  • Four implementations added theFOR loop: PATB, NIBL, and L1B offeredFOR-TO-STEP/NEXT, while TBX did not supportSTEP and used the keywordNXT to end a loop.
  • Only NIBL had any nod towards structured programming, withDO/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 forPRINT,IN forINPUT,RET forRETURN. 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 typedP., althoughPR. and other variations also worked. This system was retained inLevel I BASIC for theTRS-80, which used PATB, and was also later found inAtari BASIC and the BASIC of variousSharp 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 thePeople's Computer Company, a newsletter which becameDr. Dobb's Journal, a long-lived computing magazine. About ten versions were published in the magazine.

Prominent dialects of Tiny BASIC (in Dr. Dobb's Journal)
Date publishedIssueDialectAuthorProcessorSize
December 19751[25]Design NoteDennis Allison
February 19762[21]Tiny BASIC Extended (TBX)Dick Whipple & John Arnold80802.9K
March 19763[22]Denver Tiny BASIC (DTB)Fred Greeb80802.75K
March 19763[26]6800 Tiny BASIC (6800TB)Tom Pittman68002K[27]
April 19764[23]MINOLEric T. Mueller80801.75K
May 19765[28]Palo Alto Tiny BASIC (PATB)Li-Chen Wang80801.77K
November 197610[29]National Industrial Basic Language (NIBL)Mark Alexander & Steve LeiningerSC/MP4K
October 198049[30]Enhanced 6800 Tiny BASICRobert Hudson6800
February 1985100[31]TBI68KGordon Brandly68000
January 2006351[32]Return of Tiny BASICTom Pittman— (C)

TBX was also known as Texas Tiny BASIC.[33]

BothSCELBAL[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
DeveloperLi Chen Wang
First appeared1976
LicensePublic 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, byLi-Chen Wang. PATB first appeared in the May 1976 edition ofDr. Dobbs, written in a customassembly 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.77kilobytes of memory and assumed the use of aTeletype Machine (TTY) for userinput/output. An erratum to the original article appeared in the June/July issue ofDr. Dobb's (Vol. 1, No 6). This article also included information on adding additional I/O devices, using code for theVDM video display byProcessor Technology as an example.

Wang was one of the first to use the wordcopyleft.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 inInterface Age.[8] He also published a third version inPCC's Reference Book of Personal and Home Computing.[36]

One of the most notable changes in PATB is the addition of theFOR...NEXT loop. In the original TB, loops could only be implemented usingIF andGOTO. As inMicrosoft 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. TheSTEP 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 toEND, 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 withWHAT? for syntax errors,HOW? for run-time errors like GOTOs to a line that didn't exist or numeric overflows, andSORRY for out-of-memory problems.[24]

Wang also wrote aSTARTREK program in his Tiny BASIC that appeared in the July 1976 issue of thePeople's Computer Company Newsletter.[37][38]

He later adapted the language into 3K Control Basic forCromemco, adding variable names of the form letter-digit (e.g.,A0 toZ9), logic functions (AND(),OR(),XOR()), aCALL command to execute machine language routines, morePRINT-formatting options, and others (GET() andPUT() instead ofPEEK andPOKE; I/O port functions).[39]

Palo Alto Tiny BASIC was adapted for many other implementations, includingLevel I BASIC (1977), BASIC for theSharp PC-1211pocket computer (1980), andAstro BASIC (1982, byJamie Fenton).[40]

MINOL

[edit]

Written by a junior in high school, MINOL was the only implementation that didn't support the full Design Note, lackingoperator precedence, having only three relational operators (<, =, #), omittingGOSUB andRETURN.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.

The May 1977 issue featured a Floppy ROM containing MICRO-BASIC.

Inspired by PCC's call for Tiny BASICs, Robert Uiterwyk wrote MICRO BASIC 1.3 for theSWTPC 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 usingBinary 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 andtrigonometry functions. Both the 4K and 8K versions were sold by SWTPC. In January, 1978, Uiterwyk sold the rights of the source code toMotorola.[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 theHewlett-Packard Journal.

Published in the December 1976 issue ofInterface Age was LLL (Lawrence Livermore Laboratory) BASIC, the first draft of which was developed by Steve Leininger from Allison's specification before Leininger leftNational Semiconductor forTandy Corporation. The final interpreter was developed by John Dickenson, Jerry Barber, and John Teeter at theUniversity 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 theU.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 formedHomebrew Computer Club, which had fellow membersLi-Chen Wang (Palo Alto Tiny BASIC) andTom Pittman (6800 Tiny BASIC). Wozniak concluded that hismachine would have to have a BASIC of its own, which would, hopefully, be the first for theMOS 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 onCompact Cassette in 1976.

In 1977,Radio Shack (as it was known then) released their first computer, theTRS-80, aZ80 system withLevel 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 theSC/MP while employed atNational Semiconductor.[29] Unable to take that source code with him, he adaptedLi-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, andREAD/DATA/RESTORE statements.[47]

Originally developed in 1979,Sinclair 4K BASIC, written by John Grant, used as its language definition the 1978American 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 formicrocontrollers such as theArduino:

  • 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 themicro:bit – adapted from Palo Alto Tiny BASIC.[52]

Later implementations

[edit]

In 2002, Emmanuel Chailloux, Pascal Manoury and Bruno Pagano published a Tiny BASIC (lackingGOSUB/RETURN) inDeveloping Applications with Objective Caml as an exampleObjective Caml application.[53]

In 2013, Alex Yang published an implementation inPython.[54]

In 2019, Sergey Kuznetsov published a version inRuby.[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.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.[59]

Dialects compared

[edit]

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

Comparison of BASIC Implementations – Tiny BASICs and Other BASICs
Date
Published
DialectProgrammer(s)ProcessorTypeINPUTLETPRINTGOTOIF ...THENGOSUBRETURNENDRUNLISTCLEARNEWREMFOR/NEXTREAD / DATA / RESTOREAdded BASIC commandsCustomizationsExpressionsrelopFunctionsRNDMemory FunctionLine numbersStatement delimiterErrorsPrecisionArithmeticVariablesArraysStrings
October 1964
DTSS Dartmouth BASIC
(version 2)[60]
(Dartmouth students)GE-225Compile-and-goN/A [!]LET var = expressionPRINT expr-list { , / ; / }GO TO numberIF expression relop expression THEN line-numberGOSUB numberRETURNENDRUNLIST--startNEW [prompts for program name]REMFOR / TO / STEP / NEXTREAD, DATASTOPprecedence, ^< <= = >= > <>INT, SIN, COS, TAN, ATN, EXP, LOG, ABS, SQR, DEF FNRND(0) 0..11 to 99999None22 defined9 digits±999,999,999; E notation base 2 -256 to +255 (E±76).A–Z, A0–Z9DIM (one letter name, two dimensions); if omitted, assumed to go from 0 to 10; up to 1500 elements across all arraysNone (added in version 4)
February 1970
DEC BASIC-8[61]
(DEC staff)PDP-8Compile-and-goINPUT var-listLET var = expressionPRINT expr-list { , / ; / }GO TO numberIF expression relop expression [THEN/GO TO] line-numberGOSUB numberRETURNENDRUNLIST (first (, last))NEW [prompts for program name]REMFOR / TO / STEP / NEXTREAD, DATA, RESTORESTOP, OLD, SAVE, UNSAVEDELETE (first (, last)), BYEprecedence, ^< <= = >= > <>INT, SGN, SIN, COS, TAN, ATN, EXP, LOG, ABS, SQR, DEF FNRND(0) 0..11 to 2045None23 defined?±134,217,727; 14E-38<N<1.7E38A–Z, AA–Z9DIM (one letter name, two dimensions)None
June 1974
UIUC BASIC[62]
Alfred Weaver, Michael Tindall, Ronald Danielson8008InterpreterINPUT <variable> {, <variable>}*LET var = formulaPRINT <string> / <formula> {, <string> / <formula>}*GO TO numberIF expression THEN line-numberGOSUB numberRETURNENDRUNnot documentednot documentednot documentedREMFOR / TO / STEP / NEXTDEF FN, STOPprecedence, ^< <= = >= > # AND OR NOTFNA..Z, SIN, COS, LOG, SQR, EXP, ATN0 to 999Nonenot documented4-byte mantissa and 1-byte exponent [Datapoint 2200 floating-point arithmetic package]not documentedA–Z, A0–Z9DIM (one letter name, three dimensions)None
1975
Altair 4K BASIC[63]
Bill Gates, Paul Allen, Monte Davidoff8080InterpreterINPUT ("string",) var-list(LET) var = expressionPRINT expr-list { , / ; }GOTO numberIF expression THEN line-number/statementGOSUB numberRETURNENDRUNLIST (start)NEWREMFOR / TO / STEP / NEXTREAD, DATA, RESTORESTOPprecedence< <= = >= > <>ABS, INT, SGN, SQR, TAB, USRRND(X) <0, new using X as seed; =0, repeat; >0, next1 to 65535:12 defined40-bit operand floating??DIM (one dimension)None
December 1975
Design Note[64]
Dennis AllisonInterpreterINPUT var-listLET var = expressionPRINT expr-listGOTO expressionIF expression relop expression THEN statementGOSUB expressionRETURNENDRUNLIST[eq. to NEW]precedence< <= = >= > <> ><NoneNone1 to 255None8 defined16-bit± 32767A–ZNoneNone
February 1976
Tiny BASIC Extended[65]
Dick Whipple & John Arnold8080InterpreterIN(LET) var = expression;}GO TOIF expression [no THEN] statementGO SUBRETENDRUNLST (first (, last))NEWFOR-NXT (no STEP)DTA (array LET)precedence< <= = >= > <> ><TB() spaces in printRN (random 0-10000)SZE1 to 65535$14 defined16-bit± 32767A–ZDIM, 1- or 2-dimensions, 255x255 maxNone
March 1976
Denver Tiny BASIC[66]
Fred Greeb8080InterpreterIN(LET) var = expression;}GOTOIF expression [no THEN] statementGOSUBRETENDRUNLIST (first last)[eq. to NEW]TAPE [SAVE], LOADCLRS [CLS]precedence< <= = >= > <> ><RND(0), RND(1)SIZE2 to 255:20 defined16-bit± 32767A–Z, A1 to A6 to Z6DIM, 1 dimensionNone
March 1976
6800 Tiny BASIC[66]
Tom Pittman6800InterpreterINPUT (expression) var-listLET var = expressionPRINT expr-list { , / ; }GOTO expressionIF expression relop expression THEN statementGOSUB expressionRETURNENDRUNLIST (first last)[eq. to NEW]REMprecedence< <= = >= > <> ><USR()RND()1 to 65535None53 defined16-bit± 32767A–ZNoneNone
April 1976
MINOL[67]
Eric T. Mueller8080InterpreterIN(LET)var=expressionPRexpr-list{;}[GOTO0 jumps back to start of direct statement]IFexpressionrelopexpression&nbsp;;statementENDRUNLISTCLEAR [only variables]NEWNo spaces permitted except in stringsNo operator precedence< = #$[CHR$]![RND]1 to 254:6 defined8-bit0 to 255A–Z(H,L) memory locationsingle char
May 1976
Palo Alto Tiny BASIC[68]
Li-Chen Wang8080InterpreterINPUT [(expression) var]*(LET) var = expressionPRINT expr-listGOTO expressionIF expression [no THEN] statementGOSUB expressionRETURNSTOPRUNLIST (start)NEWREMFOR / TO / STEP / NEXTSTOPprecedence< <= = >= > #ABS()RND()SIZE1 to 32767;3 defined16-bit± 32767A–Z@(1 array of 1 dimension)None
November 1976
NIBL[69]
Mark Alexander & Steve LeiningerSC/MPInterpreterINPUT ($)var(LET) var = expressionPR/PRINT expr-listGOTO expressionIF expression (THEN) statementGOSUB expressionRETURNENDRUNLIST (start)CLEAR [variables & stack]NEWREMFOR / TO / STEP / NEXTDO/UNTILMemory addressing (@ [PEEK/POKE], STAT, PAGE)precedence< <= = >= > <>MOD(), AND, OR, NOT,RND(A,Z)TOP0 to 32767:13 four-char defined16-bit± 32767A–Zmemory addressingINPUT$,PRINT$,$exp=exp
August 1977
Level I BASIC[70]
Steve LeiningerZ80InterpreterINPUT (#digit) [(expression) var]*(LET) var = expressionPRINT (#digit) expr-listGOTO numberIF expression THEN statementGOSUB numberRETURNENDRUN (start)LIST (start)NEWREMFOR / TO / STEP / NEXTREAD, DATA, RESTORESTOP, CONT, ON-GOTO/GOSUBCLOAD, CSAVE, CLS, SET, RESETprecedence< <= = >= > <> ><ABS(), INT(), MEM, POINT(X,Y)RND()MEM1 to 32767:3 defined16-bit± 32767A–ZA(1 array of 1 dimension)A$,B$
June 1976
MICRO BASIC 1.3[71]
Robert Uiterwyk6800InterpreterINPUT var-list(LET) var = expressionPRINT expr-list { , / ; }GOTO expressionIF expression relop expression THEN statementGOSUB expressionRETURNENDRUNLIST (first (, last))NEWFOR/TO/NEXT (no STEP)TAB()precedence< <= = >= > <> ><RND, SIZERND [returns 1-32762]SIZE (statement that prints bytes used and bytes free)1 to 65535None17 defined16-bit [later BCD!]± 32767A–ZDIM (two dimensions, max size of 255)None
June 1976
SCientific ELementary
BAsic Language
(SCELBAL)[72][34]
Mark Arnold & Nat Wadsworth8008InterpreterINPUT var-list(LET) var = expressionPRINT expr-list {, / ; / }GOTO numberTHEN statementGOSUB numberRETURNENDRUNLISTSCR[atch]REMFOR / TO / STEP / NEXTSAVE, LOADUDF [USR]precedence, ^< <= = >= > <>INT, SGN, ABS, SQR, CHR [usable only in PRINT], TABRND(0) 0..11 to 999999None18 defined32-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 Wozniak6502InterpreterINPUT ("string",) var-list(LET) var = expressionPRINT expr-list { , / ; }GOTO expressionIF expression relop expression THEN line-number/statementGOSUB expressionRETURNENDRUN (start)LIST (first (, last))SCRREMFOR / TO / STEP / NEXTAUTO, DEL, POKETAB (command), CALLprecedence< <= = >= > <> # AND OR NOT MODSGN, ABS, PEEK(), LEN()RND(X) 0..X (or X..0!)HIMEM, LOMEM1 to 32767None [early version, then :]16 defined16-bit± 32767A–Z followed by any number of alphanumericDIM (one dimension)dimensioned
December 1976
LLL BASIC[74]
(University of Idaho staff)8080InterpreterINPUT var-list(LET) var = expressionPRINT expr-list { , / ;}GO TO numberIF expression relop expression (THEN) statementGO SUB numberRETURNENDRUNLISTSCRREMFOR/TO/NEXT (no STEP)STOPCALL, GET(), PUT()precedence< <= = >= > <> ><No RND?0 to 32767:14 defined32-bit operand floating point?A–Z, A0–Z9DIM (integers only, one letter name, one dimension, max size of 255)None
January 1980
Sinclair 4K BASIC[75]
John GrantZ-80InterpreterINPUT varLET var = expressionPRINT expr-list { , / ;}GO TO numberIF expression THEN statementGO SUB numberRETURNRUN (number)LISTCLEARNEWREMFOR/TO/NEXT (no STEP)STOPPOKEprecedence< = >ABS, CHR$, CODE, PEEK, RND, STR$, TL$, USRRND, RANDOMISE1 to 999910 defined16-bit integer16-bit integerA–Z followed by any number of alphanumericDIM A-Z (integers only, one letter name, one dimension, max size of 255)A$-Z$

See also

[edit]

Notes

[edit]
  1. ^At the time, the most common memory size for the 8080 was 4 KB, which cost hundreds of dollars.
  2. ^Hash was also used for not-equals inHP Time-Shared BASIC.

References

[edit]

Citations

[edit]
  1. ^Lancaster, Don (1976)."TV Typewriter Cookbook"(PDF). pp. 210–211.Archived(PDF) from the original on 2022-10-09.
  2. ^Manes & Andrews 1994, p. 81.
  3. ^Roberts, H. Edward (October 1975)."Letter from the President".Computer Notes.1 (5). Albuquerque NM.: MITS:3–4. Archived fromthe original on March 23, 2012.
  4. ^Manes & Andrews1994, p. 91.
  5. ^Allison, Dennis (July 1976)."Design notes for TINY BASIC".SIGPLAN Notices.11 (7). ACM:25–33.doi:10.1145/987491.987494.S2CID 18819472.
  6. ^ab"TB Code Sheet".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (1). December 1975.
  7. ^Dobbs 1976, p. 5.
  8. ^abcRauskolb, 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;;*********************************
  9. ^"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
  10. ^abWarren, Jim C. (July 1976). "Correspondence".SIGPLAN Notices.11 (7). ACM:1–2.ISSN 0362-1340.
  11. ^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 8080VERSION 1.0BY LI-CHEN WANG10 JUNE, 1976@COPYLEFTALL 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.
  12. ^Allison, Dennis (1976)."Build Your Own BASIC".Dr. Dobb's Journal. Vol. 1, no. 1. p. 9.
  13. ^Allison, Dennis (1976)."Quick Reference Guide for Tiny BASIC".Dr. Dobb's Journal. Vol. 1, no. 1. p. 6.
  14. ^BASIC-PLUS Language Manual (PDF). Maynard, Massachusetts: Digital Equipment Corporation. 1972. pp. 3–13.
  15. ^Allen, Dennis. "TINY BASIC".People's Computer Company.4 (3).
  16. ^Veit, Holger."Tom Pittman's 6800 tiny BASIC". Retrieved2 May 2017.
  17. ^Dr. Dobb's Journal, Volume 1, Number 1, 1976, p. 12.
  18. ^TheCRLF there symbolizes a carriage return followed by aline feed.
  19. ^Pittman, Tom."Tiny BASIC Experimenter's Kit". RetrievedAugust 9, 2020.
  20. ^"TINY BASIC 6800"(PDF).Archived(PDF) from the original on 2022-10-09. Retrieved13 Aug 2020.
  21. ^abc"Tiny BASIC Extended".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (2). February 1976.
  22. ^ab"Denver Tiny BASIC".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (3). March 1976.
  23. ^abc"MINOL".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (4). April 1976.
  24. ^abcdeRauskolb, 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.
  25. ^"Design Note".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (1). December 1975.
  26. ^"6800 Tiny BASIC".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (3). March 1976.
  27. ^"TINY BASIC User Manual+".
  28. ^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.
  29. ^ab"NIBL".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte.1 (10). November 1976.
  30. ^"Enhanced & Modified 6800 Tiny BASIC".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. October 1980.
  31. ^"TBI68K".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. February 1985.
  32. ^"Return of Tiny BASIC".Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Running Light Without Overbyte. January 2006.
  33. ^"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.
  34. ^abArnold, Mark; Wadsworth, Nat (February 1976)."SCELBAL – A Higher Level Language for 8008/8080 Systems".Dr. Dobb's Journal. pp. 30–53.
  35. ^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.)
  36. ^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)
  37. ^"People's Computer Company"(PDF).Archived(PDF) from the original on 2022-10-09. Retrieved25 December 2019.
  38. ^Turnbull, Pete."Startrek.asc". Archived fromthe original on 24 February 2021. Retrieved25 December 2019.
  39. ^"3K Control Basic Instruction Manual"(PDF). Cromemco. Archived fromthe original(PDF) on 2013-12-22. Retrieved2013-02-18.
  40. ^Ainsworth, Dick (1982).Astro BASIC. Astrocade, Inc. p. 3.
  41. ^"Robert Uiterwyk's BASIC".
  42. ^"Robert Uiterwyk's Micro Basic".
  43. ^"Part 1 Of LLL 8080 BASIC Interpreter"(PDF).Archived(PDF) from the original on 2022-10-09.
  44. ^"4 Altair Language Systems".Altair BASIC.
  45. ^Altair BASIC(PDF). MITS. 25 August 1975.Archived(PDF) from the original on 2022-10-09.
  46. ^Wozniak, Steven (1 May 2014)."How Steve Wozniak Wrote BASIC for the Original Apple From Scratch".Gizmodo.
  47. ^Welsh, David; Welsh, Theresa (2007).Priming the Pump: How TRS-80 Enthusiasts Helped Spark the PC Revolution. p. 7.
  48. ^"ZX80 – 8K BASIC ROM UPGRADE".
  49. ^Ness, Stephen."XYBASIC".Ness Software. Retrieved4 August 2020.
  50. ^"TinyBasicPlus".GitHub.
  51. ^"It's here! Half-Byte Tiny Basic 2 for Arduino and compatibles". 27 November 2014.
  52. ^"Running Tiny Basic on the Micro: Bit". 28 March 2020.
  53. ^Chailloux, Emmanuel; Manoury, Pascal; Pagano, Bruno (2002).Developing Applications with Objective Caml. France: O'Reilly.ISBN 2841771210.
  54. ^"aleozlx/tinybasic".GitHub. Retrieved2020-09-20.
  55. ^"PaloAltoTinyBasic". Retrieved2020-09-20.
  56. ^Williams, Al (31 July 2019)."bootBASIC Fits Your Favorite Language in the Boot Sector".Hack A Day. Retrieved26 March 2022.
  57. ^Gutierrez, Oscar Toledo."bootBASIC is a BASIC language in 512 bytes of x86 machine code".Github. Retrieved26 March 2022.
  58. ^Gutierrez, Oscar Toledo (27 July 2019).Programming Boot Sector Games. Lulu. p. 155.ISBN 978-0-359-76262-0.
  59. ^Henderson, Gordon (2023)."A Tiny Basic for the 6502".Drogon Projects.
  60. ^"BASIC"(PDF).Archived(PDF) from the original on 2022-10-09.
  61. ^"TSS/8 TIME-SHARING SYSTEM USER'S GUIDE". February 1970.
  62. ^"A BASIC LANGUAGE INTERPRETER FOR THE INTEL 8008 MICROPROCESSOR". 1974.
  63. ^"MITS ALTAIR BASIC REFERENCE MANUAL"(PDF).Archived(PDF) from the original on 2022-10-09.
  64. ^"Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte"(PDF).Archived(PDF) from the original on 2022-10-09.
  65. ^"Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte"(PDF).Archived(PDF) from the original on 2022-10-09.
  66. ^ab"Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte"(PDF).Archived(PDF) from the original on 2022-10-09.
  67. ^"Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte".
  68. ^"Interface Age".
  69. ^"Dr. Dobb's Journal of Computer Calisthenics and Orthodontia: Running Light Without Overbyte"(PDF).Archived(PDF) from the original on 2022-10-09.
  70. ^"Help for TRS-80 Level I BASIC".
  71. ^"Robert Uiterwyk's MICRO BASIC". Archived fromthe original on 2012-02-05. Retrieved2012-01-15.
  72. ^"SCELBAL – A higher level language for 8008/8080 systems"(PDF).Archived(PDF) from the original on 2022-10-09.
  73. ^"PRELIMINARY APPLE BASIC USERS MANUAL". October 1976.
  74. ^"Interface Age"(PDF).Archived(PDF) from the original on 2022-10-09.
  75. ^https://cdn.hackaday.io/files/1707077303528288/ZX80_OperatingManual.pdf.{{cite web}}:Missing or empty|title= (help)

Bibliography

[edit]

External links

[edit]
Dialects of theBASIC programming language (list)
Classic
Microsoft
Texas Instruments
Hewlett-Packard
Locomotive Software
Microcomputers
Minicomputers
Time-sharing computers
Other
Extenders
Procedure-
oriented
Proprietary
Free and
open source
Withobject
extensions
Proprietary
Free and
open source
RAD
designers
Proprietary
Free and
open source
Defunct
Retrieved from "https://en.wikipedia.org/w/index.php?title=Tiny_BASIC&oldid=1275331591"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp