Hubbry Logo
search
logo

Wang BASIC

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Wang BASIC

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.

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.

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 16 second units; SELECT P0 set the delay to zero, SELECT P3 would cause it to pause 12 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).

See all
User Avatar
No comments yet.