Introduction to BASIC
Please share your thoughts about whether to keep this book on Wikibooks. Maintain this notice so this book can receive a fair review and people have time to boldly address reasonable concerns through concrete improvements. Remove or replace this notice after discussion concludes and a community decision is made. Please also consider notifying the primary contributors on their discussion page with
|
BASIC was originally implemented as a combined computer language and command interpreter invented in 1964 at Dartmouth College by J. Kemeny and T. Kurtz. it was an important part of a project to make timeshared computer access available to a large community, in this case Dartmouth College. It was first implemented on a GE 225 computer. BASIC combines both programming and computer control into a single interface.
The language is a simple set of variable assignments, control flow and data handling. It was designed to be easier for most users than Fortran, but the Dartmouth version, surprisingly, included matrix operations which have not been part of most other implementations. The computer control allows the user to perform simple commands such as file save & load and program start and stop.
Because BASIC can be interpreted, and because more or less useful variants can be implemented with a small interpreter, it was an attractive choice as a high-level language for the earliest microcomputers. BASIC interpreters were generally supplied burned into ROMs which were limited (in affordable sizes) to 2KB or 4KB. Apple supplied its IntegerBASIC in ROM with the Apple II; Microsoft began as a specialist in providing ROMed BASICs to assorted computer vendors, including Atari, Altair (the original Microsoft product!), Commodore (PET / VIC-20 / 64), Radio Shack TRS-80 Model 1, 2, etc and the Color Computer), and even, rather later on, IBM in its earliest PC models (ie, BASICA).
Because the amount of RAM available on many of these early machines was severely limited, most of the ROMed BASICS had an extremely limited and abbreviated syntax to permit more than toy programs to fit into the installed RAM. Inevitably, this produced an opaque and obscure programming style. For instance, in most Microsoft BASICs, commented lines could begin with a single "'" character, rather than the original "REM", most commands could be abbreviated to the first letter ("L" for "LET"), variable names could be similarly contracted, and so on.
Disk based versions of BASIC were eventually available (after floppy disks dropped sufficiently in price) and Microsoft became the dominant supplier (eg, Applesoft BASIC for the Apple II, MBASIC for CP/M-80 machines, and Graphic Workstation BASIC (GWBASIC) for COompaq and eventually any non IBM PC clone machines. GWBASIC was meant to be compatible with BASICA for the IBM PCs, for none of the PC clone makers were allowed access to the ROM version; it eventually was also implemented as a compiler and is currently available as Visual BASIC in several flavours. Alternatives at various times included CBASIC from Gordon Eubanks (eventually acquired by Symantec), NorthStar BASIC for CP/M-80 machines, QBASIC for the Sinclair ZX80 and its 68000 based followon, the TSC BASICs (large, small, interpreted, and compiled/tokenized) for FLEX, FLEX9, and UNIflex machines based on the Motorola 6809 processor, and BASIC09 from Microware Systems in Iowa, also for the 6809 CPU. There were also several other BASICs, or variants under other names, developed and marketed for the minicomputer market (systems using 12, 16, or even 32 bit CPUs and costing between $10000 and $200000) between, say, 1970 and 1990. Several were used as the 'interface' language to database systems or business management packages. Some of them still survive. Various BASICs were also available for large mainframe systems from IBM, Burroughs, Univac, and so on.
BASIC 'dialects' and implementation 'styles' have varied. Some BASICs have stored all string variables as a part of a single large array, some haven't; some BASICs have included automatic garbage collection (eg, many Microsoft variants), others haven't; and so on. HP BASIC was one prominent 'school' and DEC BASIC another. Microsoft's 'style', basically in the DEC camp, became the de facto standard style for nearly all users by the mid-1980s. Ironically, Kemeny and Kurtz decided to offer an updated version of their language (TrueBASIC) but were too late -- there was little market for it. ANSI finally began a BASIC standardization project, but decided not to adopt Microsoft's de facto standard. There was a Minimal BASIC standard, but it was essentially ignored by the market.
The language was originally implemented as a compiler, but in the 1980s, most implementations of it were interpreters (and when used inside another application, Basic is commonly used for scripting). Compiling implementations are commonly available today (such as Visual Basic).
Dialects
[edit | edit source]Dialects of BASIC can be divided into many different groups, based on many of their aspects such as:
- Their platform (Windows, linux, etc.)
- Their type of purpose (games, gui applications, etc.)
- Their ability to be compiled or interpreted
Some dialects:
QuickBASIC: the origin of all modern BASICS. A few programmers have spurred a cult for the language, as many games and tutorials are available on the internet for use.
FreeBASIC: QuickBASIC, compiled. It has many more modern features, such as pointers, 64-byte types, and support for larger amounts of memory. FreeBASIC is recommended, as this is the standard dialect for the following tutorials. See BASIC Programming for some FreeBASIC tutorials.
DarkBASIC: A significant commercial BASIC, which utilizes the DirectX library and is great for writing games quickly.
VisualBASIC: Microsoft developed this BASIC first in the early 1990s. It is slightly inaccurate to say that this is a dialect, as it resembles much different code than standard BASIC, and is very popular for commercial use. Gambas is a similar language and is used widely by Unix BASIC programmers.
BlitzMax, a compiled BASIC dialect that supports OpenGL for graphical games on Mac OS, Linux and Microsoft Windows.
GLBasic Programming, a compiled BASIC dialect that supports OpenGL and inline C++ for graphical games on Widows, Linux, Mac OS X, iOS, and Android.
Monkey, a compiled BASIC dialect for Windows, Mac OS X, Android, iOS, and HTML5, also from Blitz Research.
PBASIC Programming, the BASIC dialect interpreted by the Parallax BasicStamp.
TI-BASIC, the BASIC dialect interpreted by TI graphing calculators, which apparently has further slight variations (?) between TI-Basic 84 Programming, Talk:TI-Basic Z80 Programming, and TI-Basic 89 Programming.
REALbasic, apparently also called Xojo.
XBasic, an open source GUI Basic for Windows and Linux, and the related (?) XBLite.
Gambas, an object-oriented open-source dialect of the BASIC programming language for Linux. See Programming Gambas from Zip for a gentle introduction.