ArticleslgStudy

science

Wang BASIC

Wang BASIC is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Wang BASIC rather than just read about it. In short: Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s.

Key takeaways

  • Wang BASIC belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Wang BASIC to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Wang BASIC from memory before moving on to harder problems.

Reference excerpt

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s. When these machines were updated to the VP series in 1976, BASIC-2 was introduced and remained the pattern for future machines in the 2200 series. A planned BASIC-3 was never released. Wang offered several models of each version of the 2200 series, differing only in the amount of microcode stored in read-only memory (ROM), and thus the number of commands available in BASIC on that machine. For instance, the B model machines differed from the base-model A by doubling the ROM and using that to store a variety of input/output and file management commands. Wang BASIC closely followed the original Dartmouth BASIC in syntax, but was an interpreter as opposed to a compile-and-go system. A notable feature was that all math used double-precision binary-coded decimal (BCD) format, which was unusual for BASICs of the era. It lacked many features common to later dialects like Microsoft BASIC, but many of these features were added in BASIC-2.

Description The following description is based on the original BASIC found in the 2200A. Not all of the instructions listed below would be available in the base model; 2200B and C added dozens of new keywords, and are outlined separately below.

Program editing and execution The original Wang BASIC for the 2200 is a relatively standard version of the Dartmouth BASIC concept, and will be familiar to users of any common BASIC interpreters like Microsoft BASIC. Like most BASIC interpreters, Wang BASIC operated in immediate mode or program mode, switching to the later when a line number is seen at the start of the line when the EXEC (return) key is pressed. Line numbers ranged from 0 to 9999. Lines could be up to 192 characters, spanning several on-screen lines, and lines could contain multiple statements separated by colons. To aid organizing large programs, the language included a RENUMBER command. LIST was used to display the program source code, while LIST S displayed only the first 15 lines and then paused. When paused, pressing the EXEC key displayed the next 15 lines. SAVE "filename" saved the current program to cassette and LOAD "filename" read it back in. SKIP 2F would read over the next two files found on the cassette tape, and then stop, allowing a subsequent LOAD or SAVE to work on the third file. BACKSPACE was the opposite of SKIP, rewinding the file pointer. Working with disk storage was slightly more complex, using LOAD DC F "filename", where F referred to one of a number of pre-defined drives, in this case "F"ixed. RUN started execution, and could be directed to a particular line, as in RUN 100. The STOP command, typically used for debugging, allowed an optional following string that was printed out when that statement was performed. TRACE could be used to print out lines as they were run, which was often used in conjunction with the custom HALT (break) and STEP keys on the keyboard to move line-by-line through a program. SELECT P was used to set a delay between TRACE lines in 1⁄6 second units; SELECT P0 set the delay to zero, SELECT P3 would cause it to pause 1⁄2 second after each line. There was no NEW command to clear memory of an existing program, instead one used CLEAR to reset memory. CLEAR P (for "P"rogram) was the equivalent of NEW but added optional from and to line numbers, deleting just that range of lines in a fashion similar to the DELETE command seen in some dialects. CLEAR V clears out variable values, normally accomplished by CLR in most dialects. CLEAR N was similar to CLEAR V, but did not clear the value of shared variables (see below).

Syntax Branching was supported through IF...THEN, GOTO and GOSUB. The alternate form, GO TO, was not supported. One limitation of Wang BASIC, as in the case of the original Dartmouth as well, is that the THEN clause of an IF statement could only be a line number, in contrast to more modern dialects that allow any statement after the THEN. It also lacked Boolean conjunctions like AND or OR, so the test could have only a single comparison. One interesting addition to the language was the idea of named routines. The implementation was based on the DEF FN statement followed by a single quote and then a number from 0 to 255, for instance, DEFFN' 1. This could then be called using GOSUB '1. To further confuse matters, the DEFFN line was a true function definition and could use parameters, like DEFFN'5(A$, N), which could be called with GOSUB'5("hello", 4). In allows one to implement multi-line function definitions, which other dialects sometimes offered using the conventional function style rather than using GOSUB. Additionally, named routines in the range 0 to 31 were assigned to the similarly numbed keys on the 2200 keyboard, allowing them to be called directly with a single keypress. PRINT supported comma and semicolon separating parameters, the former moving the cursor to the next 16-character wide column, the later leaving the cursor at the end of the printed value. It supported the TAB() function, but not SPC(). In common with other "high end" BASICs of the era, Wang BASIC offered formatted output with PRINTUSING and a separate "image". The image was defined using a separate line starting with the percent sign, for instance, 180 % ##,###.## and then using that format with 190 PRINTUSING 180, N. Any characters other than the formatting characters were echoed back during the print, so one could define a complete output with something like 180 % ANGLE= #.#### RADIANS. INPUT statements could include a prompt, along with a comma-delimited list of one or more variables. Semicolons could not be used in the INPUT, and the cursor always remained at the end of the last printed element during entry.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Wang BASIC

Start with the simplest possible case. Write down what Wang BASIC claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Wang BASIC before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Wang BASIC ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Wang BASIC

In research
Wang BASIC appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Wang BASIC in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Wang BASIC is common in secondary-school and first-year university syllabi. It links to neighbouring topics BASIC interpreters, BASIC programming language family, Wang Laboratories, so understanding it makes those chapters shorter.
In everyday life
Look for Wang BASIC outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Wang BASIC” →

How to study Wang BASIC in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Wang BASIC means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Wang BASIC out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Wang BASIC in simple terms?

Wang BASIC is a series of BASIC programming languages for computers from Wang Laboratories. The term can be used to refer to the BASIC on any Wang machine, but is mostly associated with the versions on the Wang 2200 minicomputer series of the early 1970s.

Why does Wang BASIC matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Wang BASIC?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Wang BASIC.

Tags

  • BASIC interpreters
  • BASIC programming language family
  • Wang Laboratories

Keep exploring