User Tools

Site Tools


basic

This is an old revision of the document!


BASIC Programming Language

Beginners' All-Purpose Symbolic Instruction Code was developed at Dartmouth College in 1964. It is a high level programming language that was designed for ease of use and became a first programming language for many students. Microsoft's very first product in 1975 was a BASIC interpreter for the Altair 8800. In the microcomputer revolution that followed Microsoft BASIC became the built in language for many machines and saw wide use through the late 1980s.

Getting BASIC started

For most systems, typing BASIC once you are logged in will start a BASIC interpreter. From there you can issue BASIC commands or type in STATEMENTS that can be immediately evaluated. For typing in programs, the user usually types in line numbers with the common practice being that you start at 10 and number by 10s. This gives you enough space if you need to add additional lines between statements and is particularly critical on some BASIC interpreters that don't have a RENUM fuction. BASICs on the various systems do have their own dialects and this page will attempt to point those out. On the IBM 4361 running VM/SP5 there is no interactive BASIC interpreter, but you can EDIT files and provide them as input to BASIC.

CommandDescription
OLD, LOADLoads an existing file into the memory buffer
SAVE, REPLACESaves or replaces a file with the contents of the memory buffer
NEW, SCRATCHClears the memory buffer
RUNRuns the program currently in the memory buffer
RENUMNot always available, but will renumber your program
SYSTEM, MONITORReturns to the Operating System
BYE, LOGOUT, OFFQuits BASIC and logs the user out of the system

BASIC Programming Examples

There are many statements available to you in BASIC, but here are a few that can get you started and will work across many BASIC interpreters. Check out the BASIC Reference Manuals section below for all the statements available for a particular system. Statement names and syntax can vary a bit. These examples are run under UNIX System V on the AT&T 3B2 1000-70 using the Bell Labs BASIC interpreter, but are generic enough to run on any of the BASIC systems available.

UNIX System V R.3 (WINS) (lcm3b2)

login: lcm Password: UNIX System V Release 3.2.2 AT&T 3B2 lcm3b2 Copyright © 1984, 1986, 1987, 1988, 1989 AT&T All Rights Reserved

$ basic *print 2+2 4 *print a 0 *let a=1 *print a 1 *10 print “Hello World!” *20 end *list 10 print “Hello World!” 20 end *run Hello World! *new *10 input “What is your name?”; n$ *20 print “Hello ”; n$ *30 end *list 10 input “What is your name?”; n$ 20 print “Hello ”; n$ 30 end *run What is your name?? COMPUTER Hello COMPUTER *new *10 for i = 0 to 20 *20 print i *30 next i *40 end *run 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 *list 10 for i = 0 to 20 20 print i 30 next i 40 end *10 for i = 0 to 20 step 2 *list 10 for i = 0 to 20 step 2 20 print i 30 next i 40 end *run 0 2 4 6 8 10 12 14 16 18 20 *10 for i = 20 to 0 step -1 *list 10 for i = 20 to 0 step -1 20 print i 30 next i 40 end *run 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 *system $

BASIC Reference Manuals

  • Control Data Corporation BASIC1)
basic.1587055583.txt.gz · Last modified: 2020/04/16 16:46 by smj