True BASIC
Encyclopedia
True BASIC is a variant of the BASIC programming language
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....

 descended from Dartmouth BASIC
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It is so named because it was designed and implemented at Dartmouth College...

 — the original BASIC — invented by college professors John G. Kemeny
John George Kemeny
John George Kemeny was a Hungarian American mathematician, computer scientist, and educator best known for co-developing the BASIC programming language in 1964 with Thomas E. Kurtz. Kemeny served as the 13th President of Dartmouth College from 1970 to 1981 and pioneered the use of computers in...

 and Thomas E. Kurtz
Thomas Eugene Kurtz
Thomas Eugene Kurtz is an American computer scientist who co-developed the BASIC programming language during 1963 to 1964, together with John G. Kemeny....

.

When True BASIC appeared on the market in 1985, initially based on Dartmouth BASIC 7 — otherwise known as ANSI
Ansi
Ansi is a village in Kaarma Parish, Saare County, on the island of Saaremaa, Estonia....

 BASIC — it implemented a number of new features over GW-BASIC
GW-BASIC
GW-BASIC was a dialect of the programming language BASIC developed by Microsoft from BASICA, originally for Compaq. It is compatible with Microsoft/IBM BASICA, but was disk based and did not need the ROM BASIC. It was bundled with MS-DOS operating systems on IBM PC compatibles by Microsoft...

, and allowed the user a redefinable 16-color, 640×480 pixel
Pixel
In digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....

 backdrop for program editing. True BASIC introduced new functions for graphics primitives like plot, plot area, flood, etc. It also was the first to provide a method for saving a portion of the screen and blitting it elsewhere, but had no proper buffering implementation.

Being a structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...

 implementation of the language, it dispensed with the need for line number
Line number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line.In the C...

s and GOTO
Goto
goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...

 statements, although these earlier features can still be used. Use of LET
Assignment (computer science)
In computer programming, an assignment statement sets or re-sets the value stored in the storage location denoted by a variable name. In most imperative computer programming languages, assignment statements are one of the basic statements...

 for value assignment became optional. It also allowed for descriptive variable names longer than a single letter plus a single digit. For example, the familiar algebraic equation y = mx + b (y = mx + c for the UK) could be expressed as:

let slope = 2
let x = 3
let y_intercept = 4
let y2 = slope * x + y_intercept
print "y2="; y2
end

The above code segment would yield "y2= 10".

True BASIC provides statements for matrix arithmetic, a feature that had been present in Dartmouth BASIC since early times, but had been dropped in almost all microcomputer versions of BASIC interpreters due to memory limitations. It also supports global and local variables, which permits recursive functions and subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s to be written.

There are versions of the True BASIC compiler for DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, and "classic" Mac OS
Mac OS
Mac OS is a series of graphical user interface-based operating systems developed by Apple Inc. for their Macintosh line of computer systems. The Macintosh user experience is credited with popularizing the graphical user interface...

. There is currently no Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 version of True BASIC, and so it will not run on any Mac system released since 2005. Older computers running Mac OS X can run it through Classic. At one time, versions for Tandy
TRS-80 Color Computer
The Radio Shack TRS-80 Color Computer was a home computer launched in 1980. It was one of the earliest of the first generation of computers marketed for home use in English-speaking markets...

, Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

 and Atari
Atari
Atari is a corporate and brand name owned by several entities since its inception in 1972. It is currently owned by Atari Interactive, a wholly owned subsidiary of the French publisher Atari, SA . The original Atari, Inc. was founded in 1972 by Nolan Bushnell and Ted Dabney. It was a pioneer in...

 computers were offered, as well as a UNIX
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 command-line compiler.

The designers wanted to make the language hardware-independent, to allow True BASIC source code to run equally well on any version of their compiler. For the most part they succeed in this endeavor. The drawback for users was that direct access to some features of their machines was not available, but this could be remedied with callable functions and subroutines specially written in assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

.

Using newer versions of True BASIC, some of the older functions are blocked out. An example of the recent code would be more like this:

RANDOMIZE
SET WINDOW 0,20,0,20
SET COLOR 5 !Set the pen and text colour to 5 as true basic has 0-15 colours
PRINT "Welcome To ..." !Print "Welcome To ..." on the user's screen.

DO !Begin the loop
LET x=rnd*20 !Let the value 'x' equal a random number between '0' and '20'
LET y=rnd*20 !Let the value 'y' equal a random number between '0' and '20'
Pause .1 !Waits 1/10 of a second
PLOT TEXT, at x, y: "Fabulous Wikipedia!" !Plot 'Fabulous Wikipedia!' at coordinates 'x' and 'y'
LOOP !End the loop

END !End the program

As one can see, even without comments (text following the unquoted exclamation point), True BASIC code can be read rather easily. This simple program plots the text "Welcome To ..." at the top left-hand corner of the screen, and then continues into a never-ending loop plotting "Fabulous Wikipedia!" at random coordinates.

An example of simple animation could be like this:

!Draw the Car
SET WINDOW 0,20,0,20
SET COLOR 5
BOX AREA 2,6,2,3
BOX AREA 9,13,2,3
BOX AREA 16,20,2,3
SET COLOR 249
PLOT LINES :0,5;20,5
FLOOD 10,1
BOX KEEP 0,20,0,5 IN road$
BOX CIRCLE 2,3,5,6
FLOOD 2.5,5.5
BOX CIRCLE 5,6,5,6
FLOOD 5.5,5.5
SET COLOR 35
PLOT LINES :2.5,6;5.5,6
PLOT LINES :5,6;8,6;8,8;6,8;6,10;2,10;2,8;0,8;0,6;3,6
FLOOD 4,8
SET COLOR 248
BOX AREA 4,5,8,9

BOX KEEP 0,8,5,10 IN car$ !Save the car in 'car$'

FOR x=1 TO 20 STEP 1 !Create a 'for' loop
BOX SHOW road$ AT 0,0
BOX SHOW car$ AT x,5
PAUSE .1
CLEAR
NEXT x !End the 'for' loop

END !End the programs

Further reading

  • Kemeny, John G.; Kurtz, Thomas E. (1985). Back To BASIC: The History, Corruption, and Future of the Language. Addison-Wesley Publishing Company, Inc. 141 pp. ISBN 0-201-13433-0.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK