Atari BASIC
Family | BASIC |
---|---|
Designed by | Paul Laughton Kathleen O'Brien |
Developer | Shepardson Microsystems |
First appeared | 1979 |
Stable release | Revision C
/ 1983 |
Platform | Atari 8-bit computers |
License | Commercialproprietary software |
Influenced by | |
Data General Business Basic[1] | |
Influenced | |
BASIC A+,BASIC XL,BASIC XE,Turbo-BASIC XL |
Atari BASICis aninterpreterfor theBASICprogramming language that shipped withAtari 8-bit computers.Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative ofMicrosoft BASICand differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays.
The language was distributed as an 8KBROM cartridgefor use with the 1979 Atari 400 and 800 computers. Starting with the 600XL and 800XL in 1983, BASIC is built into the system. There are three primary versions of the software: the original cartridge-based "A", the built-in "B" for the 600XL/800XL, and the final "C" version in late-model XLs and the XE series.
Despite the Atari 8-bit computers running at a higher speed than most of its contemporaries, several technical decisions placed Atari BASIC near the bottom in performance benchmarks. The original authors addressed most of these issues in a series of improved versions:BASIC A+(1981),BASIC XL(1983), and BASIC XE (1985).
The complete, annotatedsource codeand design specifications of Atari BASIC were published asThe Atari BASIC Source Bookin 1983.[2]
Development
[edit]The machines that would become theAtari 8-bit computerswere originally developed as second-generationvideo game consolesintended to replace theAtari VCS.Ray Kassar,the new president of Atari, decided to challengeApple Computerby building a home computer instead.[3]
This meant the designs needed to include theBASICprogramming language, the standard for home computers. In early 1978, Atari licensed thesource codeto theMOS 6502version ofMicrosoft BASIC.[4]It was offered in two versions: one using a 32-bit floating point format that was about 7800 bytes when compiled, and another using an extended 40-bit format that was close to 9 KB.[5]
Even the 32-bit version barely fit into the 8 KB size of the machine'sROM cartridgeformat. Atari also felt that they needed to expand the language to support the hardware features of their computers, similar to what Apple had done withApplesoft BASIC.This increased the size of Atari's version to around 11 KB; AppleSoft BASIC on theApple II+was 10,240 bytes long.[a]After six months the code was pared down to almost fit in an 8 KB ROM,[4]but Atari was facing a January 1979 deadline for theConsumer Electronics Show(CES) where the machines would be demonstrated. They decided to ask for help to get a version of BASIC ready in time for the show.[4]
Shepardson Microsystems
[edit]In September 1978,Shepardson Microsystemswon the bid on completing BASIC.[4]At the time they were finishing Cromemco 16K Structured BASIC for theZ80-basedCromemcoS-100 busmachines.[6][7]Developers Kathleen O'Brien and Paul Laughton usedData General Business Basic,an integer-only implementation, as the inspiration for their BASIC, given Laughton's experience with Data General on atime-sharingsystem.[1]
Cromemco BASIC included an extendedfloating pointimplementation using a 14-digitbinary-coded decimal(BCD) format made possible using all 16 registers of theZilog Z80processor. As it converted all data to the internal format at edit time, small constants like "1" would use up a considerable amount of memory, and this could be a particular issue when storing arrays of numbers. To address this, the language also supported a 6-digit BCD format. It also included a separate 16-bit integer format for storing internal values like line numbers and similar system values.[8]
Even the smallest BASICs on the 6502 generally used about 10K, for instance,Commodore BASICused 9K but also relied on support from theKERNAL,[b]whileApplesoft BASICused 10780 bytes.[c]To meet the goal of fitting in an 8K ROM, the new BASIC would be in two parts, the language itself on the cartridge, and a separate FP library using 2K in the system's 10K ROM.[11]To fit within 2k, the floating-point system supported only the 6-digit format.
Atari accepted the proposal, and when the specifications were finalized in October 1978, Laughton and O'Brien began work on the new language.[4]The contract specified the delivery date on or before 6 April 1979 and this also included a File Manager System (later known as DOS 1.0).[11]Atari's plans were to take an early 8K version of Microsoft BASIC to the 1979 CES, then switch to Atari BASIC for production. Development proceeded quickly, helped by abonus clausein the contract, which led to the initial version being delivered in October. Atari took an 8K cartridge version to CES instead of Microsoft's.[12]Atari Microsoft BASIClater became available as a separate product.[13]
Releases
[edit]The version Shepardson gave to Atari for the CES demo was not intended to be final, and Shepardson continued to fix bugs.[12]Unknown to Shepardson, Atari had already sent the CES version to manufacturing.[14]
This version was later known asRevision A.It contains a major bug in a routine that copies memory: deleting lines of code that are exactly 256 bytes long causes a lockup after the next command is entered. TheResetkey does not fix it.[15]
Revision Battempted to fix the major bugs in Revision A and was released in 1983 as a built-in ROM in the 600XL and 800XL models. While fi xing the memory copying bug, the programmer noticed the same pattern of code in the section for inserting lines, and applied the same fix. This instead introduced the original bug into this code. Inserting new lines is much more common than deleting old ones, so the change dramatically increased the number of crashes.[15]Revision B also adds 16 bytes to a program every time it isSAVE
d andLOAD
ed, eventually causing the machine to run out of memory for even the smallest programs.[16][17]Mapping the Ataridescribed these as "awesome bugs" and advised Revision B owners "Don't fool around; get the new ROM, which is available on cartridge" from Atari.[17]The book provides atype-in programto patch Revision B to Revision C for those without the cartridge.[18]
Revision Celiminates the memory leaks in Revision B.[17]It is built-in on later versions of the 800XL[16]and all XE models including the XEGS. Revision C was also available as a cartridge.[17]
The version can be determined by typingPRINT PEEK(43234)
at the READY prompt. The result is162
for Revision A,96
for Revision B, and234
for Revision C.[19]
Description
[edit]Program editing
[edit]Like most home computer BASICs, Atari BASIC is anchored around itsline editor.Program lines can be up to three physical screen lines of 40 characters, 120 characters total. The cursor can be moved freely, with the editor automatically tracking which BASIC program line the current screen line is part of. For instance, if the cursor is currently positioned in line 30 and the user uses cursor-up into line 20, any editing from that point will be carried out on line 20.
Atari BASIC's editor catches many errors that would not be noticed in MS-derived versions. If an error is found, the editor re-displays the line, highlighting the text near the error ininverse video.Errors are displayed as numeric codes, with the descriptions printed in the manual.[20]Because of the way the line editor works, the user can immediately fix the error. In the example pictured above (withPRUNT
), the error can be fixed by moving the cursor over theU
,typingI(the editor only has an overwrite mode), and hittingRETURN.
A line entered with a leading number, from 0 to 32767,[21]is inserted in the current program or replaces an existing line. If there's no line number, the interpreter assigns it the number -1 (800016) and the commands are executed immediately, in "immediate mode". TheRUN
command executes the stored program from the lowest line number. Atari BASIC allows all commands to be executed in both modes. For example,LIST
can be used inside a program, whereas in many interpreters this would be available in immediate mode only.
During entry, keywords can be abbreviated using the pattern set byPalo Alto Tiny BASIC,by typing a period at any point in the word. SoL.
is expanded toLIST
,as isLI.
.Only enough letters have to be typed to make the abbreviation unique, soPLOT
requiresPL.
because the single letter P is not unique. To expand an abbreviation, the tokenizer searches through its list of reserved words to find the first that matches the portion supplied. More commonly used commands occur first in the list of reserved words, withREM
at the beginning (it can be typed as.
). When the program is laterLIST
ed it will always write out the full words with three exceptions:PRINT
has a synonym,?
;GOTO
has a synonym,GO TO
;andLET
has a synonym which is the empty string (so10LETA=10
and10A=10
mean the same thing). These are separate tokens, and so will remain as such in the program listing. MS BASICs also allowed?
as a short-form forPRINT
,but this used the same token so it expanded back toPRINT
whenLIST
ed, treating it as an abbreviation, not a synonym.
Tokenizer
[edit]When the user pressesRETURNwhile editing, the current line is copied into the BASIC Input Line Buffer in memory between 580 and 5FF16.[21]Atari BASIC'stokenizerscans the text, converting each keyword to a single-byte token (for example,PRINT
is 2016),[22]each number to a six-byte floating point value, each variable name to an index into a table, and so on, until the line is fully turned into an easy to interpret format. The result is stored in an output buffer located at the first 256 bytes of the lowest available free memory, pointed to by the LOMEM pointer stored at 80, 8116.[21]The output from the tokenizer is then relocated. The program is stored as aparse tree.[d]
Shepardson referred to this complete-tokenizing concept as a "pre-compiling interpreter".[23]The resulting tokenized code eliminates any parsing during runtime, making it run faster. It has the disadvantage that small constants, like 0 or 1, are six bytes each, longer than the original text.
A set of pointers (addresses) indicates various data: variable names are stored in thevariable name table(VNTP – 82, 8316) and their values are stored in thevariable value table(pointed to at VVTP – 86, 8716). Byindirectingthe variable names in this way, a reference to a variable needs only one byte to address its entry into the appropriate table. String variables have their own area (pointed to at STARP – 8C, 8D16) as does the runtime stack (pointed to at RUNSTK – 8E, 8F16) used to store the line numbers of looping statements (FOR...NEXT
) and subroutines (GOSUB...RETURN
). Finally, the end of BASIC memory usage is indicated by an address stored at MEMTOP – 90, 9116) pointer.
Math functions
[edit]Atari BASIC includes three trigonometric functions: sine, cosine, and arc tangent.DEG
andRAD
set whether these functions use radians or degrees, defaulting to radians. Eight additional functions include rounding, logarithms, and square root. The random function,RND
,generates a number between 0 and 1; the parameter not being used.
String handling
[edit]Atari BASIC copied the string-handling system ofHewlett-Packard BASIC,[24]where the basic data type is a single character, and strings are arrays of characters. Internally, a string is represented by a pointer to the first character in the string and its length. To initialize a string, it must be DIMensioned with its maximum length. For example:
10DIMA$(20)
20PRINT"ENTER MESSAGE:";
30INPUTA$
40PRINTA$
In this program, a 20 character string is reserved, and any characters in excess of the string length will be truncated. The maximum length of a string is 32,768 characters. There is no support for arrays of strings.
A string is accessed using array inde xing functions, orslicing.A$(1,10)
returns a string of the first 10 characters ofA$
.The arrays are 1-indexed, so a string of length 10 starts at 1 and ends at 10. Slicing functions simply set pointers to the start and end points within the existing allocated memory.
Arrays are not initialized, so a numeric array or string contains whatever data was in memory when it was allocated. The following trick allows fast string initialization, and it is also useful for clearing large areas of memory of unwanted garbage. Numeric arrays can only be cleared with a FOR...NEXT loop:
10REM Initialize A$ with 1000 characters of X
20DIMA$(1000)
30A$="X":A$(1000)=A$:A$(2)=A$
String concatenation works as in the following example. The target string must be large enough to hold the combined string or an error will result:
10DIMA$(12),B$(6)
20A$="Hello":B$="there!"
30A$(LEN(A$)+1)=B$
40PRINTA$
Values in DATA statements are comma-delimited and untyped. Consequently, strings in DATA statements are not typically enclosed by quote marks. As a result, it is not possible for data items to contain a comma but they can incorporate double-quotes. Numeric values in DATA statements are read as strings or as numbers according to the type of the variable they are read into. The READ statement cannot be used with array variables.
Input/output
[edit]The AtariOSincludes a subsystem forperipheraldevice input/output (I/O) known as CIO (Central Input/Output). Most programs can be written independently of what device they might use, as they all conform to a common interface; this was rare on home computers at the time. New device drivers could be written fairly easily that would automatically be available to Atari BASIC and any other program using the Atari OS, and existing drivers could be supplanted or augmented by new ones. A replacementE:,for example could displace the one in ROM to provide an 80-column display, or to piggyback on it to generate achecksumwhenever a line is returned (such as used to verify a type-in program listing).
Atari BASIC supports CIO access with reserved wordsOPEN #, CLOSE #, PRINT #, INPUT #, GET #, PUT #, NOTE #, POINT #andXIO #.There are routines in the OS for simple graphics drawing functions but not all are available as specific BASIC keywords.PLOTandDRAWTOfor line drawing are supported while a command providing area fill for primitive linear geometric shapes is not. The fill feature can be used through the general CIO entry point, which is called using the BASIC commandXIO.
The BASIC statementOPEN #prepares a device for I/O access:
10REM Opens the cassette device on channel 1 for reading in BASIC
20OPEN#1,4,0,"C:MYPROG.DAT"
Here,OPEN #means "ensure channel 1 is free," call theC:driver to prepare the device (this will set the cassette tape spools onto tension and advance the heads keeping the cassette tape player "paused". The4means "read" (other codes are8for write and12 = 8 + 4for "read-and-write" ). The third number is auxiliary information, set to 0 when not needed. TheC:MYPROG.DATis the name of the device and the filename; the filename is ignored for the cassette driver. Physical devices can have numbers (mainly disks, printers and serial devices), so "P1:"might be the plotter and"P2:"the daisy-wheel printer, or"D1:"may be one disk drive and"D2:"and so on. If not present, 1 is assumed.
The LPRINT statement sends a string to the printer.
A is read byPEEKing memory locations maintained by the keyboard driver or by opening it as a file (e.g.OPEN1,4,0,"K:":GET#1,A$
). The latter waits for a keypress.
TypingDOSfrom BASIC exits to theAtari DOScommand menu. Any unsaved programs are lost unless a memory-swapping file feature has been enabled on the current disk. There is no command to display a disk directory from within BASIC; this must be done by exiting to DOS.
Graphics and sound
[edit]Atari BASIC supports sound, (via theSOUNDstatement), graphics (GRAPHICS, SETCOLOR, COLOR, PLOT, DRAWTO), and controllers (STICK, STRIG, PADDLE, PTRIG).[25]TheSOUNDstatement sets one of hardware's 4 square-wave channels with parameters for volume, pitch and distortion.
Advanced capabilities of the hardware such as higher pitch resolution, high-pass filters, digitised sound and waveforms, player/missile graphics (sprites), redefined character sets, scrolling, and custom graphics modes are not supported by BASIC; these will require machine language routines or PEEK/POKE statements. A few of the 17 basic character/graphics modes supported by the hardware cannot be simply accessed from BASIC on the Atari 400/800 as the OS ROMs do not support them. These include some multicolour character modes (ANTIC modes 4 & 5), descender character mode (ANTIC mode 3) and the highest resolution 2 and 4-color modes (ANTIC modes C & E, 160x192 pixels). The only way to access them is viaPEEK/POKEor machine language, setting the ANTIC registers and Display List manually. The OS ROMs on the XL/XE added support for these modes except for ANTIC mode 3, which requires a character set redefined in RAM to operate correctly.[26]
Bitmap modes in BASIC are normally set to have a text window occupying the last four rows at the bottom of the screen so the user may display prompts and enter data in a program. If a 16 is added to the mode number invoked via the GRAPHICS statement, the entire screen will be in bitmap mode (e.g. GRAPHICS 8+16). If bitmap mode in full screen is invoked Atari BASIC will gracefully switch back into text mode when program execution is terminated, avoiding leaving the user with an unresponsive screen that must be escaped by typing a blind command or resetting the computer.
Bitmap coordinates are in the range of 0 to maximum row/column minus one, thus in Mode 6 (160x192), the maximum coordinates for a pixel can be 159 and 191. If Atari BASIC attempts to plot beyond the allowed coordinates for the mode a runtime error occurs.
Advanced techniques
[edit]Line labels
[edit]Atari BASIC allows numeric variables and expressions to be used to supply line numbers toGOTO
andGOSUB
commands. For instance, a subroutine that clears the screen can be written asGOSUB CLEARSCREEN
,which is easier to understand thanGOSUB 10000
.
Strings as a way to manipulate memory
[edit]The base addresses of a string is stored in a variable table. String addresses can be redirected to point to arbitrary areas of RAM. This allows the rapid memory-shifting routines underlying string and substring assignment can be applied from BASIC to the memory used for the screen or player/missile graphics. This is particularly useful for achieving rapid vertical movement of player/missile images directly from Atari BASIC.
Random access via DATA/RESTORE
[edit]Numeric variables and expressions can be used as the parameter for theRESTORE
statement, allowingDATA
statements to be randomly accessed through code such asRESTOREROOMBASE+ROOMNUMBER:READDESCRIPTION$,TREASURE$,EXITS
.This can also be used to emulate static string arrays:RESTORESTRBASE+INDEX:READA$:PRINTA$
.
Error handling with TRAP
[edit]TheTRAP
statement jumps to a line number when an error occurs, and this reduces the need for manual error-checking. For example, when drawing graphics on the screen it is not necessary to check whether lines go beyond screen boundaries of the current graphics mode. This error state can be trapped, and the error handled if necessary.
Includes
[edit]TheENTER
command reads source code from a device and merges it into the current program, as if the user had typed it in. This allows programs to be saved out in sections viaLIST
,reading them in usingENTER
to merge or replace existing code. By using blocks of line numbers that do not overlap, programmers can build libraries of subroutines and merge them into new programs as needed.
Self-modifying code
[edit]The editor can be set-up to repeatedly read input from the screen until an EOF is reached. This allows a program to write new program code followed by aCONT
statement to the screen then, positioning the screen cursor at the start of the new code,STOP
the running program, causing the new code to be read in then execution be continued by theCONT
statement.
Embedded machine language
[edit]Atari BASIC can call machine code subroutines stored in strings orPOKE
ed into memory. The 256 byte area starting at address 153610(60016) is often used for this purpose.
Machine code is invoked with theUSR
function. The first parameter is the address of the subroutine and the following values are parameters. If the code is stored in a string namedROUTINE$
it can be called with two parameters asANSWER=USR(ADR(ROUTINE$),VAR1,VAR2)
.
Parameters are pushed onto the hardware stack as 16-bit integers in the order specified in theUSR
call in low byte, high byte order. A final byte is pushed indicating the number of arguments. The machine language code must remove these values before returning via theRTS
instruction. A 16-bit value can be returned to BASIC by placing it in addresses 21210and 21310(D416and D516).
Performance
[edit]In theory, Atari BASIC should run faster than contemporary BASICs based on the MS pattern. Because the source code is fully tokenized when it is entered, the entire tokenization and parsing steps are already complete. Even complex mathematical operations are ready-to-run, with any numerical constants already converted to the internal 40-bit format, and variables values are looked up by address rather than having to be searched for.[e]In practice, Atari BASIC is slower than most otherhome computerBASICs, often by a large amount.[27]
On two widely usedbenchmarksof the era,Bytemagazine'sSieve of Eratosthenesand theCreative Computing benchmarktest written byDavid H. Ahl,the Atari finished near the end of the list in terms of performance, and was much slower than the contemporaryApple IIandPET,[28]in spite of having the same CPU running at roughly twice the speed. It finished behind slower machines like theZX81and even some programmable calculators.[29]
Most of the language's slowness stems from three problems.[27]
The first is that the floating-point math routines are poorly optimized. In the Ahl benchmark, a single exponent operation was responsible for much of the machine's poor showing.[27]The conversion between floating-point and 16-bit integers is also particularly slow. Internally, these integers are used for line numbers and array inde xing, along with a few other tasks, but numbers in the tokenized program are stored inbinary-coded decimal(BCD) format.[30]Whenever one of these is encountered, such as the line number inGOTO 100
,the BCD value is converted to an integer, which can take up to 3500 microseconds.[31]
Another issue is how Atari BASIC implements branches. To perform a branch in aGOTO
orGOSUB
,the interpreter searches through the entire program for the matching line number.[32]In contrast, contemporary versions of MS-derived BASICs would search forward from the current line if the line number of the branch target was greater, thereby improving branch performance about two times on average.
A related and more serious problem is the implementation ofFOR
...NEXT
loops. When aFOR
statement is executed, Atari BASIC records its line number. Every time theNEXT
is reached, it searches through the program for that line, despite it being in the same place as the last time.[27]All other BASICs instead record the memory location of theFOR
statement and can immediately return to it without having to search.
The reason for this poor performance is best illustrated by a quote from one of its primary authors, Bill Wilkinson; in 1982 he stated:
Personally, I have never been sure it is necessary for an interpreted language (e.g., BASIC) to be fast. Authors... have claimed that Atari BASIC is the slowest language ever created. My first impulse was to say, "Who cares?"[33]
One may contrast this philosophy with that ofSteve Wozniak'sApple BASICfor the originalApple Iwhich was designed specifically to have the performance required to write games:
After designing hardware arcade games, I knew that being able to program them in BASIC was going to change the world.[34]
Several third-party BASICs emerged on the platform that addressed some or all of these issues. This included Wilkinson's ownBASIC XL,which reduced the time for theBytebenchmark from 194 to 58 seconds,[27]over three times as fast. On the Ahl benchmark, Atari BASIC required 405 seconds, while exactly the same code in Turbo-BASIC XL took 41.6 seconds, an order of magnitude improvement.[35]
Differences from Microsoft BASIC
[edit]- Syntax is checked and errors highlighted immediately on line entry.
- Variable names can be of arbitrary length, and all characters are significant.
- The following keywords are not in Atari BASIC:
INKEY$
,CLS
,DEF FN
,SPC
,TAB
,ELSE
. - All arrays must be dimensioned prior to use while Microsoft BASIC defaults an array to 10 elements if not dimensioned.
- String variables are treated as character arrays and must be dimensioned before use. MS BASIC stores strings on theheapand sometimes pauses forgarbage collection.
- The functions
LEFT$
,MID$
,andRIGHT$
are replaced by string inde xing. - There is not an operator for string concatenation.
- There are no arrays of strings.
- There is no support for integer variables.
- There are no bitwise operators.
INPUT
does not allow a prompt.PRINT
may be abbreviated as?
as in Microsoft BASIC, but Atari BASIC does not tokenize it intoPRINT
.It remains a question mark.- The target of
GOTO
andGOSUB
can be a variable or expression. RESTORE
may take a numeric constant, variable, or expression as a parameter, causing the nextREAD
to begin from the specified line numberFOR..NEXT
loops in Atari BASIC must have a variable name referenced by theNEXT
statement while Microsoft BASIC does not require it.- Multiple variables are not permitted with
NEXT
statements as they are in Microsoft BASIC (e.g.,NEXT X,Y
). LIST
uses a comma to separate a range instead of a minus sign.
Keywords
[edit]Keyword | Description |
---|---|
ABS | Returns theabsolute valueof a number |
ADR | Returns the address in memory of a variable (mostly used for machine code routines stored in variables) |
AND | Logical conjunction |
ASC | Returns theATASCIIvalue of a character |
ATN | Returns thearctangentof a number |
BYE | Transfers control to the internal "Self Test" program ( "Memo Pad" on early models) |
CHR$ | Returns a character given anATASCIIvalue |
CLOAD | Loads fromcassette tapeatokenizedprogram that was saved with CSAVE |
CLOG | Returns thecommon logarithmof a number |
CLOSE | Terminates pending transfers (flush) and closes an I/O channel |
CLR | Clears variables' memory and program stack |
COLOR | Chooses which logical color to draw in |
COM | Implementation of MS Basic's COMMON was cancelled. Recognized but the code for DIM is executed instead |
CONT | Resumes execution of a program after a STOP at the next line number (see STOP) |
COS | Returns thecosineof a number |
CSAVE | Saves tocassette tapea program intokenizedform (see CLOAD) |
DATA | Stores data in lists of numeric or string values |
DEG | Switches trigonometric functions to compute indegrees(radiansis the default mode) (see RAD) |
DIM | Defines the size of a string or array (see COM) |
DOS | Transfers control to the Disk Operating System (DOS); if DOS was not loaded, same as BYE |
DRAWTO | Draws a line to givencoordinates |
END | Finishes execution of the program, closes open I/O channels and stops any sound |
ENTER | Loads and merges into memory a plain text program from an external device, usually fromcassette tapeor disk (see LIST) |
EXP | Exponential function |
FOR | Starts afor loop |
FRE | Returns the amount of free memory in bytes |
GET | Reads one byte from an I/O channel (see PUT) |
GOSUB | Jumps to a subroutine at a given line in the program, placing the return address on the stack (see POP and RETURN) |
GOTOand GO TO | Jumps to a given line in the program. GOTO can be omitted in "IF... THEN GOTO..." |
GRAPHICS | Sets the graphics mode |
IF | Executes code depending on whether a condition is true or not |
INPUT | Retrieves a stream of text from an I/O channel; usually data from keyboard (default),cassette tapeor disk |
INT | Returns thefloorof a number |
LEN | Returns the length of a string |
LET | Assigns a value to a variable. LET can be omitted |
LIST | Lists (all or part of) the program to screen (default), printer, disk,cassette tape,or any other external device (see ENTER) |
LOAD | Loads atokenizedprogram from an external device; usually acassette tapeor disk (see SAVE) |
LOCATE | Stores the logical color orATASCIIcharacter at given coordinates |
LOG | Returns thenatural logarithmof a number |
LPRINT | Prints text to a printer device (same result can be achieved with OPEN, PRINT and CLOSE statements) |
NEW | Erases the program and all the variables from memory; automatically executed before a LOAD or CLOAD |
NEXT | Continues the next iteration of a FOR loop |
NOT | Logical negation |
NOTE | Returns the current position on an I/O channel |
ON | Acomputed gotoor gosub - performs a jump based on the value of an expression |
OPEN | Initialises an I/O channel |
OR | Logical disjunction |
PADDLE | Returns the position of apaddle controller |
PEEK | Returns the value at an address in memory |
PLOT | Draws a point at given coordinates |
POINT | Sets the current position on an I/O channel |
POKE | Sets a value at an address in memory |
POP | Removes a subroutine return address from the stack (see GOSUB and RETURN) |
POSITION | Sets the position of the graphics cursor |
PRINT and? | Writes text to an I/O channel; usually to screen (default), printer,cassette tapeor disk (see LPRINT and INPUT) |
PTRIG | Indicates whether a paddle trigger is pressed or not |
PUT | Writes one byte to an I/O channel (see GET) |
RAD | Switches trigonometric functions to compute inradians(see DEG) |
READ | Reads data from a DATA statement |
REM | Marks a comment in a program |
RESTORE | Sets the position of where to read data from a DATA statement |
RETURN | Ends a subroutine, effectively branching to the line immediately following the "calling" GOSUB (see GOSUB and POP) |
RND | Returns apseudorandom number |
RUN | Starts execution of a program, optionally loading it from an external device (see LOAD) |
SAVE | Writes atokenizedprogram to an external device; usually acassette tapeor disk (see LOAD) |
SETCOLOR | Maps a logical color to a physical color |
SGN | Returns thesignumof a number |
SIN | Returns thesineof a number |
SOUND | Starts or stops playing a tone on a sound channel (see END) |
SQR | Returns thesquare rootof a number |
STATUS | Returns the status of an I/O channel |
STEP | Indicates the increment used in a FOR loop |
STICK | Returns ajoystickposition |
STOP | Stops the program, allowing later resumption (see CONT) |
STRIG | Indicates whether a joystick trigger is pressed or not |
STR$ | Converts a number to string form |
THEN | Indicates the statements to execute if the condition is true in an IF statement |
TO | Indicates the limiting condition in a FOR statement |
TRAP | Sets to jump to a given program line if an error occurs (TRAP 40000 cancels this order) |
USR | Calls a machine code routine, optionally with parameters |
VAL | Returns the numeric value of a string |
XIO | General-purpose I/O routine (from "Fill screen" to "Rename file" to "Format disk" instructions) |
Notes
[edit]- ^AppleSoft BASIC occupied memory locations $D000 through $F7FF, a total of 10240 bytes.
- ^Commodore BASIC used two main areas of memory, $A000-$BFFF and $E000-$E4D2.[9]
- ^Applesoft was in the area from $D000-$F7FF, including the FP library.[10]
- ^Although the parse tree is implemented as a set of tables, which is really an implementation detail.
- ^This is the reason MS-BASICs only have two significant letters in variable names, they are stored in a list with only two bytes of ASCII for the name in order to improve searching time.
References
[edit]Citation
[edit]- ^abLorenzo, Mark (2017).Endless Loop: The History of the BASIC Programming Language.Philadelphia: SE Books. p. 106.ISBN978-1974-27707-0.
- ^Wilkinson, O'Brien & Laughton 1983.
- ^Decuir 2004.
- ^abcdeWilkinson 1982,p. ix.
- ^Steil, Michael (20 October 2008)."Create your own Version of Microsoft BASIC for 6502".Some Assembly Required.
- ^Wilkinson 1982,pp. iv–v.
- ^Cromemco 1978.
- ^Cromemco 1978,pp. 2, 3.
- ^"Memory Map".
- ^"Memory Map – Apple II with Applesoft BASIC Loaded".
- ^abWilkinson 1982,p. v.
- ^abWilkinson 1982,p. x.
- ^Cherry, Charles (June 1987)."BASIC Bonanza".Antic.
- ^Wilkinson 1982,p. vi.
- ^ab"Atari BASIC Bugs".Compute!.July 1986. p. 10.
- ^abRadcliff, Matthew (September 1985)."Revision C Converter".Antic.Retrieved2023-07-08.
- ^abcdChadwick 1985,p. 230.
- ^Chadwick 1985,pp. 250–251.
- ^Hardy, Bob (February 1993)."Keycode Getter".Atari Classics.p. 18.
- ^Manual 1980,Appendix B.
- ^abcCrawford 1982,p. 10.3.
- ^Crawford 1982,p. 10.6.
- ^Wilkinson, O'Brien & Laughton 1983,p. 5.
- ^HP 2000/Access BASIC Reference Manual(PDF).Hewlett Packard. May 1976. pp. e.
- ^Manual 1980,p. 54.
- ^"ATR: chpt.15: Display Lists".
- ^abcdeWilkinson 1985,p. 139.
- ^Ahl, David (November 1983)."Benchmark comparison test".Creative Computing.pp. 259–260.
- ^Ahl, David (January 1984)."Creative Computing Benchmark".Creative Computing.p. 12.
- ^Wilkinson, O'Brien & Laughton 1983,p. 17.
- ^Crawford 1982,p. 8.45.
- ^Winner, Lane (1982)."De Re Atari, Chapter 10: Atari BASIC".Atari, Inc.
- ^Wilkinson, Bill (September 1982)."Insight: Atari".Compute!.p. 116.
- ^Williams, Gregg; Moore, Rob (December 1984)."The Apple Story / Part 1: Early History".Byte.p. A71.
- ^"Ahl's Benchmark?".28 November 2007.
Bibliography
[edit]- The ATARI BASIC Reference Manual.Atari Inc. 1980. Archived fromthe originalon May 1, 2005.
- Chadwick, Ian (1985).Mapping the Atari.Compute! Publications.ISBN0-87455-004-1.
- Crawford, Chris (1982).De Re Atari.Atari Program Exchange.
- Cromemco 16K Extended BASIC(PDF).Cromemco. 1978.
- Wilkinson, Bill (1982).Inside Atari DOS.Optimized Systems Software, Inc.ISBN0-942386-02-7.Retrieved2009-04-04.
- Decuir, Joe(December 30, 2004).3 Generations of Game Machine Architecture(Speech). Classic Gaming Expo 2004. San Jose Convention Center.
- Wilkinson, Bill; O'Brien, Kathleen; Laughton, Paul (1983).The Atari BASIC Source Book.Compute! Books.ISBN0-942386-15-9.
- Wilkinson, Bill (February 1985)."INSIGHT: Atari".Creative Computing.pp. 139–140.
External links
[edit]- Atari BASIC, The Good, the Bad, and the Ugly
- Albrecht, Bob; Finkel, LeRoy; Brown, Jerald R. (1979).Atari Basic - A Self-Teaching Guide.Retrieved29 June2013.
- Albrecht, Bob; Finkel, LeRoy; Brown, Jerald R. (1985).Atari Basic - XL Edition.Retrieved29 June2013.
- Wikiversity: Atari BASIC programming